找回密码
 立即注册
首页 业界区 科技 $\LaTeX{}$之表格使用

$\LaTeX{}$之表格使用

袁可佳 7 小时前
本文介绍了在 \(\LaTeX{}\) 中插入表格的基本语法和一些常用的技巧,并且给出了一些在排版中常用的模板样例。
基本语法

排版表格最基本的 \(\textrm{tabular}\) 环境用法为:
  1. \begin{tabular}[⟨align⟩]{⟨column-spec⟩}
  2. ⟨item1⟩ & ⟨item2⟩ & … \\
  3. \hline
  4. ⟨item1⟩ & ⟨item2⟩ & … \\
  5. \end{tabular}
复制代码
其中  是列格式标记,在接下来的内容将仔细介绍;\(\textrm\&\) 用来分隔单元格;\\ 用来换行;\hline 用来在行与行之间绘制横线。
直接使用 \(\textrm{tabular}\) 环境的话,会 和周围的文字混排。此时可用一个可选参数  控制垂直对齐:\(\verb|t|\) 和 \(\verb|b|\) 分别表示按表格顶部、底部对齐,其他参数或省略不写(默认)表示居中对齐。
  1. \begin{tabular}{|c|}
  2.   center-\\ aligned \\
  3. \end{tabular},
  4. \begin{tabular}[t]{|c|}
  5.   top-\\ aligned \\
  6. \end{tabular},
  7. \begin{tabular}[b]{|c|}
  8.   bottom-\\ aligned\\
  9. \end{tabular} tabulars.
复制代码
1.png
但是通常情况下 \(\textrm{tabular}\)  环境很少与文字直接混排,而是会放在 \(\textrm{table}\)  浮动体环境中,并用 \caption 命令加标题。
列格式

\(\textrm{tabular}\) 环境使用  参数指定表格的列数以及每列的格式。基本的列格式见下表。
列格式说明\(\textrm{l/c/r }\)单元格内容左对齐/居中/右对齐,不折行\(\textrm{p\{\}}\)单元格宽度固定为 ,可自动折行$$\(@\{\}\)自定义内容
  1. \begin{tabular}{lcr|p{6em}}
  2.   \hline
  3.   left & center & right
  4.        & par box with fixed width\\
  5.   L    & C      & R     & P \\
  6. \hline
  7. \end{tabular}
复制代码
2.png
表格中每行的单元格数目不能多于列格式里 $\textrm{l/c/r/p} $ 的总数(可以少于这个总数),否则出错。
\(\textrm{@}\) 格式可在单元格前后插入任意的文本,但同时它也消除了单元格前后额外添加的间距。\(\textrm{@}\) 格式可以适当使用以充当“竖线”。特别地,\(\textrm{@\{\}}\) 可直接用来消除单元格前后的间距:
  1. \begin{tabular}{@{} r@{:}lr @{}}
  2.   \hline
  3.   1  & 1 & one \\
  4.   11 & 3 & eleven \\
  5.   \hline
  6. \end{tabular}
复制代码
3.png
另外还提供了简便的将格式参数重复的写法 \(\textrm*\{\}\{\}\),比如以下两种写法是等效的:
  1. \begin{tabular}{|c|c|c|c|c|p{4em}|p{4em}|}
  2. \begin{tabular}{|*{5}{c|}*{2}{p{4em}|}}
复制代码
有时需要为整列修饰格式,比如整列改变为粗体,如果每个单元格都加上 \bfseries} 命令会比较麻烦。array 宏包提供了辅助格式 \(\textrm>\) 和 \(\textrm{\itshape}r{\centering\arraybackslash}p{9em}}  \hline  Some center-aligned long text. \\  \hline\end{tabular}[/code]
4.png
array 宏包还提供了类似 \(\textrm{p}\) 格式的 \(\textrm{m}\) 格式和 \(\textrm{b}\) 格式,三者分别在垂直方向上靠顶端对齐、居中以及底端对齐。
  1. % \usepackage{array}
  2. \begin{tabular}{>{\itshape}r<{*}l}
  3.   \hline
  4.   italic & normal \\
  5.   column & column \\
  6.   \hline
  7. \end{tabular}
复制代码
5.png
列宽

在控制列宽方面,\(\LaTeX{}\) 表格有着明显的不足:\(\textrm{l/c/r}\) 格式的列宽是由文字内容的自然宽度决定的,而 \(\textrm{p}\) 格式给定了列宽却不好控制对齐(可用 array 宏包的辅助格式),更何况列与列之间通常还有间距,所以直接生成给定总宽度的表格并不容易。
\(\LaTeX{}\) 本身提供了 \(\textrm{tabular*}\) 环境用来排版定宽表格,但是不太方便使用,比如要用到 \(\textrm{@}\) 格式插入额外命令,令单元格之间的间距为 \fill,但即使这样仍然有瑕疵:
  1. % \usepackage{array}
  2. \begin{tabular}%
  3. {>{\centering\arraybackslash}p{9em}}
  4.   \hline
  5.   Some center-aligned long text. \\
  6.   \hline
  7. \end{tabular}
复制代码
6.png
tabularx 宏包提供了方便的解决方案。它引入了一个 \(\textrm{X}\) 列格式,类似 \(\textrm{p}\) 列格式,不过会根据表格宽度自动计算列宽,多个 \(\textrm{X}\) 列格式平均分配列宽。
\(\textrm{X}\) 列格式也可以用 array 里的辅助格式修饰对齐方式:
  1. % \usepackage{array}
  2. \newcommand\txt{a b c d e f g h i}
  3. \begin{tabular}{cp{2em}m{2em}b{2em}}
  4.   \hline
  5.   pos & \txt & \txt & \txt \\
  6.   \hline
  7. \end{tabular}
复制代码
7.png
横线

在之前的例子见过许多次绘制表格线的 \hline 命令。另外 \cline{<i>-} 用来绘制跨越部分单元格的横线:
  1. \begin{tabular*}{14em}%
  2. {@{\extracolsep{\fill}}|c|c|c|c|}
  3.   \hline
  4.   A & B & C & D \\ \hline
  5.   a & b & c & d \\ \hline
  6. \end{tabular*}
复制代码
8.png

在科技论文排版中广泛应用的表格形式是三线表,形式干净简明。三线表由 booktabs 宏包支持,它提供了 \toprule、\midrule 和 \bottomrule 命令用以排版三线表的三条线,以及和 \cline 对应的 \cmidrule。除此之外,最好不要用其它横线以及竖线:
  1. % \usepackage{array,tabularx}
  2. \begin{tabularx}{14em}%
  3. {|*{4}{>{\centering\arraybackslash}X|}}
  4.   \hline
  5.   A & B & C & D \\ \hline
  6.   a & b & c & d \\ \hline
  7. \end{tabularx}
复制代码
9.png
合并单元格

横向合并单元格由 \multicolumn 命令实现:
  1. \begin{tabular}{|c|c|c|}
  2.   \hline
  3.   4 & 9 & 2 \\
  4.   \cline{2-3}
  5.   3 & 5 & 7 \\
  6.   \cline{1-1}
  7.   8 & 1 & 6 \\
  8.   \hline
  9. \end{tabular}
复制代码
其中 为要合并的列数, 为合并单元格后的列格式,只允许出现一个 \(\textrm{l/c/r}\) 或 \(\textrm{p}\) 格式。如果合并前的单元格前后带表格线 |,合并后的列格式也要带 | 以使得表格的竖线一致。
  1. % \usepackage{booktabs}
  2. \begin{tabular}{cccc}
  3.   \toprule
  4.    & \multicolumn{3}{c}{Numbers} \\
  5.   \cmidrule{2-4}
  6.            & 1 & 2 & 3 \\
  7.   \midrule
  8.   Alphabet & A & B & C \\
  9.   Roman    & I & II& III \\
  10.   \bottomrule
  11. \end{tabular}
复制代码
10.png
上面的例子还体现了,形如 \multicolumn{1}{r|}{item}的命令 可以用来修改某一个单元格的列格式。
纵向合并单元格 需要用到 multirow 宏包提供的 \multirow 命令:
  1. \multicolumn{⟨n⟩}{⟨column-spec⟩}{⟨item⟩}
复制代码
为合并后单元格的宽度,可以填 \(\textrm{*}\) 以使用自然宽度。
我们看一个结合 \cline、\multicolumn 和 \multirow 命令的例子:
  1. \begin{tabular}{|c|c|c|}
  2.   \hline
  3.   1 & 2 & Center \\ \hline
  4.   \multicolumn{2}{|c|}{3} &
  5.   \multicolumn{1}{r|}{Right} \\ \hline
  6.   4 & \multicolumn{2}{c|}{C} \\ \hline
  7. \end{tabular}
复制代码
11.png
嵌套表格

在以下的例子中,注意要用 \multicolumn 命令配合 \(\textrm{@\{\}}\) 格式把单元格的额外边距去掉,使得嵌套的表格线能和外层的表格线正确相连:
  1. \multirow{⟨n⟩}{⟨width⟩}{⟨item⟩}
复制代码
12.png
如果不需要为“拆分的单元格”画线,并且只在垂直方向“拆分”的话,makecell 宏包提供的 \makecell 命令是一个简单的解决方案:
  1. % \usepackage{multirow}
  2. \begin{tabular}{ccc}
  3.   \hline
  4.   \multirow{2}{*}{Item} &
  5.     \multicolumn{2}{c}{Value} \\
  6.   \cline{2-3}
  7.     & First & Second \\ \hline
  8.   A & 1     & 2 \\ \hline
  9. \end{tabular}
复制代码
13.png
行距控制

\(\LaTeX{}\) 生成的表格看起来通常比较紧凑。修改参数 \arraystretch 可以得到行距更加宽松的表格。
  1. \begin{tabular}{|c|c|c|}
  2. \hline
  3. a & b & c \\ \hline
  4. a & \multicolumn{1}{@{}c@{}|}
  5. {\begin{tabular}{c|c}
  6.    e & f \\ \hline
  7.    e & f \\
  8.   \end{tabular}}
  9.        & c \\ \hline
  10. a & b & c \\ \hline
  11. \end{tabular}
复制代码
14.png
另一种增加间距的办法是给换行命令 \\ 添加可选参数,在这一行下面加额外的间距,适合用于在行间不加横线的表格:
  1. % \usepackage{makecell}
  2. \begin{tabular}{|c|c|}
  3. \hline
  4. a & \makecell{d1 \\ d2} \\
  5. \hline
  6. b & c \\
  7. \hline
  8. \end{tabular}
复制代码
15.png
但是这种换行方式的存在导致了一个缺陷——从第二行开始,表格的首个单元格不能直接使用中括号 \(\textrm{[]}\),否则 \\ 往往会将下一行的中括号当作自己的可选参数,因而出错。如果要使用中括号,应当放在花括号 {} 里面。或者也可以选择将换行命令写成 \(\textrm{\\\\[0pt]}\)。
浮动体

内容丰富的文章或者书籍往往包含许多图片和表格等内容。这些内容的尺寸往往太大,导致分页困难。\(\LaTeX{}\) 为此引入了浮动体的机制,令大块的内容可以脱离上下文,放置在合适的位置。
\(\LaTeX{}\) 预定义了两类浮动体环境 \(\textrm{figure}\) 和 \(\textrm{table}\)。习惯上 \(\textrm{figure}\) 里放图片,\(\textrm{table}\) 里放表格,但并没有严格限制,可以在任何一个浮动体里放置文字、公式、表格、图片等等任意内容。
以 \(\textrm{table}\) 环境的用法举例,\(\textrm{figure}\) 同理:
  1. \renewcommand\arraystretch{1.8}
  2. \begin{tabular}{|c|}
  3.   \hline
  4.   Really loose \\ \hline
  5.   tabular rows.\\ \hline
  6. \end{tabular}
  7. \end{example}
复制代码
参数提供了一些符号用来表示浮动体允许排版的位置,如 \(\textrm{hbp}\) 允许浮动体排版在当前位置、底部或者单独成页。\(\textrm{table}\) 和 \(\textrm{figure}\) 浮动体的默认设置为 \(\textrm{tbp}\)。
16.png
双栏排版环境下,\(\LaTeX{}\) 提供了 \(\textrm{table*}\) 和 \(\textrm{figure*}\) 环境用来排版 跨栏 的浮动体。用法与 \(\textrm{table}\) 和 \(\textrm{figure}\) 一样,不同之处为双栏的  参数只能用 \(\textrm{tp}\) 两个位置。
浮动体的位置选取受到先后顺序的限制。如果某个浮动体由于参数限制、空间限制等原因在当前页无法放置,就要推迟到之后处理,并使得之后的同类浮动体一并推迟。\clearpage 命令会在另起一页之前,先将所有推迟处理的浮动体排版成页,此时 \(\textrm{htbp}\) 等位置限制被完全忽略。
float 宏包为浮动体提供了 \(\textrm{H}\) 位置参数,不与 \(\textrm{htbp}\) 及 \(\textrm{!}\) 混用。使用 \(\textrm{H}\) 位置参数时,会取消浮动机制,将浮动体视为一般的盒子插入当前位置。这在一些特殊情况下很有用(如使用 multicol 宏包排版分栏内容的时候),但尺寸过大的浮动体可能使得分页比较困难。
浮动体的标题

图表等浮动体提供了 \caption 命令加标题,并且自动给浮动体编号,可以用带星号的命令 \caption*(需加载相关宏包,如 caption) 生成不带编号的标题,也可以使用带可选参数的形式 \caption[...]{...},使得在目录里使用短标题。命令之后还可以紧跟 \label 命令标记交叉引用。
\caption 生成的标题形如“Figure 1: ...”或“Table 1: ...”可通过修改 \figurename 和 \tablename 的内容来修改标题的前缀。标题样式的定制功能由 caption 宏包提供,详见该宏包的帮助文档,在此不作赘述。
\(\textrm{table}\) 和 \(\textrm{figure}\) 两种浮动体分别有各自的生成目录的命令:
  1. \begin{tabular}{c}
  2.   \hline
  3.   Head lines \\[6pt]
  4.   tabular lines \\
  5.   tabular lines \\
  6.   \hline
  7. \end{tabular}
复制代码
它们类似 \tableofcontents 生成单独的章节。
将 Excel 表格转换为 LaTeX 代码

Excel2LaTeX 插件(推荐)


  • 特点:易用,可直接在 Excel 中将表格转换为 LaTeX 代码并复制粘贴到文档中。
  • 下载地址:Excel2LaTeX
  • 使用方法:

    • 下载并安装 Excel2LaTeX.xla 插件。
    • 在 Excel 中打开插件后,选中表格,点击“Convert Table”按钮。
    • 复制生成的 LaTeX 代码并粘贴到你的 LaTeX 文档中。

Table Generator 在线工具


  • 网站:Table Generator
  • 特点:支持粘贴 Excel 表格,自动转换为 LaTeX 代码。
  • 使用方法:

    • 复制 Excel 表格数据(Ctrl + C)。
    • 在网站中粘贴(Ctrl + V)。
    • 生成 LaTeX 代码后复制到 LaTeX 文档中。

pandoc(适合批量转换)


  • 安装:
    1. \begin{table}[⟨placement⟩]
    2. \end{table}
    复制代码
  • 使用方法:
    1. \listoftables
    2. \listoffigures
    复制代码
  • 特点:适合从 CSV 文件批量转换。
Python 脚本(适合自定义需求)
  1. sudo apt install pandoc  # Linux
  2. choco install pandoc      # Windows(使用 Chocolatey)
复制代码

  • 特点:灵活,可自定义格式。
这些工具各有优缺点,如果是日常使用,推荐 Excel2LaTeX 或 Table Generator 在线工具;如果是批量处理,可以考虑 Pandoc 或 Python
几种常见表格模板

导言区包含宏包和命令
  1. pandoc -f csv -t latex input.csv -o output.tex
复制代码
普通三线表
  1. import pandas as pd
  2. from tabulate import tabulate
  3. df = pd.read_excel("your_file.xlsx")
  4. latex_code = tabulate(df, headers="keys", tablefmt="latex")
  5. print(latex_code)
复制代码
17.png
等页宽三线表
  1. \usepackage{booktabs} % 导入三线表
  2. \usepackage{longtable}
  3. \usepackage{ltxtable}
  4. \usepackage{array}       % 基础包最先
  5. \usepackage{tabularx}    % 早期加载
  6. \usepackage{multirow}    % 多行处理
  7. \usepackage{siunitx}     % 特殊列格式
  8. \usepackage{makecell}
  9. \usepackage{graphicx}
  10. \usepackage{diagbox}
  11. \usepackage{rotating}
  12. \usepackage{subcaption} % 关键宏包
  13. \usepackage{float} % 关键宏包:提供[H]选项
  14. \newcolumntype{L}{>{\raggedright\arraybackslash}X} % 左对齐
  15. \newcolumntype{C}{>{\centering\arraybackslash}X}    % 居中对齐
  16. \newcolumntype{R}{>{\raggedleft\arraybackslash}X}   % 右对齐
复制代码
18.png
跨行跨列表格
  1. \begin{table}[H]
  2.         \centering
  3.         \caption{Five different mesh densities.}
  4.         %\renewcommand\arraystretch{1.6}
  5.         \begin{tabular}{cccc}
  6.                 \toprule
  7.                 & Total cells & $\mathrm{C}_\mathrm{L}$ & $\mathrm{C}_\mathrm{D}$ \\
  8.                 \midrule
  9.                 Mesh 1 & $33.45 \times 10^4$ & 0.5606 & 0.0225 \\
  10.                 Mesh 2 & $103.24 \times 10^4$ & 0.5656 & 0.0202 \\
  11.                 Mesh 3 & $200.16 \times 10^4$ & 0.5689 & 0.0197 \\
  12.                 Mesh 4 & $305.47 \times 10^4$ & 0.5689 & 0.0197 \\
  13.                 Mesh 5 & $412.66 \times 10^4$ & 0.5689 & 0.0197 \\
  14.                 \bottomrule
  15.         \end{tabular}%
  16.         \label{tab:commom}%
  17. \end{table}%
复制代码
19.png
表格中包含图
  1. \begin{table}[H]
  2.         \centering
  3.         \caption{Five different mesh densities.}
  4.         %\renewcommand\arraystretch{1.6}
  5.         \begin{tabularx}{\linewidth}{CCCC} % C 表示自动填充列并居中
  6.                 \toprule
  7.                 & Total cells & $\mathrm{C}_\mathrm{L}$ & $\mathrm{C}_\mathrm{D}$ \\
  8.                 \midrule
  9.                 Mesh 1 & $33.45 \times 10^4$  & 0.5606 & 0.0225 \\
  10.                 Mesh 2 & $103.24 \times 10^4$ & 0.5656 & 0.0202 \\
  11.                 Mesh 3 & $200.16 \times 10^4$ & 0.5689 & 0.0197 \\
  12.                 Mesh 4 & $305.47 \times 10^4$ & 0.5689 & 0.0197 \\
  13.                 Mesh 5 & $412.66 \times 10^4$ & 0.5689 & 0.0197 \\
  14.                 \bottomrule
  15.         \end{tabularx}%
  16.         \label{tab:same_textwidth}%
  17. \end{table}%
复制代码
20.png
跨页长表格
  1. \begin{table}[H]
  2.         \centering
  3.         \caption{跨行跨列表格}
  4.         \renewcommand\arraystretch{1.6}
  5.         \begin{tabular}{|c|c|c|c|c|}
  6.                 \hline
  7.                 \multicolumn{3}{|r|}{} & 转移特性曲线的象限 & 输出特性曲线的象限 \\
  8.                 \hline
  9.                 \multicolumn{1}{|c|}{\multirow{4}[4]{*}{\rotatebox{90}{结型场效应管}}} & \multicolumn{2}{c|}{\multirow{2}[2]{*}{N沟道}} & \multicolumn{1}{c|}{\multirow{2}[2]{*}{2}} & \multirow{2}[2]{*}{1} \\
  10.                 & \multicolumn{2}{c|}{} & \multicolumn{1}{c|}{} &  \\
  11.                 \cline{2-5}          & \multicolumn{2}{c|}{\multirow{2}[2]{*}{P沟道}} & \multicolumn{1}{c|}{\multirow{2}[2]{*}{4}} & \multirow{2}[2]{*}{3} \\
  12.                 & \multicolumn{2}{c|}{} & \multicolumn{1}{c|}{} &  \\
  13.                 \hline
  14.                 \multicolumn{1}{|c|}{\multirow{4}[8]{*}{\begin{turn}{90}{绝缘栅型场效应管}\end{turn}}} & \multicolumn{1}{c|}{\multirow{2}[4]{*}{N沟道}} & 增强型   & \multicolumn{1}{c|}{2} & 1 \\
  15.                 \cline{3-5}          &       & 耗尽型   & 1,2   & 1 \\
  16.                 \cline{2-5}          & \multicolumn{1}{c|}{\multirow{2}[4]{*}{P沟道}} & 增强型   & \multicolumn{1}{c|}{3} & 3 \\
  17.                 \cline{3-5}          &       & 耗尽型   & 2,4   & 3 \\
  18.                 \hline
  19.         \end{tabular}%
  20.         \label{tab:addlabel}%
  21. \end{table}%
复制代码
21.png
跨页长表格宽度设置为页面宽度

这里需要采用分文件写法,将表格内容放到set_table_width.tex文件中,在主文件中插入如下代码,其中\textwidth控制表格宽度。
  1. \begin{table}[H]
  2. \centering
  3. \caption{表格中包含图}
  4. \begin{tabular}{|c|c|}
  5. \hline
  6. 文字 &
  7. \begin{minipage}[c][5cm]{8cm} % [c] 表示垂直居中
  8.   \includegraphics[width=8cm]{tree.png}
  9. \end{minipage} \\
  10. \hline
  11. 跨页 & 表格 \\
  12. \hline
  13. \end{tabular}
  14. \label{tab:fig_in_tab}%
  15. \end{table}%
复制代码
下面的内容单独放到set_table_width.tex中。
  1. \begin{center}
  2. \begingroup
  3. \small % 整个longtable小一号
  4. \begin{longtable}{lccccc}
  5. \caption{跨页长表格}\label{tab:long1} \\
  6. % 表格第一页表头显示内容
  7. \toprule
  8. \textbf{家庭特征} & \textbf{续发病例数(例)}  & \textbf{家庭密接数(例)}
  9. &\makecell{\textbf{家庭二代续发率}\\ \textbf{[\% (95\%CI)]}} & \textbf{$x^2$值} & \textbf{P值} \\
  10. \midrule
  11. \endfirsthead
  12. %后续页面表头显示内容
  13. \multicolumn{6}{c}{表~\ref{tab:long1}(续)}\\
  14. \toprule
  15. \textbf{家庭特征} & \textbf{续发病例数(例)}  & \textbf{家庭密接数(例)}
  16. &\makecell{\textbf{家庭二代续发率}\\ \textbf{[\% (95\%CI)]}}  & \textbf{$x^2$值} & \textbf{P值} \\
  17. \midrule
  18. \endhead
  19. % 表格最后一页前 每页底部显示内容
  20. \bottomrule
  21. \endfoot
  22. % 表格最后一页尾部显示内容
  23. \bottomrule
  24. \endlastfoot
  25. 总体蓄发率 & 201  & 477 & 42.14 (37.69,46.72) &  &  \\
  26. 发生传播家庭蓄发率  & 201  & 477 & 42.14 (37.69,46.72) &  &  \\
  27. 家庭结构 & & & &                                0.309 &        0.636 \\
  28. 二代户        & 83 &        190        & 43.68 (36.57,51.05)        & & \\       
  29. 三代户        &118&        287        & 41.11 (35.40,47.06) & &\\               
  30. 家庭规模        & & & &                        5.191        & 0.027 \\
  31. 总体蓄发率 & 201  & 477 & 42.14 (37.69,46.72) &  &  \\
  32. 发生传播家庭蓄发率  & 201  & 477 & 42.14 (37.69,46.72) &  &  \\
  33. 家庭结构 & & & &                                0.309 &        0.636 \\
  34. 二代户        & 83 &        190        & 43.68 (36.57,51.05)        & & \\       
  35. 三代户        &118&        287        & 41.11 (35.40,47.06) & &\\               
  36. 家庭规模        & & & &                        5.191        & 0.027 \\
  37. 总体蓄发率 & 201  & 477 & 42.14 (37.69,46.72) &  &  \\
  38. 发生传播家庭蓄发率  & 201  & 477 & 42.14 (37.69,46.72) &  &  \\
  39. \end{longtable}
  40. \endgroup % 字号恢复
  41. \end{center}
复制代码
22.png
并排表格
  1. \LTXtable{\textwidth}{set_table_width.tex}
复制代码
23.png
并排子表格
  1. % set_table_width.tex
  2. \begingroup
  3. \small
  4. \begin{longtable}{LCCC}
  5. \caption{跨页长表格设置宽度}\label{tab:set_width} \\
  6. % 表格第一页表头显示内容
  7. \toprule
  8. \textbf{家庭特征} & \makecell{\textbf{发生家庭传播(n=99)}\\ \textbf{[户,百分比(\%)]}}  & \makecell{\textbf{未发生家庭传播(n=57)}\\ \textbf{[户,百分比(\%)]}}
  9. &\makecell{\textbf{总计(n=156)}\\ \textbf{[户,百分比(\%)]}}  \\
  10. \midrule
  11. \endfirsthead
  12. %后续页面表头显示内容
  13. \multicolumn{4}{c}{表~\ref{tab:set_width}(续)}\\
  14. \toprule
  15. \textbf{家庭特征} & \makecell{\textbf{发生家庭传播(n=99)}\\ \textbf{[户,百分比(\%)]}}  & \makecell{\textbf{未发生家庭传播(n=57)}\\ \textbf{[户,百分比(\%)]}}
  16. &\makecell{\textbf{总计(n=156)}\\ \textbf{[户,百分比(\%)]}} \\
  17. \midrule
  18. \endhead
  19. % 表格最后一页前 每页底部显示内容
  20. \bottomrule
  21. \endfoot
  22. % 表格最后一页尾部显示内容
  23. \bottomrule
  24. \endlastfoot
  25. 家庭结构                    & ~          & ~          & ~            \\
  26. ~ ~ 二代户                 & 47(47.5\%) & 29(50.9\%) & 76(48.7\%)   \\
  27. ~ ~ 三代户                 & 52(52.5\%) & 28(49.1\%) & 80(51.3\%)   \\
  28. 家庭规模                    & ~          & ~          & ~            \\
  29. ~ ~ 2\textasciitilde{}3 & 27(27.3\%) & 29(50.9\%) & 56(35.9\%)   \\
  30. ~ ~ 4\textasciitilde{}5 & 60(60.6\%) & 26(45.6\%) & 86(55.1\%)   \\
  31. ~ ~ 6+                  & 12(12.1\%) & 2(3.5\%)   & 14(9.0\%)    \\
  32. 住房类型                    & ~          & ~          & ~            \\
  33. ~ ~ 楼房                  & 74(74.7\%) & 41(71.9\%) & 115(73.7\%)  \\
  34. ~ ~ 平房                  & 22(22.2\%) & 15(26.3\%) & 37(23.7\%)   \\
  35. ~ ~ 其他                  & 3(3.0\%)   & 1(1.8\%)   & 4(2.6\%)     \\
  36. 人均住房面积(㎡)               & ~          & ~          & ~            \\
  37. ~ ~ ≤20                 & 22(22.2\%) & 10(17.5\%) & 32(20.5\%)   \\
  38. ~ ~ 20-40               & 58(58.6\%) & 36(63.2\%) & 94(60.3\%)   \\
  39. ~ ~ ≥40                 & 19(19.2\%) & 11(19.3\%) & 30(19.2\%)   \\
  40. 家庭人均年收入(元)              & ~          & ~          & ~            \\
  41. ~ ~ 5000                & 3(3.0\%)   & 0(0\%)     & 3(1.9\%)     \\
  42. ~ ~ 5000-19999          & 9(9.1\%)   & 6(10.5\%)  & 15(9.6\%)    \\
  43. ~ ~ 20000-49999         & 18(18.2\%) & 9(15.8\%)  & 27(17.3\%)   \\
  44. ~ ~ 50000-99999         & 29(29.3\%) & 15(26.3\%) & 44(28.2\%)   \\
  45. ~ ~ ≥100000             & 40(40.4\%) & 27(47.4\%) & 67(42.9\%)   \\
  46. 吸烟家庭                    & ~          & ~          & ~            \\
  47. ~ ~ 是                   & 57(57.6\%) & 26(45.6\%) & 83(53.2\%)   \\
  48. ~ ~ 否                   & 42(42.4\%) & 31(54.4\%) & 73(46.8\%)   \\
  49. 家庭地区                    & ~          & ~          & ~            \\
  50. ~ ~ 富阳地区                & 20(20.2\%) & 21(36.8\%) & 41(26.3\%)   \\
  51. ~ ~ 嘉兴地区                & 29(29.3\%) & 6(10.5\%)  & 35(22.4\%)   \\
  52. ~ ~ 丽水地区                & 34(34.3\%) & 14(24.6\%) & 48(30.8\%)   \\
  53. ~ ~ 温州地区                & 16(16.2\%) & 16(28.1\%) & 32(20.5\%)                         
  54. \end{longtable}
  55. \endgroup
复制代码
24.png

来源:程序园用户自行投稿发布,如果侵权,请联系站长删除
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

相关推荐

您需要登录后才可以回帖 登录 | 立即注册