1

I am using the ltxtable package to be able to set the longtable to \textwidth

I have \setlength{\parindent}{0pt}' in the preamble.

The first line of each longtable is indented, how do I get rid of that?

Example

\subsubsection*{Test}
\label{test}

\begin{filecontents}{longtab.tex}
    \begin{longtable}{p{0.5\textwidth}p{0.1\textwidth}X}
    \addtocounter{table}{-1}
     one &   & two \\
     three &   & four \\
    \end{longtable}%
\end{filecontents}
\LTXtable{\textwidth}{longtab} 
2

LaTeX tries to ignore spaces at the begin of a table cell by using \ignorespaces. But the space after \addtocounter{table}{-1} caused by the line end is not seen and therefore not ignored by the automatically added \ignorespaces. This line end can be commented out:

\documentclass[a5paper]{article}

\usepackage{ltxtable}
\usepackage{filecontents}

\begin{document}

\subsubsection*{Test}
\label{test}

\begin{filecontents}{longtab.tex}
    \begin{longtable}{p{0.5\textwidth}p{0.1\textwidth}X}
    \addtocounter{table}{-1}%
     one &   & two \\
     three &   & four \\
    \end{longtable}%
\end{filecontents}
\LTXtable{\textwidth}{longtab}

\end{document}

Result

If you do not want to have the remaining "indentation" by the horizontal space automatically added around table cells, then this can be suppressed by @{} in the table column specification. This makes sense, if there are not horizontal lines in the table:

\begin{longtable}{@{}p{0.5\textwidth}p{0.1\textwidth}X@{}}

Result

  • On the other hand, \addtocounter probably doesn't belong in the longtable. – egreg Jan 26 '14 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.