14

CONTEXT.

Because of specific University requirements (1), I had to use this nice code found on tex.stackexchange https://tex.stackexchange.com/a/96366/50507 written by David Carlisle, that was fitting perfectly with my needs so far.

(1) The requirements are listed on that question, please follow the link, I don't want to make a duplicate. It also explains the oneside document article.

Therefore, given the linked code, let's consider it as my Minimum Working Example :

\documentclass[oneside]{article}
\usepackage{caption}
\def\a{One two three four \stepcounter{enumi}\roman{enumi} five six. }
\def\b{\a\a\par\a\a\a Red green blue yellow black white. }
\def\c{\b\b\par\b\b\b\b\b\par\b\b\b\par\b\b\b\par\b}
\makeatletter
\def\@oddhead{ODD PAGE\hfill\thepage}

\long\def\grabfirst#1#2\@@{\toks@{#2}\xdef\insertlist{\the\toks@}#1}
\let\old@outputpage\@outputpage
\def\@outputpage{%
\ifx\insertlist\@empty
\shipout\vbox to\@colht {\vss}%
\else
\begingroup
\setbox\@outputbox\vbox to\@colht {%
\expandafter\grabfirst\insertlist\@@
}%
\def\@oddhead{\thepage(x)  \hfill EVEN PAGE}
\old@outputpage
\addtocounter{page}{-1}%
\endgroup
\fi
\old@outputpage}

\gdef\insertlist{}
\long\def\insertpic#1{\g@addto@macro\insertlist{{#1}}}

\makeatother
\begin{document}

\c
\insertpic{%
\rule{1cm}{2cm}
\captionof{figure}{a picture}}
\c
\begin{figure}[t]
this\\
is\\
a\\
t figure

\caption{zzz}
\end{figure}

\c
\begin{figure}[p]
this\\
is\\
a\\
p figure

\caption{zzz}
\end{figure}

\c
\insertpic{%
\rule{1cm}{1cm}
\captionof{figure}{a picture}}

\c
\end{document}

THE PROBLEM.

My aim is to set up different margins on recto pages and verso pages, for example :

  • on recto : left = 3cm, right = 3cm, top = 3cm, bottom = 3cm (let's say it's the default, given on the full report, except on verso when they occur)
  • on verso only (when they occur): left = 2cm, right = 2cm, top = 1.5cm, bottom = 1.5cm

The problem is that some of the pictures (and tables) are too wide for the global margin used for the entire code, thus for the verso as well.


MY QUESTION.

I don't see how I can modify the margins geometry of one side (verso) without modifying the other side (recto) and not breaking the given code. I would be most grateful if you could help me with that.


ADDITIONAL NOTE.

Please note that it was not the nature of my question - my first question was simply to use different geometry on recto and verso - the linked solution worked very fine for me so far except for these margins.

However if there is no way to set up different margin on recto and verso with this code, I would be most grateful if you could propose another solution with the same numbering requirements.

SUGGESTIONS regarding the question format?

As I didn't received any answers yet, should you have any suggestion to help me presenting better the issue that I am facing, so that I could get more easily a solution, please do not hesitate to let me know in comments. Shall I propose another bounty ? What should I do to find some hints about that topic ? Thank you again for your attention.

  • Onesided documents have no versopages. – Johannes_B Aug 19 '14 at 8:21
  • 2
    @Johannes_B : We just had the same conversation with another user (comments were deleted by both of us). Please read the university requirements given in the linked page, explaining why it's "onesided" (I had the same requirements actually). I am open to any code suggestion you may have for such requirements, I would be very pleased if you had a "cleaner" suggestions for that. Otherwise, they are still some "recto/verso" pages thanks to this code, and I am still looking for a solution =). Thanks for your understanding. – enigmator Aug 19 '14 at 8:26
  • There is no link in the question you refer to. – egreg Aug 19 '14 at 15:02
  • 1
    @egreg Requirements are written in the linked question, as written above. I don't understand from where the problem is coming from by your side. (the link again : tex.stackexchange.com/questions/96343/…). It's weird that you can't see the link of the other tex.stackexchange question, I can see it by my side. – enigmator Aug 19 '14 at 15:13
  • 1
    @enigmator I see your link and it links to the correct answer. I can't help you though. – Juri Robl Aug 20 '14 at 8:18
1

One can do this by setting margin for (recto) odd pages using geometry, for example

\usepackage[margin={3cm,4cm}]{geometry}

or

\usepackage[margin=3cm,includeheadfoot]{geometry}

and then change localy the settings of (verso) even pages by

\def\@outputpage{%
\ifx\insertlist\@empty
\shipout\vbox to\@colht {\vss}%
\else
\begingroup
\addtolength{\oddsidemargin}{-1cm}
\addtolength{\topmargin}{-1.5cm}
\addtolength{\textwidth}{2cm}
\addtolength{\@colht}{3cm}
\setbox\@outputbox\vbox to\@colht {%
\expandafter\grabfirst\insertlist\@@
}%
\def\@oddhead{\thepage(x)  \hfill EVEN PAGE}
\old@outputpage
\addtocounter{page}{-1}%
\endgroup
\fi
\old@outputpage}

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.