我很困惑如何在 LaTeX 中创建下表
我花了很多时间在互联网和书籍上搜索关于乳胶的内容,但找不到相关内容。我的问题是如何包含第一行(如您所见,该行居中且有两列)以及最后一行。
非常感谢。
答案1
包含以下包multirow
:
\usepackage{multirow}
并在您的表中使用它,如下所示:
\multicolumn{2}{c}{ Field variables }
该字段现在将跨越 2 个单元格,文本将居中,内容将是“字段变量”。
答案2
因此,根据我收到的答复,下表如下:
\begin{table}
\centering
\begin{tabular}{p{3.5cm}cp{1.75cm}p{3cm}p{1.75cm}}
\toprule
\multicolumn{3}{c}{Field variables} & \multicolumn{2}{c}{Field equations}\\
\midrule
Name & Symbol & Number of Unknowns & Name & Number of equations \\
\midrule
Displacement (vector) & $\textbf{u}$ & 3 & Conservation of Linear Momentum & 3 (3.2.9) \\
Strain (second-order symmetric tensor) & $\boldsymbol{\varepsilon}$ & 6 & Kinematics & 6 (3.2.4) \\
Stress (second-order symmetric tensor) & $\boldsymbol{\sigma}$ & 6 & & \\
Density (scalar) & $\rho$ & 1 & Conservation of Mass & 6 (3.2.4) \\
Internal Energy (scalar) & $u$ & 1 & & 1 (3.2.4) \\
Temperature (scalar) & $T$ & 1 & Conservation of Mass & 6 (3.2.4) \\
Heat Fluc (scalar) &$\bf{q}$ & 3& &\\
\bottomrule
Number of Unknowns:& & 21 & Number of Equations& 11
\end{tabular}
\caption{Unknown field variables and available field equations in continuum mechanics.}
\end{table}
但是,我希望所有列的内容都左对齐(第一行除外)。我该如何实现?
答案3
作为起点,您可以尝试这个网站http://www.tablesgenerator.com 它将帮助你像在 Excel 中一样在线创建表格
答案4
你可以从以下方式开始:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{p{3.5cm}cp{1.75cm}p{3cm}p{1.75cm}}
\toprule
\multicolumn{3}{c}{Field variables} & \multicolumn{2}{c}{Field equations}\\
\midrule
Name & Symbol & Number of Unknowns & Name & Number of equations \\
\midrule
Displacement (vector) & \textbf{u} & 3 & Conservation of Linear Momentum & 3 (3.2.9) \\
Strain (second-order symmetric tensor) & $\varepsilon$ & 6 & Kinematics & 6 (3.2.4) \\
\bottomrule
\end{tabular}
\end{document}
更新:根据 Johanne_B 和 Barbara Beeton 的建议,进行了更好的对齐和cmidrules
介绍。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage{booktabs}
\usepackage{array} % for \newcolumntype
\newcolumntype{v}[1]{%
>{\raggedright\hspace{0pt}\arraybackslash}p{#1}%
}
\begin{document}
\begin{tabular}{v{3.5cm}cv{1.75cm}v{3cm}v{1.75cm}}
\toprule
\multicolumn{3}{c}{Field variables} & \multicolumn{2}{c}{Field equations}\\
\cmidrule(r){1-3}\cmidrule(l){4-5}
Name & Symbol & Number of Unknowns & Name & Number of equations \\
\cmidrule(r){1-1}\cmidrule(rl){2-2}\cmidrule(rl){3-3}\cmidrule(rl){4-4}\cmidrule(l){5-5}
Displacement (vector) & \textbf{u} & 3 & Conservation of Linear Momentum & 3 (3.2.9) \\
Strain (second-order symmetric tensor) & $\varepsilon$ & 6 & Kinematics & 6 (3.2.4) \\
\bottomrule
\end{tabular}
\end{document}