How can I insert a newline in a framebox?
TH. has suggested putting the framebox around another box, but specifying the size can be awkward. Here's my (note: plug) solution to the problem:
\usepackage{minibox}
...
\minibox[frame]{R-Sq:\\ For example}
A ‘minibox’ is exactly equivalent to a tabular in the current implementation; I just wanted the shorter markup.
At the risk of beating a dead horse, I find the framed package works most convenient.
\usepackage{framed}
\begin{framed}
My long text that needs new lines.
\end{framed}
You need not worry about sizing--line breaks are automatic. It works well with the beamer class too.
If you dig through the chain of macro expansions, you see that \framebox(x,y)[z]{text}
ends up typesetting text
in an \hbox
.
So you can use this.
\documentclass{article}
\begin{document}
\framebox(115,115){%
\parbox{115\unitlength}{R-Sq:\\For example}%
}
\end{document}
Where all I've done is put the input inside an appropriately sized \parbox
.