因此,我一直\Xhline
在表格中使用,以便我可以将表格的顶部、第二行和底部线条设置为比其他线条更粗。我的代码(如下)可以运行并生成一个表格,并且顶部和底部线条的粗细增加了,但由于某种原因,第二行并没有增加,尽管我使用了完全相同的命令。下面的代码仅适用于我的表格,文档的其余部分很大。当我将这部分代码复制到新窗口并运行它时,表格看起来很完美,但是当我在主文档中运行它时,线条粗细并不总是增加。有人知道是什么原因导致它在我的文档中间歇性地工作吗?
ps 无法标记xhline
因此hline
仅包含表格标记。
\documentclass[11pt,a4paper]{report}
\usepackage {multirow}
\usepackage [english]{babel}
\usepackage{fixltx2e}
\usepackage{setspace}
\usepackage{booktabs}
\usepackage{array}
\usepackage{tabularx}
\usepackage{calc}
\usepackage{makecell}
\begin{document}
\begin{table}[!ht]
\centering
\setlength\extrarowheight{5pt}
\begin{tabular}{p{3cm}p{3cm}p{8.5cm}}
\Xhline{2.0pt}
\multicolumn{3}{c}{\textbf{Model set-up}} \\
\Xhline{2.0pt}
\multicolumn{2}{l}{\textbf{Channel dimensions}} & 29.76m x 2m\\ \Xhline{0.2pt}
\multirow{2}{*}{\textbf{Bathymetry}} & 8m$<$x$<$12m & Z\textsubscript{f} = 0.05 * (x - 10) \textsuperscript{2}\\
& Everywhere else: & Z\textsubscript{f} = -0.2m \\ \Xhline{0.2pt}
\multicolumn{2}{l}{\textbf{Mesh (Figure XXXX)}} & Triangulated regular grid. Increased resolution at the bump and it is wake. \\ \Xhline{0.2pt}
\multicolumn{2}{l}{\multirow{3}{*}{\textbf{Boundaries}}}
& Channel entrance: Open boundary with prescribed discharge ($Q$ = 2m\textsuperscript{3}) \\
\multicolumn{2}{l}{}
& Channel exit: Open boundary with prescribed water level ($y$=0.4m)\\
\multicolumn{2}{l}{}
& Remaining boundaries: Closed \\ \Xhline{0.2pt}
\multicolumn{2}{l}{\textbf{Friction}} & Bottom friction was defined using the Strickler formula and a coefficient of 40 was set. All other sides were frictionless\\ \Xhline{0.2pt}
\multicolumn{2}{l}{\textbf{Time step}} & 0.02 seconds\\ \Xhline{0.2pt}
\multicolumn{2}{l}{\textbf{Duration}} & 100 seconds\\ \Xhline{0.2pt}
\Xhline{2.0pt}
\end{tabular}
\centering
\end {table}
\end {document}
答案1
这是使用较少软件包的表格。我按照您的意愿保留了线条粗细,但仅使用 定义了此规则booktabs
。也许这对您有用:
% arara: pdflatex
\documentclass[11pt,a4paper]{report}
\usepackage{multirow, booktabs}
\usepackage{siunitx}
\begin{document}
\begin{table}
\centering
\begin{tabular}{p{3cm}p{3cm}p{8.5cm}} \toprule[2.0pt]
\multicolumn{3}{c}{\textbf{Model set-up}} \\ \midrule[2.0pt]
\multicolumn{2}{l}{\textbf{Channel dimensions}} & $\SI{29.76}{\metre}\times\SI{2}{\metre}$ \\ \midrule[0.2pt]
\multirow{2}{*}{\textbf{Bathymetry}} & $\SI{8}{\metre}<x<\SI{12}{\metre}$ & $Z_\mathrm{f} = 0.05\cdot(x-10)^2$\\ & Everywhere else: & $Z_\mathrm{f}= \SI{-0.2}{\metre}$ \\ \midrule[0.2pt]
\multicolumn{2}{l}{\multirow{2}{*}{\textbf{Mesh (Figure XXXX)}}} & Triangulated regular grid. Increased resolution at the bump and it is wake. \\ \midrule[0.2pt]
\multicolumn{2}{l}{\multirow{5}{*}{\textbf{Boundaries}}} & Channel entrance: Open boundary with prescribed discharge ($Q = \SI{2}{\cubic\metre}$) \\
\multicolumn{2}{l}{} & Channel exit: Open boundary with prescribed water level ($y=\SI{0.4}{\metre}$)\\
\multicolumn{2}{l}{} & Remaining boundaries: Closed \\ \midrule[0.2pt]
\multicolumn{2}{l}{\multirow{3}{*}{\textbf{Friction}}} & Bottom friction was defined using the Strickler formula and a coefficient of $40$ was set. All other sides were frictionless\\ \midrule[0.2pt]
\multicolumn{2}{l}{\textbf{Time step}} & $0.02$ seconds \\ \midrule[0.2pt]
\multicolumn{2}{l}{\textbf{Duration}} & $100$ seconds \\ \bottomrule[2.0pt]
\end{tabular}
\end{table}
\end{document}