0

I got a longtable with rows containing more or less information. I want to achieve a left alignment because of justification errors plus different lengths in row size (horizontally). My current solution results in strange behaviour. It seems as definition of newcolumtype overrides my settings in table.

How can I control both of it? Left alignment + different cell lengths?

\documentclass{article}
\usepackage{lipsum}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{array}
\newcolumntype{L}{>{\raggedleft\arraybackslash}p{1cm}}
\begin{document}
\begin{longtable}{Lp{8cm} Lp{4cm}}\toprule
 col1 & col2 \\\midrule
 \lipsum[1] & \lipsum[2]  \\ \bottomrule
\end{longtable}
\end{document}
1

You are setting up four columns in your longtable. If you want to use the L-column with an argument to set the width do it like this:

\documentclass{article}
\usepackage{lipsum}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedleft\arraybackslash}p{#1}}
\begin{document}
\begin{longtable}{L{8cm} L{4cm}}\toprule
 col1 & col2 \\\midrule
 \lipsum[1] & \lipsum[2]  \\ \bottomrule
\end{longtable}
\end{document}

enter image description here

  • Thanks a lot Ulrike! To-the-point solution! :-) – Jens Jan 7 at 14:00

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.