1

Today, I updated from TeXLive 2015 to TeXLive 2019 (about time, right?). However, I am having an issue that I haven't encountered before. I usually declare \C as a macro for the complex numbers. However, this collides with some implicit declaration of a command related to the hyperref package (which I also need).

I get the following error message:

! LaTeX Error: Command \C unavailable in encoding TU.

I checked the manual of the hyperref package, but they don't seem to define a command \C.

Here is a minimal working example:

\documentclass{article}

\usepackage{fontspec}

\usepackage{amsmath}
\usepackage{amssymb}
\DeclareMathOperator{\C}{\mathbb{C}}
\DeclareMathOperator{\R}{\mathbb{R}}
\usepackage{hyperref}


\begin{document}
$\C$
\end{document}

Note that this is unique to \C. The document compiles properly for \R.

5
  • 1
    hyperref preempts \C. Change the name.
    – egreg
    Mar 24 '20 at 10:31
  • 1
    Thanks. What does \C do in hyperref?
    – Lukas
    Mar 24 '20 at 10:33
  • Please, avoid minimal. It is not for minimal examples.
    – egreg
    Mar 24 '20 at 10:42
  • Thanks a lot. I will use article the next time.
    – Lukas
    Mar 24 '20 at 10:53
  • It is very annoying that hyperref defines a "\C" macro. I don't think final users are supposed to care more about name clash then package developers. I, myself, hate using \C for complexes. But coworkers do use it. I already evangelize too much to ask them to change their \C because hyperref sudently decide to pollute namespace. :-( Dec 27 '20 at 0:09
3

Since hyperref needs to cover Unicode for producing bookmarks, it defines an own output encoding called PU.

In the file puenc.def we find

\DeclareTextCommand{\C}{PU}[1]{#1\83\017}% U+030F

so \C is used for the combining double grave accent.

You have two alternatives:

  1. change the name of \C for the complex numbers to a different (perhaps better) name, such as \sC (set C) or what you like best;

  2. undefine \C.

For the latter,

\documentclass{article}

\usepackage{fontspec}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{hyperref}

\let\C\relax

\DeclareMathOperator{\C}{\mathbb{C}}
\DeclareMathOperator{\R}{\mathbb{R}}

\begin{document}

$\C$

\end{document}

Be careful with your bookmarks and be sure not to use that strange accent.

1
  • 2
    I normally just recommend using \CC kinda looks like the double nature of \mathbb
    – daleif
    Mar 24 '20 at 10:55

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.