[Tex/LaTex] How to adjust the margin width in a longtable

changepagelongtablemarginstables

I am typesetting a document with quite narrow margins. When I have to input a table, I use \begin{adjustwidth} from the changepage package, to make it stand out on the right side.

In the MWE below, I use tabularx to typeset table 1, increase a 20% the allowed textwidth, and increase the same amount in cm from the left margin.

However, I have a really long table that will span for 2 pages, and I have to use the longtable package to typeset it, but the adjustwidth trick does not work with this table (table 2).

Any ideas how to do it? I have tried using the ltxpackage, which allows to use the X column specifier on longtables, but I obtained the same result.

Here is the MWE:

\documentclass[11pt]{book}

\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{tabularx, longtable, ctable, changepage, geometry}

\geometry{
    paper=a4paper, % Change to letterpaper for US letter
    inner=3.5cm, % Inner margin
    outer=4.8cm, % Outer margin
    bindingoffset=.5cm, % Binding offset
    top=1.5cm, % Top margin
    bottom=1.5cm, % Bottom margin
    marginpar=3.8cm,
    %showframe, % Uncomment to show how the type block is set on the page
}

\begin{document}
\blindtext\\

TABLE 1

\begin{table}[htb]
    \begin{adjustwidth}{-2.361474cm}{0cm}
    \begin{tabularx}{1.2\textwidth}{r>{\raggedright}X>{\raggedright}X} \FL
        a & b & c \ML
        a & b & c \NN
        a & b & c \LL
    \end{tabularx}
    \end{adjustwidth}
\end{table}

TABLE 2

\begin{table}[htb]
    \begin{adjustwidth}{-2.361474cm}{0cm}
    \begin{longtable}{p{1.5cm}p{2.5cm}p{2.5cm}p{2cm}p{1.5cm}p{1.5cm}p{1.5cm}} 
        \multicolumn{7}{l}{Table continued} \\
        \endhead
        \\
        a &     b & c & d & e & f & g \ML
        \endfirsthead
        \multicolumn{7}{r}{\textit{(continued on the next page)}}
        \endfoot
        a &     b & c & d & e & f & g \NN
        a &     b & c & d & e & f & g \LL
    \end{longtable}
\end{adjustwidth}   
\end{table}

\end{document}

Many thanks

Best Answer

enter image description here

\documentclass[11pt]{book}

\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{tabularx, longtable, ctable, changepage, geometry}

\geometry{
    paper=a4paper, % Change to letterpaper for US letter
    inner=3.5cm, % Inner margin
    outer=4.8cm, % Outer margin
    bindingoffset=.5cm, % Binding offset
    top=1.5cm, % Top margin
    bottom=1.5cm, % Bottom margin
    marginpar=3.8cm,
    showframe, % Uncomment to show how the type block is set on the page
}

\begin{document}
\blindtext% never put \\ at the end of a paragraph


% never put longtable in a table\begin{table}[htb]
%    \begin{adjustwidth}{-2.361474cm}{0cm}
\setlength\LTleft{-2.5cm}% 2.5cm into the left margin
\setlength\LTright{0pt plus 1fill minus 1fill}% whatever is needed at the right
    \begin{longtable}{p{1.5cm}p{2.5cm}p{2.5cm}p{2cm}p{1.5cm}p{1.5cm}p{1.5cm}} 
        \multicolumn{7}{l}{Table continued} \\
        \endhead
        \\
        a &     b & c & d & e & f & g \ML
        \endfirsthead
        \multicolumn{7}{r}{\textit{(continued on the next page)}}
        \endfoot
        a &     b & c & d & e & f & g \NN
        a &     b & c & d & e & f & g \LL
    \end{longtable}
%\end{adjustwidth}   
%\end{table}

\end{document}