0

My question is related to this question here. I also want a blank page after every page but i want it to be counted. That means I want only the oddnumbered pages to be filled with content, with the formatting of the odd numbered pages. The solution with the atbegshi package gives my the empty page but the formatting on the contentpages changes between even- and odd numbered pages (and also the pagenumber).

Or, in other words: Is there a way to pretend that every page is an odd page?

If I'm unclear please tell me. I found it hard to explain my problem.

Thanks for any help!

(The reason for all this: Bilingual book and a set documentclass)

  • Welcome to TeX.SX! – Bobyandbob Jul 12 '18 at 14:57
  • Do you really want an empty page or do you simply want to number the page with odd numbers? – Ulrike Fischer Jul 12 '18 at 15:00
  • @UlrikeFischer the doumentclass that i use has different heads for even and odd pages. So, I want to number the pages with odd numbers and apply the oddpage format of the class to it if that makes any sense. – Verdruss Jul 12 '18 at 15:03
  • You didn't answer my question. Do you really want the empty pages? – Ulrike Fischer Jul 12 '18 at 15:06
  • @UlrikeFischer Sorry. Well, no, in the end i just want to merge two pdfs somehow, one with even, one with odd pages. When I tried that worked better with empty pages but they are not necessary, no. – Verdruss Jul 12 '18 at 15:08
3

Try in the preamble

 \usepackage{atbegshi}
 \AtBeginShipout{\stepcounter{page}}
|improve this answer|||||
  • One last question: Now the table of contents has all the page numbers incremented by 1 (So something on page 4 is labeled 5 in the TOC and so on). Do you know why this could happen? – Verdruss Jul 12 '18 at 16:09
  • Yes I know what happens but I don't have the time now to build a test document and try out solutions. – Ulrike Fischer Jul 12 '18 at 16:27
1

With this, all pages are numbered either odd or even. It's done by adding a hook to the output routines, right after page counting is done. The hook is set with \AtPageCounting, adding another \setcounter{page} here. The advantage of this is, that there is no more of-by-one error.

Of course, having only odd or even page numbers will confuse the heck out of book classes, i.e. with only odd numbers there will never be an empty page before a new chapter and with only even numbers there will be an empty page before all new chapters. But with the option openany this doesn't matter anymore.

With only \AtPageCounting{\stepcounter{page}} all page numbers are odd. By adding the line \AtBeginDocument{\stepcounter{page}} all pages are even numbered.

Caution: this hook is not meant for doing any typesetting! This was not tested and will very likely lead to crazy errors!

And also, caution: there are packages/classes, which change the output routines. With those this may not work. But I tested it with the standard classes, the KomaScript classes and memoir. It works with all of them.

\documentclass[a4paper]{article}
%\documentclass[a4paper]{report}
%\documentclass[a4paper]{book}
%\documentclass[a4paper]{scrartcl}
%\documentclass[a4paper]{scrreprt}
%\documentclass[a4paper]{scrbook}
%\documentclass[a4paper,article]{memoir}
%\documentclass[a4paper]{memoir}

\usepackage{etoolbox}
\makeatletter
% the hook
\newcommand*{\at@page@counting@hook}{}

% insert hook after page counting
\patchcmd{\@outputpage}{\stepcounter{page}}{\stepcounter{page}\at@page@counting@hook}{}{%
    \GenericWarning{(preamble)\@spaces\@spaces\@spaces\@spaces}{Package preamble Warning: patching \string\@outputpage\space did not work.}}

% setting the hook
\newcommand*{\AtPageCounting}[1]{%
    \def\at@page@counting@hook{#1}%
}
\makeatother

% to step page counter by 2
\AtPageCounting{\stepcounter{page}}

% the above alone leads to only odd page number
% adding this line leads to only even page numbers
%\AtBeginDocument{\stepcounter{page}}

\usepackage{blindtext}

\begin{document}
\tableofcontents

\Blinddocument
\end{document}
|improve this answer|||||
  • This also looks pretty good, thank you. Right now i just did two different documents and Frankensteind the toc of the first one into the second one. Your solution is much cleaner, i guess :D – Verdruss Jul 16 '18 at 19:36

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.