Latex 表格不显示垂直线

Latex 表格不显示垂直线

有人能告诉我为什么我的垂直线在 1 和文本的第一部分之后停止了 在此处输入图片描述

这是使用的代码:

\begin{table}[H]
    \centering
    \begin{tabular}{|c|c|c|}
    \hline
        constants&value&context\\
        \hline
        C1&1& \multirow{9}{0.8\textwidth}{These three constants are specifically designed to address the total profit objective and serve as scaling factors for the cost and revenue aspects.The first constant, C1, is set to 1 since the actual apartment values are already incorporated into the revenue equation. The remaining two constants are introduced to ensure that when the real values are plugged into the equations alongside these constants, the total sum equates to 70 million euros. In this context, C1 accounts for the revenue, while the other two constants are used to approximate both the construction time and material expenses, each approximating around 35 million euros.}
        \\\\\\
        \cline{1-2}
        C2&10\\
        \\\\
        \cline{1-2}
        C3&50\\
        \\\\
        \hline
    \end{tabular}
\end{table}

答案1

我认为您应该重新设计表格,以便当前占据右侧列的材料成为其自己的文本块。

在此处输入图片描述

\documentclass{article}
\usepackage{array}
\begin{document}

\begin{table}[htbp]
\begin{center}
    \begin{tabular}{|c|c|}
        \hline
        Constant & Value  \\ \hline
        C1 & \phantom{0}1 \\
        C2 & 10 \\
        C3 & 50 \\ \hline
    \end{tabular}
\end{center} 
These three constants are specifically designed to address the total profit objective and serve as scaling factors for the cost and revenue aspects. The first constant, C1, is set to 1 since the actual apartment values are already incorporated into the revenue equation. The remaining two constants are introduced to ensure that when the real values are plugged into the equations alongside these constants, the total sum equates to 70 million euros. In this context, C1 accounts for the revenue, while the other two constants are used to approximate both the construction time and material expenses, each approximating around 35 million euros.
\end{table}

\end{document}

答案2

对于您的表格,我将使用tblrtabularray。使用它的代码简单、简短,并能给出很好的结果:

在此处输入图片描述

\documentclass{article}
\usepackage{ragged2e}
\usepackage{tabularray}

\begin{document}
\begin{table}[htb]
    \centering
    \begin{tblr}{hlines, vlines,
                 colspec = {l l X[cmd=\RaggedRight]},
                 cell{2}{3} = {r=3}{},  % for multi row cell
                 vspan=even
                 }

constants   & value & context   \\
C1          & 1     &   These three constants are specifically designed to address the total profit objective and serve as scaling factors for the cost and revenue aspects.The first constant, C1, is set to 1 since the actual apartment values are already incorporated into the revenue equation. The remaining two constants are introduced to ensure that when the real values are plugged into the equations alongside these constants, the total sum equates to 70 million euros. In this context, C1 accounts for the revenue, while the other two constants are used to approximate both the construction time and material expenses, each approximating around 35 million euros. \\
C2          & 10    &   \\  
C3          & 50    &   \\
    \end{tblr}
\end{table}
\end{document}

评论:

  • 在表格中你可以考虑使用˙\small` 字体大小
  • 由于您没有提供有关文档的任何信息,其中的表格可能看起来有点不同(最后一列可能更宽或更短)。

相关内容