Re: a latex-widths question
On Sat, 19 Jan 2002 20:02:48 -0100, andrej hocevar <ah@siol.net> wrote:
> I've seen some LaTeX discussions here, so just a quick question:
> how do I tell LaTeX that a box should have the width of a certain
> word? (Precisely, I mean a real box; a rectangle of given
> dimensions.)
In the category of more than one way to do it...
You can use an \fbox{Your Text}, and adjust the box padding with
\setlength{\fboxsep}{NNunits}.
A more complicated example from LaTeX Companion:
%% In preamble
\newlength{\wdth}
\newcommand{\defbox}[1]{\settowidth{\wdth}{#1}}
\newcommand{\textbox}[1]{\framebox[\wdth]{#1}}
%% Example usage
as wide as this text\\
\defbox{as wide as this text}\textbox{}\\
\textbox{text}\\
\textbox{longer text}
%% Produces something like
as wide as this text
+--------------------+
| |
+--------------------+
+--------------------+
| text +
+--------------------+
+--------------------+
| longer text +
+--------------------+
--
Eric G. Miller <egm2@jps.net>
Reply to: