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.

The most recent version of source2e.pdf, which refers to the most recent version of the LaTeX2e-kernel, can be downloaded from the Comprehensive TeX Archive Network (CTAN) at:
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
438  \cleaders \hb@xt@ .44em{\hss.\hss}\hfill
439  \kern\z@}


This question might be reduced to RTFM (read the fine manual) or HTFTFM (how to find the fine manual). You surely will not find a single document or webpage which includes all commands, macros, packages, and classes since the whole TeX world is changing daily (what is a standard command?). Let us hope that the growth continues in the future. Note that some packages or classes are accessible to a small number of people, only, thus these commands cannot be covered by such a collection of all commands.

The commands of the classes are usually defined and documented in the corresponding manuals such as https://ctan.org/pkg/koma-script or https://ctan.org/pkg/memoir. The same holds for packages, too. Some classes or packages might have a reasonable documentation on https://ctan.org and a more comprehensive manual published as a book.

The documentation of some classes or packages might be sparse and you might be lucky by searching "\foocommand latex" on the search engine of your choice or "\foocommand" on this site or other TeX related pages.

A list of TeX primitives can be found here: https://www.tug.org/utilities/plain/cseq.html. Another useful source is https://ctan.org/pkg/latex2e-help-texinfo. Once you learned how to use the https://ctan.org/pkg/comprehensive you surely will find it useful (I know someone who only took a brief look on it and he does not know how to work with it and he does not find it useful).