我希望生成一个 LaTeX 表格,其中第二列中有合并单元格。到目前为止,我看到的所有示例都在第一列中有合并单元格。文本也需要在单元格中换行。
(尚无法发布图片!)基本上,我有 3 列,15 行。
第 1 列样本编号,第 2 列时间,第 3 列备注
col1 行 1-15 未合并(正常)
col2 1-7 行未合并(正常)
col3 第 5-7 行合并,文本换行
col3 行 8-12 合并换行文本
col2 行 8-13 合并,需要换行
ETC。
excel2latex
使用(booktabs
、包)的结果实现multirow
给出以下代码:
\begin{table}
\centering
\begin{tabular}{rrr}
\addlinespace
\toprule
Sample ID & Time [s] & Remarks \\
\midrule
1 & \multicolumn{1}{c}{50} & \\
2 & \multicolumn{1}{c}{100} & \\
3 & \multicolumn{1}{c}{150} & \\
4 & \multicolumn{1}{c}{200} & \\
5 & \multicolumn{1}{c}{250} & \multicolumn{1}{c}{\multirow{3}[0]{*}{Sampled from different area of the tank}} \\
6 & \multicolumn{1}{c}{250} & \multicolumn{1}{c}{} \\
7 & \multicolumn{1}{c}{250} & \multicolumn{1}{c}{} \\
a & \multicolumn{1}{c}{\multirow{6}[0]{*}{No times recorded for this section but it is known that there is a constant time gap between samples}} & \multicolumn{1}{c}{\multirow{5}[0]{*}{No discernible difference samples a-e}} \\
b & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\
c & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\
d & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\
e & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\
f & \multicolumn{1}{c}{} & viscous \\
g & Short time & odourless \\
h & Long time & strong acrid odour, high viscosity \\
\bottomrule
\end{tabular}%
\end{table}
答案1
好的,按照要求,我重新发布答案。你需要明白我花了一些时间来回答这个问题。每个人下面显示的接受率是为了向人们展示提问者是否可能做出适当的回答,如果接受率太低,则意味着你忽略了答案,人们将不再想回答那个人。
答案如下------------------
这可能就是你想要的。根据您的选择调整参数:
\documentclass{article}
\usepackage{multirow}
\begin{document}
\begin{tabular}
{|r|c|c|}
\hline
\multicolumn{1}{|c|}{Sample ID}&
\multicolumn{1}{|c}{Time [s]}&
\multicolumn{1}{|c|}{Remarks}
\\\hline\hline
1 &50 & \\\hline
2 &100 & \\\hline
3 &150 & \\\hline
4 &200 & \\\hline
5 &250 &
\multirow{3}{*}{\parbox{2in}{Sampled from different area of the tank}}
\\\cline{1-2}
6 &250 & \\\cline{1-2}
7 &250 & \\\hline
a &
\multirow{6}{*}
{\parbox{2in}{No times recorded for this section but it is known that there is a constant time gap between samples}}
&
\multirow{5}{*}{No discernible difference samples a-e} \\\cline{1-1}
b & & \\\cline{1-1}
c & & \\\cline{1-1}
d & & \\\cline{1-1}
e & & \\\cline{1-1}\cline{3-3}
f & & viscous \\\hline
g & Short time & odourless \\\hline
h & Long time & strong acrid odour, high viscosity \\
\hline
\end{tabular}
\end{document}