看板LaTeX
标 题[问题]hyperref 搭配中文 \addcontentsline 的问题
发信站SayYA 资讯站 (Sat Nov 3 00:44:42 2007)
转信站ptt!ctu-reader!ctu-peer!news.nctu!News.Math.NCTU!SayYa
问题是这样的
一开始用 addcontentsline 时当内容是中文没什麽问题
後来想加上 hyper reference 用 package hyperref
一开始没有发现是内容为中文时才有问题 (请参考例子三)
找了一阵子之後做了例子一与例子二两个测试之後
才发现 addcontentsline 的内容是英文时使用 hyperref 正常
但是 如果内容是中文则 会有例子三的 error message
大意是 {\nameCSecondPage } 里面多了 "\"
找了许久没有找到答案 ......
目前是暂时使用例子二的作法英文内容加上 hyperref
不过如可以可以找到例子三的问题那就更好了
谢谢!
例子一: 中文内容 + no hyperref [1][2]=> ok
<quote src=[1]>
\usepackage[draft,hyperindex=true,backref,colorlinks=true]{hyperref}
\newcommand{\nameFirstPage}{First page}
\newcommand{\nameSecondPage}{Second Page}
\newcommand{\nameCSecondPage}{第二页}
\addcontentsline{toc}{chapter}{\nameFirstPage}
\newpage{\thispagestyle{empty} \
\addcontentsline{toc}{chapter}{\nameSecondPage}\mbox{}\clearpage}
\newpage{\thispagestyle{empty} \
\addcontentsline{toc}{chapter}{\nameCSecondPage}\mbox{}\clearpage}
</quote>
例子二: 英文内容 + hyperref [3][4] => ok
<quote src=[2]>
\usepackage[final,hyperindex=true,backref,colorlinks=true]{hyperref}
[......]
\newcommand{\nameFirstPage}{First page}
\newcommand{\nameSecondPage}{Second Page}
\newcommand{\nameCSecondPage}{第二页}
\addcontentsline{toc}{chapter}{\nameFirstPage}
\newpage{\thispagestyle{empty} \
\addcontentsline{toc}{chapter}{\nameSecondPage}\mbox{}\clearpage}
%\newpage{\thispagestyle{empty} \
%\addcontentsline{toc}{chapter}{\nameCSecondPage}\mbox{}\clearpage}
</quote>
例子三:中文内容 + hyperref [5] => fail
<quote src=[5]>
\usepackage[final,hyperindex=true,backref,colorlinks=true]{hyperref}
\newcommand{\nameFirstPage}{First page}
\newcommand{\nameSecondPage}{Second Page}
\newcommand{\nameCSecondPage}{第二页}
\addcontentsline{toc}{chapter}{\nameFirstPage}
\newpage{\thispagestyle{empty} \
\addcontentsline{toc}{chapter}{\nameSecondPage}\mbox{}\clearpage}
\newpage{\thispagestyle{empty} \
\addcontentsline{toc}{chapter}{\nameCSecondPage}\mbox{}\clearpage}
</quote>
<quote src=error message>
[1]
! Argument of \reserved@a has an extra }.
<inserted text>
\par
l.17 ...ntentsline{toc}{chapter}{\nameCSecondPage}
\mbox{}\clearpage}
</quote>
[1]
http://suglwu.blogdns.org/wiki/images/cname_nohyperref.tex
[2]
http://suglwu.blogdns.org/wiki/images/cname_nohyperref.pdf
[3]
http://suglwu.blogdns.org/wiki/images/ename_hyperref.tex
[4]
http://suglwu.blogdns.org/wiki/images/ename_hyperref.pdf
[5]
http://suglwu.blogdns.org/wiki/images/cname_hyperref.tex
--
我是路过的路人
--
※ Origin: SayYA 资讯站 <bbs.sayya.org>
◆ From: ee704-ip156.et.ntust.edu.tw