% \iffalse meta-comment
%
% Copyright (C) 1993-2021
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%    https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi
% LABLST.TEX -- A LaTeX input file for printing label definitions.
% Copyright (c) 1985, 1994 by Leslie Lamport, Chris Rowley
% This file created on 5 November 1994
%
% Modified December 1994 (DPC) to allow _ ^ etc in label keys and to
%                              input packages used by the main file.
%
% Modified June 1995 (CAR)
%
% This version puts all bibilographic entries at the end of the
% output.  It inputs the .aux file twice.

% Initial interactions:
%
\typeout{}
\typeout{LABLST version of 10 June 1995}
\typeout{}
\typeout{*********************************}
\typeout{* Enter input file name }
\typeout{* \space\space without the .tex extension: }
\typein[\lablstfile]{*********************************}


\def\spaces{\space\space\space\space\space}
\typeout{}
\typeout{********************************************************}
\typeout{* Enter document class used in file \lablstfile.tex }
\typeout{* \space\space with no options or extension: }
\typein[\lablstclass]%
        {********************************************************}

\documentclass{\lablstclass}

% Now ask for packages. The answer should be a comma separated list.
% In fact only packages that define commands that are used in
% section titles etc need be loaded.
% \def\spaces{\space\space\space\space\space}
\typeout{}
\typeout{**************************************************}
\typeout{* Enter packages used in file \lablstfile.tex }
\typeout{* \space\space with no options or extensions: }
\typein[\lablstpackages]%
        {**************************************************}

\usepackage{\lablstpackages}

\nofiles
\parindent 0pt

\begin{document}

\mbox{}

\vspace{-3cm}

{\LARGE  File \textbf{\lablstfile.tex} --- lablst output}
{\Large (\today)
\\[0.5\baselineskip]
Using document class:\quad \lablstclass\\
  \mbox{\phantom{Using }and packages:\quad \lablstpackages}
 }

\vspace{2\baselineskip}

\makeatletter

% This is always disabled:
%
\let \@mlabel \@gobbletwo

% No protection needed:
%
\let \protect \relax

% Better formatting?:
%
\let \raggedright  \relax

% Only write out toc entries:
%
\def \@writefile #1#2{%
  \def\lablst@tempa{#1}%
  \def\lablst@tempb{toc}%
  \ifx \lablst@tempa\lablst@tempb
    \par{#2}\par\nobreak
    \vspace{3pt}%
  \fi
}

% Allow characters like ^ _ to be printed `verbatim'.
%
\def\@lablstverb#1{%
  \def\lablst@tempa{#1}%
  {\ttfamily\expandafter\strip@prefix\meaning\lablst@tempa}}%


% For first run:
%
\def \newlabel #1#2{%
  \par
  \hbox to \textwidth{%
    \hfill\makebox[10em][r]{\@lablstverb{#1}}%
    \hspace{1em}\makebox[4.5em][l]{\@firstoftwo #2}%
    Page:
    \makebox[2.5em][r]{\@secondoftwo #2}%
    \hspace{4em}}\par
}

\let \bibcite \@gobbletwo

{\Large \sl Logical labels within sections}

\input \lablstfile.aux


% For second run:
%
\def \bibcite #1#2{\par
  \hbox to \textwidth{%
  \hfill\makebox[2in][r]{\@lablstverb{#1}}\hspace{1em}[#2]\hspace{4em}}}

\let \newlabel \@gobbletwo
\let \@writefile \@gobbletwo

\par
\vspace{2\baselineskip}

{\Large \sl Bibliography logical labels}

\input \lablstfile.aux

\end{document}
