使用 LyX 时表格中的水平线不会闭合

使用 LyX 时表格中的水平线不会闭合

我正在使用 LyX 构建表格,但由于某种原因,水平线没有闭合。它看起来像这样:

糟糕的餐桌

该表的 LaTeX 代码是

% Preview source code

%% LyX 2.3.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{array}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

\makeatother

\usepackage{babel}
\begin{document}
\noindent \begin{center}
\begin{tabular*}{0.8\columnwidth}{@{\extracolsep{\fill}}|>{\centering}m{0.12\columnwidth}|>{\raggedright}m{0.48\columnwidth}|>{\centering}m{0.2\columnwidth}|}
\hline 
\textbf{Symbol} & \textbf{Meaning} & \textbf{Mathematical definition}\tabularnewline
\hline 
\hline 
$a\left(t\right)$ & Scale factor & \tabularnewline
\hline 
$\eta$ & Conformal time & $\mathop{\mathrm{d}}\eta=\mathop{\mathrm{d}}t/a\left(t\right)$\tabularnewline
\hline 
$X_{,\mu}$ & Partial derivative of $X$ w.r.t. the coordinate $x_{\mu}$ & $X_{,\mu}=\partial_{\mu}X$\tabularnewline
\hline 
$X_{|\mu}$ & Partial covariant-derivative of $X$ w.r.t. the coordinate $x_{\mu}$ & $X_{|\mu}=\nabla_{\mu}X$\tabularnewline
\hline 
$\dot{X}$ & Unless stated otherwise, partial derivative w.r.t. comoving-time & $\dot{X}=\partial X/\partial\eta$\tabularnewline
\hline 
$H$ & Cosmological expansion rate & $H=a_{,t}/a$\tabularnewline
\hline 
$\mathcal{H}$ & Cosmological comoving expansion rate & $\mathcal{H}=a_{,t}=\dot{a}/a$\tabularnewline
\hline 
$H_{0},h$ & The Hubble constant & $h=H_{0}/100$\tabularnewline
\hline 
\end{tabular*}
\par\end{center}
\end{document}

非常感谢您的帮助。

谢谢!

答案1

您对列宽的定义不一致。请尝试以下操作(表格仍然有宽度0.8\textwidth

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{array}

\providecommand{\tabularnewline}{\\}

\begin{document}
\begin{center}
\newlength\tabwidth  % <--- defined new length from which 
                     % is latter calculated widths of columns
\setlength\tabwidth{0.8\linewidth}
\begin{tabular*}{\tabwidth}{
    |>{\centering}m{\dimexpr0.2\tabwidth-2\tabcolsep-1.33\arrayrulewidth} % calculation of column width considered `\tabcolsep` and `rrayrulewidth`
    |>{\raggedright}m{\dimexpr0.5\tabwidth-2\tabcolsep-1.33\arrayrulewidth}
    |>{\centering}m{\dimexpr0.3\tabwidth-2\tabcolsep-1.33\arrayrulewidth}|}
\hline
\textbf{Symbol} & \textbf{Meaning} & \textbf{Mathematical definition}\tabularnewline
\hline
\hline
$a\left(t\right)$ & Scale factor & \tabularnewline
\hline
$\eta$ & Conformal time & $\mathop{\mathrm{d}}\eta=\mathop{\mathrm{d}}t/a\left(t\right)$\tabularnewline
\hline
$X_{,\mu}$ & Partial derivative of $X$ w.r.t. the coordinate $x_{\mu}$ & $X_{,\mu}=\partial_{\mu}X$\tabularnewline
\hline
$X_{|\mu}$ & Partial covariant-derivative of $X$ w.r.t. the coordinate $x_{\mu}$ & $X_{|\mu}=\nabla_{\mu}X$\tabularnewline
\hline
$\dot{X}$ & Unless stated otherwise, partial derivative w.r.t. comoving-time & $\dot{X}=\partial X/\partial\eta$\tabularnewline
\hline
$H$ & Cosmological expansion rate & $H=a_{,t}/a$\tabularnewline
\hline
$\mathcal{H}$ & Cosmological comoving expansion rate & $\mathcal{H}=a_{,t}=\dot{a}/a$\tabularnewline
\hline
$H_{0},h$ & The Hubble constant & $h=H_{0}/100$\tabularnewline
\hline
\end{tabular*}
\end{center}
\end{document}

这使:

在此处输入图片描述

相关内容