% \iffalse meta-comment %<*internal> \iffalse % %<*readme> ---------------------------------------------------------------- listlbls --- Creates a list of all labels used throughout a document Author: Norbert Melzer E-mail: timmelzer@gmail.com License: Released under the LaTeX Project Public License v1.3c or later See: http://www.latex-project.org/lppl.txt ---------------------------------------------------------------- This is a package meant to help a LaTeX-writer to keep track all the defined labels by typesetting a complete list of labels whereever the author requests it. Keep in mind, that you might need to have additional LaTeX runs to get the references right. This package is based on an answer David Carlisle gave on tex.stackexchange.com in the thread ``List of all labels with hyperlinks''[1]. [1]: http://tex.stackexchange.com/questions/147695/list-of-all-labels-with-hyperlinks/147705#147705 % %<*readmemd> listlbls ======== Creates a list of all labels used throughout a document | Key | Value | |--------:|:---------------------------------------------------------------| | Author | Norbert Melzer | | E-mail | timmelzer@gmail.com | | License | Released under the LaTeX Project Public License v1.3c or later | | See | http://www.latex-project.org/lppl.txt | This is a package meant to help a LaTeX-writer to keep track all the defined labels by typesetting a complete list of labels whereever the author requests it. Keep in mind, that you might need to have additional LaTeX runs to get the references right. This package is based on an answer David Carlisle gave on tex.stackexchange.com in the thread [List of all labels with hyperlinks][1]. [1]: http://tex.stackexchange.com/questions/147695/list-of-all-labels-with-hyperlinks/147705#147705 % %<*internal> \fi \def\nameofplainTeX{plain} \ifx\fmtname\nameofplainTeX\else \expandafter\begingroup \fi % %<*install> \input docstrip.tex \keepsilent \askforoverwritefalse \preamble ---------------------------------------------------------------- listlbls --- Creates a list of all labels used throughout a document Author: Norbert Melzer E-mail: timmelzer@gmail.com License: Released under the LaTeX Project Public License v1.3c or later See: http://www.latex-project.org/lppl.txt ---------------------------------------------------------------- \endpreamble \postamble Copyright (C) 2014 by Norbert Melzer This work may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this license or (at your option) any later version. The latest version of this license is in the file: http://www.latex-project.org/lppl.txt This work is "maintained" (as per LPPL maintenance status) by Norbert Melzer. This work consists of the file listlbls.dtx and a Makefile. Running "make" generates the derived files README, listlbls.pdf and listlbls.sty. Running "make inst" installs the files in the user's TeX tree. Running "make install" installs the files in the local TeX tree. \endpostamble \usedir{tex/latex/listlbls} \generate{ \file{\jobname.sty}{\from{\jobname.dtx}{package}} } % %\endbatchfile %<*internal> \usedir{source/latex/listlbls} \generate{ \file{\jobname.ins}{\from{\jobname.dtx}{install}} } \nopreamble\nopostamble \usedir{doc/latex/listlbls} \generate{ \file{README.txt}{\from{\jobname.dtx}{readme}} } \generate{ \file{README.md}{\from{\jobname.dtx}{readmemd}} } \ifx\fmtname\nameofplainTeX \expandafter\endbatchfile \else \expandafter\endgroup \fi % % \fi % % \iffalse %<*driver> \ProvidesFile{listlbls.dtx} % %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{listlbls} %<*package> [2023/05/24 v1.04 Creates a list of all labels used throughout a document] % %<*driver> \documentclass{ltxdoc} \usepackage{microtype} \usepackage{lmodern} \usepackage{fontawesome5} \usepackage[a4paper,margin=25mm,left=45mm,nohead]{geometry} \usepackage{multicol} \usepackage[reportchangedates]{doc} \usepackage{dtxdescribe} \usepackage[numbered]{hypdoc} \usepackage{xspace} \usepackage{nameref} \usepackage[english]{babel} \usepackage[draft,totoc]{listlbls} \EnableCrossrefs \CodelineIndex \RecordChanges \newcommand\TSE{\href{http://tex.stackexchange.com/}{\TeX-Stackexchange}\xspace} \newcommand\link[2]{\href{#1}{#2}\footnote{\nolinkurl{#1}}} \newcommand\ghissue[3]{\link{https://github.com/#1/#2/issues/#3}{\faIcon{github}~#1/#2\##3}} \newcommand\thisissue[1]{\ghissue{nobbz}{listlbls}{#1}} \begin{document} \DocInput{\jobname.dtx} \end{document} % % \fi % % \GetFileInfo{\jobname.dtx} % \DoNotIndex{\newcommand,\newenvironment,\def,\detokenize,\dotfill,\else,\endinput,\expandafter,\fi,\ifeof,\ifx,\immediate,\jobname,\par,\pageref,\openin,\noindent,\newtoks,\newread,\newlabel,\loop,\long,\read,\ref,\relax,\repeat,\texttt,\the,\tmp,\zz,\ProcessOptions,\let,\ifdefined,\DeclareOption,\addcontentsline,\chapter,\DeclareTranslation,\DeclareTranslationFallback,\GetTranslation,\newif,\RequirePackage,\section,\`,\ยด,\'} % %\title{\textsf{listlbls} --- Creates a list of all labels used throughout a document\thanks{This file % describes version \fileversion, last revised \filedate.} %} %\author{Norbert Melzer\thanks{E-mail: \href{mailto:timmelzer@gmail.com}{timmelzer@gmail.com}}} %\date{Released \filedate} % %\maketitle % %\changes{v1.00}{2014/07/25}{First public release} %\changes{v1.01}{2014/07/25}{Changed maintainer email} %\changes{v1.01}{2014/07/25}{Changed some internal stuff to make it releaseable on CTAN} %\changes{v1.02}{2014/07/27}{Local option wins agains global option} %\changes{v1.02}{2014/07/27}{Added languag-support for English, German and French.} %\changes{v1.03}{2014/08/04}{Proceeding with namespacing internal macros} %\changes{v1.04}{2023/05/24}{Fix build problems due to bitrotten dependencies} %\changes{v1.04}{2023/05/24}{Switch back to lmodern for documentation} % \begin{abstract} % This is a package meant to help a \LaTeX-writer to keep track all the defined labels by typesetting a complete list of labels whereever the author requests it. Keep in mind, that you might need to have additional \LaTeX\ runs to get the references right. % % This package is based on an answer \textsc{David Carlisle}\ gave on \TSE in the thread \href{http://tex.stackexchange.com/questions/147695/list-of-all-labels-with-hyperlinks/147705#147705}{List of all labels with hyperlinks}. % \end{abstract} % % \begin{multicols}{2} % \tableofcontents % \end{multicols} % \section{Installation}\label{sec:install} % % The following explanations are only valid for Linux-like systems with gnu-|make| available. % % \subsection{\TeX live}\label{ssec:inst-tl} % % This package is bundled in \TeX live, so you can simply (|sudo|) |tlmgr install listlbls| (which should work for windows as well) % % \subsection{From Github}\label{ssec:inst-gh} % % \begin{enumerate} % \item Check out the sourcecode from \link{https://github.com/}{GitHub}:\\ % |git clone https://github.com/NobbZ/nixos-config.git| or\\ % |git clone git@github.com:NobbZ/listlbls.git| or\\ % |gh repo clone NobbZ/listlbls| % \item Switch to the source-folder:\\|cd listlbls| % \item Checkout the branch/tag you desire: |master| for latest release, |develop| for latest builds (might be broken) or the version number desired.\\ % |git checkout | % \item Compile the document using |make|:\\ % |make all| % \item You can do either a user-installation or a system-wide installation: % \begin{description} % \item[user:] |make inst| % \item[system:] |make install| (will ask for root!) % \end{description} % \end{enumerate} % % \subsection{From CTAN}\label{ssec:inst-ctan} % % \begin{enumerate} % \item Browse to \url{http://ctan.org/pkg/listlbls}. % \item Download the package as zip archive (``Download'' at the bottom of the page).\\ % |wget http://mirrors.ctan.org/macros/latex/contrib/listlbls.zip| % \item Unzip wherever you want. \\ % |unzip listlbls.zip| % \item |cd| into the directory you unzipped to. \\ % |cd listlbls| % \item You can do either a user-installation or a system-wide installation: % \begin{description} % \item[user:] |make inst| % \item[system:] |make install| (will ask for root!) % \end{description} % \end{enumerate} % % \section{Usage}\label{sec:usage} % % \subsection{Initialization}\label{ssec:use-init} % % Just activate the package as usual: |\usepackage|\oarg{options}|{listlbls}| % % \DescribeOption{draft} If |draft| is given as option, |\listoflabels| will typeset the list of labels. % % \DescribeOption{final} If |final| is given as option, |\listoflabels| will do nothing. Please remember, that |final| is set globally by most documentclasses. % % \DescribeOption{totoc} If this is given the List of Labels will appear in a table of contents (unnumbered). % % \DescribeOption{notoc} If this is given the List of Labels will \emph{not} appear in a table of contents, but it will still have a headline. % % \DescribeOption{numtoc} Typesets a numbered headline, this option also implies |totoc|! % % \DescribeOption{nonameref} Even if the package |nameref| if detected, it will not be used. % % This document was typeset with |\usepackage[draft,totoc]{listlbls}| also the package |nameref| was loaded. % % A locally set option will win against a globally set contrary option! % % \subsection{Macros}\label{ssec:use-macros} % % Then anywhere in your document, you can use the |\listoflabels|-macro to typeset a list of labels. An example can be seen on page \pageref{special:listoflabels}. % % \DescribeMacro{\label} \marg{name} % Use |\label| as you are used to it! % % \DescribeMacro{\listoflabels} \oarg{label} % This macro will typeset the list of labels when this module is in draft mode. % It will itself register the label from the optional arg, defaulting to ``|special:listoflabels|''. % %\StopEventually{^^A % \PrintChanges % % \PrintIndex % % \listoflabels %} % % \section{Contribution and bugreports}\label{sec:contribute} % % If you have feature-requests or bug-reports, please feel free to report them on the \link{https://github.com/NobbZ/listlbls}{project page at GitHub}. % % If you want to contribute then follow these steps: % \begin{enumerate} % \item Visit the \link{https://github.com/NobbZ/listlbls}{project page at GitHub}, % \item forkt it, % \item clone it to your local machine, % \item create a branch ``|feature/|\meta{feature name}'', % \item do your changes, % \item push them back to GitHub, % \item create a pull request to |develop|, % \item and wait for approval. % \end{enumerate} % After approval your code will be merged to the |development|-branch and I will generally not accept pull-requests that edit |develop| directly. % % \section{Known issues and limitations}\label{sec:issues} % \changes{v1.04}{2023/05/24}{Add issues and limitations section} % % \subsection{\texttt{\textbackslash{}include}}\label{ssec:issues-include} % % Documents containing |\include| will not work. % Currently there is no logic to recurse through the different |.aux|-files. % % Please see \thisissue{4} for more information. % % \section{Implementation}\label{sec:implementation} % % \begin{macrocode} %<*package> \newif\ifllbls@draft\llbls@draftfalse \newif\ifllbls@totoc\llbls@totocfalse \newif\ifllbls@numtoc\llbls@numtocfalse \newif\ifllbls@nameref\llbls@namereftrue % \end{macrocode} % \subsection{Options}\label{ssec:impl-options} % \begin{option}{draft} % \changes{v1.01}{2014/07/25}{Added option} % \changes{v1.02}{2014/07/27}{Introduced @ifdraft} % Check for |draft|-option: % \begin{macrocode} \DeclareOption{draft}{\llbls@drafttrue} % \end{macrocode} % \end{option} % \begin{option}{final} % \changes{v1.01}{2014/07/25}{Added option} % \changes{v1.02}{2014/07/27}{Introduced @ifdraft} % Check for |final|-option: % \begin{macrocode} \DeclareOption{final}{\llbls@draftfalse} % \end{macrocode} % \end{option} % \begin{option}{totoc} % \changes{v1.02}{2014/07/27}{Added option} % Check for |totoc|-option: % \begin{macrocode} \DeclareOption{totoc}{\llbls@totoctrue} % \end{macrocode} % \end{option} % \begin{option}{notoc} % \changes{v1.02}{2014/07/27}{Added option} % Check for |notoc|-option: % \begin{macrocode} \DeclareOption{notoc}{\llbls@totocfalse} % \end{macrocode} % \end{option} % \begin{option}{numtoc} % \changes{v1.02}{2014/07/27}{Added option} % Check for |numtoc|-option: % \begin{macrocode} \DeclareOption{numtoc}{\llbls@numtoctrue} % \end{macrocode} % \end{option} % \begin{option}{nonameref} % \changes{v1.03}{2014/08/04}{Added option} % Check for |nonameref|-option: % \begin{macrocode} \DeclareOption{nonameref}{\llbls@namereffalse} % \end{macrocode} % \end{option} % Process the options: % \begin{macrocode} \ProcessOptions*\relax % \end{macrocode} % \subsection{Loading auxilliary packages}\label{ssec:impl-aux} % Load the package |translations| to provide internationalised caption for the\\|\listoflabels|. % \begin{macrocode} \RequirePackage{translations} % \end{macrocode} % \subsection{Set up internationalisation}\label{ssec:impl-i18n} % Define fallback translations: % \begin{macrocode} \DeclareTranslationFallback% {llbls-listoflabels}% {List of Labels} \DeclareTranslationFallback% {llbls-onpage}% {on page} % \end{macrocode} % \subsubsection{English}\label{sssec:impl-i18n-en} % \begin{macrocode} \DeclareTranslation{English}% {llbls-listoflabels}% {List of Labels} \DeclareTranslation{English}% {llbls-onpage}% {on page} % \end{macrocode} % \subsubsection{German}\label{sssec:impl-i18n-de} % \begin{macrocode} \DeclareTranslation{German}% {llbls-listoflabels}% {Sprungmarkenverzeichnis} \DeclareTranslation{German}% {llbls-onpage}% {auf Seite} % \end{macrocode} % \subsubsection{French}\label{sssec:impl-i18n-fr} % \begin{macrocode} \DeclareTranslation{French}% {llbls-listoflabels}% {Liste des \'etiquettes} \DeclareTranslation{French}% {llbls-onpage}% {\`a la page} % \end{macrocode} % \subsubsection{Portuguese}\label{sssec:impl-i18n-pt} % \changes{v1.04}{2023/05/24}{Add Portuguese translation} % \begin{macrocode} \DeclareTranslation{Portuguese}% {llbls-listoflabels}% {Lista de R\'{o}tulos} \DeclareTranslation{Portuguese}% {llbls-onpage}% {na p\'{a}gina} % \end{macrocode} % \subsection{Internal stuff}\label{ssec:impl-internal} % \begin{macro}{\llbls@headline}\begin{macro}{\llbls@toccommand}\begin{macro}{\llbls@tocgroup} % Determine if we have |\chapter|s or not and create a command that maps to |\chapter| or |\section| as needed. % \begin{macrocode} \ifdefined\chapter \ifllbls@numtoc \def\llbls@headline{% % \end{macrocode} % We are using |\llbls@labelname| here and in the other possible definitions of |\llbls@headline| to be able to set the label name in the |\listoflabels| macro. % \begin{macrocode} \chapter{List of Labels}\label{\llbls@labelname}} \else \def\llbls@toccommand{\chapter*} \def\llbls@tocgroup{chapter} \fi \else \ifllbls@numtoc \def\llbls@headline{% \section{List of Labels}\label{\llbls@labelname}} \else \def\llbls@toccommand{\section*} \def\llbls@tocgroup{section} \fi \fi \ifdefined\llbls@headline\else \def\llbls@headline{% \llbls@toccommand{\GetTranslation{llbls-listoflabels}}% \label{\llbls@labelname}% \ifllbls@totoc% \addcontentsline{toc}% {\llbls@tocgroup}% {\GetTranslation{llbls-listoflabels}}% \relax% \fi% } \fi % \end{macrocode} % \end{macro}\end{macro}\end{macro} % \begin{macro}{\llbls@refs} % Whether or not we use |\nameref| in the output. % \begin{macrocode} \ifdefined\nameref \ifllbls@nameref \newcommand\llbls@refs[1]{\nameref{#1}, \ref{#1}} \else \newcommand\llbls@refs[1]{\ref{#1}} \fi \else \newcommand\llbls@refs[1]{\ref{#1}}% \fi % \end{macrocode} % \end{macro} % \begin{macro}{\llbls@findlabel} % No explanation yet. % \begin{macrocode} \long\def\llbls@findlabel#1#2\llbls@findlabel{% \ifx\newlabel#1% \llbls@lablist\expandafter{\the\llbls@lablist\llbls@showlabel#2} \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\llbls@showlabel} % \changes{v1.02}{2014/08/04}{Add support for nameref-package} % Displays a single entry in the |\listoflabels| % \begin{macrocode} \def\llbls@showlabel#1#2{% \par\noindent Label: % \texttt{\detokenize{#1}}\dotfill% \llbls@refs{#1}~\GetTranslation{llbls-onpage}~\pageref{#1}% } % \end{macrocode} % \end{macro} % % \begin{macrocode} \newtoks\llbls@lablist \newread\llbls@zz \immediate\openin\llbls@zz=\jobname.aux \loop \ifeof\llbls@zz\else \read\llbls@zz to \llbls@tmp \expandafter\llbls@findlabel\llbls@tmp\relax\llbls@findlabel \repeat % \end{macrocode} % \subsection{External stuff}\label{ssec:impl-extern} % \begin{macrocode} \ifllbls@draft % \end{macrocode} % \begin{macro}{\listoflabels} % \changes{v1.04}{2023/05/24}{add optional argument to change the name of the label used.} % \begin{macro}{\llbls@labelname} % Print a list of all available lables that are defined throughout the document. % \begin{macrocode} \newcommand{\listoflabels}[1][special:listoflabels]{% \def\llbls@labelname{#1}% \llbls@headline% \the\llbls@lablist} % \end{macrocode} % \end{macro}\end{macro} % \begin{macrocode} \else \let\listoflabels=\relax \fi \endinput % % \end{macrocode} %\Finale