# lastpage for french

Does someone know, why the package lastpage doesn't work for french?

\documentclass{scrbook}

\usepackage[utf8x]{inputenc}
\usepackage{ucs}
\usepackage{french}
\usepackage{helvet}
\usepackage{fancyhdr}
\usepackage{lastpage}

\fancypagestyle{mine}{ %
\fancyhf{}
\fancyfoot[LO]{\thepage\ sur \pageref{LastPage}}
}

\begin{document}
\pagestyle{mine}

\newpage

bla
\end{document}


I get the error: \clearpage undefined. \end{document}

• fancyhdr and a KOMA class is a bad idea ... but I think, you use \usepackage[french]{babel} and the appropiate fontencoding/inputencoding
– user31729
Feb 27 '17 at 15:44
• The class scrbook is the problem, the french package has nothing to do with that. Feb 27 '17 at 15:46
• Why do you use the package french instead of \usepackage[french]{babel}? Feb 27 '17 at 18:01
• @UlrikeFischer Because I need babel v3.9i for this, and I can't upgrade it due to some administrator rights.. Feb 28 '17 at 7:49

Apparently french.sty defined a patch to cope with lastpage, but a change in the latter package makes the thing break.

You can use zref, instead:

\documentclass{scrbook}

\usepackage[utf8]{inputenc}
\usepackage{french}
\usepackage{helvet}
\usepackage{fancyhdr}
\usepackage{zref-user,zref-lastpage}

\fancypagestyle{mine}{%
\fancyhf{}%
\fancyfoot[LO]{\thepage\ sur \zpageref{LastPage}}%
}

\begin{document}
\pagestyle{mine}
abc
\newpage

bla
\end{document}


Note that utf8x is not recommended nowadays. Also fancyhdr is not recommended with koma-script classes, but it still works.