I would like to have a box which changes width depending on the text in it. Shorter sentences should have a narrow box, and as the sentence gets longer the box should grow (until it is as wide as the text, then I would like a line break). Font size should not be affected. The best solution I've got so far (see below) scales the text when it is short.
\ovalbox{
\begin{minipage}[t]{0.85\columnwidth}
\resizebox{\textwidth}{!}{Some variable-length text}
\end{minipage}
}
Best Answer
You can put a frame around text with the
\fbox
command:To put text in an ellipse, you can use the TikZ/PGF package and its
shapes.geometric
library:Note that in both cases the text acts as one "big" box relative to the paragraph and will not be broken in separate lines.
If you wish to typeset whole paragraphs in a frame that does not expand to full line width if the paragraph fits on one line, then the following approach (inspired by
\@makecaption
) might do:Typesetting large blocks inside ellipses does not seem practical to me.