tikz breaks pagenumbers
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
moderncv |
New
|
Undecided
|
Unassigned |
Bug Description
The examples don't produce page numbers using pdflatex from Debian unstable, texlive texlive-latex-extra 2013.20140408-1.
Steps to reproduce:
cd moderncv
cp examples/
pdflatex template.tex && pdflatex template.tex
grep lastpage template.aux
# grep returns nothing
I expect something like:
\newlabel{
moderncv 1.40 works.
The new command \RequirePackage
grep "Package: tikz" template.log
Package: tikz 2013/12/13 v3.0.0 (rcs-revision 1.142)
Workarounds:
1) In template.tex: Add \label{lastpage} before \end{document}.
or
2) In moderncv.cls: Move \AtEndDocument{
(I have no clue about the consequences, though.)
--- moderncv-
+++ moderncv-
@@ -153,8 +153,8 @@
- \pagestyle{
- \AtEndDocument{
+ \pagestyle{
+\AtEndDocument
\pagestyle{plain}
I'm not sure if \RequirePackage {tikz} is the culprit in moderncv-1.51: 2.5-1.40. 14 (TeX Live 2013/W32TeX) (format=pdflatex 2014.2.25) 23 JUL 2015 18:28 2.6-1.40. 15 (TeX Live 2014/W32TeX) (preloaded format=pdflatex 2015.7.23) 23 JUL 2015 16:09 2.6-1.40. 16 (TeX Live 2015/W32TeX) (preloaded format=pdflatex 2015.7.23) 23 JUL 2015 19:49
I have moderncv-1.51 installed with TexLive 2013 on Windows 7, compiling with:
This is pdfTeX, Version 3.1415926-
This gives me (correctly) the pagenumber.
Compiling the same document also with moderncv-1.51 using TexLive 2014:
This is pdfTeX, Version 3.14159265-
Does not print the pagenumbers.
Compiling the same document also with moderncv-1.51 using TexLive 2015:
This is pdfTeX, Version 3.14159265-
I could figure out that the label is not added if the \label{ lastpage} }
\AtEndDocument{
is within the \begin{document}. So moving it inside the Preamble fixes the problem for TexLive 2014 and 2015. As you described it in your patch. I enhanced your patch a bit so that the label is only set when the pagenumber is wanted.
--- moderncv.cls 2015-07-23 19:23:42.487668400 +0200 1.5.1-patched. cls 2015-07-23 20:14:06.344643700 +0200 if@displaypagen umbers\ @displaypagenum berstrue {\nopagenumbers }{\@displaypage numbersfalse} numbers% r@lastpage} {}{% numbers% \label{ lastpage} } r@lastpage} {\ClassWarning{ moderncv} {LaTeX Warning: r@lastpage is undefined. Label:lastpage on last page is missing?}}{%
\ifthenelse{ \pageref{ lastpage} >1}{%
\newlength{ \pagenumberwidt h}%
\settowidth {\pagenumberwid th}{\color{ color2} \addressfont\ itshape\ strut\thepage/ \pageref{ lastpage} }%
\fancypages tyle{plain} {%
\ fancyfoot[ r]{\parbox[ b]{\pagenumberw idth}{\ color{color2} \pagenumberfont \strut\ thepage/ \pageref{ lastpage} }}}% the parbox is required to ensure alignment with a possible center footer (e.g., as in the casual style) plain}} {}}% \label{ lastpage} }\else\ fi}} plain}} {}}}%
+++ moderncv-
@@ -145,16 +145,17 @@
\newif\
\newcommand*
\AtEndPreamble{%
- \AtBeginDocument{%
- \if@displaypage
- \@ifundefined{
+ \if@displaypage
+ \AtEndDocument{
+ \AtBeginDocument{%
+ \@ifundefined{
- \pagestyle{
- \AtEndDocument{
+ \pagestyle{
+ \else\fi}
\pagestyle{plain}
% reduced list spacing