Insert a table of basic grammar
1. Description
- Environment: \ begin {tabular} \ end {tabular}
- Align format: l r aligned left center c
- Line: | vertical \ hline horizontal double pipe || \ hline \ hline double dash
- Set Width: p {} width value, when the content exceeds the width, wrap
2. Source Code
%导言区
\documentclass[UTF8]{ctexart}
%正文区
\begin{document}
% l 左 c 居中 r 对齐
% | 竖线 \hline横线 || 双竖线 \hline \hline 双横线
\begin{tabular}{| l | c | c | c || r |}
\hline
名字 & 语文 & 数学 & 英语 & 备注\\
\hline
张三啊啊 & 87 & 100 & 93 & 优秀 \\
\hline
李 & 75 & 64 & 52 & 补考另行通知\\
\hline
\hline
王五 & 80 & 82 & 78 & 良好\\
\hline
\end{tabular}
.
..............................
.
% p{设置宽度},内容超过宽度时,自动换行
\begin{tabular}{| l | c | c | c || p{1.5cm} |}
\hline
名字 & 语文 & 数学 & 英语 & 备注\\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知\\
\hline
\hline
王五 & 80 & 82 & 78 & 良好\\
\hline
\end{tabular}
\end{document}
3. The output effect
To get more specific, you can use the following methods to view the document:
At the command line, type:
- texdoc booktab
- texdoc longtab
- texdoc tabular