{Tabular} 中的表格宽度问题 & {Tabu} 中的表格列宽度调整问题

{Tabular} 中的表格宽度问题 & {Tabu} 中的表格列宽度调整问题

我正在研究一篇 Elsevier 论文,其中我必须建立一个符号表。我尝试了 {tabular} 和 {tabu} 包。但是在 Tabular 中,表格宽度超出了文本块宽度,而在 Tabu 中,表格宽度与文本宽度匹配,但我无法调整第一列以获得较小的宽度,以便另一列获得大部分空间。代码显示如下:

\documentclass[preprint, authoryear]{elsarticle}

\journal{Journal of Transportation Research, Part E}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage{textcomp}
\usepackage{siunitx}
\usepackage{amstext}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{multicol}
\setlength{\columnsep}{1cm}
\usepackage{tikz}
\usepackage{lettrine}
\allowdisplaybreaks
\usepackage[export]{adjustbox}
\usepackage{ragged2e}
\usepackage{subfig}
\usepackage{float}
\usepackage{booktabs}
\usepackage{makecell, multirow}
\usepackage{tabularx}
\usepackage{array}
\usepackage{tabu}

\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\usepackage{url}
\urlstyle{same}
\usepackage[colorlinks=true,linkcolor=black, citecolor=blue, urlcolor=blue]{hyperref}

%% `Elsevier LaTeX' style
\bibliographystyle{elsarticle-harv}
%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\section{Introduction}\label{sec: intro}
Text text Text textText textText textText textText textText text
Text textText textText textText textText text Text textText textText textText textText textText textText textText textText textText textText textText textText textText text


Text text Text textText textText textText textText textText text
Text textText textText textText textText text Text textText textText textText textText textText textText textText textText textText textText textText textText textText text

\begin{table}[H]
    \caption{Notations}
    \label{tab: DenoteTabl}
    \centering
    \begin{tabu}{|X[{l,1cm}]X[l]|}
        \hline
        \multicolumn{2}{|c|}{Sets} \\ \hline
        $N$ & Nodes within the underlying network, indexed by $i$\\
        $A$ & Arcs of train services, indexed by ${\left\langle{i,j}\right\rangle}$\\
        $G$ & Goods o, indexed by $g$  \\
        $K$ & Origin/Destination pair of orders / traffic classes, indexed by $k$  \\ 
        $R$ & Remoteness:  indexed by $r$\\
        $YT$ & CL and TR nodes, indexed by $yt$, $yt\in \{cl,tr\}$   \\ 
        $BP$ & Breaking points used in constituting intervals\\
        \hline
        \multicolumn{2}{|c|}{Sets} \\ \hline
        $N$ & Nodes within the underlying network, indexed by $i$\\
        $A$ & Arcs of train services, indexed by ${\left\langle{i,j}\right\rangle}$\\
        $G$ & Goods o, indexed by $g$  \\
        $K$ & Origin/Destination pair of orders / traffic classes, indexed by $k$vvvvvvvvvvvvvvvvvvvvvvvvvvv \\ 
        $R$ & Remoteness:  indexed by $r$\\
        $YT$ & CL and TR nodes, indexed by $yt$, $yt\in \{cl,tr\}$   \\ 
        $BP$ & Breaking points used in constituting intervals\\
        \hline
        \multicolumn{2}{|c|}{Sets} \\ \hline
        $N$ & Nodes within the underlying network, indexed by $i$\\
        $A$ & Arcs of train services, indexed by ${\left\langle{i,j}\right\rangle}$\\
        $G$ & Goods o, indexed by $g$  \\
        $K$ & Origin/Destination pair of orders / traffic classes, indexed by $k$  \\ 
        $R$ & Remoteness:  indexed by $r$\\
        $YT$ & CL and TR nodes, indexed by $yt$, $yt\in \{cl,tr\}$   \\ 
        $BP$ & Breaking points used in constituting intervals\\
        \hline
    \end{tabu}
\end{table}

Text text Text textText textText textText textText textText text
Text textText textText textText textText text Text textText textText textText textText textText textText textText textText textText textText textText textText textText text

\begin{table}[H]
    \caption{Notations}
    \label{tab: DenoteTabl}
    \centering
    \begin{tabular}{|ll|}
        \hline
        \multicolumn{2}{|c|}{Sets} \\ \hline
        $N$ & Nodes within the underlying network, indexed by $i$\\
        $A$ & Arcs of train services, indexed by ${\left\langle{i,j}\right\rangle}$\\
        $G$ & Goods o, indexed by $g$  \\
        $K$ & Origin/Destination pair of orders / traffic classes, indexed by $k$  \\ 
        $R$ & Remoteness:  indexed by $r$\\
        $YT$ & CL and TR nodes, indexed by $yt$, $yt\in \{cl,tr\}$   \\ 
        $BP$ & Breaking points used in constituting intervals\\
        \hline\multicolumn{2}{|c|}{Sets} \\ \hline
        $N$ & Nodes within the underlying network, indexed by $i$\\
        $A$ & Arcs of train services, indexed by ${\left\langle{i,j}\right\rangle}$\\
        $G$ & Goods o, indexed by $g$  \\
        $K$ & Origin/Destination pair of orders / traffic classes, indexed by $k$  vvvvvvvvvvvvvvvvvvvvvvvvvvv \\ 
        $R$ & Remoteness:  indexed by $r$\\
        $YT$ & CL and TR nodes, indexed by $yt$, $yt\in \{cl,tr\}$   \\ 
        $BP$ & Breaking points used in constituting intervals\\
        \hline\multicolumn{2}{|c|}{Sets} \\ \hline
        $N$ & Nodes within the underlying network, indexed by $i$\\
        $A$ & Arcs of train services, indexed by ${\left\langle{i,j}\right\rangle}$\\
        $G$ & Goods o, indexed by $g$  \\
        $K$ & Origin/Destination pair of orders / traffic classes, indexed by $k$  \\ 
        $R$ & Remoteness:  indexed by $r$\\
        $YT$ & CL and TR nodes, indexed by $yt$, $yt\in \{cl,tr\}$   \\ 
        $BP$ & Breaking points used in constituting intervals\\
        \hline
    \end{tabular}
\end{table}
Text text Text textText textText textText textText textText text
Text textText textText textText textText text Text textText textText textText textText textText textText textText textText textText textText textText textText textText text

Text text Text textText textText textText textText textText text
Text textText textText textText textText text Text textText textText textText textText textText textText textText textText textText textText textText textText textText text
\end{document}

此外,表格可能会变得比页面还大,我可能必须为第一页的表格添加像表 1 这样的标题,而另一页的表格则应该添加像表 1 续这样的标题。

如果您能帮助我解决上述问题(表格宽度与 {Tabular} 中的文本块匹配、{Tabu} 中的列宽调整以及具有相同名称/标签的长表格(表格 1、表格 1 续)以作为表格 1 进行交叉引用),我将不胜感激。

问候

答案1

使用包tabu代替

\centering
\begin{tabu}{|X[{l,1cm}]X[l]|}
    \hline

使用:

\tabulinesep = 3pt
\begin{tabu}to \linewidth {|r X[l]|}

在此处输入图片描述

我建议使用而不是表格tabularx

\setlength\extrarowheight{2pt}
\begin{tabularx}{\linewidth}{|r X|}
    \hline

(其他代码行相同)

在此处输入图片描述 在此处输入图片描述

相关内容