2

Whenever my class handouts require a second side, I add the indicator Page 2$\rightarrow$ at the bottom (flush right) to spotlight the fact that there is additional content on the flip-side. Presently, I accomplish this with a simple \vfill and \hfill. But the indicator then occupies page space. How can I most easily (preferably using native LaTeX) push this indicator into the footer (flush right) of the document?

d-cmst
  • 23,095
  • 2
    Could you add a full MWE of your handout? – Aradnix Sep 17 '14 at 18:50
  • 2
    "Native LaTeX" means no packages whatsoever? For example, is fancyhdr forbidden? – d-cmst Sep 17 '14 at 18:51
  • 2
    are you willing to specify insertion of the arrow indicator manually, or do you expect it to be triggered automatically? – barbara beeton Sep 17 '14 at 19:04
  • You could always use \raisebox. Also \makebox[\textwidth][r]{} \hspace{-\textwidth} will take up no space. – John Kormylo Sep 17 '14 at 21:34
  • Ever considered \usepackage{lastpage}\usepackage{fancyhdr}\fancyfoot[C]{\thepage/\pageref{lastpage}}? This way it displays 1/2 so that everyone knows there's another page, and you don't need to add some manual tweaks with an ugly output ;) – yo' Sep 17 '14 at 23:37
  • @tohecz I find pageslts works better than lastpage now. Also, it does not spew warnings telling me to use pageslts instead! – cfr Sep 17 '14 at 23:53
  • @tohecz I appreciate and agree with your frank assessment of my objective as a "manual tweak with an ugly output". So I installed the fancyhdr and lastpage packages, and issued the commands \usepackage{lastpage}\usepackage{fancyhdr}\fancyfoot[C]{\thepage of \pageref{lastp‌​age}}. The document compiled but nothing showed up in the footer. So I replaced the \fancyfoot command with \cfoot{\thepage\ of \pageref{pastpage}} as suggested by the fancyhdr documentation. Again, the document compiled but nothing showed up in the footer. Suggestions? – steven_nevets Sep 18 '14 at 19:04
  • @steven_nevets There can be many causes. Would you care to create a MWE, please? – yo' Sep 18 '14 at 20:10
  • @tohecz It was a problem with my package manager. I've fixed it. If you post your fancyhdr solution as an answer, I'd be happy to select it officially as my accepted answer. Thanks again. – steven_nevets Sep 18 '14 at 21:08

3 Answers3

1

I would prefer a standard solution with Page 1 of 2, like this:

\documentclass{article}

\usepackage{fancyhdr}
\usepackage{lastpage}
\fancyfoot[C]{Page \thepage\@ of \pageref{LastPage}}
\pagestyle{fancy}

\usepackage{lipsum}

\begin{document}

\lipsum[1-20]

\end{document}

Don't forget to compile multiple times.

yo'
  • 51,322
0

Based on my answer at What are the ways to position things absolutely on the page?

\documentclass{article}
\usepackage{everypage}
\usepackage{xcolor}
\usepackage{lipsum}
% THESE ARE LaTeX DEFAULTS; CAN CHANGE IF NEEDED.
\def\PageTopMargin{1in}
\def\PageLeftMargin{1in}
\newcommand\atxy[3]{%
 \AddThispageHook{\smash{\hspace*{\dimexpr-\PageLeftMargin-\hoffset+#1\relax}%
  \raisebox{\dimexpr\PageTopMargin+\voffset-#2\relax}{\textcolor{red}{#3}}}}}
% VERIFIED THAT SETTING \hoffset AND \voffset DO NOT BREAK SOLUTION.
%\hoffset=0.4in
%\voffset=0.2in
\begin{document}
\atxy{\dimexpr\hoffset+\PageLeftMargin+\oddsidemargin+\textwidth}{10in}{%
  \makebox[0pt][r]{\LARGE Page 2$\rightarrow$}}
\lipsum[1-7]
\end{document}

enter image description here

0

Here are two attempts. I think you need to use the twoside option, which may affect your margin settings. The first def has the desired feature only on page 1. The second version is simpler, but will have the feature for all odd pages, and doesn't check if the final page has an even number, so it's really only 'guaranteed' for a two page doc.

\documentclass[twoside]{article}

\makeatletter%
\def\myfoot{%
\let\@oddhead\@empty%
\def\@oddfoot{\ifnum\value{page}=1\reset@font\hfill\thepage\hfill%
\makebox[0pt][l]{Page \the\numexpr(\value{page}+1)$\to$}%
\else {\reset@font\hfil\thepage\hfil}\fi}%
\let\@evenhead\@empty%
\def\@evenfoot{\reset@font\hfil\thepage\hfil}}%
\makeatother

\begin{document}
Hello.
\myfoot
\end{document}

Second def.

\makeatletter%
\def\myfoot{%
\let\@oddhead\@empty%
\def\@oddfoot{ \reset@font\hfill\thepage\hfill%
\makebox[0pt][l]{Page \the\numexpr(\value{page}+1)$\to$}%
\let\@evenhead\@empty%
\def\@evenfoot{\reset@font\hfil\thepage\hfil}}}%
\makeatother
corporal
  • 741