# errors with \fbox and parenthesis

So I'm doing a LaTeX tutorial and trying to recreate a LaTeX document where a pair of tables are in parenthesis, in a box, in a list. I've come upon this error when I try to use both \fbox and \left( and \right).

\begin{document}
\begin{enumerate}
\item{
\fbox{
$\left( \begin{tabular}{c|c} \rule[-.15in]{0in}{0.15in} \overbrace{\int_{1}^{3}\frac{1}{t}\emph{dt}} & |\mathbf{-}4| \\ \hline \rule[-.15in]{0in}{0.40in} \oint \mathbf{B}\cdot d\textbf{a} & \textbf{A} \\ \end{tabular} \right)$

$\stackrel{?}{=}$

$\left( \begin{tabular}{c|c} \rule[-.15in]{0in}{0.50in}\underbrace{\ln 3} & 4 \\ \hline \rule[-.15in]{0in}{0.40in}0 & \frac{1}{4\pi}\int \frac{BX\dot{R}}{R^2}d\tau' \\ \end{tabular} \right)$
}
}
\item By completing the square, solve the equation $2\emph{x}^2+8\emph{x}+1=0$.

\textbf{Solution:}
\bigskip
\begin{center}
$2x^2+8x+1=0$
\end{center}
\end{enumerate}
\end{document}


For some reason, if I don't include the code for the parenthesis, it comes out boxed, or if I exclude the code for the box, it can have parenthesis. But when I try both, I get the errors about missing $and missing }. Can somebody tell me the interaction I'm missing here, because I can't see the issue. The errors are: Missing$ inserted. }
Bad math environment delimiter. }
Missing $inserted. } Missing } inserted. } Missing$ inserted. }
Bad math environment delimiter. }
Extra }, or forgotten $. } Extra }, or forgotten$. }
Extra }, or forgotten $. } Command \item invalid in math mode. \item Something's wrong--perhaps a missing \item. \item B Something's wrong--perhaps a missing \item. \item B Missing$ inserted. ...the square, solve the equation $2\emph{x}^ Missing \endgroup inserted. \begin{center} Missing } inserted. \begin{center} Something's wrong--perhaps a missing \item. \begin{center} \begin{enumerate} on input line 16 ended by \end{center}. \end{center} Missing } inserted. \end{center} \begin{document} ended by \end{enumerate}. \end{enumerate} Extra \endgroup. \end{enumerate}  • Welcome! Could you please make your code copy-paste-compilable? I realise that it won't compile, but we want to copy-paste-compile... and get the error you want help with. Right now, that won't happen. Also, please report exact error messages. They are much more useful than your summary or interpretation. (If you understand the error well enough to do that, you understand it well enough to fix it without asking.) – cfr Oct 9 '15 at 23:28 • You can't use $...$ inside \fbox. – egreg Oct 9 '15 at 23:29 • Why are you using \emph{} in maths mode? And \textbf{}? Wouldn't array be more suitable than tabular? – cfr Oct 9 '15 at 23:49 ## 1 Answer You cannot have vertical spacing / a paragraph break within \fbox{} but display maths sets its content off separately. You can keep \fbox happy by using a \parbox within the \fbox. For example: \documentclass{article} \begin{document} \begin{enumerate} \item{ \fbox{ \parbox{.8\linewidth}{% $\left( \begin{tabular}{c|c} \rule[-.15in]{0in}{0.15in} \overbrace{\int_{1}^{3}\frac{1}{t}\emph{dt}} & |\mathbf{-}4| \\ \hline \rule[-.15in]{0in}{0.40in} \oint \mathbf{B}\cdot d\textbf{a} & \textbf{A} \\ \end{tabular} \right)$$\stackrel{?}{=}$$\left( \begin{tabular}{c|c} \rule[-.15in]{0in}{0.50in}\underbrace{\ln 3} & 4 \\ \hline \rule[-.15in]{0in}{0.40in}0 & \frac{1}{4\pi}\int \frac{BX\dot{R}}{R^2}d\tau' \\ \end{tabular} \right)$ } } } \item By completing the square, solve the equation$2\emph{x}^2+8\emph{x}+1=0$. \textbf{Solution:} \bigskip \begin{center}$2x^2+8x+1=0$\end{center} \end{enumerate} \end{document} Do you really want the additional vertical space added by the center environment, on top of \bigskip and that added by \end{enumerate}? Some of this may just get cancelled, of course, but not always and this will often not give the output you want. Nesting maths environments like that cannot be good, either.... Also: • \item does not take a mandatory argument: the syntax is \item[<label>] stuff; • don't use \emph{} in maths mode; • ditto \textbf{}. • a new line means a space - comment new lines to avoid spurious spacing; • probably array is better than tabular here. But nesting maths environments still seems dodgy: \documentclass{article} \begin{document} \begin{enumerate} \item % \fbox{% \begin{minipage}{.8\linewidth}% $\left( \begin{array}{c|c} \rule[-.15in]{0in}{0.15in}% \overbrace{\int_{1}^{3}\frac{1}{t}dt} & |\mathbf{-}4| \\ \hline \rule[-.15in]{0in}{0.40in} \oint \mathbf{B}\cdot d\mathbf{a} & \mathbf{A} \\ \end{array} \right)$ $\stackrel{?}{=}$ $\left( \begin{array}{c|c} \rule[-.15in]{0in}{0.50in}\underbrace{\ln 3} & 4 \\ \hline \rule[-.15in]{0in}{0.40in}0 & \frac{1}{4\pi}\int \frac{BX\dot{R}}{R^2}d\tau' \\ \end{array} \right)$ \end{minipage}% } \item By completing the square, solve the equation$2x^2+8x+1=0\$.

\textbf{Solution:}
$2x^2+8x+1=0$
\end{enumerate}
\end{document} 