14

I have text with some non-ascii characters in chapters, sections... which I'd like to see in bookmarks displayed correctly. I noticed that,

  • If I run xelatex, everything is fine, no need to set \hypersetup{unicode=true} to get this working
  • If I run lualatex, I have these issues:

    1. If unicode=false, then bookmarks containing non-ascii characters have strange unreadable symbols instead of those chars, but everything else is fine

    2. If unicode=true, then bookmarks are just fine, but page numbers in resulting PDF file are garbled in Adobe Reader 9 on Linux (and Okular shows some strange symbols in bookmark pane too)

Is it a driver issue? Any suggestion how to overcome this problem?

Here's a MWE:

\documentclass{article}    
\usepackage{hyperref} 
%\hypersetup{unicode=true}

\begin{document}  

\section{Test 1 čćžđš}    
Some text.\clearpage  

\section{Test 2 šđžćč}    
Some text.

\end{document}

A notice: I tried to post this question on comp.text.tex earlier, but something went wrong and it didn't show up. Anyway, if the post shows up later, I'll post the link here.

6
  • it is on c.t.t.
    – user2478
    Commented Jul 29, 2011 at 19:42
  • I can't find it :(
    – Meho R.
    Commented Jul 29, 2011 at 21:35
  • the answer from Heiko is also there
    – user2478
    Commented Jul 29, 2011 at 21:36
  • 1
    Is there a link? And if you're referring to this post (groups.google.com/group/comp.text.tex/browse_thread/thread/…), no, there is no answer which solves this issue.
    – Meho R.
    Commented Jul 29, 2011 at 22:55
  • @Meho: yes, it would be great if you would post that as answer and accept it.
    – Stefan Kottwitz
    Commented Aug 20, 2011 at 14:28

3 Answers 3

23

I received an email from Heiko suggesting that I try auto pdfencoding which worked indeed. So, the solution is:

\hypersetup{pdfencoding=auto}

And corrected MWE from above:

\documentclass{article}    
\usepackage{hyperref} 
\hypersetup{%
    pdfencoding=auto,
    pdfauthor={Author Test ČĆŽĐŠ},
    pdftitle={Title test, čćžđš}
    }

\begin{document}  

\section{Test 1 čćžđš}    
Some text.\clearpage  

\section{Test 2 šđžćč}    
Some text.

\end{document}

Complete Heiko's answer can be found on comp.text.tex.

3

Even with pdfencoding=auto, I had trouble with either the bookmarks or the metadata or the page numbers. But all three come out perfectly if I use the navigator package rather than hyperref.

3
  • 2
    Yes, I noticed that metadata gets messed up sometimes. The solution might be to use \hypersetup locally, that is, e.g., \hypersetup{pdfencoding=utf8} before specifying author name, title and other metadata stuff, then \hypersetup{pdfencoding=auto} after that, to get bookmarks and numbers displayed correctly.
    – Meho R.
    Commented Oct 28, 2011 at 0:46
  • 3
    This solution breaks my metadata. Putting pdfencoding=auto on first place in the package option (\usepackage[pdfencoding=auto]{hyperref}) does everything right. Is that kind of a bug in hyperref? Shouldn't "auto" be default?
    – LaRiFaRi
    Commented Jul 19, 2013 at 13:48
  • 1
    @LaRiFaRi not sure if you're still active here, but this fixed the problem for me. Would you consider posting it as a separate answer? It seems a shame it's buried in a comment. Commented May 31, 2020 at 19:24
1

Putting pdfencoding=auto on first place in the package option (\usepackage[pdfencoding=auto]{hyperref}) does everything right.

You must log in to answer this question.

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