您的位置:首页 > 其它

LaTex 制作表格 合并行\multirow 合并列\multicolumn

2015-01-16 00:00 519 查看
摘要: LaTex 制作表格 合并行\multirow 合并列\multicolumn在latex文件最前面用这个包\usepackage{multirow}multirow 宏包提供了 \multirow 命令可以在表格中排版横跨两行以上的文本。命令的格式如下:\multirow{nrows}[bigstructs]{width}[fixup]{text}nrows 设定所占用的行数。bigstructs 此为可选项,主要是在你使用了 bigstruct 宏包时使用。width 设定该栏文本的宽度。如果想让 LaTeX 自行决定文本的宽度,则用 * 即可。fixup 此为可选项,主要用来调整文本的垂直位置。text 所要排版的文本。可用 \\ 来强迫换行。更多介绍与实例:http://www.ctex.org/documents/packages/table/multirow.htm补充例子1: http://blog.sina.com.cn/s/blog_5e16f1770100u40t.html
\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}
[object Object]通常畫表格需要使用到\multicolumn, \multirow, \hline, \cline四種指令其中要使用\multirow,必須在前頭先行加入\usepackage{multirow}直接看例子,Latex程式碼 =>
使用宏包multirow,提供了如下命令:参看效果图:演示代码:\documentclass{article}\usepackage{longtable}\usepackage{rotating}\usepackage{multirow}\begin{document}\begin{longtable}{| c | c | c | c
| c | c |}\hline& \multicolumn{5}{| c |}{ } \\& \multicolumn{5}{| c |}{\textbf{\large Father's Occupation}} \\& \multicolumn{5}{| c |}{ } \\\hline& & & & & \\\multicolumn{1}{|c|}{\textbf{}}& \multicolumn{1}{|c|}{\textbf{}}& \multicolumn{1}{c|}{\textbf{Group A}}& \multicolumn{1}{c|}{\textbf{Group B}}& \multicolumn{1}{c|}{\textbf{Group C}}& \multicolumn{1}{c|}{\textbf{Group D}} \\& & & & & \\\cline{2-6}& & & & & \\\multirow{5}{*}{\begin{sideways}{\textbf{\large Mother's Occupation}}\end{sideways}}& \textbf{Group A} & $8$ & $3$ & $4$ & $1$ \\& & & & & \\\cline{2-6}& & & & & \\& \textbf{Group B} & $3$ & $3$ & $0$ & $1$ \\& & & & & \\\cline{2-6}& & & & & \\& \textbf{Group C} & $0$ & $0$ & $1$ & $0$ \\& & & & & \\\cline{2-6}& & & & & \\& \textbf{Group D} & $2$ & $0$ & $0$ & $1$ \\& & & & & \\\hline& & & & & \\& \textbf{Total:} & \textbf{26} & \textbf{10} & \textbf{10} & \textbf{4} \\& & & & & \\\hline\end{longtable}\end{document}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: