# Unwanted indentations ONLY in the first row of longtable

I have a lot longtables in my work and I figured it out that ONLY the first row of the first column is indented. It doesn't occur in the rest of rows. I saw that with another type of tables (like tabular), that are smaller, my problem doesn't occur.

I was searching how to fix it, I found this post, but the solution didn't work for me. left alignment of longtable - unwanted minimal indent

I painted the error in blue. I want the first row exactly equal than the second one.

Anyone who knows how to fixed it?

\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
\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
\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}

• Sorry I forgot to add an image of my error. I painted in blue. It's the indentation that I don't want. – Eva Aug 28 '20 at 16:41

The problem is with \label{tab:CasosDosVarHom}. You must add a % after the argument of \label (at the end of the input line). Otherwise, it produces a stray space.

\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
\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
\multicolumn{6}{l}{}\\
\endfoot
\noalign {\rule [-1.4ex]{6.7cm}{0.4pt}}
\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}


• Thanks very much!!!! – Eva Aug 28 '20 at 16:45
• Oh well spotted (+1) I thought @Eva meant the Foo row by "1st row" so I was looking in the wrong place:-) Actually it's probably safer to put the label inside the entry (eg mutirow works by accident after \label but \multicolumn would give an error. – David Carlisle Aug 28 '20 at 16:48

I would reorganize your table preamble. Mowing \label immediately after caption solve your problem:

\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
\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
\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}


Other small changes in your code make table more consistent (added lines at end of the each part of table, information that table continue on the next page, enabling table break only at begin of multirow cells).

• +1!!! Thanks so much for giving me extra advices about my code! I’m learning LaTeX and I don’t really expert at this. I need to ask you some questions about your changes: 1) How can I organize the preambule packages? I usually see people that put a lot of packages but I don't really know how many can I introduce in one bracket. 2) A4paper + hmargin = 2.5 and vmargin = 2cm are exactly the same measures that I had? Because I need my master’s thesis to have margins of 2 cm (top and bottom) and 2.5 cm (left and right). But I didn’t put nothing about A4…. – Eva Aug 29 '20 at 8:31
• 1) I didn't know that the second caption could be put with \caption[]. It is to be able to put the entire initial caption!! Omg, thank you very much, because I resigned myself to being able to fix that problem (that's why I didn't put the full title). And it also makes them bold and separate, exactly the same as the initial! Thank you. 2) I didn’t how to avoid that table didn't break in the multirow cells. Thanks so much for giving me this solution !!! I couldn't find another solution here and I'm always putting other multirow (with the cells that don't fit in the page). – Eva Aug 29 '20 at 8:32
• Dear @Eva, you are welcome! BTW, if an answer solve your problem on the best way, you can accept it (by clicking on check mark at top left side of answer). As I see, so far you not accept any from received answers :-(. – Zarko Aug 29 '20 at 10:07
• @Zarco I didn't know it, so sorry. Accepted it! – Eva Aug 29 '20 at 10:14
• @Zarco Can you explain me the two questions that I asked above? (Thanks in advance!) – Eva Aug 29 '20 at 10:16