3

I have a longtable that is about 14cm wide and the text width of 12 cm. Therefore I would like to widen the text width on two pages for 2 cm, toward the outer edge of the page. I have "discovered" that there are addmargin and addmargin* environments, but I just don't have a clue how to use them. I tried various combinations of parameters with no success. Any idea how to do that?

Thanks

MWE:

\documentclass[11pt]{scrbook}
\usepackage{longtable}

\usepackage[paperwidth=210mm,paperheight=255mm,top=20mm,bottom=25mm,inner=25mm,outer=65mm,marginparsep=7mm,marginparwidth=48mm,headsep=4mm,headheight=6mm]{geometry}

\begin{document}

more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more text

\begin{addmargin*}[0cm]{-2cm}
\begin{longtable}{llll}
\hline
\hline
text & text & more and more and more text & more and and more and more text \\
\hline
\endhead

\hline
\hline
\endfoot

text & text & more and more and more text & more and and more and more text \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
text & text & more and more and more text & more and and more and more text \\
\end{longtable}
\end{addmargin*}

more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more text

\end{document}enter code here
2

I've got another solution, see below. I decided not to delete my answer dated October 19, 2013, because we found out that addmargin* won't work properly with longtable and \LTleft from the longtable package doesn't help much, either.

Maybe we can solve the issue the other way round: If you can put your longtable below a heading, then you could use \newgeometry starting from this heading with 20 mm less outer margin. To hide that, put your text inside an addmargin* environment, but not the table. Then restore the former geometry.

Looks like this:

\documentclass[11pt]{scrbook}
\usepackage{longtable, blindtext}

\usepackage[paperwidth=210mm,paperheight=255mm,top=20mm,bottom=25mm,inner=25mm,outer=65mm,marginparsep=7mm,marginparwidth=48mm,headsep=4mm,headheight=6mm]{geometry}

\begin{document}

\blinddocument


\newgeometry{paperwidth=210mm,paperheight=255mm,top=20mm,bottom=25mm,inner=25mm,outer=45mm,
  marginparsep=7mm,marginparwidth=48mm,headsep=4mm,headheight=6mm}

\section{Tabulars}
\label{sec:tabulars}


\begin{addmargin*}[0cm]{2cm}
more and more and more and more and more and more and more and more
and more and more and more and more and more and more and more and
more and more and more and more and more and more and more and more
and more and more and more and more and more and more and more text
\end{addmargin*}

\begin{longtable}{llll}
\hline
\hline
text & text & more and more and more text & more and and more and more text \\
\hline
\endhead

\hline
\hline
\endfoot

text & text & more and more and more text & more and and more and more text \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
% & & a& \\
% & & a& \\
% & & a& \\
% & & a& \\
% & & a& \\
% & & a& \\
% & & a& \\
% & & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
& & a& \\
text & text & more and more and more text & more and and more and more text \\
\end{longtable}


\begin{addmargin*}[0pt]{2cm}
  more and more and more and more and more and more and more and more
  and more and more and more and more and more and more and more and
  more and more and more and more and more and more and more and more
  and more and more and more and more and more and more and more text
\end{addmargin*}

\restoregeometry

\blinddocument


\end{document}

This is not a perfect solution because of the pagebreak comming with \newgeometry and \restoregeometry, but maybe you can deal with it when you make the final layout.

  • Thanks! I'll have a look at this solution. Fortunatelly, in my case longtable is actually part of a special subsection, which consists of the longtable and two lines of text. I'll still keep the question open in case someone comes with more general solution. – Pygmalion Oct 20 '13 at 10:40
  • The problem with this solution is that it influences headers and footers. The longtable is safely within page, but header is now out of the page... :-( Also \restoregeometry is just in front of \tableofcontents, which creates one redundant empty page between. – Pygmalion Oct 20 '13 at 10:47
  • @Pygmalion KOMA-script allows manipulation of the width of the header using \KOMAoptions for the affected pages, maybe it's a bit tricky. And if the longtable is the last part of your text just before the toc, maybe you won't need \restoregeomentry here or at all. – Keks Dose Oct 20 '13 at 10:57
  • Correction: I solved the header problem simply by repeating the command \setheadwidth[0pt]{textwithmarginpar} just after \newgeometry. The problem of empty page between \restoregeometry and \tableofcontents remains! – Pygmalion Oct 20 '13 at 12:33
  • Would you update your MWE? Because if I simply trade the last \blinddocument for a \tableofcontents, there is no empty page. – Keks Dose Oct 20 '13 at 12:48
0

[[ If nothing else helps one might consider to consult the manual (you get it with »texdoc komascript« on the command line, then search for »addmargin«). However:

\begin{addmargin*}[0cm]{-2cm}
 \begin{longtable}...
  ...
 \end{longtable}
\end{addmargin*}

If it does not work, please provide a MWE. ]]

I was wrong:


Edit

My apologies. You wrote, you had no clue and I misunderstood that.

Besides that, it's not sure that addmargin and longtable, see here, maybe you understand German. Markus Kohm provided an example for a solution without addmargin, but I did not check it:

\setlength{\LTleft}{-1cm}
\begin{longtable}{|c|c|c|}
\captionabove{Beschriftung der Tabelle}\\
Dies ist der Test & Dies ist der Test & Dies ist der Test \\
Dies ist der Test & Dies ist der Test & Dies ist der Test \\
Dies ist der Test & Dies ist der Test & Dies ist der Test \\
Dies ist der Test & Dies ist der Test & Dies ist der Test \\
Dies ist der Test & Dies ist der Test & Dies ist der Test \\
Dies ist der Test & Dies ist der Test & Dies ist der Test \\
Dies ist der Test & Dies ist der Test & Dies ist der Test \\
Dies ist der Test & Dies ist der Test & Dies ist der Test \\
Dies ist der Test & Dies ist der Test & Dies ist der Test \\
\end{longtable}

I found a post (http://www.komascript.de/node/1629) where Markus more or less says that a longtable inside an addmargin environment won't work.

  • Of course I consulted the manual and first tried what you proposed above, and failed... I'll try to make a MWE then. – Pygmalion Oct 19 '13 at 19:57
  • @Pygmalion See my edits: you were right and I was wrong. – Keks Dose Oct 19 '13 at 20:10
  • The poblem with LTleft is that it translates to left on even and odd pages. It should translate to left on even pages and to right on odd pages. I speak too little German to understand this highly technical discussion. I don't see any documentation on LTleft. – Pygmalion Oct 19 '13 at 20:19
  • LTleft is part of longtable and documented in the package documentation (but it works as you say, which isn't quite what you want) – David Carlisle Oct 19 '13 at 20:23
  • @DavidCarlisle Thanks, I was searching KOMA manual :o/ – Pygmalion Oct 19 '13 at 20:24

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.