Latex + CJK + Beamer制作中文PDF文档书签乱码问题的解决

试验了很久,终于找到解决方案。参考http://hi.baidu.com/wtx358/blog/item/8e94698969f771b40e244463.html

本质的问题是CJK支持uft8编码,但是beamer没有CJKutf8选项。因此,修改beamer.cls文件,增加一块关于CJKuft8的定义即可。

转贴上面链接中的内容:

\DeclareOptionBeamer{CJK}{\ExecuteOptionsBeamer{cjk}}

\DeclareOptionBeamer{cjk}{

\def\beamer@hypercjk{\hypersetup{CJKbookmarks=true}}

\def\beamer@activecjk{

% Activate all >128 characters.

\count@=127

\@whilenum\count@<255 \do{%

\advance\count@ by 1

\lccode`\~=\count@

\catcode\count@=\active

\lowercase{\def~{\kern1ex}}

}

}

}

把% Activate all >128 characters.改成% Activate all >=0x80 characters. 然后在后加上下面几句:

 

\DeclareOptionBeamer{CJKutf8}{\ExecuteOptionsBeamer{cjkutf8}}

\DeclareOptionBeamer{cjkutf8}{%

\PassOptionsToPackage{unicode}{hyperref}

\def\beamer@activecjk{

% Activate all characters >= 0x80.

\count@=127

\@whilenum\count@<254 \do{%

\advance\count@ by 1

\lccode`\~=\count@

\catcode\count@=\active

\lowercase{\def~{\kern1ex}}

}

}

}

之后用\documentclass[CJKutf8]{beamer}调用beamer类,并用\usepackage{CJKutf8}来使用CJKutf8宏包,之后按常规使用中文环境,最后用pdflatex编译 .tex文档两次即可。

texlive中手动安装latex包

有tlmgr就用它,

没有,可以下载源文件安装:
1. download the package files, especially the ins and dtx file
2. compile the ins file (latex name.ins). that should result in a name.sty file.
3. create a directory for the new package: sudo mkdir /usr/share/texmf-texlive/tex/latex/name/
4. copy name.sty to the latex directory: sudo cp /usr/share/texmf-texlive/tex/latex/name/
(note, you can also store them in your home directory, but I haven’t tried that yet)
5. important: be sure the file has permissions: -rw-r–r–. If in doubt, run sudo chmod 644 name.sty
6. update latex to recognize the new package by running texhash /usr/share/texmf-texlive
7. OPTIONAL – compile latex name.dtx to get the documentation

转自:Judson’s Notes