2

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.

1
  • 4
    hyperref or one of the packages it loads redefines \t. I suggest you take a different name for you macro, one letter names are always tightly contested and therefore dangerous. BTW: This is one of the reasons why it makes sense to (1) load all packages before you define custom commands and apply other (re-)definitions and (2) to use \newcommand. If you had \usepackage{hyperref}\newcommand\t{\textup{\tiny T}}, you would have gotten an error.
    – moewe
    Nov 11 '18 at 22:36
4

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.