I was looking for a way to output a list of all the labels used in the document, but so far have only found this answer that uses a built in function in WinEdt. Is there a similar functionality in MikTex/TeXworks, or will I need to search the file using one of the regular expression and running it in command prompt or something? I'm currently using TeXworks Version 0.6.1 (MikTeX 2.9.6100 64-bit) on Windows 10. Thanks!

  • 4
    you can easily extract that from the .aux file – David Carlisle Mar 3 '18 at 20:13
  • @DavidCarlisle ok, I see it in the .aux file now; didn't know it was there. Would the solution be to just search through the file then? I was looking to a way to list just the labels is a different window than the main document to reference as I'm writing. – beez Mar 4 '18 at 2:24
  • I, too, think this constitutes an answer. It's specific to LaTeX. – thymaro Mar 4 '18 at 21:20

So, based on the comment by @DavidCarlisle, I was able to figure out how to search the *.aux file for the labels. First I had to tell TeXworks to show the *.aux file using the instructions found in this question and this question. Then I was able to use PowerShell to search the contents of the file using the Select-String cmdlet based on the instructions here and searching for "label" in the *.aux file.

  • If there's a more elegant solution, I'd accept that. – beez Mar 14 '18 at 4:24

Well, I don't know if this counts as built-in, but you can always let LaTeX do the work for you:



% These packages are only used in the example content:
\usepackage{amsmath, amssymb}


    % Just for demonstration purposes
    % I use this to format the output.
    % basically taken from https://tex.stackexchange.com/a/275957/48973
            \ifdim\@tempdima < #1%

    % \newlabel is the command used in the .aux file to register labels
    % its format changes when using hyperref
    % for printing the label list to the document
                    \hskip .025\textwidth
                    \expandafter\def\expandafter\@tempa\expandafter{\@makelabelparameterslist ##2}%
                    \foreach \field/\minwidth in \@tempa {%
                        \hskip .025\textwidth
            \foreach \entry in \@labellist {%
    % for writing the label list to the log file and console
                \expandafter\def\expandafter\@tempa\expandafter{\@makelabelparameterslist ##2}%
                \foreach \field/\minwidth in \@tempa {%
            \message{^^JLabels used in this document:}%
            \foreach \entry in \@labellist {%

% print the label list at the end of the document
% also write it to the log file





    \caption{Ooh, an image!}



\begin{equation}\setcurrentlabelname{Fermat's last theorem}\label{eq:fermat}
    \nexists \; a, b, c, n \in \mathbb Z_+, n > 2 : a^n + b^n = c^n



\printlabellist outputs a list of the labels in the document (if hyperref is not used, only the first three columns exist):

MWE output of the label list

\typeoutlabellist will write the label list to the log file (and the console):

Labels used in this document: 
<label>         <num>       <page>      <title>         <anchor>        <> 
sec:one         1       1       One         section.1        
sec:alpha       1.1         1       Alpha       subsection.1.1       
sec:beta        1.2         1       Beta        subsection.1.2       
sec:two         2       1       Two         section.2        
fig:example         1       2       Ooh, an image!      figure.1         
sec:three       3       2       Three       section.3        
sec:aleph       3.1         2       Aleph       subsection.3.1       
sec:beth        3.2         2       Beth        subsection.3.2       
eq:fermat       1       3       Fermat's last theorem       equation.3.1         
sec:gimel       3.3         3       Gimel       subsection.3.3       

(If anybody knows of a way to better format this table (i.e. pad the short entries with spaces), let me know.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.