I'm using package hyperref to write a book in Portuguese. Appendices should appear in TOC as in Apêndice A Title of the appendix.

When I compile it with LuaLatex on a computer with Ubuntu 16.04, I get this error message:

! Missing \endcsname inserted.
<to be read again> 
l.2 ....a.A}{Ap\352ndice T\355tulo de ap\352ndice}{}

The file main.out looks like this:

\BOOKMARK [0][-]{chapter.1}{Blabla}{}% 1
\BOOKMARK [0][-]{Ap\char "00EA\relax ndice.a.A}{Ap\352ndice T\355tulo de ap\352ndice}{}% 2

But, when I compile the same project with LuaLatex on a computer with Ubuntu 18.10, I get no error message and the file main.out looks like this:

\BOOKMARK [0][-]{chapter.1}{Blabla}{}% 1
\BOOKMARK [0][-]{Apêndice.a.A}{Ap\352ndice T\355tulo de ap\352ndice}{}% 2

What can possible be wrong with LuaLatex on my Ubuntu 16.04?




\author{Nome do Autor}









\chapter{Título de apêndice}

Mais texto.

  • 3
    Don't use luainputenc. (I don't know if it is the source of your problem, I didn't try your MWE is far away from a minimal example.) – Ulrike Fischer Jan 30 '19 at 12:58
  • 1
    @manooooh With LuaLaTeX that really should not be necessary. And I have never had issues with non-ASCII chars in pdfLaTeX either in those positions. – moewe Jan 30 '19 at 16:39
  • 1
    You would only need luainputenc if you had to combine legacy encodings and Unicode in the same document, using LuaLaTeX. If at all possible, I would advise you to instead remove any legacy font packages, and use Unicode throughout. – Davislor Jan 30 '19 at 18:24
  • 1
    @LeonardoCastro That probably is not the best approach: the hyperref manual says that bookmarks must be in Unicode anyway. Your source files for LuaTeX should always be UTF-8, and you should give hyperref the unicode=true option. The only time you’d need luainputenc is if you’re trying to mix Unicode with legacy 7- and 8-bit fonts, but in the real world there’s no reason to ever do that. If you’re writing your book in LuaTeX, you can just consistently use Unicode. – Davislor Mar 11 '19 at 15:17
  • 1
    @LeonardoCastro There are a handful of special cases where you might be forced to use a legacy font in the same document as Unicode. If you’re writing a new book, though, and you’re handling details like the bookmarks yourself, and something you do needs luainputenc, you should stop doing it. – Davislor Mar 11 '19 at 15:30