LaTeX forum ⇒ Theses, Books, Title pagesAdding back cover page on an even page. Topic is solved

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

Adding back cover page on an even page.  Topic is solved

Postby pvt » Thu Apr 09, 2015 3:32 pm

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:

  1. \newcommand*\cleartoleftpage{
  2. \clearpage\ifodd\c@page
  3. \hbox{}
  4. \vspace*{\fill}
  5. \thispagestyle{empty}
  6. \newpage
  7. \fi
  8. }


This now means the command
  1. \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

  1. \cleartoleftpage
  2.  
  3. \begingroup
  4. \thispagestyle{empty}
  5. \begin{tikzpicture}[remember picture,overlay]
  6. \node[inner sep=0pt] at (current page.center) {\includegraphics[max width=\paperwidth]{backcover}}; % Background image
  7. \end{tikzpicture}
  8. \vfill
  9. \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.

Tags:

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

Postby Stefan Kottwitz » Thu Apr 09, 2015 4:09 pm

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

Postby pvt » Thu Apr 09, 2015 4:23 pm

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: 9557
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Thu Apr 09, 2015 4:35 pm

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

Postby Lalilulelo » Tue Oct 13, 2015 12:11 am

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 :
  1. \newcommand*\cleartoleftpage{%
  2. \clearpage
  3. \ifodd\value{page}\hbox{}\newpage\fi
  4. }


I customed it with a few things you added :
  1. \newcommand*\cleartoleftpage{%
  2. \clearpage
  3. \ifodd\value{page}\hbox{}\vspace*{\fill}\thispagestyle{empty}\newpage\fi
  4. }

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: 4121
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Tue Oct 13, 2015 11:30 am

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

Postby Lalilulelo » Thu Oct 15, 2015 10:29 am

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: 4121
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Thu Oct 15, 2015 10:37 am

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.


Return to “Theses, Books, Title pages”

Who is online

Users browsing this forum: No registered users and 3 guests