Using \DeclareUnicodeEncoding, I defined my own encoding that adjusts the \^ such that it maps to a circumflex accent U+005E rather than to a combining circumflex accent U+0302 (which is already set by xunicode to represent the modified letter accent U+02C6).

I hit a few bumps/snags/hurdles.

  1. The first problem was caused by a circumflex appearing in listings environments that was solved by adding \input{tuenc.def} (with \makeatletter).
  2. The second problem appears when typing \^{}, which causes a log error.

Log Error

file.log:505:Missing character: There is no   in font [/usr/local/texlive/2016/texmf-dist/fonts/opentype/rozynski/comicneue/ComicNeue_Regular.otf]/OT:mapping=tex-text;!


See comments in the code. Note that I picked ComicNeue_Regular.otf specifically because it does not support U+0302 or U+00A0, and it is contained within TeX Live.


  Path = /usr/local/texlive/2016/texmf-dist/fonts/opentype/rozynski/comicneue/ ,
  Extension = .otf ,
  UprightFont = *_Regular,
  NFSSEncoding= preventcombinedcircumflex,

% Solved the general issue by adding \EncodingAccent{\^}{"005E}, or so I thought.
% Solved the lstlisting issue was solved by adding \makeatletter\input{tuenc.def}
% Unsolved



If you add


then you find

! Text line contains an invalid character.
l.84   \if\relax\detokenize{#2}\relax 

which is... interesting and translates as: it's not your fault..

The offending line is


which says if the argument of the accent command is empty use a non breaking space. You need something as when using unicode combining characters you don't want a\"{} to put the accent on the a because the following combining character had no base to act on.

But your example shows it's not safe to use ^^a0 . Instead of inputting tuenc.def input a local copy where


has been changed to (I guess)


perhaps we should use space always. I'll raise it with the team....

  • Very interesting indeed. \catcode160 is a non-breakable space which you set to category code 15, correct? Oct 18 '17 at 18:39
  • @JonathanKomar just as a debugging aid catcode 15 is invalid character so tex stops at the point the character first got into the system. I added a fix to my answer. Oct 18 '17 at 18:42
  • Wait, wouldn't it be much better to put the redefinition in @JonathanKomar's code after loading tuenc.def rather than producing yet another .def file that would be a slight variant of tuenc.def?? Oct 19 '17 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.