# Wrapping text inside framebox

I would like to wrap the text inside a \framebox, such that it continues on the next line instead of running out of the margins.

A minimum working example:

\documentclass[]{report}
\begin{document}

\framebox{\textit{If this script fails, you can try the following:
lower the degree (d), decrease the number of simplices, increase
the order of continuity (if possible) or increase the number of
datapoints in the listed simplices}}.

\end{document}


Any ideas?

-

Set the contents of the \framebox in a \parbox:

\documentclass{article}
\begin{document}

\noindent
\framebox{\parbox{\dimexpr\linewidth-2\fboxsep-2\fboxrule}{\itshape%
If this script fails, you can try the following: lower the degree~(d),
decrease the number of simplices, increase the order of continuity (if possible)
or increase the number of datapoints in the listed simplices.}}

\end{document}


The calculations (using \dimexpr) ensures that the width of the box excludes the gap between the contents and the frame (2 gaps of \fboxsep and 2 widths of \fboxrule on either side). Also, since you're probably not interested in a paragraph indent outside this block, I've used \noindent.

Note that this block is not breakable across the page boundary.

-
Great, exactly what I wanted. Thanks a lot! –  Pietair Jun 22 '13 at 13:45