My project has several tex files (a main one and one for each chapter). Each chapter has subdivisions (section, subsection). I make many cross-references using \label and \ref. So far I have been manually keeping track of which [sub]section points to which other chapter/[sub]section.

Is there a program (or even a second tex file that I could compile) that reads all the tex files and provides me with a "map" (it can of course be textual rather than graphic) of these cross-references?

  • 2
    not one I'm aware of but as long as all your labels and references are written explicitly like \ref{...} it shouldn't be too hard to just write a program to parse your TeX files and handle it.
    – user202729
    Commented Apr 11, 2023 at 18:05
  • 3
    It would be even easier to parse the aux file.
    – Teepeemm
    Commented Apr 11, 2023 at 18:06
  • 1
    If you‘d use package varioref, expanding \vref can print e.g „see figure 123 on page 321“. It‘s not a map, but perhaps useful?
    – MS-SPO
    Commented Apr 11, 2023 at 18:14
  • 2
    To follow that up, why do you want this information? Is it solely personal curiosity, and the format doesn't really matter that much? Is it so that you can show other people "here's the important chapter/[sub]section"? Are you losing track of what your label keys are, and need the showlabel package? And what is your operating system?
    – Teepeemm
    Commented Apr 11, 2023 at 18:20
  • 2
    You don't need an external program, during the compilation LaTeX sees all \label and \ref commands and it would easy to extend them e.g. to write to an extra file or to store everything in some command. You only need to decide how you want to represent the data. Commented Apr 11, 2023 at 20:43

1 Answer 1


An idea using todonotes just thinking in sections, but probably can be adapated as well to check cross references to floats without many problems.


% need at least two runs !!
\usepackage{lipsum} % for dummy text 
\usepackage[colorinlistoftodos, size=tiny]{todonotes} 
% add "disable" to hide cross-references ! 
\setuptodonotes{fancyline, color=blue!30,shadow}
\def\myref#1{\todo{Reference to \ref{#1} 
\nameref{#1} (label \texttt{#1})  in \currentname}\ref{#1}}
\def\mylabel#1{\todo[color=red!30]{Label \texttt{#1} in \currentname}\label{#1}}


% in real documents, better at the end: 

\listoftodos[Cross References and Labels] 

\lipsum[1][1-3] See in \myref{bar}. 
\lipsum[2][1-3] See \myref{ssbar}.  
\subsection{Economic Impact}
\mylabel{sfoo}\lipsum[1-5] See section \myref{foo}
\mylabel{bar}\lipsum[1-5] See section \myref{foo} 

  • +1 Nice approach
    – MS-SPO
    Commented Apr 12, 2023 at 8:04
  • Nicely done! :)
    – cmhughes
    Commented Apr 12, 2023 at 16:19
  • Yes, that \listoftodos command is exactly the kind of thing I'd want! Except I really don't want the todos themselves - I'll check out a way to have that Commented Apr 12, 2023 at 19:29
  • 1
    You can hide all the todos, including the list, just adding the disable option, so there is not a problem dozen or todo notes to obtain a clean final versión in seconds. If you really need the list but hiding the notes in text, one dirty trick could be make the notes completely white with the command options (noline, color=white, textcolor=white, bordercolor=white) and the links too ... but why for only a draft version?
    – Fran
    Commented Apr 12, 2023 at 21:06
  • Aahhh perfect, thanks for the dirty trick, that's exactly it. Thank you @Fran !! Commented Apr 13, 2023 at 2:47

You must log in to answer this question.

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