pdftex driver of hyperref package doesn't work with utf-8 encoded .tex files
Asked Answered
U

2

6

i use pdflatex to generate pdf files. my source files are all utf-8 encoded because of non-english characters. without \usepackage{hyperref} code, they can be compiled without any problem. but when i put \usepackage{hyperref} (even without any \href{}{} code) in the package list, an error would occur, saying

**************************************
! Use of \@chapter doesn't match its definition.  
\CJK@altchar ...fx \csname \reserved@a \endcsname   
                                                  \relax \CJKsymbol {\@tempc...  
l.1 \chapter{XXX}                    
?  
**************************************

where "XXX" represents non-english characters.

then i googled a lot, finding the cause is that hyperref uses pdftex drivers, which doesn't work with utf-8 encoded files. i checked this page: http://www.tug.org/applications/hyperref/manual.html , and failed to find any driver suitable for pdflatex.

i tried \usepackage[utf8]{inputenc}, but still couldn't get it to work.

so anyone could help me? thank you!

Unchartered answered 4/1, 2011 at 9:52 Comment(0)
D
6

Have you tried loading hyperref using \usepackage[unicode]{hyperref}, or, equivalently, specifying \hypersetup{ unicode = true } right after ? This should enable you to use unicode characters in bookmarks.

Dnieper answered 14/1, 2011 at 23:24 Comment(1)
This solved it for me (utf8 names in PDF chapters using lualatex). Note that two recompilations might be needed (to update the table of contents).Box
Q
2

Try this, works for me. Instead of:

\usepackage[pdftex, unicode,
            pdfauthor={çç êÊ},
            pdftitle={T\'{o}picos Avançados ôô},
            pdfsubject={Trabalho 6},
            pdfkeywords={a1, a2},
            pdfproducer={Latex with hyperref},
            pdfcreator={pdflatex}]{hyperref}

I do:

\usepackage[pdftex, unicode,
            pdfproducer={Latex with hyperref},
            pdfcreator={pdflatex}]{hyperref}

\hypersetup{
  pdfauthor={çç êÊ},
  pdftitle={T\'{o}picos Avançados ôô},
  pdfsubject={Trabalho 6},
  pdfkeywords={a1, a2},
}

I hope it works for you too.

Quinonez answered 23/5, 2015 at 22:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.