\fbox 和括号错误

\fbox 和括号错误

因此,我正在编写一个 LaTeX 教程,并尝试重新创建一个 LaTeX 文档,其中一对表格位于括号中、框中、列表中。当我尝试同时使用 \fbox 和 \left( 和 \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}

出于某种原因,如果我不包含括号的代码,它就会出现方框,或者如果我排除方框的代码,它就会有括号。但是当我尝试两者时,我得到了关于缺少 $ 和缺少 } 的错误。有人能告诉我我在这里缺少的交互吗,因为我看不到问题所在。

错误如下:

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}

答案1

您不能在 内设置垂直间距/段落分隔符\fbox{},但显示数学会单独设置其内容。您可以在 内\fbox使用 来保持快乐。例如:\parbox\fbox

\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}

输出

center您真的想要环境在 之上\bigskip添加额外的垂直空间吗\end{enumerate}?当然,其中一些可能会被取消,但并非总是如此,而且这通常不会产生您想要的输出。

像那样的嵌套数学环境也不会好……

还:

  • \item不采用强制参数:语法是\item[<label>] stuff
  • 不要\emph{}在数学模式下使用;
  • 同上\textbf{}
  • 换行意味着留一个空格——注释掉新行以避免出现不必要的空格;
  • 可能比这里array更好。tabular

但嵌套数学环境似乎仍然不可靠:

\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}

稍微调整了一下

相关内容