File not processing under xelatex

File not processing under xelatex

Why would such a simple file like:

\documentclass{article}
\usepackage{hyperref}

\newcommand{\U}{\emph{U}}
\newcommand{\C}{\mathrm{C}}

\begin{document}
  This is a test.
\end{document}

process fine under pdflatex and fail under xelatex?

답변1

When xelatex is used, hyperref loads the PU encoding definition files (it's for bookmarks), which defines \U as an alias for \u (the breve accent). I don't know the reason for this, as other accents such as \r, \v and \d don't have the uppercase counterpart defined.

If you're sure the breve accent is not finding its place in your document you can do

\providecommand{\U}{}
\renewcommand{\U}{\emph{U}}

which will work in both settings. But be prepared to get some weird result if actually the original \U turns out to be necessary.

On the other hand, I'm not sure what such a \U command is useful for.

관련 정보