1

tl;dr: \pageref{} gives section name and other info additional to pagenumber

I want to display the page numbers in my document in a "current page / all pages" form and defined

\fancyfoot[LE,RO]{\thepage/\pageref{preLastPage}}

however, \pageref{} shows not only the page number, but also the section name and other info, so it displays: 4/122Discussionsection.6

same with other \pageref{} cases, eg when I want to refer to a part on another page:

For caption see page~\pageref{graph_abstract_caption}.

It displays: "For caption see page 33Introductionfigure.caption.10."

It seems to be a marker problem, but I did not redefine anything as far as I know. I am using

\usepackage{nameref,hyperref,lastpage,fancyhdr}

In case I did mess with markers somewhere, how do I fix it? Thanks!

Lilly
  • 11
  • 2
    Welcome to TeX.SE! Please show us a short comilable TeX code resulting in your issue.Then we do not have to guess what you are doing ... – Mensch May 27 '22 at 14:04
  • 1
    I guess this is part of my problem. I have a huge thesis with different parts and I do not know where this error is caused. When I compile from scratch just one section, the pagenumber reference is fine. If I add the next chapter, it is messed up, if I take it out again and only compile the first section, it is STILL messed up, although the previous compilation of the same part was fine. I do not understand where this problem comes from, was hoping someone has seen the problem before or has an idea based on the wrong information that is printed. – Lilly May 27 '22 at 15:14
  • That is what nameref does. If you don't want it, remove nameref from \usepackage. In itself nameref does it only with the use of \nameref but maybe your \pageref has been redefined to include some nameref stuff. If you remove nameref, you might get an error message that shows where that is done. Without your code, I'm just guessing, of course. – Pieter van Oostrum May 27 '22 at 19:28
  • @PietervanOostrum that worked! thanks a lot! – Lilly May 27 '22 at 20:15
  • @PietervanOostrum I am having the same exact problem as OP, and my setup is the same as hers (big thesis project with too many files to find an MWE), except I am only loading hyperref, not nameref. Any idea how to approach this? – Mew Apr 03 '23 at 13:56
  • @Mew, Sorry, I am on vacation now without a computer at hand, so I cannot dive into this problem. – Pieter van Oostrum Apr 03 '23 at 21:19
  • @PietervanOostrum A little update: after some pruning, I have found that I can remove this effect by commenting out either of two(!) lines: \RequirePackage[2020-02-02]{latexrelease} and \usepackage{hyperref}. I needed the former based on this thread, and hyperref is obviously necessary. Seems to be an ordinary bug. – Mew Apr 28 '23 at 14:12

0 Answers0