0

I obtain weird results when I sequentially arrange several tables with specific column widths

MWE

\documentclass[ngerman]{scrartcl}

\usepackage[german]{babel}
\usepackage{booktabs, array}
\usepackage{longtable}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}


\begin{document}
\begin{longtable}{R{139.4185pt} L{278.837pt}} %Numbers are .3333 and .6666 of \textwidth
    Bla & Bla\\
\end{longtable}

\begin{tabular}{R{139.4185pt} L{278.837pt}}
    Bla & Bla\\
\end{tabular}

\begin{tabular}{R{139.4185pt} L{278.837pt}}
    Bla & Bla\\
\end{tabular}
\begin{tabular}{R{139.4185pt} L{278.837pt}}
    Bla & Bla\\
\end{tabular}
\end{document}

This produces unwanted offset that sometimes depends on whether there is an empty line before a tabular or not. No matter where I place the longtable, the next tabular has wrong offset:

Example of wrong offsets

What's going on?

  • Add \setlength{\parindent}{0pt} To your preamble. What is happening is that each table is being placed like a paragraph hence satisfying the indentation of the document. – azetina Nov 29 '13 at 0:37
  • Isn't this somewhat counterintuitive as a default behaviour for tables? – BandGap Nov 29 '13 at 0:50
  • @BandGap tablular are inline constructs they are positioned like a letter A If you put two in the source file they come side by side if you put one at the start of a paragraph it is indented by the paragraph indent. If you want to make a vertical display out of a table normally you need something like begin{center}\begin{tabular} – David Carlisle Nov 29 '13 at 8:45
1

The effect is as a result of the default indentation of the document. Place \setlength{\parindent}{0pt} in the preamble if you want zero indentation or \noindent before each table to remove the indentation and the effect will be removed.

\documentclass[ngerman]{scrartcl}

\usepackage[german]{babel}
\usepackage{booktabs, array}
\usepackage{longtable}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\setlength{\parindent}{0pt}

\begin{document}
\begin{longtable}{R{139.4185pt} L{278.837pt}} %Numbers are .3333 and .6666 of \textwidth
    Bla & Bla\\
\end{longtable}

\begin{tabular}{R{139.4185pt} L{278.837pt}}
    Bla & Bla\\
\end{tabular}

\begin{tabular}{R{139.4185pt} L{278.837pt}}
    Bla & Bla\\
\end{tabular}
\begin{tabular}{R{139.4185pt} L{278.837pt}}
    Bla & Bla\\
\end{tabular}
\end{document}
  • Excellent, it works. I had the impression it would be easy to solve... Thanks – BandGap Nov 29 '13 at 0:41

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.