I write most of my documents with XeLaTeX. Sometimes, however, i need to collaborate with someone who does not. In these cases, it is generally easy for me to add a pdfLaTeX-specific header:


The only issue is unicode characters:

Unicode char ⟨charcode⟩ not set up for use with LaTeX

Can I tell inputenc to silently drop these characters, or replace them by a box, or some fallback character? For now the only solution I have is to define


and to wrap all unicode characters in this macro to hide them from pdfLaTeX, which is a pain.

1 Answer 1


Macro \UTFviii@defined checks, whether the UTF-8 character is defined, it can be redefined. The following example replaces the undefined character by a box around its hexadecimal number (LaTeX/utf8.def should not be too old):


  \ifx #1\relax
    % \PackageError{inputenc}{%
    %   Unicode\space char\space
    %   \expandafter\UTFviii@splitcsname\string#1\relax\MessageBreak
    %   not\space set\space up\space for\space use\space
    %   with\space LaTeX%
    % }\@eha
    \expandafter #1%

Euro symbol: €


  • Wonderful. Thanks so much! Can you maybe explain how one finds about \UTFviii@defined?
    – Clément
    Aug 6, 2016 at 5:22
  • @Clément It's a part of the internals of inputenc: you have to read the code to find it.
    – Joseph Wright
    Aug 6, 2016 at 6:47
  • 1
    @Clément Another method for finding: \tracingmacros=1\relax before the undefined Unicode character, stopping the TeX job with x at the error message and analyzing the .log file backwards. Aug 6, 2016 at 6:52

You must log in to answer this question.

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