5

Edit: I think this is a duplicate of How can I see the "implementation" of the \LaTeX command? .

I wanted to see the code for the hyperref \autoref command, so created this simple document:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\show\autoref
\end{document}

However, in the log output, instead of the code, I see:

> \autoref=macro:
->\protect \autoref  .
l.4 \show\autoref

Changing line 4 to \show\section shows the code for \section, as expected:

> \section=\long macro:
->\@startsection {section}{1}{\z@ }{-3.5ex \@plus -1ex \@minus -.2ex}{2.3ex \@plus .2ex}{\normalfont \Large \bfseries }.
l.4 \show\section

How can I get the actual code for \autoref?

Suzanne Soy
  • 3,043

2 Answers2

4

That is the code for \autoref if you want to see the code for the internal command \autoref_ (with a space) then

{\let\protect\show\autoref}

works

> \autoref =macro:
->\leavevmode \@ifstar {\HyRef@autoref \@gobbletwo }{\HyRef@autoref \hyper@@lin
k }.
\autoref ->\protect \autoref  

l.4 {\let\protect\show\autoref
                              }
David Carlisle
  • 757,742
1

This is described in the tex faq: https://texfaq.org/FAQ-ltxcmds

An expl3-variant to show the internal command (which ends with a space as David mentioned):

\documentclass{article}
\usepackage{hyperref,expl3}
\begin{document}
\ExplSyntaxOn\cs_show:c{autoref~}\ExplSyntaxOff
\end{document}
David Carlisle
  • 757,742
Ulrike Fischer
  • 327,261