I am looking a way to wrap something with a frame. I try different approaches but finally choose to use fancybox
package and minipage
(because I need to control the width of the frame). It works pretty good for text-only content
\usepackage{fancybox}
\begin{document}
\fbox{%
\begin{minipage}{\textwidth}
\textbf{Why we use negative angle in above calculate?}\newline
Since .... we have to ....
\end{minipage}
}
\end{document}
However, if we add any environment like lstlisting
or verbatim
, it doesn't work
\fbox{%
\begin{minipage}{\textwidth}
\textbf{Why we use negative angle in above calculate?}\newline
Since .... we have to ....
\begin{lstlisting}
A = x+y;
B = x^2-2y;
\end{lstlisting}
\end{minipage}
}
Is that any way to make it work?
p.s. I have created a webpage for the user to type the latex stuff inside and whatever they type, I will like to wrap that with a framebox and generated a pdf with pdflatex. I cannot control what they type, they might type text, math, environment and/or mix all of those. So any better way to frame whatever the latex stuff inside?