2

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

3
  • 1
    set \LTleft to -2cm – David Carlisle Dec 18 '17 at 18:31
  • Encasing a longtable inside a table, as "TABLE 2" does, cannot work. – Mico Dec 18 '17 at 19:39
  • Thanks! What about a \ctable? Is there any way to adjust it to the right/left at need? – Pau Dec 18 '17 at 20:16
3

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}

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.