tectonic icon indicating copy to clipboard operation
tectonic copied to clipboard

Undefined control sequence `\DeclareUnicodeCharacter` redux

Open andreasabel opened this issue 2 years ago • 3 comments

This is a reopening of #800, which was not resolved, but sidestepped by using \newunicodechar instead of \DeclareUnicodeCharacter.

MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{00AC}{\ensuremath{\neg}}
\begin{document}
¬
\end{document}
$ pdflatex MWE.tex
...
Output written on MWE.pdf ...
...
$ tectonic MWE.tex
...
error: MWE.tex:3: Undefined control sequence
...
$ tectonic -V
Tectonic 0.14.1

The contract of executing \usepackage[utf8]{inputenc} is that \DeclareUnicodeCharacter is then defined. See https://mirror.math.princeton.edu/pub/CTAN/macros/latex/base/inputenc.pdf.

andreasabel avatar Sep 25 '23 11:09 andreasabel

Seems worth noting that tectonic is based on xelatex, if you run your MWE.tex through xelatex it gives a slightly more descriptive error.

(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty

Package inputenc Warning: inputenc package ignored with utf8 based engines.

)
! Undefined control sequence.
<recently read> \DeclareUnicodeCharacter

I haven't really looked into it a lot, but that at least gave me the impression it wasn't expected to work.

ratmice avatar Sep 25 '23 12:09 ratmice

Seems worth noting that tectonic is based on xelatex,

Ah, ok, good to know. I had used tectonic on pdflatex documents, and it had worked out of the box (which is great!), so I assumed it would be pdflatex compatible.

Package inputenc Warning: inputenc package ignored with utf8 based engines.

I think one should either get this warning or have \DeclareUnicodeCharacter defined.

andreasabel avatar Sep 26 '23 06:09 andreasabel

Package inputenc Warning: inputenc package ignored with utf8 based engines.

I think one should either get this warning or have \DeclareUnicodeCharacter defined.

Yeah, It occurred to me that this message is probably just not being printed by default, but still exists if you run tectonic with the --print option (which turns out to be the case).

ratmice avatar Sep 26 '23 06:09 ratmice