Page Layout ⇒ Double page: Figures on even pages, text on odd pages
Double page: Figures on even pages, text on odd pages
I guess it's possible to do in some way or another, the question is how to do it?
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
Double page: Figures on even pages, text on odd pages
It is tailored to work with a book class with the oneside option activated.
First thing first, insert a blank page between every text page automatically (or a picture if a picture is defined beforehand). Write in the preamble:
Code: Select all
\usepackage{afterpage}
\makeatletter
\newcommand\@addfig{\relax}
\newcommand\addfig[1]{\global\long\def\@addfig{#1}}
\newcommand\@putfig{\@addfig\addfig{\relax}}
\newcommand\blankpage{%
\null
\vfill
\@putfig%
\vfill
\thispagestyle{empty}% BEWARE, if you want the header and footer, you should put the correct style here
\clearpage%
\addtocounter{page}{-1}% BEWARE, if you want the left pages to be numbered, don't put this line, this is intended to have picture page with the same number as the facing text page
\afterpage{\blankpage}}
\makeatother
Code: Select all
\afterpage{\blankpage}
Code: Select all
\addfig{%
\centering
\includegraphics[scale=1]{Image1}
\caption{Test}
\label{Ima1}
}
You have to redefine \caption in order for it to work outside a float.
Very classic with that in the preamble:
Code: Select all
\makeatletter
\def\@captype{figure}
\makeatother
You will have:
- Text only on right side pages
- Images only on left side pages
- Correct list of figures (and tables as well if you tweak it a bit)
- The correct numeration of your pages if you manage the pagestyle and stepcounter correctly.
I found the most important part of the process (the blankpage macro) thanks to Danie Els on an other forum.
Double page: Figures on even pages, text on odd pages
To go further with the discussion, I would like to handle 2 additional features:
- the suppression of blank pages automaticly inserted by book,
- the possibility to switch between figure and table captions.
Code: Select all
\renewcommand\chapter{
\thispagestyle{plain}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
Code: Select all
\newcommand\switchcaption[1]{\def\@captype{#1}}
- when it is useful to use directly \def instead of \(re)newcommand (\newcommand\@captype{figure} seems to work just as well as \def\@captype{figure}),
- when it is needed to work within \makeatletter \makeatother (apparently \newcommand works differently in both cases: it "reads" the new command name with subsequent braces outside \makeatletter \makeatother and without braces otherwise),
- why \addfig definition needs to statements (one for \@addfig and another apparently for its argument).
PS: the answer by Danie Els is avaiable at http://tex.stackexchange.com/questions/ ... nly-on-rig
Double page: Figures on even pages, text on odd pages
- The blank pages were actually linked to the page break inserted by `\include` (I am writing a thesis...). Using `\input` instead solves the problem (without redefining `\chapter`). In addition, I managed to avoid blank pages at the end of the document redefining `\blankpage` to stop recursion (`\renewcommand{\blankpage}{}`).
- To define table captions (which are much less numerous than figure ones), I realised that I could use the command `\captionof` provided by the caption package I am using anyway.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Double page: Figures on even pages, text on odd pages
It would be very kind if you mention when doing a crossposting [1]*. This is only fair because it prevents others from double efforts and waste of time.Ben wrote:I finally worked out more elegant (and suitable) solutions to the above-mentionned issues.
- The blank pages were actually linked to the page break inserted by `\include` (I am writing a thesis...). Using `\input` instead solves the problem (without redefining `\chapter`). In addition, I managed to avoid blank pages at the end of the document redefining `\blankpage` to stop recursion (`\renewcommand{\blankpage}{}`).
- To define table captions (which are much less numerous than figure ones), I realised that I could use the command `\captionof` provided by the caption package I am using anyway.
The same applies to this [2]. Such behaviour is contra-productive.Martigan wrote:I found the most important part of the process (the blankpage macro) thanks to Danie Els on an other forum.
* According to the rules you are obliged to do so.
[1] {TeX} SX – Figures on left pages, text on right ones with class book (cont.)
[2] {TeX} SX – Figures on left pages, text on right ones with class book, numbering only on right pages
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10