一些基本的插入表格的操作见:https://blog.csdn.net/gsgbgxp/article/details/129457872
遇到问题先查阅《IShort》和刘海洋老师的《LaTeX入门》。
设置表格列宽基础操作(不借助tabularx)
先从一个简单表格开始
\begin{table}[!h]
\centering
\begin{tabular}{cc}
\hline
{\textbf{System}} & {\textbf{TeX}} \\
\hline
All & TeX Live \\
macOS & MacTeX \\
Windows & MikTeX \\
\hline
\end{tabular}
\end{table}
显示效果为
如果我们想设置两列的宽度,可以采用的方案为设置{p{4cm}p{4cm}}
,
\begin{table}[!h]
\centering
\begin{tabular}{p{4cm}p{4cm}}
\hline
{\textbf{System}} & {\textbf{TeX}} \\
\hline
All & TeX Live \\
macOS & MacTeX \\
Windows & MikTeX \\
\hline
\end{tabular}
\end{table}
这里补充说明以下:
l/c/r
:单元格内容左对齐/居中/右对齐,不折行p{⟨width⟩}
:单元格宽度固定为⟨width⟩,可自动折行
这些参数是可以不借助其他宏包直接使用的。
在上面的表格中,默认是左对齐。如果想要标题行居中,其他行仍左对齐,可以采用的方式为
\begin{table}[!h]
\centeri