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

2
  • i don't understand well but you can change margin, what you can't do is changing text width.
    – touhami
    Commented Aug 22, 2016 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! Commented Aug 22, 2016 at 7:54

1 Answer 1

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}
7
  • 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! Commented Aug 22, 2016 at 8:25
  • P.S. Updated MWE to better respect my actual document structure. Commented Aug 22, 2016 at 8:39
  • please make sure that your code compile. it doesn't for me and add example of main.csv
    – touhami
    Commented Aug 22, 2016 at 8:43
  • MWE correctd. I'm sorry for confusion! ;( Commented Aug 22, 2016 at 9:27
  • @LubošKejzlar answer updated, hope it's ok now.
    – touhami
    Commented Aug 22, 2016 at 10:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .