LaTex表格內單元格內容強制換行
阿新 • • 發佈:2019-02-03
/newcommand{/tabincell}[2]{/begin{tabular}{@{}#[email protected]{}}#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}{@{}# [email protected]{}}#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}
%然後使用&/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}{@{}#
\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}