不需要的縮排僅出現在長表的第一行

不需要的縮排僅出現在長表的第一行

我的工作中有很多長表,我發現只有第一列的第一行是縮排的。它不會出現在其餘行中。我看到使用另一種類型的表格(例如表格),較小,我的問題不會發生。

我正在尋找如何修復它,我找到了這篇文章,但該解決方案對我不起作用。 longtable 左對齊 - 不需要的最小縮進

我把錯誤畫成了藍色。我希望第一行與第二行完全相等。 問題

誰知道如何修復它?

首先十分感謝。

\documentclass[a4paper]{article}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{lipsum}  
\usepackage{booktabs,threeparttablex}
\usepackage{etoolbox}
\appto\TPTnoteSettings{\footnotesize}
\usepackage{caption}
\usepackage[labelfont=bf,labelsep=period]{caption} 
\usepackage{array}
\usepackage[lmargin=2.5cm, rmargin=2.5cm, top=2cm, bottom=2cm]{geometry} 

\begin{document}

\lipsum[2-6]

\begin{ThreePartTable}
\renewcommand\TPTminimum{\textwidth}
\setlength\LTleft{0pt}
\begin{TableNotes}[flushleft] 
    \footnotesize 
    \item[*] Footnote1
\end{TableNotes}

\begin{longtable}{| m{1.7cm} | m{2.1cm}| m{1.4cm}| m{2cm}| m{4.4cm}| m{1.7cm}|}
\caption{\textit{\textbf{It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout}}} \\
\hline
\textbf{Foo} & \textbf{Foo} & \textbf{Foo} & \textbf{Foo} & \textbf{Foo (Foo)} & \textbf{Foo\tnote{*}} \\ 
\hline
\endfirsthead
\multicolumn{6}{l}{\tablename\ \thetable:
\textit{It is a long established fact that a reader }(Cont\ldots)}\\
\hline
\textbf{Foo} & \textbf{Foo} & \textbf{Foo} & \textbf{Foo} & \textbf{Foo (Foo} & \textbf{Foo} \\ 
\hline
\endhead
\multicolumn{6}{l}{}\\
\endfoot
\noalign {\rule [-1.4ex]{6.7cm}{0.4pt}}
\insertTableNotes
\endlastfoot
\label{tab:CasosDosVarHom}
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\ 
                        & Foo & 6 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 4 & Foo & Foooo (0.001) & F \\ 
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\ 
                        & Foo & 6 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 4 & Foo & Foooo (0.001) & F \\ 
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\ 
                        & Foo & 6 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 4 & Foo & Foooo (0.001) & F \\ 
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\ 
                        & Foo & 6 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 4 & Foo & Foooo (0.001) & F \\ 
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\ 
                        & Foo & 6 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 4 & Foo & Foooo (0.001) & F \\ 
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\ 
                        & Foo & 6 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 4 & Foo & Foooo (0.001) & F \\ 
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\ 
                        & Foo & 6 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 4 & Foo & Foooo (0.001) & F \\ 
\hline
\end{longtable}
\end{ThreePartTable}

\end{document}

答案1

問題在於\label{tab:CasosDosVarHom}.您必須在(輸入行末尾)%的參數後面新增。\label否則,它會產生雜散空間。

行尾的百分號 (%) 有什麼用? (為什麼我的巨集會創造額外的空間?)

\documentclass[a4paper]{article}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{lipsum}  
\usepackage{booktabs,threeparttablex}
\usepackage{etoolbox}
\appto\TPTnoteSettings{\footnotesize}
\usepackage{caption}
\usepackage[labelfont=bf,labelsep=period]{caption} 
\usepackage{array}
\usepackage[lmargin=2.5cm, rmargin=2.5cm, top=2cm, bottom=2cm]{geometry} 

\begin{document}

\lipsum[2-6]

\begin{ThreePartTable}
\renewcommand\TPTminimum{\textwidth}
\setlength\LTleft{0pt}
\begin{TableNotes}[flushleft] 
    \footnotesize 
    \item[*] Footnote1
\end{TableNotes}

\begin{longtable}{| m{1.7cm} | m{2.1cm}| m{1.4cm}| m{2cm}| m{4.4cm}| m{1.7cm}|}
\caption{\textit{\textbf{It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout}}} \\
\hline
\textbf{Foo} & \textbf{Foo} & \textbf{Foo} & \textbf{Foo} & \textbf{Foo (Foo)} & \textbf{Foo\tnote{*}} \\ 
\hline
\endfirsthead
\multicolumn{6}{l}{\tablename\ \thetable:
\textit{It is a long established fact that a reader }(Cont\ldots)}\\
\hline
\textbf{Foo} & \textbf{Foo} & \textbf{Foo} & \textbf{Foo} & \textbf{Foo (Foo} & \textbf{Foo} \\ 
\hline
\endhead
\multicolumn{6}{l}{}\\
\endfoot
\noalign {\rule [-1.4ex]{6.7cm}{0.4pt}}
\insertTableNotes
\endlastfoot
\label{tab:CasosDosVarHom}% <--ADD PERCENT HERE!!
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\ 
                        & Foo & 6 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 4 & Foo & Foooo (0.001) & F \\ 
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\ 
                        & Foo & 6 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 4 & Foo & Foooo (0.001) & F \\ 
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\ 
                        & Foo & 6 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 4 & Foo & Foooo (0.001) & F \\ 
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\ 
                        & Foo & 6 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 4 & Foo & Foooo (0.001) & F \\ 
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\ 
                        & Foo & 6 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 4 & Foo & Foooo (0.001) & F \\ 
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\ 
                        & Foo & 6 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 4 & Foo & Foooo (0.001) & F \\ 
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\ 
                        & Foo & 6 & Foo & Foooo (0.001) & F \\ 
                        & Foo & 4 & Foo & Foooo (0.001) & F \\ 
\hline
\end{longtable}
\end{ThreePartTable}

\end{document}

在此輸入影像描述

答案2

我會重新整理你的表序言。\label標題後立即割草可以解決您的問題:

\documentclass[a4paper]{article}
\usepackage[hmargin=2.5cm, vmargin=2cm]{geometry}
\usepackage{array, booktabs,
            longtable, multirow,
            threeparttablex}
\usepackage{etoolbox}
\appto\TPTnoteSettings{\footnotesize}
\usepackage{caption}
\usepackage[labelfont=bf,labelsep=period,
            textfont={it,bf}]{caption}
\usepackage{lipsum}

\begin{document}

\lipsum[2-6]

    \begin{ThreePartTable}
\renewcommand\TPTminimum{\textwidth}
\setlength\LTleft{0pt}
\begin{TableNotes}[flushleft]
    \footnotesize
    \item[*] Footnote1
\end{TableNotes}

\begin{longtable}{| m{1.7cm} | m{2.1cm}| m{1.4cm}| m{2cm}| m{4.4cm}| m{1.7cm}|}
\caption{It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout}
\label{tab:CasosDosVarHom}  \\  % <---
    \hline
\textbf{Foo}    & \textbf{Foo}  & \textbf{Foo}      
                & \textbf{Foo}  & \textbf{Foo (Foo)}    & \textbf{Foo\tnote{*}} \\
    \hline
\endfirsthead
\caption[]{It is a long established fact that a reader \dots (Cont.)}           \\
    \hline
\textbf{Foo}    & \textbf{Foo}  & \textbf{Foo}
                & \textbf{Foo}  & \textbf{Foo (Foo)}    & \textbf{Foo}          \\
    \hline
\endhead
    \hline
    \multicolumn{6}{r}{\footnotesize\textit{Continue on the next page}}         \\
\endfoot
    \hline
\insertTableNotes
\endlastfoot
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001)  & F \\*
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\*
                        & Foo & 6 & Foo & Foooo (0.001)  & F \\*
                        & Foo & 4 & Foo & Foooo (0.001)  & F \\
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001)  & F \\*
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\*
                        & Foo & 6 & Foo & Foooo (0.001)  & F \\*
                        & Foo & 4 & Foo & Foooo (0.001)  & F \\
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001)  & F \\*
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\*
                        & Foo & 6 & Foo & Foooo (0.001)  & F \\*
                        & Foo & 4 & Foo & Foooo (0.001)  & F \\
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001)  & F \\*
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\*
                        & Foo & 6 & Foo & Foooo (0.001)  & F \\*
                        & Foo & 4 & Foo & Foooo (0.001)  & F \\
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001)  & F \\*
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\*
                        & Foo & 6 & Foo & Foooo (0.001)  & F \\*
                        & Foo & 4 & Foo & Foooo (0.001)  & F \\
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001)  & F \\*
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\*
                        & Foo & 6 & Foo & Foooo (0.001)  & F \\*
                        & Foo & 4 & Foo & Foooo (0.001)  & F \\
\hline
\multirow{4}{*}{10-343} & Foo & 2 & Foo & Foooo (0.001)  & F \\*
                        & Foo & 1 & Foo & Fooooo (0.001) & F \\*
                        & Foo & 6 & Foo & Foooo (0.001)  & F \\*
                        & Foo & 4 & Foo & Foooo (0.001)  & F \\
\hline
\end{longtable}
    \end{ThreePartTable}
\end{document}

程式碼中的其他小更改使表格更加一致(在表格每個部分的末尾添加了行,表格在下一頁上繼續的信息,僅在multirow單元格開頭啟用表格中斷)。

在此輸入影像描述

在此輸入影像描述

相關內容