DeclareUnicodeCharacter 之后缺少 \begin{document}

DeclareUnicodeCharacter 之后缺少 \begin{document}

编译此文件时:

\documentclass{article}
\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{27e3}{somereplacement}
\begin{document}

Hi, world! P ⟣ Q

\end{document}

我得到以下输出:

> pdflatex test.tex 
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2014/05/01>
Babel <3.9k> and hyphenation patterns for 2 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/utf8.def
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.dfu)
(/usr/share/texlive/texmf-dist/tex/latex/base/ot1enc.dfu)
(/usr/share/texlive/texmf-dist/tex/latex/base/omsenc.dfu)))

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.3 ...lareUnicodeCharacter{27e3}{somereplacement}

答案1

解决方法是我应该27E3用大写字母拼写。

相关内容