# Turn advise on page in exam [duplicate]

This question already has an answer here:

I like to have a "turn page around" advise on an exam sheet because it continues. Right now, I do it manually. I need to search where the page ends and put a

\vspace*{0.5cm}
\hfill \textit{Please turn $$\hookrightarrow$$}


at the appropriate position. This is not a very neat solution, since the space needed to be adopted so that it doesn't fall onto the next page. And if I would have to do this twice or more, the vertical position should always be the same. Is there a way to achieve this automatically? Here's a minimal working example to play with.

\documentclass{minimal}
\usepackage[english]{babel}
\usepackage{blindtext}

\begin{document}

\begin{enumerate}

\blindtext[5]

\blindtext[3]

\vspace*{0.1cm}
\hfill \textit{Bitte wenden $$\hookrightarrow$$}

\blindtext[2]

\end{enumerate}

\end{document}

-

## marked as duplicate by Tobi, Thorsten, Claudio Fiandrino, Kurt, diabonasFeb 13 '13 at 18:21

The exam class offers precisely this functionality: for instance, you can write

\documentclass{exam}

\runningfooter{}{}{%
\oddeven{\iflastpage{}{\textbf{Turn over}}}{}
}


to put an instruction to turn over only on the right-hand side of double-page spreads, but not on the very last page of the document.

If you want to implement this yourself, you could look at how exam does it, but frankly it's such a useful class for this sort of thing that I would suggest you use it unless you have a pressing reason not to do so.

(Edited to add: if you do want to do this without changing your class, the only bit not in the fancyhdr package is the \iflastpage macro, which is reasonably easy to pull out:

\makeatletter
\AtEndDocument{%
\immediate\write\@mainaux
{\string\gdef\string\mydoc@lastpage{\arabic{page}}}}

\def\iflastpage#1#2{%
\@ifundefined{mydoc@lastpage}{\def\@@lastpage{-1}}%
{\edef\@@lastpage{\mydoc@lastpage}}%
\ifnum\value{page}=\@@lastpage\relax
#1%
\else
#2%
\fi
}
\makeatother


With this in your preamble you could use

\usepackage{fancyhdr}
\fancyfoot{} % clear everything
\fancyfoot[RO]{\iflastpage{}{\textbf{Turn over}}}


to get something like the effect you're after.)

-
I've tinkered my own style and it now fits my needs very well. This is one of the few things left I like to add. So the pressing reason is that I putted in too much work to throw it away now. –  DaPhil Feb 13 '13 at 14:05
Does the edited version suit better? –  Ant Feb 13 '13 at 14:21
It does, thanks a lot. –  DaPhil Feb 13 '13 at 14:29

An alternative solution using the package totpages to perform the test for the last page, but without any @-ed command. This package provides, in two runs, a count of the total number of sheets needed to print the paper, which we can use in a comparison with the current page.

\documentclass{article}

\usepackage{lipsum}
\usepackage{ifthen}
\usepackage{eso-pic} % Needed only for my lazy definition of the turn-over mark

\newcommand{\turnoverifneeded}{%
\ifthenelse{\equal{\thepage}{\TotSheets}}
{}
{Please turn around and turn the page over}% Redefine this as you wish
}

\AddToShipoutPictureBG{\AtPageLowerLeft \turnoverifneeded}% Same for this, can be replaced with a call to the fancyhdr features for example

\usepackage[pagespersheet=1]{totpages} % To be loaded last

\begin{document}

\lipsum[1-6]

\end{document}

-

If you want to shift the text to the lower right corner replace \vspace*{0.1cm} with \vfill.

There are several other methods to add som text at a fixed position, e.g. TikZ and its (current page) node.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand{\vs}{%
\tikz[remember picture,overlay]{\node at
($(current page.south east)+(-2,3)$)
[anchor=south east] {Bitte wenden!};}
}

\usepackage{lipsum}% blind text

\begin{document}
\vs
\lipsum[1-3]
\end{document}


You can place the \vs (volti subito) macro anywhere on the page and the text get’s always the same position measured from the lower right corner of your paper. But with this solution you must find the page that needs a \vs yourself, though. I don’t know the structure of your document so I can’t tell if there could be an automated version …

-
Yes. About 2 seconds after I posted I realized to do this via \vfill. I'm more interested in automatically find the position where to put the command. –  DaPhil Feb 13 '13 at 13:50
Please see my edit. –  Tobi Feb 13 '13 at 13:56