On Fri, 11 May 2007 20:01:55 +0300
Vyatcheslav Yatskovsky
Hello,
I have following two definitions for hotkeys
\def\hotkey#1{\inframed[corner=00, offset=0pt]{\ #1\ }}
\def\hotkey#1{\inframed[corner=00, offset=0pt]{\enspace#1\enspace}}
The first is my favorite since it looks compact, but one-letter hotkeys look odd (the frame's height is more then width).
\hotkey{Ctrl} - nice \hotkey{T} - not nice
The second definition works better for one-letter hotkeys.
\hotkey{Ctrl} - not nice \hotkey{T} - nice
My question is: can I set the MINIMUM width of a box to have boxes not less then, say, squared.
-- Best regards, Vyatcheslav Yatskovsky
Hi Vyatcheslav, you can measure the width of your text by saving the content in a box and using the \wd primitve afterwards. \def\hotkey#1% {\bgroup \setupframed[corner=00,offset=0pt] \setbox\scratchbox\hbox{#1}% \ifdim\wd\scratchbox<\dimexpr\strutht+\strutdp\relax \dimen0\dimexpr\strutht+\strutdp\relax \advance\dimen0-\wd\scratchbox \divide\dimen0 by2 \inframed{\kern\dimen0\box\scratchbox\kern\dimen0}% \else \inframed{\enspace\box\scratchbox\enspace}% \fi \egroup} \starttext text \hotkey{Ctrl} text \hotkey{T} text text \hotkey{Ctrl} text \hotkey{I} text \stoptext You should think about a fixed width for "Ctrl", "Alt" ... Wolfgang