[NTG-context] Vertical alignment of framed text

Peter Rolf indiego at gmx.net
Thu Apr 19 14:05:14 CEST 2007


Hi Vyatcheslav,

Vyatcheslav Yatskovsky wrote:
> Hello,
> 
> 
> Thank you Wolfgang, but 
> 
> 
> \defineframed
> 
>    [hotkey][offset=4pt,corner=00,location=low]
> 
> 
> produces too big frames, while
> 
> 
> \defineframed
> 
>    [hotkey][height=\lineheight,offset=4pt,corner=00,location=low]
> 
> 
> produces nice tight frames but places the text very BELOW the line text.
> (Previously the text was too much ABOVE).
> 
> 
> If I remove offset then it looks good (on center), except I really want
> more right/left spacing (from the inner text to the frame) but less
> spacing top/below, so that It resembles a keyboard key. 
> 
> 
> How to get just center position while keeping the frame tight and more
> X-stretched?
>
the best way is to define your own macro, as \framed alone can't handle
this special case. if you insert an \offset macro inside \framed (with
offset=overlay to avoid additional offsets), you can use different
offset values for all directions.

you still have to lower the result, so you also need

\dontleavehmode\lower??ex\hbox{<Hotkey>}

in your final macro.

something like (untested!)

\def\Hotkey#1%
  {\dontleavehmode\lower??ex\hbox
   {\framed[offset=overlay,corner=00,...]
    {\offset[leftoffset=??em, rightoffset=??em,
       topoffset=??ex, bottomoffset=??ex]
     {#1\strut}}}}

try to use em for horizontal offsets and ex for vertical ones (instead
of fixed values). also metapost generated backgrounds (overlay) look
much better here.

happy fiddling with all the ?? ;)

peter

> 
> 
>> On Tue, 17 Apr 2007 16:27:03 +0300
> 
>> Vyatcheslav Yatskovsky <yatskovsky at gmail.com
> <mailto:yatskovsky at gmail.com>> wrote:
> 
> 
>>> \defineframed
> 
>>>    [hotkey][height=\lineheight,offset=4pt,corner=00]
> 
> 
>> Hi,
> 
> 
>> \defineframed
> 
>>    [hotkey][offset=4pt,corner=00,location=low]
> 
> 
>> Wolfgang
> 
> 
> 
>>> \starttext
> 
>>> Another way to start or stop the device is to use hotkey. If the
> application is active (that is, sits on the foreground of your desktop),
>  the hotkey is {\hotkey{Space}}. If it is not active, then use global
> hotkey -- \hotkey{Alt}+\hotkey{Space}.
> 
>>> \stoptext
> 
> 
> 
> -- 
> 
> Best regards,
> 
> Vyatcheslav Yatskovsky
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> ntg-context mailing list
> ntg-context at ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context



More information about the ntg-context mailing list