# Issue with the lengths of the margins in article class in twoside mode

Simply, put the solution to my problem is that for everything before the first section, the odd margin must be swapped with the even margin and vice versa. At the first section, everything must be normal.

The problem is that we cannot modify several times the evensidemargin and oddsidemargin.

I am in the article class with the two-side option enabled.(The document will be bound.) My oddsidemargin is not the same as the evensidemargin.

It is a requirement that the first page of the text proper be numbered by 1; I do not need to number the pages of the title page, the abstract, the toc and so on. I prefer to have the first page of the section on the left. In the MWE, the pages begin where they must in therms of left and right.

This is the details of my outline,

\documentclass[twoside,a4paper, 11pt]{article}

\newcommand{\emptypage}{\clearpage\null\thispagestyle{empty}\clearpage}

\usepackage{lipsum}

\setlength{\paperheight}{297mm}
\setlength{\paperwidth}{210mm}
\setlength{\hoffset}{-1in}
\setlength{\voffset}{-1in}
\setlength{\textheight}{252mm}
\setlength{\textwidth}{150mm}
\setlength{\evensidemargin}{40mm}
\setlength{\oddsidemargin}{25mm}
\setlength{\topmargin}{15mm}
\setlength{\footskip}{9mm}
\setlength{\marginparsep}{5mm}
\setlength{\marginparwidth}{25mm}
\setlength{\marginparpush}{0mm}
\setlength{\parindent}{0ex}
\setlength{\parskip}{1ex}
\renewcommand{\baselinestretch}{1.11}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%é

\begin{document}

\pagenumbering{roman}

\begin{titlepage}

TiTle

\end{titlepage}

\emptypage

\begin{abstract}

Summary
\end{abstract}

\clearpage

\begin{abstract}

Summary number 2
\end{abstract}

\emptypage

\tableofcontents

\clearpage
%\setcounter{page}{1}
\pagenumbering{arabic}
\normalfont
\normalsize

\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]
\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]
\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]
\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]
\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]
\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]
\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]
\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]
\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]

\section{first section}
\lipsum[11-22]

\end{document}

• I use \leftskip=15mm \rightskip=-15mm for the abstracts. But the trick does not work for the titlepage and the toc.... – user50260 Apr 23 '14 at 16:06
• I suggest you use geometry rather than specifying all of the lengths manually. Not only does this have options to automate some of what you need, it also allows you to change the page layout mid-document using \newgeometry. \cleartoevenpage may be helpful if you really want sections starting on the left rather than the right. – cfr Apr 24 '14 at 0:42

The package geometry is overkill, I believe (and I do not wish to load a lot of packages). I manage to shift the margins with

\advance\hoffset by the difference between \evensidemargin and \oddsidemargin


However, the ToC is truly a nightmare since it runs on several pages. Of course I do not have access to the mechanism and even though I can apply the aforementioned shift, it remains general and the pages on the right are not shifted by the right amount.

I wonder whether the patch command from etoolbox can be helpful along with how to whether we are in a odd or even page, or ifthenelse package, but I do not contrive a solution as my knowledge of LaTeX is very limited. Can geometry deals with the ToC easily ?

Okay so with a package ifoddpage it does work but I find the hack very ugly since it applies to the whole document instead of the toc alone)

    \newlength{\diffmargins}
\setlength\diffmargins{\evensidemargin}

\newcommand{\emptypage}{\clearpage\null\thispagestyle{empty}\clearpage}

\usepackage{ifoddpage}
\makeatletter
\renewcommand\tableofcontents{%
\thispagestyle{empty}%
\section*{\contentsname
\@mkboth{}
{}}%
%    \small%
\checkoddpage
\ifoddpage
\else
\fi
\@starttoc{toc}%
\thispagestyle{empty}%
\checkoddpage
\ifoddpage
\else
\fi
}
\makeatother


then in the document

\tableofcontents

\emptypage
\emptypage


• Most people would reasonably say that don't using geometry is overkill. Consider that with geometry you only have to specify a set of options. So, you save a lot of lines of code. Package usage remains a matter of choice, but you should not limit yourself in that way: Packages are awesome! :) From reading the OP I still don't exactly understand the issue. What I can tell is that the \newgeometry macro from geometry probably would be a good initial point. – Ruben Apr 24 '14 at 6:47