# Hyperref bug with a \def

The following very MWE shows the issue, which disappears when the call to hyperref is commented:

\documentclass{article}

\def\n{\textup{\tiny N}}
\def\t{\textup{\tiny T}}

\usepackage{hyperref}

\begin{document}

${}_{\t}$
$_{\t}$
${}_{\t}$
$_\t$

\end{document}


However, it compiles fine when hyperref is called before the two \def.


If you use \newcommand instead of \def, you'll clearly see the source of the problem:

! LaTeX Error: Command \t already defined.
Or name \end... illegal, see p.192 of the manual.


The \t command is defined in the LaTeX Internal Character Representation for the “tie accent” and hyperref assumes this is the meaning of \t. Since it has to do several patches for its working, you end up with \t being essentially redefined to its original meaning, which can be seen if you add \show\t after \begin{document}

> \t=macro:
->\PD1-cmd \t \PD1\t .


Without your redefinition and without hyperref, you'd get

> \t=macro:
->\OML-cmd \t \OML\t .


which is essentially the same (the encoding name may change when \show is used for technical reasons which are beyond the scope of this answer).

Moral: don't use \def if you don't know precisely what you're doing. And never redefine a command with \renewcommand if you don't know precisely about it.

• Thanks. I should have guess but the error message disturbed me a bit. Nov 12 '18 at 8:28