LaTex表格內單元格內容強制換行


/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}
結果如下圖:

LaTex表格內單元格內容強制換行
http://blog.sina.com.cn/s/blog_531bb7630101841e.html





免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM