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, 2020 at 10:31
  • 1
    Thanks. What does \C do in hyperref? Mar 24, 2020 at 10:33
  • Please, avoid minimal. It is not for minimal examples.
    – egreg
    Mar 24, 2020 at 10:42
  • Thanks a lot. I will use article the next time. Mar 24, 2020 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, 2020 at 0:09

2 Answers 2

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
  • 4
    I normally just recommend using \CC kinda looks like the double nature of \mathbb
    – daleif
    Mar 24, 2020 at 10:55
0

I have perhaps hundred documents in which I use \C as a macro for \mathbf{C} and all of them are lost because of this collision. I wrote a python program for making substitutions of words in documents which I have run on all my *.tex documents to change \C for \CC (the double \ is necessary for python understand "\C"). Anyone interested can find substitui_palavra.py at http://www.calculo-numerico.sobralmatematica.org/programas/substitui_palavra.pyt and change ".pyt" to ".py".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .