抱歉,当我尝试在 LaTeX 中构建平板电脑时,出现以下错误消息:
!Missing \endgroup inserted.
<inserted text>
\endgroup
1.141 & \multicolumn{2}{c|c|}{Cash Flow at}
\\ \cline{3-4}
这是我在 LaTeX 中的原始代码。请问如何修改才能避免错误?
\begin{tabular}{|c|c|r|r|}
\hline
& \multicolumn{2}{c|c|}{Cash Flow at} \\ \cline{3-4}
\textbf{Action} & \textbf{Cash flow at $t=0$} & \textbf{$t=3$} & \textbf{$t=6$} \\ \hline
Lend \$3,000,000 in 3-years markets & -\$3,000,000 & +\$3,649,428.891 &0 \\ \hline
Roll over at $t=3$ for 3 years & 0 & -\$3,649,428.891 & +\$3,649,428.891+\tilde y\\ \hline
Borrow PV(\$3,649,428.891) in 6-years markets & +\$3,100,554.785 &0 &-\$3,649,428.891 \\ \hline
\textbf{Total} & +\$100,554.7855 &0 & +\tilde y \\ \hline
\end{tabular} \\
答案1
在您的示例中,基本上存在两个问题:
- 该错误是由于
\multicolumn{2}{c|c|}{Cash Flow at}
其中只需要一个列说明符作为第二个参数而引起的,该参数应该是\multicolumn{2}{c|}{Cash Flow at}
。 - 另一个问题是
\tilde y
哪个应该在$...$
符号里面,即$\tilde{y}$
。
修正后的 MWE 为:
\documentclass{article}
\usepackage{geometry}
\begin{document}
\begin{tabular}{|c|c|r|r|}
\hline
&& \multicolumn{2}{c|}{Cash Flow at} \\ \cline{3-4}
\textbf{Action} & \textbf{Cash flow at $t=0$} & \textbf{$t=3$} & \textbf{$t=6$} \\ \hline
Lend \$3,000,000 in 3-years markets & -\$3,000,000 & +\$3,649,428.891 &0 \\ \hline
Roll over at $t=3$ for 3 years & 0 & -\$3,649,428.891 & +\$3,649,428.891+$\tilde {y}$\\ \hline
Borrow PV(\$3,649,428.891) in 6-years markets & +\$3,100,554.785 &0 &-\$3,649,428.891 \\ \hline
\textbf{Total} & +\$100,554.7855 &0 & +$\tilde {y}$ \\ \hline
\end{tabular}
\end{document}