基本上,我想生成下表LaTeX(注意第二个单元格的" 逗号对齐 "):
----------------------------------------
| Header1 | Header2 |
----------------------------------------
| 1 | "value 1" , "value 2" |
| 2 | "one" , "two" |
| 3 | "abcdefheasal" , "ok" |
----------------------------------------
Run Code Online (Sandbox Code Playgroud)
我生成上表的方式LaTeX如下:
\begin{tabular}{|c|l|}
\hline
Header1 & Header2 \\
\hline
1 & ``value 1'' , ``value 2'' \\
2 & ``one'' , ``two'' \\
3 & ``abcdefheasal'' , ``ok'' \\
\hline
\end{tabular}
Run Code Online (Sandbox Code Playgroud)
但显然,该代码产生以下内容(显然没有" 逗号对齐 "):
-----------------------------------
| Header1 | Header2 |
-----------------------------------
| 1 | "value 1" , "value 2" |
| 2 | "one" , "two" |
| 3 | "abcdefheasal" , "ok" |
-----------------------------------
Run Code Online (Sandbox Code Playgroud)
将后一张桌子变成我想要的桌子的最佳方法是什么?即前者
作为Martin B答案的修改,请考虑使用@符号来制作列分隔符:
\begin{tabular}{|c|l@{ , }l|}
\hline
Header1 & \multicolumn{2}{l|}{Header2} \\
\hline
1 & ``value 1'' & ``value 2'' \\
2 & ``one'' & ``two'' \\
3 & ``abcdefheasal'' & ``ok'' \\
\hline
\end{tabular}
Run Code Online (Sandbox Code Playgroud)
另请注意,multicolumn在第一行绘制垂直线时需要额外的管道.
| 归档时间: |
|
| 查看次数: |
10638 次 |
| 最近记录: |