0

With the following example, I cannot change the first page footer.

\documentclass[addpoints]{exam}
\firstpagefooter{left}{middle}{Page \thepage\ sur \numpages}
\title{Exam}
\begin{document}
\maketitle
\begin{questions}
\question Lorem Ipsum
\end{questions}
\end{document}

It seems the \firstpagefooter or even the \footer command don't work.

What's wrong?

In my usecase, I redefine the \maketitle command:

\documentclass[addpoints]{exam}
\firstpagefooter{left}{middle}{Page \thepage\ sur \numpages}
\title{Exam}

\makeatletter
\def\@maketitle{%
  \newpage
  \null
  \begin{center}%
    {\LARGE \bfseries\@title \par}%
    \vskip 1.5em%
  \end{center}%
  \par
  \noindent\rule{\textwidth}{0.4pt}\vskip 1em
  \thispagestyle{foot}
}
\makeatother

\begin{document}
\maketitle
\begin{questions}
\question Lorem Ipsum
\end{questions}
\end{document}

enter image description here

1
  • Or replace ALL of \maketitle. Better yet, call it something else. Apr 3, 2022 at 18:44

1 Answer 1

2

The \maketitle command forces \pagestyle{plain} for this first page.

If you want to change the style, add before \begin{document}

\usepackage{xpatch}
\xpatchcmd{\maketitle}
{\thispagestyle{plain}}
{}{}{}

a

If you want to use the same footer on all subsequent pages, use

\footer{left}{middle}{Page \thepage\ sur \numpages}

instead of \firstpagefooter

To use a custom first page define a new command, like \maketitleALT

\documentclass[addpoints]{exam}
\footer{left}{middle}{Page \thepage\ sur \numpages}
\title{Exam}

\makeatletter
\newcommand{\maketitleALT}{% added <<<<<<<<<<<<<<<<<
\centering
{\LARGE \bfseries\@title \par}%
\noindent\rule{\textwidth}{0.4pt}\vskip 1em
\thispagestyle{foot}
}
\makeatother

\begin{document}
    \maketitleALT % changed <<<<<<<<<<
    \begin{questions}
        \question Lorem Ipsum
    \end{questions}
\end{document}

b

2
  • I've edited my question. In my case I redefined the \maketitle. How should I solve the issue?
    – nowox
    Apr 3, 2022 at 13:50
  • @nowox Please see the updated answer. Apr 3, 2022 at 14:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .