发布时间:2010-11-15 14:46:06
文章类别:表格制作
原文地址:http://blog.sina.com.cn/s/blog_5e16f1770100mvtd.html

QQ群:91940767/145316219/141877998/80300084/194770436
淘宝店:http://latexstudio.taobao.com
技巧续篇:http://latexstudio.net/
常见数学公式问题集下载

一般情况下,我们不会用到很粗的表格线,而标准的三线格可以用booktabs来生成三个不同粗细的表格线。有时,我们想自己随意设置不同粗细的表格线该怎么办?

【解决方案】
方案一:我们可以定义自己的表格线,可以任意指定其宽度如:
\makeatletter
\def\hlinew#1{%
\noalign{\ifnum0=`}\fi\hrule \@height #1 \futurelet
\reserved@a\@xhline}
\makeatother%在正文中的用法为 \hlinewd{0.75pt} 等等
%不过上面的命令\hlinewd不能与longtable正常工作
使用示例:
\begin{tabular}{|l||*{4}{c|}}\hlinew{1pt}
Room With a Long Name &&&&\\\hline
Auditorium &&&&\\\hline
Seminar Room &&&&\\\hline
\end{tabular}
效果图:
LaTeX技巧423:LaTeX如何加粗表格横线





这是比较底层的方法。我们已经有更为高级的方法来实现。
方案二:使用makecell宏包来定制表格线,这个包提供了\Xcline \Xhline来定制表格线如:
\begin{tabular}{!{\vrule width1.2pt}c
!{\vrule width1.2pt}c|c
!{\vrule width1.2pt}}
\Xhline{1.2pt}
\multirowthead{4}{First Column head}&
\multicolumn{2}{c!{\vrule width1.2pt}}{\thead{Multicolumn head}}\\
\Xcline{2-3}{1.2pt}
& \thead{Second \\multlined \\ column head} &
\thead{Third \\ column head}\\
\Xhline{1.2pt}
Cell text & A &\multirowcell{4}{28--31}\\
\Xhline{1.2pt}
\end{tabular}
示例为:
LaTeX技巧423:LaTeX如何加粗表格横线
另外,这个宏包还提供了一组命令,可使表格中列数据单独定位:居中、靠左或靠右,可将某一列标题旋转90度,可在单元格中划对角线,还可设定表格线段的粗细等。
参看:
http://www.ctan.org/tex-archive/macros/latex/contrib/makecell/makecell.pdf

点赞(1)

评论列表 共有 0 条评论

暂无评论
立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部