latex - Latex 中的错误我无法修复涉及多行和多列的问题
问题描述
\begin{center}
\footnotesize
\begin{tabular}{| c | c c c |}
\hline
\multirow{3}{*}{Equipment acquired at start of year} & \multicolumn{3}{c|}{Replacement cost (\$) for given years} & &\\
\cline{2-4}
& 1 & 2 & 3\\
\hline
1 & 4000 & \multicolumn{1}{|c|}{5400} & 9800\\
2 & 4300 & \multicolumn{1}{|c|}{6200} & 8700\\
3 & 4800 & \multicolumn{1}{|c|}{7100} & -\\
4 & 4900 & \multicolumn{1}{|c|}{-} & -\\
\hline
\end{tabular}
\end{center}
我收到一个错误:
Extra alignment tab has been changed to \cr.
同样对于这部分代码,我不确定究竟是什么错误(我收到了 20 个错位错误和缺少括号):
\begin{table}[]
\centering
\begin{tabular}{c|c|c|c|c|c|c|c|c|c|c}
\multicolumn{11}{Directed Edge Weights (Row $\rightarrow$ Col)} & & & & & & & & & & \\
\hline
$\rightarrow$ & A & B & C & D & E & F & G & H & I & J\\
\hline
A&0&4000&&&&&&&&\\
B&&0&5400&4300&&&&&&\\
C&&&0&&9800&6200&4800&&&\\
D&&&&0&9800&6200&4800&&&\\
E&&&&&0&&&8700&7100&4900\\
F&&&&&&0&&8700&7100&4900\\
G&&&&&&&0&8700&7100&4900\\
H&&&&&&&&0&&\\
I&&&&&&&&&0&\\
J&&&&&&&&&&0\\
\hline
\end{tabular}
\caption{Table of Adjacent Edges}
\label{tab:Edges of graph}
\end{table}
请帮忙 :)
解决方案
在这两种情况下,使用多列后似乎都添加了其他单元格。在第一种情况下,您可以& &
在多列之后删除,一切都应该正常工作:
\begin{center}
\footnotesize
\begin{tabular}{| c | c c c |}
\hline
\multirow{3}{*}{Equipment acquired at start of year} & \multicolumn{3}{c|}{Replacement cost (\$) for given years} \\
\cline{2-4}
& 1 & 2 & 3\\
\hline
1 & 4000 & \multicolumn{1}{|c|}{5400} & 9800\\
2 & 4300 & \multicolumn{1}{|c|}{6200} & 8700\\
3 & 4800 & \multicolumn{1}{|c|}{7100} & -\\
4 & 4900 & \multicolumn{1}{|c|}{-} & -\\
\hline
\end{tabular}
\end{center}
在第二种情况下,您需要&
在多列之后删除重复的符号。同样在这种情况下,没有指示多列中的间距。下表对我来说很好,尽管我已经{c}
在多列中添加了。
\begin{table}
\centering
\begin{tabular}{c|c|c|c|c|c|c|c|c|c|c}
\multicolumn{11}{c}{Directed Edge Weights (Row $\rightarrow$ Col)} \\
\hline
$\rightarrow$ & A & B & C & D & E & F & G & H & I & J\\
\hline
A&0&4000&&&&&&&&\\
B&&0&5400&4300&&&&&&\\
C&&&0&&9800&6200&4800&&&\\
D&&&&0&9800&6200&4800&&&\\
E&&&&&0&&&8700&7100&4900\\
F&&&&&&0&&8700&7100&4900\\
G&&&&&&&0&8700&7100&4900\\
H&&&&&&&&0&&\\
I&&&&&&&&&0&\\
J&&&&&&&&&&0\\ \hline
\end{tabular}
\caption{Table of Adjacent Edges}
\label{tab:Edges of graph}
\end{table}
推荐阅读
- javascript - 只读输入的千位分隔符
- javascript - React-Native-Maps:地图为空。仅显示 Google 徽标和标记
- firebase - 反应原生地图方向
- angular - Angular 12.2 导致 Typescript 出现优化问题。所有类型都具有相同的名称并启用了优化
- javascript - 如何保持使用 auth0 登录的 React 应用程序
- vue.js - 无法更新引导 vue 表中的数据
- encryption - 如何从未删除的加密文件中获取原始文件?
- javascript - 在Javascript中从数组中过滤一组字母
- nixos - 创建具有自定义固件支持的可引导 USB
- python-3.x - 通过 openpyxl 使用公式从 Excel 单元格中获取值