# How to put a long piece of text in a box?

I want to put a long piece of text in a box, for example

The quick brown fox jumps right over the lazy dog. the quick brown fox
jumps right over the lazy dog. the quick brown fox jumps right over the lazy
dog. the quick brown fox jumps right over the lazy dog. the quick brown fox
jumps right over the lazy dog. the quick brown fox jumps right over the lazy
dog. the quick brown fox jumps right over the lazy dog. the quick brown fox
jumps right over the lazy dog.


How can this be done? Any suggestion in brief.

-

You can use \fbox{...} to put a frame around a \parbox{...} containing your text. Here's an example document. Note the \noindent that prevents the box from being shifted to the right.

\documentclass{article}

\begin{document}

\noindent\fbox{%
\parbox{\textwidth}{%
The quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog.
}%
}
\end{document}

-

A minipage environment is a sufficient way to box or group something:

\documentclass{article}
\begin{document}
\begin{minipage}{15em}
The quick brown fox jumps right over the lazy dog. the quick brown fox
jumps right over the lazy dog. the quick brown fox jumps right over the lazy
dog. the quick brown fox jumps right over the lazy dog. the quick brown fox
jumps right over the lazy dog. the quick brown fox jumps right over the lazy
dog. the quick brown fox jumps right over the lazy dog. the quick brown fox
jumps right over the lazy dog.
\end{minipage}
\end{document}


If you want to frame it, you can put a \fbox command around it. That is,

\fbox{\begin{minipage}{15em}
...
\end{minipage}}


-

\documentclass{article}
\usepackage{xcolor}
\usepackage{lipsum}
\begin{document}
\lipsum[1]

\medskip

\noindent\fcolorbox{red}{yellow}{%
\minipage[t]{\dimexpr0.48\linewidth-2\fboxsep-2\fboxrule\relax}
\lipsum[2]
\endminipage}\hfill
\fcolorbox{red}{yellow}{%
\minipage[t]{\dimexpr0.48\linewidth-2\fboxsep-2\fboxrule\relax}
\lipsum[3]
\endminipage}

\medskip

\lipsum[4]
\end{document}


Notes:

• You can adjust the thickness of border and padding of \fcolorbox{<border-color>}{<background-color>}{<contents>} by setting \fboxrule=<value><unit> and \fboxsep=<value><unit>, respectively. Put the setting before invoking \fcolorbox{<border-color>}{<background-color>}{<contents>}. For example: \fboxrule=1pt and \fboxsep=5pt.
• Use t, c and b options to align the base line of the most top row, the center row and the most bottom row with the surrounding baseline.
-

The solutions with \fbox and minipage or \parbox all have the defect that the text will be an indivisible object which can't be split across pages. For a one shot application it might be the way to go. Otherwise there's the mdframed package that's highly customizable.

-

If you would like to specify the dimensions of the box (width and height) that is supposed to contain the text, please check this question: Fit text into given box by adjusting the fontsize

-