【latex学习资料】Latex中的超链接(资料下载)

2012-12-04 11:25 阅读 821 次 评论关闭

1. 使用“hyperref”这个宏包，即在latex文档的导言部分添加“\usepackage{hyperref}”；
2. 使用“PdfLatex”对latex源文件进行编译，不要用“”编译。

If you need to make references to URLs, or write explicit links, the following low-level user macros are provided:

\href{URL}{text}

The text is made a hyperlink to the URL; this must be a full URL (relative to the base URL, if that is deﬁned). The special characters # and ~ do not need to be escaped in any way.

\url{URL}

Similar to \href{URL}{\nolinkurl{URL}}. Depending on the driver \href also tries to detect the link type. Thus the result can be a url link, ﬁle link, …

Write URL in the same way as \url, without creating a hyperlink.

\hyperbaseurl{URL}

A base URL is established, which is prepended to other speciﬁed URLs, to make it easier to write portable documents.

\hyperimage{imageURL}{text}

The link to the image referenced by the URL is inserted, using text as the anchor.

For drivers that produce HTML, the image itself is inserted by the browser, with the text being ignored completely.

\hyperdef{category}{name}{text}

A target area of the document (the text) is marked, and given the name category.name

\hyperref{URL}{category}{name}{text}

\hyperref[label]{text}

\hypertarget{name}{text}

A simple internal link is created with \hypertarget, with two parameters of an anchor name, and anchor text. \hyperlink has two arguments, the name of a hypertext object deﬁned somewhere by \hypertarget, and the text which be used as the link on the page.

Note that in HTML parlance, the \hyperlink command inserts a notional # in front of each link, making it relative to the current testdocument; \href expects a full URL.

\phantomsection

This sets an anchor at this location. It works similar to \hypertarget{}{} with an automatically choosen anchor name. Often it is used in conjunction with \addcontentsline for sectionlike things (index, bibliography, preface). \addcontentsline refers to the latest previous location where an anchor is set. Example:

Now the entry in the table of contents (and bookmarks) for the index points to the start of the index page, not to a location before this page.

\autoref{label}

This is a replacement for the usual \ref command that places a contextual label in front of the reference. This gives your users a bigger target to click for hyperlinks (e.g. ‘section2’instead of merely the number ‘2’).

The label is worked out from the context of the original \label command by hyperref by using the macros listed below (shown with their default values). The macros can be (re)deﬁned in documents using \(re)newcommand; note that some of these macros are already deﬁned in the standard document classes. The mixture of lowercase and uppercase initial letters is deliberate and corresponds to the author’s practice.

Latex中的超链接.doc