0

I'm trying to put the total page number in the footer of my Lyx-doxument (a la https://tex.stackexchange.com/a/235/89786) by putting in the preamble the following

\fancyhf{}               % Clear fancy header/footer
\fancyfoot[C]{Page \thepage~of~\pageref{LastPage}}  % Page number in center footer
\makeatletter
\let\ps@plain\ps@fancy   % Plain page style = fancy page style
\makeatother

Somehow lyx only seems to do one pass of the page numbers and I get a footer (on the 5:th page) reading: "Page 5 of ??".

Any ideas?

I can add a label at the last page called LastPage, but this creates a hyperlink label as

enter image description here

which is really ugly.

3
  • Document > Settings... > PDF Properties > Hyperlinks > No frames around the links
    – Fran
    Aug 14, 2017 at 12:00
  • 1
    May be a duplicate of tex.stackexchange.com/questions/24972/… ?
    – Fran
    Aug 14, 2017 at 12:02
  • 2
    Judging by the fact that the reference works when you manually added the label, I would guess that you did not include \usepackage{lastpage}. That package will automatically define the LastPage label. Without a label, it doesn't matter how many times the document is generated, the reference will always just show ??. Aug 15, 2017 at 9:08

1 Answer 1

1

You left out one crucial thing from the code in the https://tex.stackexchange.com/a/235/89786:

\usepackage{lastpage}

This package will automatically create a label called LastPage on the last page. If you don't have that label, it doesn't matter how many times you'd run pdflatex, the cross-reference would of course never work.

As for the look of the cross-references, that can be changed in Document --> Settings, as Fran mentioned in a comment:

document settings in LyX

You must log in to answer this question.

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