Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using exam class.

I am writing an exam, and I wanted the last footnote (the final, last one to appear) to be End of Exam.

I have this:

\pagestyle{headandfoot}
\runningheadrule
\firstpageheader{AP Calculus Practice Exam A1}{ Mao Laoshi }{Senior 2}
\firstpageheadrule
\runningheader{AP Calculus Practice Exam A1}
{ Page \thepage\ of \numpages}
{Senior 2 }

\footer{}
{\iflastpage{End of exam}{Please go on to the next page\ldots}}
{}
share|improve this question
1  
It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. While solving problems is fun, setting them up is not. Then those trying to help can simply cut and paste your MWE and get started on solving problem. –  Peter Grill Nov 8 '12 at 3:10
add comment

2 Answers 2

up vote 8 down vote accepted

You can use

\iflastpage{<text 1>}{<text 2>}

inside \footer. <text 1> will be used in the last page, and <text 2> will be used in all other pages, except the last one; a simple example, now including the settings of the edited question:

\documentclass{exam}
\usepackage[paperheight=12cm]{geometry}% just for the example
\usepackage{lipsum}% just to generate filler text for the example

\pagestyle{headandfoot}
\runningheadrule
\firstpageheader{AP Calculus Practice Exam A1}{ Mao Laoshi }{Senior 2}
\firstpageheadrule
\runningheader{AP Calculus Practice Exam A1}
{Page \thepage\ of \numpages}
{Senior 2}
\footer{}
{\iflastpage{End of exam}{Please go on to the next page\ldots}}
{}

\begin{document}
\lipsum[1-7]
\end{document}

enter image description here

share|improve this answer
    
the \lipsum[1-30] do I have to know how many pages before the end? –  MaoYiyi Nov 8 '12 at 3:20
1  
@MaoYiyi no; \lipsum[30] only generates some pages with "dummy" text and you don't have to use it in your actual document; \iflastpage automatically will detect the last page. –  Gonzalo Medina Nov 8 '12 at 3:21
    
@MaoYiyi in your document all you need to add is something like \footer{} {\iflastpage{End of exam}{Please go on to the next page\ldots}} {} in the preamble. –  Gonzalo Medina Nov 8 '12 at 3:24
    
Your solutoin gave me a runaway footer issue, but answer below worked? I have none idea why. –  MaoYiyi Nov 8 '12 at 4:19
    
@MaoYiyi did you try the exact code I posted? Did you get the error with that code or with your actual code? –  Gonzalo Medina Nov 8 '12 at 4:21
show 5 more comments

One can also achieve the same result with the command \runningfooter{<text>}{<text>}{<text>}:

\runningfooter{}{\iflastpage{End of exam}{Please go on to the next page\ldots}}{Page \thepage\ of \numpages}

This allows the first page footer to be different from the rest of the pages:

\firstpagefooter{}{}{Page \thepage\ of \numpages}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.