`
lc52520
  • 浏览: 361026 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

latex中不规则表格合并multirow、multicolumn的使用

阅读更多

multirow

multirow 宏包提供了 \multirow 命令可以在表格中排版横跨两行以上的文本。命令的格式如下:

\multirow{nrows}[bigstructs]{width}[fixup]{text}

nrows

设定所占用的行数。

bigstructs

此为可选项,主要是在你使用了 bigstruct 宏包时使用。

width

设定该栏文本的宽度。如果想让 LaTeX 自行决定文本的宽度,则用 * 即可。

fixup

此为可选项,主要用来调整文本的垂直位置。

text

所要排版的文本。可用 \\ 来强迫换行。

下面是几个例子:

\newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}} \begin{tabular}{|c|c|} \hline \multirow{4}{1in}{Common g text} & Column g2a\\ & Column g2b \\ & Column g2c \\ & Column g2d \\ \hline \multirow{3}[6]*{Common g text} & Column g2a\bigstrut\\\cline{2-2} & Column g2b \bigstrut\\\cline{2-2} & Column g2c \bigstrut\\ \hline \multirow{4}[8]{1in}{Common g text} & Column g2a\bigstrut\\\cline{2-2} & Column g2b \bigstrut\\\cline{2-2} & Column g2c \bigstrut\\\cline{2-2} & Column g2d \bigstrut\\ \hline \multirow{4}*{\minitab[c]{Common \\ g text}} & Column g2a\\ & Column g2b \\ & Column g2c \\ & Column g2d \\ \hline \end{tabular}

结果如图所示:
更多的例子:
      

\renewcommand{\multirowsetup}{\centering} \begin{tabular}{|l|l|l|l|} \hline \multirow{4}{2cm}{This is a demo table} & C2a & \multirow{4}{2cm}{This is another one} & C4a\\ & C2b & & C4b\\ & C2c & & C4c\\ & C2d & & C4d\\ \hline \end{tabular} \bigstrutjot=1pt% \begin{tabular}{|l|l|l|l|} \hline \multirow{4}{2cm}{This is a demo table} & C2a & \multirow{4}{2cm}{This is another one} & C4a\\ & C2b & & C4b\\ & C2c & & C4c\\ & C2d & & C4d\\ \hline \end{tabular} \begin{tabular}{|l|l|l|l|} \hline \multirow{4}{2cm}{This is a demo table} & C2a & \multirow{4}[30]{2cm}{This is another one} & C4a\\ & C2b & & C4b\\ & C2c & & C4c\\ & C2d & & C4d\\ \hline \end{tabular} \begin{tabular}{|l|l|l|l|} \hline \multirow{4}{2cm}{This is a demo table} & C2a & \multirow{4}{2cm}[30pt]{This is another one} & C4a\\ & C2b & & C4b\\ & C2c & & C4c\\ & C2d & & C4d\\ \hline \end{tabular} \begin{tabular}{|l|l|l|l|} \hline \multirow{4}{2cm}{This is a demo table} & C2a & \multirow{4}[30]{2cm}[-30pt]{This is another one} & C4a\\ & C2b & & C4b\\ & C2c & & C4c\\ & C2d & & C4d\\ \hline \end{tabular}

有关 multirow 宏包更详细的说明,可参见它的说明文档(英文 PDF 格式)

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics