1

I'm writing my thesis, and recently I noticed that I have a warning that I can't get rid of:

name{chapter*.2} has been referenced but does not exist, replaced by a fixed one

I created a minimal working example that you can use to reproduce the warning. I wasn't able to reduce it further since the warning seems to only occur if you use a table of contents, bibliography, hyperref and an acronym glossary at the same time. It also seems to only occur after the first compilation run of the document. Since this is my thesis I'm scared that this warning could result in some errors down the line. I would be very grateful if you could help me getting rid of this warning.

Edit: I also just noticed that after the first compilation run the acronym glossary is also missing in the table of contents. After another compilation round it appears in the table of contents.

Edit: You can find the log file contents here: https://pastebin.com/Hu8Hm3ng

MWE.tex

\documentclass[
    12pt,                                   
    DIV=12,                                 
    paper=A4,                               
    listof=totoc,                           
    parskip=half,                       
    bibliography=totoc,                     
]{scrreprt}


\usepackage[                    
    backend = biber,                                            
]{biblatex}
\addbibresource{MyBib.bib}

\usepackage[
    toc,                                        
    nomain,                                     
    acronym,                                    
    nopostdot,                              
    nonumberlist,                               
]{glossaries}

\loadglsentries{MyAcronym}
\makeglossaries                                 

\usepackage[
    bookmarks         = true,                   
    bookmarksnumbered = true,                   
    pdfpagemode       = {UseOutlines},                      
    pdfpagelabels     = true,               
]{hyperref}

\begin{document}
    
    \tableofcontents

    \chapter{Lorem Ipsum}
    This is a citation \cite{Test.2023}. This is a \acrfull{Test}
    
    \printglossary[title={Acronyms}, type=\acronymtype]

    \printbibliography
    
\end{document}

MyBib.bib

@book{Test.2023,
    author          = {Lorem Ipsum},
    year            = {2023},
    title           = {Strange Warning},
}

MyAcronym.tex

\newacronym{Test}{Test}{Test Full}
9
  • 1
    I get no warning. Is your system up-to-date? May 18, 2023 at 20:52
  • I'm using MiKTex and TeXstudio. I just updated the packages through the MiKTeX console but I'm still getting the warning.
    – mab0189
    May 18, 2023 at 21:12
  • 1
    try if it works if you load glossaries after hyperref. If not show the log-file with the warning. May 18, 2023 at 21:19
  • 1
    add another pdflatex compilation. May 18, 2023 at 22:14
  • 2
    some things need another compilation to settle down, if the warning disappears it is fine. May 18, 2023 at 22:25

1 Answer 1

4

tl;dr: Just compile with LaTeX again a couple more times to make the warning in the MWE go away.


Documents that contain cross-references and lists like a table of contents need to be compiled several times with LaTeX, because LaTeX cannot "see into the future". When the ToC is typeset LaTeX has not yet processed the chapters that are referenced there and therefore cannot know their page numbers. LaTeX resolves this by writing this information to an auxiliary file during the compile run. That file can then be read in at the beginning of the document in the next run. That way the page numbers of your chapters are available from the start of the LaTeX run and the ToC can be typeset with correct page references. Of course this only works if you run LaTeX multiple times. (For some background and more technical explanations see Understanding how references and labels work)

LaTeX has a heuristic set up that warns you in the .log file if further LaTeX runs are necessary (because new cross-references were added or because they might have changed). Always rerun LaTeX as often as required to make these messages go away. If you get a warning you don't understand it is not a bad idea to rerun and see if it goes away. If that does not help, deleting all auxiliary files (.aux, .bbl, .bcf, .toc, .acn, ...) and recompiling from scratch might also be useful at times.

If you involve various external tools like Biber and makeglossaries, things become more involved and more LaTeX runs might be required.

I would compile your example at least as follows

LaTeX, Biber, LaTeX, LaTeX, makeglossaries, LaTeX, LaTeX

It's an interesting question whether you should run Biber or makeglossaries first. If you expect the bibliography/citations to influence the list of acronyms (for example because a .bib entry could reference an acronym), you should run Biber before makeglossaries. If you expect the acronyms to influence citations (for example because the entry in the list of acronyms cites a particular .bib entry), you would run makeglossaries before Biber. In theory it's possible that both influence the other in which case you'd have to run Biber, LaTeX, LaTeX, makeglossaries, LaTeX, LaTeX, Biber, LaTeX, LaTeX.

In practice it probably makes little difference, though, because you should not delete the auxiliary files between runs and can just rerun Biber and makeglossaries periodically as you see fit.

Generally speaking compiling "too often" is not problematic. Compiling too little can be because references might not resolve properly due to missing or outdated forward data from auxiliary files.


Unfortunately, it seems that you managed to create a situation where a further LaTeX run is required, but LaTeX does not tell you so explicitly. Instead you just get the slightly cryptic warning about the reference and the ToC is off. Indeed, the following slightly reduced MWE does not even produce any rerun warning in the LaTeX run after the makeglossaries run, but it definitely needs to be compiled at least with

LaTeX, makeglossaries, LaTeX, LaTeX

for the ToC to show correctly.

\documentclass[
  listof=totoc,
  bibliography=totoc,
]{scrreprt}

\usepackage[toc,]{glossaries}

\newacronym{Test}{Test}{Test Full}
\makeglossaries

\usepackage{hyperref}

\begin{document}
  \tableofcontents

  \chapter{Lorem Ipsum}
  This is a \acrfull{Test}

  \addchap{Foo}
  Hullo

  \printglossary[title={Acronyms}, type=\acronymtype]
\end{document}

Generally speaking, I recommend running LaTeX (and Biber and makeglossaries and whatever other tools you need) a few more times even if it does not seem necessary just in case. Tools like latexmk that monitor the auxiliary files and run LaTeX and friends automatically for you might also be able to help here.

1
  • Thank you very much @moewe for this detailed answer! I've heard that LaTeX sometimes needs to be compiled multiple times. The warning worried me as I don't remember having such a warning back then with almost the same setup. Thanks to your detailed explanation I have peace of mind now.
    – mab0189
    May 19, 2023 at 9:29

You must log in to answer this question.

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