LaTex 表格问题
2016-01-27 11:07
393 查看
表格问题1************************************************************************
合并表格后,合并单元格的下面三行不能平均分配列,如图所示:
源代码是:
表格宽度分配不均匀,所以需要指定列的宽度,代码如下:
代码运行后的结果是:
由此又产生了另外一个问题,即单元格中的文字没有句中:
需要将代码改为:
问题完美解决。
表格问题2********************************************************
效果如果显示:
此处再给出一个复杂点的表格源码:
可以使用 diagbox 宏包,基本语法格式是:
\diagbox[选项]{左}{右}
\diagbox[选项]{左}{中}{右}
\diagbox[dir=⟨方向⟩]{A}{B}
这个表头可以由以下命令实现:
\diagbox[dir=SE]{A}{B}{C}
调用宏包后,直接把上面命令放在 tabular 环境里的对应位置即可。
合并表格后,合并单元格的下面三行不能平均分配列,如图所示:
源代码是:
\begin{table}[htbp] \centering \begin{tabular}{|l|c|c|c|c|c|c|} \hline \multirow{2}{*}{\textbf{Model}} & \multicolumn{3}{|c|}{\textbf{Trigger Boundary(\%)}} & \multicolumn{3}{|c|}{\textbf{Trigger Boundary + Type(\%)}} \\ \cline{2-7} & P & R & F & P & R & F \\ \hline \textit{Single-word} & 55 & 55 & 55 & 55 & 55 & 55 \\ \hline \textit{Multi-word} & 55 & 55 & 55 & 55 & 55 & 55\\ \hline \textit{All} & 55 & 55 & 55 & 55 & 55 & 55 \\ \hline \end{tabular} \caption{Number of words in triggers} \label{event:triggerNum} \end{table}
表格宽度分配不均匀,所以需要指定列的宽度,代码如下:
\begin{table}[htbp] \centering \begin{tabular}{|p{2cm}|p{1cm}|p{1cm}|p{1cm}|p{1.2cm}|p{1.2cm}<{\centering}|p{1.2cm}<{\centering}|} \hline \multirow{2}{*}{\textbf{Model}} & \multicolumn{3}{|c|}{\textbf{Trigger Boundary(\%)}} & \multicolumn{3}{|c|}{\textbf{Trigger Boundary + Type(\%)}} \\ \cline{2-7} & P & R & F & P & R & F \\ \hline \textit{Single-word} & 55 & 55 & 55 & 55 & 55 & 55 \\ \hline \textit{Multi-word} & 55 & 55 & 55 & 55 & 55 & 55\\ \hline \textit{All} & 55 & 55 & 55 & 55 & 55 & 55 \\ \hline \end{tabular} \caption{Number of words in triggers} \label{event:triggerNum} \end{table}
代码运行后的结果是:
由此又产生了另外一个问题,即单元格中的文字没有句中:
需要将代码改为:
\begin{tabular}{|p{3cm}<{\centering}|p{1cm}<{\centering}|p{1cm}<{\centering}|p{1cm}<{\centering}|p{1.2cm}<{\centering}|p{1.2cm}<{\centering}|p{1.2cm}<{\centering}|}
问题完美解决。
表格问题2********************************************************
\begin{tabular}{@{}>{\sf }lcclcclcc@{}} \toprule & \multicolumn{2}{c}{\bf Specific Heats} & & \multicolumn{2}{c}{\bf Specific Heats} & & \multicolumn{2}{c}{\bf Specific Heats} \\ \cmidrule{2-3} \cmidrule{5-6} \cmidrule{8-9}& $c$ & $C$ & & $q$ & $Q$ & & $e$ & $E$ \\ \midrule Aluminum & 900 & 24.3 & & 900 & 24.3 & & 900 & 24.3 \\ Copper & 385 & 24.4 & & 900 & 24.3 & & 900 & 24.3 \\ Gold & 130 & 25.6 & & 900 & 24.3 & & 900 & 24.3 \\ Steel/Iron & 450 & 25.0 & & 900 & 24.3 & & 900 & 24.3 \\ Lead & 130 & 26.8 & & 900 & 24.3 & & 900 & 24.3 \\ Mercury & 140 & 28.0 & & 900 & 24.3 & & 900 & 24.3 \\ Water & 4190 & 75.4 & & 900 & 24.3 & & 900 & 24.3 \\ Ice & 2100 & 38 & & 900 & 24.3 & & 900 & 24.3 \\ \bottomrule \end{tabular}
效果如果显示:
此处再给出一个复杂点的表格源码:
\begin{table*} \newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}} \small \begin{tabular}{|p{2cm}<{\centering}|p{2cm}<{\centering}|p{2cm}<{\centering}|p{2cm}<{\centering}|p{2cm}<{\centering}|p{2cm}<{\centering}|p{2cm}<{\centering}|} \hline \multirow{2}{*}{\centering \tabincell{l}{trigger \\types}} & \multicolumn{3}{|c|}{one-word Noum$F(\%)$} & \multicolumn{3}{|c|}{one-word and multi-word Noum$F(\%)$}\\ \cline{2-4}\cline{5-7} & common feature & \tabincell{l}{common + \\unique \\feature} & \tabincell{l}{common+\\qunique+\\global \\feature} & \tabincell{l}{common \\feature} & \tabincell{l}{common + \\unique \\feature} & \tabincell{l}{common+\\unique+\\global\\ feature}\\ \hline Pho & 900 & 900 & 900 & 900 & 900 & 900 \\ Gen & 385 & 900 & 900 & 900 & 900 & 900 \\ Tra & 130 & 900 & 900 & 900 & 900 & 900 \\ Loc & 450 & 900 & 900 & 900 & 900 & 900 \\ Cat & 130 & 900 & 900 & 900 & 900 & 900 \\ Bin & 140 & 900 & 900 & 900 & 900 & 900 \\ Reg & 419 & 900 & 900 & 900 & 900 & 900 \\ Pos & 210 & 900 & 900 & 900 & 900 & 900 \\ Neg & 210 & 900 & 900 & 900 & 900 & 900 \\ \hline Overall & 210 & 900 & 900 & 900 & 900 & 900 \\ \hline \end{tabular} \caption{different feature compare} \label{diffFeatureCompare} \end{table*}
可以使用 diagbox 宏包,基本语法格式是:
\diagbox[选项]{左}{右}
\diagbox[选项]{左}{中}{右}
\diagbox[dir=⟨方向⟩]{A}{B}
这个表头可以由以下命令实现:
\diagbox[dir=SE]{A}{B}{C}
调用宏包后,直接把上面命令放在 tabular 环境里的对应位置即可。
相关文章推荐
- Android开发学习笔记之通过API接口将LaTex数学函数表达式转化为图片形式
- Ubuntu12.04 安装LaTex(TexLive+TexMaker+中文环境) 4000
- Miktex 2.9 + Texmaker 中文显示
- 有关LaTeX参考文献的一些问题
- LaTeX实用宏命令
- LaTeX使用小结
- Sublime text 3 + MacTex + Skim 中文显示问题
- 关于LATEX插入图的处理,仅供参考
- LaTeX新人教程,30分钟从完全陌生到基本入门
- LaTeX入门笔记
- 经测可用的3个网页插入Latex公式在线编辑器
- Latex初探(二): 基本用法
- latex 备忘
- (排bug)CTex+TeXstudio中文乱码问题
- 在Windows和Linux下使用LaTeX
- TeX排版记录 多行长公式 括号 对齐 问题
- Synctex无效的问题
- 将jpg/jpeg文件转换为eps格式,在latex文档中插入eps
- 使用LaTex/Ctex遇到的几个问题--内存不足、pgfplots安装等
- .cls vs. .sty