# Different (swapped) margins on first page only

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
\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}
How to do this???

\lipsum[1]

%
% Structure of first page
%
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.

\lipsum
\end{document}


EDIT:

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!

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

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}
How to do this???

\lipsum[1]

%
% Structure of first page
%
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.


• 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