开发者

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

开发者 https://www.devze.com 2023-02-02 22:48 出处:网络
i use pdflatex to generate pdf f开发者_JAVA技巧iles. my source files are all utf-8 encoded because of non-english characters. without \\usepackage{hyperref} code, they can be compiled without any prob

i use pdflatex to generate pdf f开发者_JAVA技巧iles. 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!


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消