[Tex/LaTex] Longtabu total width, fixed left margin

fullwidthgeometrylongtablemarginstabu

I'm trying to make a longtabu 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, but using endhead and endfirsthead is completely ignored. So it does not help me either, because I need that.

Final possibility:
Using the geometry package does the trick, but that package adds a pagebreak when I start using it, I can't have that. It has to be directly under some text, which has a narrower textwidth.

Cheers.

I add a little example:

\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}

Best Answer

longtable lets you set the left and right margins but unfortunately the tabu wrapper around longtable always passes in an optional argument which sets the margins to 0pt or \fill depending on the lcr alignment.

So for longtabu as well as setting the margins to -1in you need to patch tabu not to default c alignment (which would reset them back to \fill).

enter image description here

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

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

\setlength\LTleft{-1in}
\setlength\LTright{-1in}
\section{This is the width I need for my longtabu}


\noindent\kern-1in X \dotfill X\kern-1in\mbox{}



\makeatletter
\g@addto@macro\tabu@setup{\def\tabu@aligndefault{x}}
\makeatother

    \begin{longtabu} to \dimexpr\linewidth+0in\relax  {*{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{document}