# Defined a character with \DeclareUnicodeCharacter - “Undefined control sequence” when I use it

I'm trying to define some unicode characters to add a halloween theme to my upcoming homework, but I'm getting "Undefined control sequence" when I try to use a character that I've declared.

Here is my LaTeX file:

\Documentclass[24pt,a4paper,margin=1in]{report}

\usepackage[utf8]{inputenc}

\DeclareUnicodeCharacter{00E4}{\pumpkin}

\begin{document}

\pumpkin

\end{document}


And here is the console output up through the error when I build it with pdflatex:

\$ pdflatex.exe hw5.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7140 64-bit)
entering extended mode
(hw5.tex
LaTeX2e <2018-12-01>
("D:\MiKTeX 2.9\tex/latex/base\report.cls"
Document Class: report 2018/09/03 v1.4i Standard LaTeX document class
("D:\MiKTeX 2.9\tex/latex/base\size10.clo"))
("D:\MiKTeX 2.9\tex/latex/base\inputenc.sty")

LaTeX Warning: Unused global option(s):
[24pt,margin=1in].

(hw5.aux)
! Undefined control sequence.
l.11 \pumpkin


Any help would be appreciated.

• Welcome to TeX.SX! You have to define (or load a package which does so) \pumpkin somewhere. A quick search reveals the conveniently timed halloweenmath package: tex.stackexchange.com/q/336768/134574. – Phelype Oleinik Oct 26 '19 at 1:43
• So \DeclareUnicodeCharacter doesn't introduce a new control sequence? – jcarpenter2 Oct 26 '19 at 1:46
• It's perfect! :) – jcarpenter2 Oct 26 '19 at 1:48
• No, it defines the unicode codepoint (in this case 00E4) to expand to the given control sequence. More or less like a shortcut. In this case you are making ä expand to \pumpkin. Not a terribly good idea, if you intend to use ä in your document, but definitely valid for trick-or-treating ;-) – Phelype Oleinik Oct 26 '19 at 1:48