创建表格时垂直线不完整

创建表格时垂直线不完整

我的代码如下。当我在行之间留出空间时,最后一列线会分裂。我怎样才能得到一条垂直实线?请回复

\begin{table}[h!]
        \caption{\textbf{$\alpha=10; U=1; q_u=10; q^{*}=0.3; K_0=0.41; \mu_1=\mu_2=0.5; G_m=0.1$
        }}
        \begin{center}
            \begin{tabular}{|p{4cm}|p{5cm}|p{5cm}|} \hline
                    \hspace{4cm} {\textbf{Applied Pre-stress}} & \textbf{Equivalent Shear Modulus , $G_e$ , considering Confinement effect} &\textbf{Equivalent Shear Modulus , $G_e$ , without considering Confinement effect}\\ \hline
                    0 & 0.318921 & 0.32016 \\ & \\
                    0.2 & 0.932458 & 0.935286\\ & \\
                    0.4 &  1.473396 & 1.476634 \\ & \\
                    0.6 & 1.997815 & 2.003647\\ & \\
                    0.8 & 2.517339 & 2.524832\\ & \\
                    1.0 & 3.033942 & 3.043077 \\ \hline
            \end{tabular}
                    \label{t2}
        \end{center}
\end{table}

答案1

& \\不要在表格中使用换行符 ( )。

\documentclass{article}

\def\VSpace{1.0ex}%  Adjust this to what spacing you want
\begin{document}
\begin{table}[h!]
        \caption{\textbf{$\alpha=10; U=1; q_u=10; q^{*}=0.3; K_0=0.41; \mu_1=\mu_2=0.5; G_m=0.1$
        }}
        \begin{center}
            \begin{tabular}{|p{4cm}|p{5cm}|p{5cm}|} \hline
                    \hspace{4cm} {\textbf{Applied Pre-stress}} & \textbf{Equivalent Shear Modulus , $G_e$ , considering Confinement effect} &\textbf{Equivalent Shear Modulus , $G_e$ , without considering Confinement effect}\\ \hline
                    0 & 0.318921 & 0.32016 \\[\VSpace]
                    0.2 & 0.932458 & 0.935286\\[\VSpace]
                    0.4 &  1.473396 & 1.476634 \\[\VSpace]
                    0.6 & 1.997815 & 2.003647\\[\VSpace]
                    0.8 & 2.517339 & 2.524832\\[\VSpace]
                    1.0 & 3.033942 & 3.043077 \\ \hline
            \end{tabular}
                    \label{t2}
        \end{center}
\end{table}
\end{document}

答案2

如果你希望行间有更多空间,那么使用可选参数

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

\begin{table}[htb!]
\caption{\textbf{$\alpha=10; U=1; q_u=10; q^{*}=0.3; K_0=0.41; \mu_1=\mu_2=0.5; G_m=0.1$}}
                    \label{t2}
\centering
\begin{tabularx}{\linewidth}{|X|X|X|} \hline
\hspace{4cm} {\textbf{Applied Pre-stress}} & \textbf{Equivalent Shear Modulus , $G_e$ , considering Confinement effect} &\textbf{Equivalent Shear Modulus , $G_e$ , without considering Confinement effect}\\ \hline
                    0 & 0.318921 & 0.32016 \\[10pt] 
                    0.2 & 0.932458 & 0.935286\\[10pt] 
                    0.4 &  1.473396 & 1.476634 \\[10pt] 
                    0.6 & 1.997815 & 2.003647\\[10pt] 
                    0.8 & 2.517339 & 2.524832\\[10pt] 
                    1.0 & 3.033942 & 3.043077 \\ \hline
\end{tabularx}
\end{table}

\end{document}

相关内容