返回博客列表

Untitled

2. table 环境

应用场景

  1. 基础表格:创建简单的行列结构(tabular 嵌套在 table 中)。
  2. 复杂表格:合并单元格(\multicolumn\multirow)、添加斜线表头。
  3. 跨栏表格:使用 table* 环境实现双栏文档中的跨栏表格。
  4. 长表格分页:使用 longtable 宏包支持跨页长表格。
  5. 旋转表格:通过 rotating 宏包将表格旋转 90 度。

table 参数详解

\begin{table}[位置参数]
  \centering
  \caption{标题}\label{标签}
  \begin{tabular}{列格式}
    % 表格内容
  \end{tabular}
\end{table}

参数说明

  1. 位置参数:与 figure 相同(h, t, b, p, !, H 等)。
  2. 列格式tabular 环境):
    - l:左对齐列。
    - c:居中对齐列。
    - r:右对齐列。
    - p{3cm}:固定宽度列,自动换行。
    - |:垂直线,\hline:水平线。
    - 示例:{|l|c|r|} 表示三列,带边框。

  3. 高级表格功能
    - \multicolumn{3}{c}{标题}:合并 3 列并居中。
    - \multirow{2}{*}{内容}:合并 2 行(需 multirow 宏包)。
    - \toprule, \midrule, \bottomrule:专业表格线(需 booktabs 宏包)。

\resizebox{width}{height}{content}

  • width: 目标宽度
  • height: 目标高度( ! 表示按比例缩放)
  • content: 要调整大小的内容

评论