Page LayoutStart Chapters on odd Pages in one-sided Document

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
AliceWonder
Posts: 28
Joined: Wed Oct 31, 2012 12:04 am

Start Chapters on odd Pages in one-sided Document

Post by AliceWonder »

Hello,

I'm using the standard book class. One version of the book will be printed two-sided, but there will also be a PDF version that does nice things like use the hyperref package and has color diagrams etc.

Code: Select all

\newif\ifprintdoc
\newif\ifcolor
%\printdoctrue
\ifprintdoc
  \documentclass[12pt,letterpaper,twoside]{book}
\else
  \documentclass[12pt,letterpaper,oneside]{book}
  \colortrue
\fi
...
\ifprintdoc
  \newcommand{\href}[2]{#2}
  \newcommand{\texorpdfstring}[2]{#1}
\else
  \usepackage[unicode,colorlinks,linkcolor=blue,urlcolor=blue]{hyperref}
\fi
I would very much like the page numbering to be the same with PDF and printed version. With the twoside option, LaTeX correctly always starts a chapter on an odd page, inserting a blank page if the previous chapter ended on a odd page. With oneside it doesn't.

Is there a way to tell the oneside option to behave like twoside for things like \chapter{foo} and \cleardoublepage or do I need to use twoside for the PDF version and then alter the margins somehow so the page is centered (I don't want print ready margins in the PDF)?

Thank you for suggestions.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

AliceWonder
Posts: 28
Joined: Wed Oct 31, 2012 12:04 am

Re: Start Chapters on odd Pages in one-sided Document

Post by AliceWonder »

Another option might be to increment the page number by 1 if a chapter is otherwise starting on an even numbered page. That would mean sometimes the PDF page numbering skips a page but I don't think that is so bad, that may be more tolerable than making a user scroll through blank pages.
AliceWonder
Posts: 28
Joined: Wed Oct 31, 2012 12:04 am

Start Chapters on odd Pages in one-sided Document

Post by AliceWonder »

OK. This is what I want to do after each chapter command, hopefully I can easily redefine the chapter macro to do it.

Code: Select all

\newcommand{\mutilatepages}{%
\ifodd\thepage%
\else%
\addtocounter{page}{1}%
\fi%
}
Since chapters always start on a new page if that is run directly after \chapter{foo} using \thepage should always be safe and it fixes the page numbering so PDF one-sided page numbering is identical to printed two-sided but without needing blank pages in the PDF.

I'm sure figuring out how to redefine \chapter to do that for me won't be too difficult.
AliceWonder
Posts: 28
Joined: Wed Oct 31, 2012 12:04 am

Start Chapters on odd Pages in one-sided Document

Post by AliceWonder »

My hack is broken if page numbering is not arabic. But I can fix that.

Code: Select all

\ifodd\arabic{page}
Post Reply