# How to use the quote environment inside a \framebox?

Now I run into a problem with frameboxes. Why is the following not valid LaTeX code?

\framebox{
The following text was taken from:
\begin{quote}
Erik Pickles: How it will end
\end{quote}
}


I get the following error:

something's wrong -- maybe an missing item?

-

Framebox doesn't like have an environment inside it. You could consider using the framed package.

\documentclass{article}
\usepackage{framed}
\begin{document}
\begin{framed}
Here is text
\begin{quote}
Here is quote
\end{quote}
\end{framed}
\end{document

-
"Framebox doesn't like have an environment inside it." Isn't correct like that. The issue isn't that quote is an environment but that \framebox forces horizontal mode for its content and quote likes to open a new paragraph and list which doesn't work in that mode. –  Martin Scharrer Sep 27 '11 at 20:55

If you do not want to use a package as pointed out by Seamus you can use a minipage to do the trick.

\documentclass[11pt]{article}
\begin{document}
\framebox{%
\begin{minipage}{6cm}
The following text was taken from:
\begin{quote}
Erik Pickles: How it will end
\end{quote}
\end{minipage}
}
\end{document}

-
This version has the advantage that the frame box doesn't extend all the way to the end of the frame. It does however have the disadvantage that you have to set the width manually... –  Seamus Nov 30 '10 at 18:02
@Seamus You're right, but you can always adapt to the default version of the command by changing the {6m} to {\textwidth} –  Yiannis Lazarides Nov 30 '10 at 19:26
or you could do some fancy \settowidth magic to get the box to just surround the text you have... I actually think that would be a pretty elegant solution, but I can't work out how to make it into a macro easily... –  Seamus Dec 1 '10 at 11:22

With package varwidth you do not have to know the width of the box

\documentclass[11pt]{article}
\usepackage{varwidth}
\begin{document}
\framebox{%
\begin{varwidth}{\textwidth}% the greatest possible line width
The following text was taken from:
\begin{quote}
Erik Pickles: How it will end
\end{quote}
\end{varwidth}%
}
\end{document}

-

If you don't need to have it break across pages you can use the following.

\documentclass{article}

Otherwise use framed as Seamus suggested. Herbert's solution to use varwidth is also very good if you have not much text and want a tight frame around it.