latex之hyperref包

作者:金良([email protected]) csdn博客:http://blog.csdn.net/u012176591


1.编译出错

导言区引入包\usepackage{hyperref},用命令pdfLaTeX进行编译,出错:

! Improper alphabetic constant.
<to be read again> 
                   \@tempcntb 
l.54 \section{前言}
                   
? 
问题扩展
作为中文支持来讲,CCT,CJK长期占据了国内的TeX用户,这两个都有不少各自的问题,现在来讲,xeCJK即XeTeX 在中文支持上更有优势。
ctex包,把如上几个中文支持方式进行了集成,实际还是原有的CJK或者CCT,有了局部的改进,比如CJK中英文间距等等,所以在使用ctex包时,通常编译的时候使用的中文支持还是CJK,故而上面的问题的解决如下。

解决方案
给hyperref包加上一个选项
\usepackage[CJKbookmarks=true]{hyperref}

错误就消失了。

2.更改默认设置

这样能确保生成的pdf文件中包含有可以用鼠标进行点击的超链接。但是这样存在一个问题,就是这些包含超链接的文本周围会出现红色的方框,这种方框显得很违和,尤其是当出现在目录中时,大片的方框非常难看。如下图所示:
latex之hyperref包_第1张图片

客服以上问题的方法是,不要使用“hyperref”宏包的默认属性,即使用如下方式引入宏包:
\usepackage[colorlinks,linkcolor=red,anchorcolor=blue,citecolor=green]{hyperref}
“colorlinks”的意思是将超链接以颜色来标识,而并非使用默认的方框来标识。
linkcolor, anchorcolor, citecolor分别表示用来标识link, anchor, cite等各种链接的颜色。
若正式的文档中不想使用彩色的标识,但又希望具有超链接的功能,则将上例中的各种颜色换成“black”即可。
相关链接请参考 http://www.tug.org/applications/hyperref/manual.html#x1-40003
下面是相关内容:
3.5 Extension options

extension	text		
Set the file extension (e.g. dvi) which will be appended to file links created if you use the xr package.
hyperfigures	boolean		
backref	text	false	
Adds ‘backlink’ text to the end of each item in the bibliography, as a list of section numbers. This can only work properly if there is a blank line after each \bibitem. Supported values are section, slide, page, none, or false. If no value is given, section is taken as default.
pagebackref	boolean	false	
Adds ‘backlink’ text to the end of each item in the bibliography, as a list of page numbers.
hyperindex	boolean	true	
Makes the page numbers of index entries into hyperlinks. Relays on unique page anchors (pageanchor, …)
pageanchors and plainpages=false.
hyperfootnotes	boolean	true	
Makes the footnote marks into hyperlinks to the footnote text. Easily broken …
encap			
Sets encap character for hyperindex
linktocpage	boolean	false	
make page number, not text, be link on TOC, LOF and LOT
breaklinks	boolean	false	
allow links to break over lines by making links over multiple lines into PDF links to the same target
colorlinks	boolean	false	
Colors the text of links and anchors. The colors chosen depend on the the type of link. At present the only types of link distinguished are citations, page references, URLs, local file references, and other links. Unlike colored boxes, the colored text remains when printing.
linkcolor	color	red	
Color for normal internal links.
anchorcolor	color	black	
Color for anchor text.
citecolor	color	green	
Color for bibliographical citations in text.
filecolor	color	cyan	
Color for URLs which open local files.
menucolor	color	red	
Color for Acrobat menu items.
runcolor	color	filecolor	
Color for run links (launch annotations).
urlcolor	color	magenta	
Color for linked URLs.
allcolors	color		
Set all color options (without border and field options).
frenchlinks	boolean	false	
Use small caps instead of color for links.
hidelinks			
Hide links (removing color and border).
Note that all color names must be defined before use, following the normal system of the standard LATEX color package.
3.6 PDF-specific display options

bookmarks	boolean	true	
A set of Acrobat bookmarks are written, in a manner similar to the table of contents, requiring two passes of LATEX. Some postprocessing of the bookmark file (file extension .out) may be needed to translate LATEX codes, since bookmarks must be written in PDFEncoding. To aid this process, the .out file is not rewritten by LATEX if it is edited to contain a line \let\WriteBookmarks\relax
bookmarksopen	boolean	false	
If Acrobat bookmarks are requested, show them with all the subtrees expanded.
bookmarksopenlevel	parameter		
level (\maxdimen) to which bookmarks are open
bookmarksnumbered	boolean	false	
If Acrobat bookmarks are requested, include section numbers.
bookmarkstype	text	toc	
to specify which ‘toc’ file to mimic
CJKbookmarks	boolean	false	
This option should be used to produce CJK bookmarks. Package hyperref supports both normal and preprocessed mode of the CJK package; during the creation of bookmarks, it simply replaces CJK’s macros with special versions which expand to the corresponding character codes. Note that without the ‘unicode’ option of hyperref you get PDF files which actually violate the PDF specification because non-Unicode character codes are used – some PDF readers localized for CJK languages (most notably Acroread itself) support this. Also note that option ‘CJKbookmarks’ cannot be used together with option ‘unicode’.
No mechanism is provided to translate non-Unicode bookmarks to Unicode; for portable PDF documents only Unicode encoding should be used.
pdfhighlight	name	/I	
How link buttons behave when selected; /I is for inverse (the default); the other possibilities are /N (no effect), /O (outline), and /P (inset highlighting).
citebordercolor	RGB color	0 1 0	
The color of the box around citations
filebordercolor	RGB color	0 .5 .5	
The color of the box around links to files
linkbordercolor	RGB color	1 0 0	
The color of the box around normal links
menubordercolor	RGB color	1 0 0	
The color of the box around Acrobat menu links
urlbordercolor	RGB color	0 1 1	
The color of the box around links to URLs
runbordercolor	RGB color	0 .7 .7	
Color of border around ‘run’ links
allbordercolors			
Set all border color options
pdfborder		0 0 1	
The style of box around links; defaults to a box with lines of 1pt thickness, but the colorlinks option resets it to produce no border.




你可能感兴趣的:(latex,书签,编译错误,hyperref)