轉:latex中hyperref對目錄和參考文獻超鏈接以及顏色的設定

https://blog.csdn.net/ywh15387127537/article/details/82969087
http://blog.sina.com.cn/s/blog_6610db7a0102vptg.html
https://blog.csdn.net/ywh15387127537/article/details/82969087
https://blog.csdn.net/sweet_dew/article/details/43451475

在Latex生成的pdf文檔中建立超鏈接(如從正文到參考文獻,從目錄到相應內容,從頁碼編號到實際頁面等),有利於讀者快速定位當前閱讀的信息。

如何在生成的pdf文件中包含超鏈接呢?需要注意一下兩點:

1. 使用“hyperref”這個宏包,即在latex文檔的導言部分添加“\usepackage{hyperref}”;
2. 使用“PDFLaTeX”對latex源文件進行編譯,不要用“LaTeX”編譯。

這樣能確保生成的pdf文件中包含有可以用鼠標進行點擊的超鏈接。但是這樣存在一個問題,就是這些包含超鏈接的文本週圍會出現彩色的方框,這種方框實在有礙觀瞻,尤其是當出現在目錄中時,大片的方框非常難看。

克服以上問題的方法是,不要使用“hyperref”宏包的默認屬性,即使用如下方式引入宏包:

\usepackage[colorlinks,
            linkcolor=red,
            anchorcolor=blue,
            citecolor=green
            ]{hyperref}

colorlinks”的意思是將超鏈接以顏色來標識,而並非使用默認的方框來標識。
linkcolor, anchorcolor, citecolor分別表示用來標識link, anchor, cite等各種鏈接的顏色。
若正式的文檔中不想使用彩色的標識,但又希望具有超鏈接的功能,則將上例中的各種顏色換成“black”即可。

如果您的pdf製作中文書籤有亂碼如下命令,就OK了

\usepackage[dvipdfm,  %pdflatex,pdftex這裏決定運行文件的方式不同
            pdfstartview=FitH,
            CJKbookmarks=true,
            bookmarksnumbered=true,
            bookmarksopen=true,
            colorlinks, %註釋掉此項則交叉引用爲彩色邊框(colorlinkspdfborder同時註釋掉)
            pdfborder=001,   %註釋掉此項則交叉引用爲彩色邊框
            linkcolor=green,
            anchorcolor=green,
            citecolor=green
            ]{hyperref}  

若正式的文檔中不想使用彩色的標識,但又希望具有超鏈接的功能,則將上例中的各種顏色換成“black”即可。
\href{URL}{text}
\url{URL}
\nolinkurl{URL}
\hyperbaseurl{URL}
\hyperimage{imageURL}{text}
\hyperdef{category}{name}{text}
\hyperref{URL}{category}{name}{text}
\hyperref[label]{text}
\hyperlink{name}{text}
\hypertarget{name}{text}
\phantomsection
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{\indexname}
\printindex
\autoref{label}

· \url{網址}:生成網址鏈接,以等寬字體排版;

· \href{網址}{描述}:生成網址鏈接,以正常字體顯示描述,隱藏網址。

選項中可供設置的常用選項見下表:

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

boolean

FALSE

Adds ‘backlink’ text to the end of each item in the bibliography, as list of section numbers. This can only work properly if there is blank line after each \bibitem.

pagebackref

boolean

FALSE

Adds ‘backlink’ text to the end of each item in the bibliography, as 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.

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

magenta

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

cyan

Color for linked URLs.

frenchlinks

boolean

FALSE

use small caps instead of color for links

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章