1

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{\headheight}{4mm}
    \setlength{\headsep}{6mm}
    \setlength{\footskip}{9mm}
    \setlength{\marginparsep}{5mm}
    \setlength{\marginparwidth}{25mm}
    \setlength{\marginparpush}{0mm}
    %\addtolength{\textheight}{0in}
    %\addtolength{\textwidth}{0in}
    \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}
2
  • I use \leftskip=15mm \rightskip=-15mm for the abstracts. But the trick does not work for the titlepage and the toc....
    – user50260
    Apr 23, 2014 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, 2014 at 0:42

1 Answer 1

1

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}
    \addtolength{\diffmargins}{-\oddsidemargin}

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

\usepackage{ifoddpage}
\makeatletter
\renewcommand\tableofcontents{%
\thispagestyle{empty}%
    \section*{\contentsname
        \@mkboth{}
                {}}%
%    \small%
\checkoddpage
\ifoddpage
\advance\hoffset by \diffmargins
\else
\advance\hoffset by -\diffmargins
\fi
\@starttoc{toc}%
\thispagestyle{empty}%
\checkoddpage
\ifoddpage
\advance\hoffset by 2\diffmargins
\else
\advance\hoffset by -\diffmargins
\fi
}
\makeatother

then in the document

\tableofcontents

\emptypage
\emptypage

\advance\hoffset by -\diffmargins

\pagenumbering{arabic}
\normalfont
\normalsize

I believe the \newgeometry would only be used in the redefinition of the toc, not outside; so it would be simpler.

3
  • 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, 2014 at 6:47
  • Addendum: If you prepare for switching to ConTeXt you should reduce package usage and not get familiarized to it.
    – Ruben
    Apr 24, 2014 at 6:51
  • the problem is that latex applies the margins based on the number of the page, instead of being on the right or the left. It is very stupid. :D
    – user50260
    Apr 24, 2014 at 7:19

You must log in to answer this question.