1

I have to typeset twosided document (using memoir class) with wider outer margins (designed for some remarks). The problem is, that on the first page these margins have to be swapped, i.e. iner (left) margin is wider. Unfortunately, it is not possible to manually break first page (page contains longtable), so there is no simple way to use \newgeometry (AFAIK).

Hopefully the explanation is clear, there si simple non-working MWE:

\documentclass[twoside]{memoir}
\usepackage{lipsum, filecontents}
\usepackage{pgfplotstable, csvsimple, longtable, afterpage}
\usepackage[showframe]{geometry}
\geometry{top=10cm,bottom=10cm,outer=5cm,inner=1cm}

\begin{filecontents*}{main.csv}
    tableA
    exampleA.csv
    exampleA.csv   % Added line
    exampleA.csv   % Added line
    exampleA.csv   % Added line
\end{filecontents*}

\begin{filecontents*}{exampleA.csv}
    colA
    a
    b
    c
    d
    e
    f
    g
    h
    i
    j
    k
    l
    m
    n
    o
    p
    q
\end{filecontents*}

\begin{document}
This page has to be with "swaped" margins, i.e. outer=1cm, inner=5cm.
How to do this???

\lipsum[1]

%
% Structure of first page
%
\csvreader[%
    head to column names,
    separator=semicolon]{main.csv}{}{%

  \begin{enumerate}
    \item First example \tableA
    \pgfplotstabletypeset[
        string type,
        begin table=\begin{longtable},
        end table=\end{longtable}]{\tableA}
  \end{enumerate}
}


This page (and all following from page number 2) has margins as
defined above, i.e. outer=5cm, inner=1cm.

Unfortunately this page start somwhere inside above loop...

\lipsum
\end{document}

EDIT:
Added 3 lines to main.csv.

Problem:
Proposed solution doesn't work. Updated MWE compile with errors.

After reading a lot of suggestions I still have no sulution...so I'll appreciate any help or suggestion!

Thank you in advance,

Lubos

  • i don't understand well but you can change margin, what you can't do is changing text width. – touhami Aug 22 '16 at 7:24
  • Could you be more specific, how to do this, please? (I edited my post to be more clear, hope it helps.) Thanks! – Luboš Kejzlar Aug 22 '16 at 7:54
1

Here is a solution. Using afterpage package.

Note in newgeometry outer+inner=OLDouter+OLDinner to don't change the textwidth.

\documentclass[twoside]{memoir}
\usepackage{lipsum}
\usepackage{geometry}
\geometry{top=1cm,bottom=1cm,outer=5cm,inner=1cm}
\usepackage{afterpage}

\begin{document}
\newgeometry{top=1cm,bottom=1cm,outer=1cm,inner=5cm}
\afterpage{\aftergroup\restoregeometry}
\lipsum[1-40]
\end{document} 

Update one can use

\oddsidemargin=\evensidemargin
\afterpage{\aftergroup\restoregeometry}

Example

\documentclass[twoside]{memoir}
\usepackage{lipsum, filecontents}
\usepackage{pgfplotstable, csvsimple, longtable, afterpage}
\usepackage{geometry}
\geometry{top=10cm,bottom=10cm,outer=5cm,inner=1cm}

\begin{filecontents*}{main.csv}
    tableA
    exampleA.csv
\end{filecontents*}

\begin{filecontents*}{exampleA.csv}
    colA
    a
    b
    c
    d
    e
    f
    g
    h
    i
    j
    k
    l
    m
    n
    o
    p
    q
\end{filecontents*}

\begin{document}

\oddsidemargin=\evensidemargin
\afterpage{\aftergroup\restoregeometry}
This page has to be with "swaped" margins, i.e. outer=1cm, inner=5cm.
How to do this???

\lipsum[1]

%
% Structure of first page
%
\csvreader[%
    head to column names,
    separator=semicolon]{main.csv}{}{%

  \begin{enumerate}
    \item First example \tableA
    \pgfplotstabletypeset[
        string type,
        begin table=\begin{longtable},
        end table=\end{longtable}]{\tableA}
  \end{enumerate}
}


This page (and all following from page number 2) has margins as
defined above, i.e. outer=5cm, inner=1cm.

Unfortunately this page start somwhere inside above loop...

\lipsum
\end{document}
  • Unfortunately, this doesn't work for me, probably because of more complicated structure. On the first page starts longtable environment created using pgfplotstable... Anyway thanks for suggestion! – Luboš Kejzlar Aug 22 '16 at 8:25
  • P.S. Updated MWE to better respect my actual document structure. – Luboš Kejzlar Aug 22 '16 at 8:39
  • please make sure that your code compile. it doesn't for me and add example of main.csv – touhami Aug 22 '16 at 8:43
  • MWE correctd. I'm sorry for confusion! ;( – Luboš Kejzlar Aug 22 '16 at 9:27
  • @LubošKejzlar answer updated, hope it's ok now. – touhami Aug 22 '16 at 10:27

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.