3

Assuming I have a table going over several pages

\documentclass[DIV=8]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{booktabs,array,ragged2e,longtable}
\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash}p{#1\textwidth}}

\usepackage{enumitem}
%% Create a very compact itemized list environment
\newlist{mylist}{itemize}{1}
\setlist[mylist]{label=\textbullet, nosep, wide, 
                 leftmargin=*, % hanging indentation
                 before=\vspace{-0.50\baselineskip},
                 after =\vspace{-0.8\baselineskip}}
\begin{document}

% keep scope of longtable-related instructions local to current TeX group
\begingroup 
\setlength\tabcolsep{0pt} % <--- important
\setlength\LTleft{0pt}
\setlength\LTright{0pt}

\begin{longtable}{@{\extracolsep{\fill}}P{0.38}P{0.38}P{0.2}}

\caption{My caption} \label{my-label}\\ 
\toprule
Column 1 & Column 2 & Column 3 \\ 
\midrule
\endfirsthead

\multicolumn{3}{l}{(Table \ref{my-label}, cont'd)}\\ % re-state table number
\addlinespace
\toprule
Column 1 & Column 2 & Column 3 \\ 
\midrule
\endhead

\bottomrule
\addlinespace
\multicolumn{3}{r}{(cont'd on next page)}\\
\endfoot

\bottomrule
\endlastfoot

\begin{mylist}
     \item Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita
    \item Lorem ipsum dolor sit
    \item Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
\end{mylist} & 
\begin{mylist}
    \item Lorem ipsum dolor sit amet, consetetur sadipscing
    \item Lorem ipsum dolor sit
    \item Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
    \item Lorem ipsum
\end{mylist} & 
\begin{mylist}
    \item Lorem ipsum
    \item Lorem ipsum
\end{mylist} \\

\addlinespace

\begin{mylist}
    \item Lorem ipsum dolor sit amet, consetetur sadipscing  
    \item Lorem ipsum dolor sit
    \item Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
\end{mylist} & 
\begin{mylist}
    \item Lorem ipsum dolor sit amet, consetetur sadipscing 
    \item Lorem ipsum dolor sit
    \item Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
    \item Lorem ipsum
    \item Lorem ipsum
\end{mylist} & 
\begin{mylist}
    \item Lorem ipsum
    \item Lorem ipsum
\end{mylist} \\ 

\addlinespace

\begin{mylist}
    \item Lorem ipsum dolor sit amet, consetetur sadipscing  
    \item Lorem ipsum dolor sit
    \item Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
\end{mylist} & 
\begin{mylist}
    \item Lorem ipsum dolor sit amet, consetetur sadipscing 
    \item Lorem ipsum dolor sit
    \item Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
    \item Lorem ipsum
    \item Lorem ipsum
\end{mylist} & 
\begin{mylist}
    \item Lorem ipsum
    \item Lorem ipsum
\end{mylist} \\ 

\addlinespace

\begin{mylist}
    \item Lorem ipsum dolor sit amet, consetetur sadipscing  
    \item Lorem ipsum dolor sit
    \item Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
\end{mylist} & 
\begin{mylist}
    \item Lorem ipsum dolor sit amet, consetetur sadipscing 
    \item Lorem ipsum dolor sit
    \item Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
    \item Lorem ipsum
    \item Lorem ipsum
\end{mylist} & 
\begin{mylist}
    \item Lorem ipsum
    \item Lorem ipsum
\end{mylist} \\ 

%\addlinespace % omit if at page break

\begin{mylist}
    \item Lorem ipsum dolor sit amet, consetetur sadipscing  
    \item Lorem ipsum dolor sit
    \item Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
\end{mylist} & 
\begin{mylist}
    \item Lorem ipsum dolor sit amet, consetetur sadipscing 
    \item Lorem ipsum dolor sit
    \item Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
    \item Lorem ipsum
    \item Lorem ipsum
\end{mylist} & 
\begin{mylist}
    \item Lorem ipsum
    \item Lorem ipsum
\end{mylist} \\ 

\end{longtable}
\endgroup % end of TeX group that encases the 'longtable' material

\end{document}

Code Copy and pasted from here, thanks to Mico.

I need the table to be wider than my textwidth - in portraitmode. Using the geometry package as suggested here is unfeasable because than the table starts on a new page. I want to have it within my textflow though. Is there a way to make a longtable wider than the textiwdth?

3

Change the values of \LTleft and \LTright: for instance,

\setlength\LTleft{-40pt}
\setlength\LTright{-40pt}

enter image description here

| improve this answer | |
  • Nice and Easy. I accept this answer. Is there a quick and easy way to do that with a tabularx too? \begin{table}[ht] \begin{tabularx}{\textwidth}{@{} LLLLL @{}} %CONTENT \end{tabularx} \end{table}? Writing \begin{tabularx}{\textwidth+80pt}{@{} LLLLL @{}} does not do the trick – Stophface Feb 15 '18 at 11:01
  • For tabularx, you can use the adjustwidth environment (from changepage). In case you use \ltables (which combines longtable and tabularx), the above parameters might work, but I've never tested. – Bernard Feb 15 '18 at 11:17
  • Would using changepage not signify that the table starts on a new page and come "out of the text flow"? – Stophface Feb 15 '18 at 11:47
  • Not at all (except perhaps the automatic placement of tables by LaTeX). – Bernard Feb 15 '18 at 12:36
0

Use package xltabular with the environment of the same name:

\documentclass[DIV=8,captions=tableabove]{scrartcl}
[...]
\usepackage{booktabs,array,ragged2e,xltabular}
\newcolumntype{P}[1]{>{\RaggedRight}p{#1\textwidth}}

\usepackage{enumitem}
\newlist{mylist}{itemize}{1}
\setlist[mylist]{label=\textbullet, nosep, wide, 
    leftmargin=*, % hanging indentation
    before=\vspace{-0.50\baselineskip},
    after =\vspace{-0.8\baselineskip}}
\begin{document}

\begingroup 
\setlength\tabcolsep{2pt}       
\begin{xltabular}{\linewidth}{@{} >{\RaggedRight}X >{\RaggedRight}X P{0.22} @{} }
        \caption{My caption} \label{my-label}\\ 
        \toprule
...

enter image description here

| improve this answer | |

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.