8

I'm trying to make a longtable that is wider than the textwidth at a certain moment. I've tried different things always ending up with a different problem:

First possibility: If I use the adjustwidth environment the longtabu does not align correctly. The left margin stays fixed and the right margin gets out of the page. This in contrast, if I do the exact same thing to make a tabu (instead of longtabu), it works perfectly. I think using the adjustwidth is the best way to go, but I can't manage to get it working.

Second possibility: I've found a solution using the fullwidth package. That package does the trick on small longtables, but freezes when I'm trying to do it on my big longtable. The command \setlength\LTleft{-2cm} didn't work as well.

The final option I tried was to use geometry. But that changes the margin of the whole page thus making a page break which I'm not interested in. The code I used for this was

\newgeometry{left=1.2cm}
\begin{longtable}
long table stuff
\end{longtable}
\restoregeometry

Here's an example of what I want contra what I get

\documentclass[a4paper]{article}
\usepackage{longtable}
\usepackage{chngpage}
\usepackage{lipsum}
\usepackage{tabu}

\begin{document}
\section{This is the original textwidth.}
\lipsum[1]

\section{This is the width I need for my longtabu}
\begin{adjustwidth}{-1in}{-1in}
\begin{tabu} to \linewidth {*{13}{|X[l]} |}
01 & 02 & 03 & 04 & 05 & 06 & 07 & 08 & 09 & 10 & 11 & 12 & 13 \\
01 & 02 & 03 & 04 & 05 & 06 & 07 & 08 & 09 & 10 & 11 & 12 & 13 \\
01 & 02 & 03 & 04 & 05 & 06 & 07 & 08 & 09 & 10 & 11 & 12 & 13 \\
01 & 02 & 03 & 04 & 05 & 06 & 07 & 08 & 09 & 10 & 11 & 12 & 13 \\
\end{tabu}
\end{adjustwidth}

\section{This is what happens}
\begin{adjustwidth}{-1in}{-1in}
\begin{longtabu} to \linewidth {*{13}{|X[l]} |}
01 & 02 & 03 & 04 & 05 & 06 & 07 & 08 & 09 & 10 & 11 & 12 & 13 \\
01 & 02 & 03 & 04 & 05 & 06 & 07 & 08 & 09 & 10 & 11 & 12 & 13 \\
01 & 02 & 03 & 04 & 05 & 06 & 07 & 08 & 09 & 10 & 11 & 12 & 13 \\
01 & 02 & 03 & 04 & 05 & 06 & 07 & 08 & 09 & 10 & 11 & 12 & 13 \\
\end{longtabu}
\end{adjustwidth}

\end{document}
  • setting LTleft to be negative would work with the original longtable, do you really need the tabu fork? – David Carlisle Mar 6 '14 at 13:54
  • Arh, great, it finally worked! Thanks you. Why doesn't LTleft affect the longtabu? Also, how do I accept your answer? – user3189626 Mar 6 '14 at 14:09
15

With longtable you can do this, if tabu has broken it then that's a problem with tabu:-)

enter image description here

\documentclass[a4paper]{article}


\usepackage{longtable}
\usepackage{lipsum}



\begin{document}
\section{This is the original textwidth.}
\lipsum[1]

\section{This is the width I need for my longtabu}

\setlength\LTleft{-1in}
\setlength\LTright{-1in}
\begin{longtable}{@{\extracolsep{\fill}}*{13}{|r}|@{}}
01 & 02 & 03 & 04 & 05 & 06 & 07 & 08 & 09 & 10 & 11 & 12 & 13 \\
01 & 02 & 03 & 04 & 05 & 06 & 07 & 08 & 09 & 10 & 11 & 12 & 13 \\
01 & 02 & 03 & 04 & 05 & 06 & 07 & 08 & 09 & 10 & 11 & 12 & 13 \\
01 & 02 & 03 & 04 & 05 & 06 & 07 & 08 & 09 & 10 & 11 & 12 & 13 \\
\end{longtable}

\end{document}

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.