Theses, Books, Title pagesAdding back cover page on an even page.

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
Post Reply
pvt
Posts: 2
Joined: Thu Apr 09, 2015 3:09 pm

Adding back cover page on an even page.

Post by pvt »

Hi community members!

I discovered this beautiful template and I'm now using it to produce some manuals. Thank you authors :)
(The Legrand Orange Book template)

I came across the need to have one last page which is the back cover page and it needed to be on an even page. So I added the following to the structure.tex:

Code: Select all

\newcommand*\cleartoleftpage{
\clearpage\ifodd\c@page
\hbox{}
\vspace*{\fill}
\thispagestyle{empty}
\newpage
\fi
}
This now means the command

Code: Select all

\cleartoleftpage
can be used to guarantee the back cover lands on an even page. As an example, just before the \end{document} in main.tex

Code: Select all

\cleartoleftpage

\begingroup
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
		\node[inner sep=0pt] at (current page.center) {\includegraphics[max width=\paperwidth]{backcover}}; % Background image
\end{tikzpicture}
\vfill
\endgroup
I hope it helps someone.

BR,
PVT
Last edited by pvt on Thu Apr 09, 2015 4:21 pm, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Re: Adding back cover page on an even page.

Post by Stefan Kottwitz »

Hi PVT,

welcome to the forum!

Thank you for sharing this code! It can be helpful.

Btw. it would be great if you would also mention the template name. As I wrote in the announcement post at the top of the forum topic list, "Template information". ;-)
Though your tip is generally useful for book-like documents.

Stefan
LaTeX.org admin
pvt
Posts: 2
Joined: Thu Apr 09, 2015 3:09 pm

Re: Adding back cover page on an even page.

Post by pvt »

Hi Stefan,

I suppose you mean tagging appropriately. (I had thought) I did it, but something went wrong. Fixed! ;)

BR,
PVT
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Re: Adding back cover page on an even page.

Post by Stefan Kottwitz »

Great, tagging is even better! I did not dare to speak of it after the very first post. :D
I see that you are an experienced LaTeX user and you like to share your solutions. I hope to see you again here! :mrgreen:

Stefan
LaTeX.org admin
Lalilulelo
Posts: 2
Joined: Tue Oct 13, 2015 12:00 am

Adding back cover page on an even page.

Post by Lalilulelo »

Hi LaTeX world :)

Your command was very helpful, but did not work for me. Here is the error message I get (my file is called backcover.tex):
(./backcover.tex
! Missing number, treated as zero.
<to be read again>
\unhbox
l.3 \cleartoleftpage
I found an other version of \cleartoleftpage here :

Code: Select all

\newcommand*\cleartoleftpage{%
  \clearpage
  \ifodd\value{page}\hbox{}\newpage\fi
}
I customed it with a few things you added :

Code: Select all

\newcommand*\cleartoleftpage{%
  \clearpage
  \ifodd\value{page}\hbox{}\vspace*{\fill}\thispagestyle{empty}\newpage\fi
}
The \vspace*{\fill}\thispagestyle{empty} allows to have an empty header on the last odd page.

The main difference between your code and the other version seems to be the \value{page} and \c@page. I don't know why :?:

But it finally gives me exactly what I wanted : the final page of my document on an even page with a blank page before.

Awesome !
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Adding back cover page on an even page.

Post by Johannes_B »

Your code, or more precisely the code of Martin, uses a higher level of coding, whereas the code in the OP above uses internals that should be used by advanced users only.
The essential thing missing is the catcode change from @ to a letter. Please see What do makeatletter and makeatother do?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Lalilulelo
Posts: 2
Joined: Tue Oct 13, 2015 12:00 am

Re: Adding back cover page on an even page.

Post by Lalilulelo »

I learned something today :) Thanks !
Also if I add \makeatletter or \makeatother in the command of the OP, it will work? Don't really know which one to use (can't test either right know, that's why I ask).
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Adding back cover page on an even page.

Post by Johannes_B »

Yes, it should work, but i haven't tested.
Functionally, both versions should do the same, they use the same way of doing it. But the version of the OP above uses low-level commands, that aren't allowed in regular documents (low-level) and have to be made available using the @-hackery.

Better do the second approach. People do all kinds of crazy stuff they found on the internet without understanding the solution, leading to much more confusion at the very end.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Fakhra
Posts: 1
Joined: Fri Jun 18, 2021 5:54 pm

Adding back cover page on an even page.

Post by Fakhra »

How can I add spine in the same template?
Post Reply