Latex 标题未与长表模式下的表对齐

Latex 标题未与长表模式下的表对齐,latex,landscape,caption,longtable,Latex,Landscape,Caption,Longtable,在我的长表中,当我使用横向模式时,标题与表格宽度不对齐。虽然当我移除横向模式时,它很好。然而,我的桌子又宽又长,我需要将它与横向模式对齐。这是一个MWE,请帮帮我 谢谢 \documentclass{article} \usepackage{lipsum} % Just to fill some paragraph with random texts. \usepackage[margin=1in,left=1.5in,includefoot]{geometry} % Setup the mar

在我的长表中,当我使用横向模式时,标题与表格宽度不对齐。虽然当我移除横向模式时,它很好。然而,我的桌子又宽又长,我需要将它与横向模式对齐。这是一个MWE,请帮帮我

谢谢

\documentclass{article}
\usepackage{lipsum} % Just to fill some paragraph with random texts.
\usepackage[margin=1in,left=1.5in,includefoot]{geometry} % Setup the margin of the document \usepackage{float}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{tabu, colortbl}
\usepackage{array}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{lscape}
\usepackage[referable]{threeparttablex}
\usepackage{amsmath}
\usepackage{parskip}
\usepackage{xcolor}
\usepackage{setspace}

\renewcommand{\arraystretch}{1.5}
\setlength{\tabcolsep}{2pt}
\tabulinesep=1mm

\usepackage{ltcaption}
% The ltcaption package supports \CaptionLabelFont & \CaptionTextFont introduced by the NTG document classes
%\renewcommand\LTcaptype{table}
\renewcommand\CaptionLabelFont{\normalsize}
\renewcommand\CaptionTextFont{\normalsize}

\setlength{\LTcapwidth}{\textwidth} % caption width is same as table width
\setlength\LTcapskip{0.25em} % otherwise caption will skip baseline between caption and content

\renewcommand{\arraystretch}{1.5} % Insert space between table rows
\setlength{\tabcolsep} {1.3pt}
\tabulinesep = 1.2 mm

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Document begins here
\begin{document}

\begin{ThreePartTable}
\begin{landscape}
\begin{singlespace}
\begin{longtabu} to \linewidth {X[1,L]X[1,L]X[1,L]}
\noalign{\phantomsection}\caption[Feasible triples for a highly variable Grid]{Feasible triples for 
highly variable Grid, MLMMH. This is really really a long caption. This is really really a long caption. This is really really a long caption. This is really really a long caption. This is really really a long caption. This is really really a long caption. This is really really a long caption} \label{tbl} \\

\hline \multicolumn{1}{l}{\textbf{Time (s)}} & \multicolumn{1}{l}{\textbf{Triple chosen}} & \multicolumn{1}{l}{\textbf{Other feasible triples}} \\ \hline 
\endfirsthead

\multicolumn{3}{l}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline \multicolumn{1}{l}{\textbf{Time (s)}} &
\multicolumn{1}{l}{\textbf{Triple chosen}} &
\multicolumn{1}{l}{\textbf{Other feasible triples}} \\ \hline 
\endhead

\hline \multicolumn{3}{l}{{Continued on next page}} \\ \hline
\endfoot

\hline \hline
\endlastfoot

0 & (1, 11, 13725) & (1, 12, 10980), (1, 13, 8235), (2, 2, 0), (3, 1, 0) \\
2745 & (1, 12, 10980) & (1, 13, 8235), (2, 2, 0), (2, 3, 0), (3, 1, 0) \\
5490 & (1, 12, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
8235 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
10980 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
13725 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
16470 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
19215 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
21960 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
24705 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
27450 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
30195 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
32940 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
35685 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
38430 & (1, 13, 10980) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
41175 & (1, 12, 13725) & (1, 13, 10980), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
43920 & (1, 13, 10980) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
46665 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
49410 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
52155 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
54900 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
57645 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
60390 & (1, 12, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
63135 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
65880 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
68625 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
71370 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
74115 & (1, 12, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
76860 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
79605 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
82350 & (1, 12, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
85095 & (1, 12, 13725) & (1, 13, 10980), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
87840 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
90585 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
93330 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
96075 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
98820 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
101565 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
104310 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
107055 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
109800 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
112545 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
115290 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
118035 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
120780 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
123525 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
126270 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
129015 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
131760 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
134505 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
137250 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
139995 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
142740 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
145485 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
148230 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
150975 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
153720 & (1, 12, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
156465 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
159210 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
161955 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
164700 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\

\end{longtabu}
\end{singlespace}

\end{landscape}
\end{ThreePartTable}
\end{document}

以下任一修复程序:

  • 如下所示覆盖
    \LTcapwidth
    ,就像您的
    环境开始一样

    \begin{ThreePartTable}
    \begin{landscape}
    \setlength\LTcapwidth{\linewidth}
    
    ...
    
  • 或者,只需删除文档标题中
    \LTcapwidth
    \setlength
    命令即可

    % \setlength{\LTcapwidth}{\textwidth}
    
  • 产生以下结果:


    通常,对于
    横向
    模式,请使用
    \linewidth
    而不是
    \textwidth

    谢谢!你的解决方案1非常有效。我会记住关于横向模式的建议以及\linewidth而不是\textwidth的使用。你帮了大忙“dfri”:@shotgun很乐意帮忙!