\usepackage{multirow}
\begin{table}[htbp]
\begin{tabular}{p{2.5cm}p{2.5cm}p{1.5cm}p{6.5cm}}
\hline
\multicolumn{2}{c}{\textbf{Parameters}} & \multirow{2}{*}{\textbf{Used value}} & \multicolumn{1}{c}{\multirow{2}{*}{\textbf{Definition}}} \\
\textbf{Original} & \textbf{English translation} & & \multicolumn{1}{c}{} \\
\hline
Rechenlauf fortsetzen & Continue calculation & No & It determines whether a calculation run is to be continued. If yes, the result data from the file HYDRO\_AS 2D.CPR is transferred to the program and used as initial boundary condition. \\
Simulationszeit {[}s{]} & Simulation time {[}s{]} & 86400 & It defines the simulation time in seconds \\
Zeitintervall SMS {[}s{]} & Time interval SMS {[}s{]} & 8640 & It defines the time interval (in seconds) for the storage of area-based result data which can be visualized with the SMS program following the calculations. \\
Zeitintervall Q\_Strg {[}s{]} & Time interval Q\_Strg {[}s{]} & 900 & It defines the time interval (in seconds) for which the data of the node strings are written to the Q\_Strg.dat. \\
Hmin & \multirow{5}{*}{} & 0.01 m & Minimum water depth \\
VELMAX & & 15 m/s & Maximum velocity allowed \\
Amin & & 1.e-15 m\textsuperscript{2} & Minimum element size allowed for calculating the internal calculation time step \\
CMUVISC & & 0.60 & Coefficient cm in the viscosity formula \\
SCF & & 1.00 & Coefficient for the additional acceleration of the calculation process \\
\hline
\end{tabular}
\end{table}
答案1
几点:
使用
booktabs
包装以获得更好的间距使用
siunitx
包来正确获取值和单位之间的空间使用
tabularx
将表格保持在可用的文本宽度内,你的表格要宽得多细分中间规则
您的参数似乎是一些变量的名称?我会用打字机字体或小写字母来写它们。
将列左对齐。在非常窄的列中对齐文本永远不会看起来好看
如果单位是使用值的参数名称的一部分,则可以混合使用。我不了解你的程序,所以不知道正确的方法是什么,但要保持一致
使用以下方法使表格内容与规则对齐
@{}
\documentclass{article}
\usepackage{geometry}
\usepackage{booktabs}
\usepackage{array}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{siunitx}
\newcolumntype{L}[1]{>{\centering\raggedright}m{#1}}
\begin{document}
\begin{table}[htbp]
\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\linewidth}{@{}L{2.5cm}L{2.5cm}L{1.5cm}X@{}}
\toprule
\multicolumn{2}{c}{\textbf{Parameters\hspace{1em}}} & & \\
\textbf{Original} & \textbf{English translation} & \textbf{Used value} & \textbf{Definition} \\
\cmidrule(r){1-2} \cmidrule(lr){3-3} \cmidrule(l){4-4}
Rechenlauf fortsetzen & Continue calculation & No & It determines whether a calculation run is to be continued. If yes, the result data from the file \texttt{HYDRO\_AS 2D.CPR} is transferred to the program and used as initial boundary condition. \\
Simulationszeit & Simulation time & \SI{86400}{s} & It defines the simulation time in seconds \\
Zeitintervall \texttt{SMS} & Time interval \texttt{SMS} & \SI{8640}{s} & It defines the time interval (in seconds) for the storage of area-based result data which can be visualized with the \texttt{SMS} program following the calculations. \\
Zeitintervall \texttt{Q\_Strg} & Time interval \texttt{Q\_Strg} & \SI{900}{s} & It defines the time interval (in seconds) for which the data of the node strings are written to the \texttt{Q\_Strg.dat}. \\
Hmin & \multirow{5}{*}{} & \SI{0.01}{m} & Minimum water depth \\
\texttt{VELMAX} & & \SI{15}{m/s} & Maximum velocity allowed \\
Amin & & \SI{e-15}{\meter\square} & Minimum element size allowed for calculating the internal calculation time step \\
\texttt{CMUVISC} & & 0.60 & Coefficient cm in the viscosity formula \\
\texttt{SCF} & & 1.00 & Coefficient for the additional acceleration of the calculation process \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
答案2
这里有一个与 @samcarter 发布的解决方案非常相似的解决方案。例如,它使用环境tabularx
,不完全对齐单元格内容,并使用包的宏num
、\si
和来显示数字、科学单位以及数字和相关单位的组合。\SI
siunitx
一些差异:
- 第 3 列不允许换行
- 第 1 列和第 2 列单元格内容的自动悬挂缩进
- 标题单元格无粗体显示
- 第 4 列中的语言更加简洁
- 使用
\path
宏(由url
包提供)排版文件名 - 使用
,
(逗号)作为 4 位或更多位数字的千位分隔符
\documentclass{article}
\usepackage[a4paper]{geometry} % set page parameters suitably
\usepackage[hyphens,spaces,obeyspaces]{url} % for '\path' macro
\usepackage{ragged2e,tabularx,booktabs,siunitx}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\newcolumntype{P}[2]{>{\RaggedRight\hangafter=1\hangindent=1em}p{#1}}
\begin{document}
\begin{table}[htbp]
\sisetup{per-mode=symbol,
tight-spacing,
group-minimum-digits=4,
group-separator={,}}
\begin{tabularx}{\textwidth}{@{} *{2}{P{2.2cm}}lL @{}}
\toprule
\multicolumn{2}{c}{Parameters} & Used value & Definition \\
\cmidrule(r){1-2}
Original & English translation \\
\midrule
Rechenlauf fortsetzen & Continue calculation & No & Determines whether a calculation run is to be continued. If yes, result data from the file \path{HYDRO_AS 2D.CPR} is transferred to program and used as initial boundary condition \\
Simulations\-zeit [\si{\second}] & Simulation time [\si{\second}] & \num{86400} & Simulation time, in seconds \\
Zeitintervall SMS [\si{\second}]& Time interval SMS [\si{\second}] & \num{8640} & Time interval (in seconds) for storage of area-based result data which can be visualized with the SMS program following the calculations \\
Zeitintervall Q\_Strg [\si{\second}] & Time interval Q\_Strg [\si{\second}] & \num{900} & Time interval (in seconds) for which the data of the node strings are written to \path{Q_Strg.dat} \\
Hmin & & \SI{0.01}{\meter} & Minimum water depth \\
VELMAX & & \SI{15}{\meter\per\second} & Maximum velocity allowed \\
Amin & & \SI{e-15}{\meter\squared} & Minimum element size allowed for calculating the internal calculation time step \\
CMUVISC & & \num{0.60} & Coefficient cm in viscosity formula \\
SCF & & \num{1.00} & Coefficient for additional acceleration of calculation process \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
答案3
这是一个稍微偏离主题的答案,因为其他人已经比我更好地介绍了 TeX 方面,而我专注于写作。
您可以在最后一列中缩减许多条目的措辞。许多条目开头的“It”绝对是多余的。我还会删除“determines”或“defines”和“the”。您还可以删除其他一些冠词,并将文本编辑成更短的形式。我已经为您试过了,见下文。在某些情况下我可能做得过头了,但我仍然认为第一个条目有点冗长。这可以在除一个多行项目之外的所有多行项目中节省一行,使所有内容更易于阅读。此外,您在某些条目上有句号,但在其他条目上没有。
我还会在行之间添加一些垂直空间(在编辑过程中总高度仍然可以更小),以使最后一列更易于阅读。使用\raggedright
分行而不是连字符,我已将“继续计算”用于分行,但未将“时间间隔”作为开始的单元格用于分行,以演示效果。这些要点已在其他答案中介绍,我已不一致地演示了它们\raggedright
的用法。\texttt
尤其应该避免变量名中的换行符等
\def\arraystretch{1.5}%
\begin{table}[htbp]
\begin{tabular}{p{2.5cm}p{2.5cm}p{1.5cm}p{6.5cm}}
\hline
\multicolumn{2}{c}{\textbf{Parameters}} & \multirow{2}{*}{\textbf{Used value}} & \multicolumn{1}{c}{\multirow{2}{*}{\textbf{Definition}}} \\
\textbf{Original} & \textbf{English translation} & & \multicolumn{1}{c}{} \\
\hline
Rechenlauf fortsetzen & \raggedright Continue calculation & No & Whether calculation run is to be continued. If yes, results from file \texttt{HYDRO\_AS 2D.CPR} are transferred to the program and used as initial condition. \\
Simulationszeit {[}s{]} & Simulation time {[}s{]} & 86400 & Simulation time (in seconds) \\
Zeitintervall SMS {[}s{]} & Time interval SMS {[}s{]} & 8640 & Time interval (in seconds) for storage of area-based results which can subsequently be visualized with the SMS program. \\
Zeitintervall Q\_Strg {[}s{]} & Time interval Q\_Strg {[}s{]} & 900 & Time interval (in seconds) for which data of the node strings are written to \texttt{Q\_Strg.dat}. \\
Hmin & \multirow{5}{*}{} & 0.01 m & Minimum water depth \\
VELMAX & & 15 m/s & Maximum velocity \\
Amin & & 1.e-15 m\textsuperscript{2} & Minimum element size for calculating internal calculation time step \\
CMUVISC & & 0.60 & Coefficient cm in viscosity formula \\
SCF & & 1.00 & Coefficient for additional acceleration of calculation process \\
\hline
\end{tabular}
\end{table}