There are a number of ways you can go about solving this problem, mostly depending on how much detail you would like.
Getting the raw code definition of any command is trivial; there is a TeX primitive \meaning
, which will expand to the current one-level expansion of the macro (that is, it will not attempt to expand those macros inside of it). If you are using a complicated package setup or if the definition of the macro is changing, this is the most reliable way to go. Otherwise, you can save some time with the texdef
Perl script:
$ texdef -t latex large
\large:
\long macro:->\@setfontsize \large \@xiipt {14}
Note that this only parses the output of TeX as seen below, but it can be a huge timesaver for simple queries.

See its man
or info
page for documentation on the tool, or use texdoc texdef
, which brings us to the next level.
With TeX being a typesetting language, it just so happens that many package authors/teams are also very good, thorough writers.
The texdoc
tool will take its argument and search all of the documentation that is available to it for your term.
Now, it doesn't do a search in depth but in breadth; it will not search the contents of all the documentation available to it.
(That would take forever!)
Most of my needs are met with texdoc
; normally you can provide the package name that your command belongs to and violà: your documentation opens in your default reader.
The documentation for the LaTeX kernel is also available with texdoc source2e
(and a pared-down, unfinished macros2e
); as for the detail of this documentation—well—it's turtles all the way down.
See man texdoc
, info texdoc
, and—you guessed it—texdoc texdoc
for more information on this tool.
If texdoc
yet does not satisfy you, then the last resorts are printed books and Google, where printed books generally only compile information already available for free.
cleveref
package exists.hyperref
also defines a fewref
commands for this purpose.) For the definition of\ref
, you can take a look atlatex.ltx
. But any package can overwrite this itself so you may be better off using\show
/\meaning
and/orlatexdef
(see texdef).cleveref
(\cref
) and facilities in thehyperref
package (\autoref
).\@startsection
for LaTeX? or Where can I find an online manual for low-level LaTeX commands?texdef
tool:texdef -t latex \ref
. As for redefining it, simply\renewcommand
to a copy of the definition in your preamble and make your necessary changes.