首页 > 其他 > 详细

【转】Letax表格内单元格换行

时间:2017-04-02 11:47:35      阅读:348      评论:0      收藏:0      [点我收藏+]

转自:http://blog.sina.com.cn/s/blog_531bb7630101841e.html

/newcommand{/tabincell}[2]{/begin{tabular}{@{}#1@{}}#2/end{tabular}}%放在导言区
%然后使用&/tabincell{c}{}&就可以在表格中自动换行
%比如这么用
/begin{tabular}{|c|c|}
/hline
1 & the first line //
/hline
2 & /tabincell{c}{haha// heihei//zeze} //
/hline
/end{tabular}
以下为一例子,可直接存为.tex文件编译运行:
\documentclass[a4paper,12pt]{article}
\begin{document}
\begin{table}
\newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}
  \centering
  \begin{tabular}{|c|c|c|}\hline
1 & \tabincell{c}{the first line \\ the next\\the next\\ last} & \tabincell{c}{one \\ one}\\\hline
2 & \tabincell{c}{hello\\ aha\\ ok \\yes \\en} & \tabincell{c}{two \\ two \\ two} \\\hline
\end{tabular}
  \caption{longtitle}
\end{table}
\end{document}
结果如下图:

 技术分享

【转】Letax表格内单元格换行

原文:http://www.cnblogs.com/Dontstop/p/6658557.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!