多行命令后不显示垂直线

多行命令后不显示垂直线
\begin{table}[ht]

\caption{Table 5.1: Case studied depending on pre-chamber pressure and CVC chamber fuel blends}

\begin{center}
\begin{tabular}{|c|c|c|}
\hline
Case Number&Pre-chamber Pressure (bar)&CVC chamber fuel blends (by volume)\\
\hline
5.1&2&Fuel-B, 50:50 CH$_{4}$-H$_{2}$ blend\\
\hline
5.2&2&Fuel-A, 30:70 CH$_{4}$-H$_{2}$ blend\\
\hline
5.3&4&Fuel-B, 50:50 CH$_{4}$-H$_{2}$ blend\\
\hline
5.4&4&Fuel-A, 30:70 CH$_{4}$-H$_{2}$ blend\\
\hline
5.5&6&Fuel-B, 50:50 CH$_{4}$-H$_{2}$ blend\\
\hline
5.6&6&Fuel-A, 30:70 CH$_{4}$-H$_{2}$ blend\\
\hline



\end{tabular}

\end{center}

\label{tab:multicol}

\end{table}
\\
\\
\\
\\
\\
\\\
\\

\begin{table}[ht]

\caption{Table 5.2. Thermodynamic properties and mass fraction}

\begin{center}

\begin{tabular}{|c|c|c|c|c|}

\hline

\multirow{Mass fraction, Y} &
\multicolumn{2}{c} 
%{\hspace*{-3.5mm} \hspace*{3mm} 
{Pre-chamber } \vline 
&
\multirow{CVC chamber}
%\vline 
&
\multirow{nozzle}
\\
\cline{2-3}

    &   Case 4.1 Reactive
 & Case 4.2 Inert H
 %& Case 4.3 Inert U
 \\
 \hline
He&0&0.0905&0.2152&0\\
\hline
CH_{4}&0&0&0&0.0552\\
\hline
Ar&1.21e-2&0.2248&0.4755&0\\
\hline
CO&3.40e-2&0&0&0\\
\hline
CO_{2}&1.11e-1&0&0&0\\
\hline
H&6.08e-5&0&0&0\\
\hline
H_{2}&1.01e-3&0&0&0\\
\hline
H$_{2}${O}&1.23e-1&0&0&0\\
\hline
NO&3.31e-3&0&0&0\\
\hline
N_{2}&7.08e-1&0.6847&0.3092&0.7247\\
\hline
O&2.41e-4&0&0&0\\
\hline
OH&3.64e-3&0&0&0\\
\hline
O_{2}&2.65e-3&0&0&0.2201\\
\hline
Temperature(K)&2670&2670&2670&300\\
\hline
Pressure(bar)&6&6&6&1\\
\hline
\end{tabular}

\end{center}

\label{tab:multicol}


\end{table}

第一行最后两列不显示垂直线

答案1

-命令multirow通常需要三个参数(应该跨越多少行、内容的宽度以及要打印的内容)。您还必须记住正确使用 -环境。您忘记在包含缺失垂直线的行中tabular添加两个。缺少该垂直线是因为表格在该列的该点结束。&\\

将代码更改为具有先前不起作用的表的 MWE:

\documentclass{article}

\usepackage{multirow}

\begin{document}

\begin{table}[ht]

\caption{Table 5.2. Thermodynamic properties and mass fraction}

\begin{center}

\begin{tabular}{|c|c|c|c|c|}

\hline

\multirow{2}{*}{Mass fraction, Y} & \multicolumn{2}{c}{Pre-chamber } \vline &\multirow{2}{*}{CVC chamber}&\multirow{2}{*}{nozzle} \\
\cline{2-3}
    &   Case 4.1 Reactive & Case 4.2 Inert H &&\\
\hline
He&0&0.0905&0.2152&0\\
\hline
$CH_{4}$&0&0&0&0.0552\\
\hline
Ar&1.21e-2&0.2248&0.4755&0\\
\hline
CO&3.40e-2&0&0&0\\
\hline
$CO_{2}$&1.11e-1&0&0&0\\
\hline
H&6.08e-5&0&0&0\\
\hline
$H_{2}$&1.01e-3&0&0&0\\
\hline
$H_{2}${O}&1.23e-1&0&0&0\\
\hline
NO&3.31e-3&0&0&0\\
\hline
$N_{2}$&7.08e-1&0.6847&0.3092&0.7247\\
\hline
O&2.41e-4&0&0&0\\
\hline
OH&3.64e-3&0&0&0\\
\hline
$O_{2}$&2.65e-3&0&0&0.2201\\
\hline
Temperature(K)&2670&2670&2670&300\\
\hline
Pressure(bar)&6&6&6&1\\
\hline
\end{tabular}

\end{center}

\label{tab:multicol}


\end{table}
\end{document}

电流输出: 在此处输入图片描述

答案2

虽然您的问题已修复(\multirow需要 3 个参数),但我会诚实地更改您的表格以提高其可读性。这些是我会做的更改:

  1. 删除所有垂直规则和大部分水平规则,然后切换到booktabs包。
  2. dcolumn使用该包并设置新的列类型,将小数点处的数值对齐。
  3. 如果需要,您可以添加交替灰线,以便更容易阅读行。您不会在下面的输出中看到这一点,但如果您想看到,您可以取消注释(删除它%前面的)命令%\rowcolors{3}{gray!5}{white}

我还将标题移到了表格下方,但您可以根据自己的喜好随意移动它(尽管我通常在下面看到它)。

输出

图1

代码

\documentclass{article}
\usepackage{booktabs, dcolumn}
\usepackage{multirow,array}
\usepackage{geometry}
\usepackage[table]{xcolor}

\newcolumntype{.}{D{.}{.}{-1}}

\begin{document}
\begin{table}[h!]
    \centering
    %\rowcolors{3}{gray!5}{white}
\begin{tabular}{r.*{4}{.}}
\toprule
\multirow{2}{*}{Mass fraction, Y} & \multicolumn{2}{c}{Pre-chamber} & \multicolumn{1}{c}{\multirow{2}{*}{CVC chamber}} & \multicolumn{1}{c}{\multirow{2}{*}{nozzle}} \\
 & \multicolumn{1}{c}{Case 4.1 Reactive} & \multicolumn{1}{c}{Case 4.2 Inert H} & & \\ \midrule
He & 0 & 0.0905 & 0.2152 & 0 \\
CH$_{4}$ & 0 & 0 & 0 & 0.0552 \\
Ar & 1.21e-2 & 0.2248 & 0.4755 & 0 \\
CO & 3.40e-2 & 0 & 0 & 0 \\ 
CO$_{2}$ & 1.11e-1 & 0 & 0 & 0 \\
H & 6.08e-5 & 0 & 0 & 0 \\
H$_{2}$ & 1.01e-3 & 0 & 0 & 0 \\
H$_{2}${O} & 1.23e-1 & 0 & 0 & 0 \\
NO & 3.31e-3 & 0 & 0 & 0 \\
N$_{2}$ & 7.08e-1 & 0.6847 & 0.3092 & 0.7247 \\
O & 2.41e-4 & 0 & 0 & 0 \\
OH & 3.64e-3 & 0 & 0 & 0 \\
O$_{2}$ & 2.65e-3 & 0 & 0 & 0.2201 \\
Temperature (K) & 2670 & 2670 & 2670 & 300 \\
Pressure (bar) & 6 & 6 & 6 & 1 \\ \bottomrule
\end{tabular}
\caption{Table 5.2. Thermodynamic properties and mass fraction}
\label{tab:multicol}
\end{table}
\end{document}

相关内容