# Standard pre-defined macros in LaTeX: where to find them all

I hope this question is not a duplicate, but I couldn't find anything here on tex.stackexchange.

What I want is the place where all the macros already defined in LaTeX are. For example I know that the command \hrulefill is defined as

\def\hrulefill{\leavevmode\leaders\hrule\hfill\kern\z@}


(I got this form this question), but where can I find all the possible commands defined already for all the LaTeX classes (such as the sectioning commands \chapter, \part and so on)?

• The file latex.ltx is a start. But you can use {\tt\meaning\hrulefill} to get the definition in the document (or if you control the logs and such you can use \show\hrulefill, but I prefer \meaning since what I usually see is the result pdf). – Manuel May 21 '18 at 11:44

"source2e - LATEX2ε kernel documentation for the entire system as one document" at CTAN might be of interest to you.

That document comes as .pdf-file whose name is source2e.pdf.

https://ctan.org/pkg/source2e

The title of the version of that document relating to the most recent version of the LaTeX2e-kernel at the time of writing this answer (May 21, 2018) is:

The LaTeX2e Sources

Johannes Braams, David Carlisle, Alan Jeffrey, Leslie Lamport, Frank Mittelbach, Chris Rowley, Rainer Schöpf

2018-04-01 Patch level 5

That document does not contain information about the code of LaTeX2e-classes and -packages, but it contains information about how the LaTex2e-format/the LaTeX2e-kernel itself is implemented.

Within that document you can find how, e.g., commands like \documentclass or \usepackage or \begin or \end are defined in the LaTeX2e-kernel.

E.g., in the section about File b: ltplain.dtx Date: 2017/04/10 Version v2.3c, on page 28 of that .pdf-file, you can find the LaTeX2e-kernel-definition of \hrulefill:

\hrulefill  LaTeX change: \kern\z@ added to end of \hrulefill and \dotfill to make them
\dotfill    work in ‘tabular’ and ‘array’ environments. (Change made 24 July 1987). LaTeX
change: \leavevmode added at beginning of \dotfill and \hrulefill so that
they work as expected in vertical mode.

The box in \dotfill originally contained (in plain.tex):
\mkern 1.5mu .\mkern 1.5mu;
the width of .44em differs from this by .04pt which is probably an acceptable

436 \def\dotfill{%
437  \leavevmode