Skip to content

Instantly share code, notes, and snippets.

@wilx
Last active May 8, 2017 17:51
Show Gist options
  • Save wilx/b12ace4d82922848ee8e237cbf2f9e57 to your computer and use it in GitHub Desktop.
Save wilx/b12ace4d82922848ee8e237cbf2f9e57 to your computer and use it in GitHub Desktop.
\section{Introduction}\label{introduction}
This package is used to emend cross-referencing commands in LaTeX to
produce some sort of \lstinline!\special! commands; there are backends
for the \lstinline!\special! set defined for HyperTeX dvi processors,
for embedded pdfmark commands for processing by Acrobat Distiller (dvips
and dvipsone), for dviwindo, for pdfTeX, for dvipdfm, for TeX4ht, and
for VTEX's pdf and HTML backends.
Included are:
\begin{enumerate}
\def\labelenumi{\alph{enumi})}
\tightlist
\item
\lstinline!backref!: a package by David Carlisle to provide links back
from bibliography to the main text; these are hypertext links after
using \lstinline!hyperref!.
\item
\lstinline!nameref!: a package to allow reference to the \emph{names}
of sections rather than their numbers.
\end{enumerate}
\section{Download}\label{download}
\lstinline!hyperref! is available on CTAN:macros/latex/contrib/hyperref/
Also a ZIP file is provided that contains the files, already sorted in a
TDS tree: CTAN:install/macros/latex/contrib/hyperref.tds.zip
\lstinline!CTAN:! means one of the `Comprehensive TeX Archive Network'
nodes or one of its mirrors. This is explained in
\url{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=archives}
The main repository of \lstinline!hyperref! is located at GitHub
\url{https://github.com/ho-tex/hyperref}
\section{Installation}\label{installation}
\subsection{Installation with ZIP file in TDS
format}\label{installation-with-zip-file-in-tds-format}
The ZIP file \lstinline!hyperref.tds.zip! contains the files sorted in a
TDS tree. Thus you can directly unpack the ZIP file inside a TDS tree.
(See CTAN:tds.zip for an explanation of TDS.)
Example:
\begin{lstlisting}
cd /...somewhere.../texmf
unzip /...downloadpath.../hyperref.tds.zip
\end{lstlisting}
Do not forget to refresh the file name database of this TDS tree,
Example:
\begin{lstlisting}
texhash /...somewhere.../texmf
\end{lstlisting}
\subsection{Manual installation}\label{manual-installation}
\begin{enumerate}
\def\labelenumi{\alph{enumi})}
\item
Download the \lstinline!hyperref! files from CTAN or the TUG server.
If necessary, unpack them.
\item
If directory \lstinline!beta! exists, replace the files by the
counterparts in this directory, if you want to use the latest
versions.
\item
Generate the package and driver files:
\begin{lstlisting}
tex hyperref.ins
\end{lstlisting}
\item
Install the files \lstinline!*.sty!, \lstinline!*.def!, and
\lstinline!*.cfg! in your TDS tree:
\begin{lstlisting}
cp *.sty *.def *.cfg TDS:tex/latex/hyperref/
\end{lstlisting}
Replace \lstinline!TDS:! by the prefix of your TDS tree (texmf
directory). The exception is bmhydoc.sty, it belongs to the source
files (TDS:source/latex/hyperref/).
\item
Copy the documentation files to ``TDS:doc/latex/hyperref/'':
\lstinline!manual.pdf!, \lstinline!README!, \lstinline!README.pdf!,
\lstinline!ChangeLog!, \lstinline!ChangeLog.pdf!,
\lstinline!slides.pdf!, \lstinline!paper.pdf!,
\lstinline!options.pdf!, \lstinline!hyperref.pdf!,
\lstinline!backref.pdf!, \lstinline!nameref.pdf! (Also the HTML
version of the manual can be put there.)
\item
Update the databases if necessary, eg. for teTeX:
\begin{lstlisting}
mktexlsr .../texmf
\end{lstlisting}
\end{enumerate}
\section{Additional Packages}\label{additional-packages}
Depending on the driver and option settings, \lstinline!hyperref! loads
other packages:
\begin{itemize}
\tightlist
\item
atbegshi.sty: CTAN:macros/latex/contrib/oberdiek/atbegshi.pdf
\item
atveryend.sty: CTAN:macros/latex/contrib/oberdiek/atveryend.pdf
\item
backref.sty (loaded by option \lstinline!backref! or
\lstinline!pagebackref!):
CTAN:macros/latex/contrib/hyperref/backref.dtx
\item
bigintcalc.sty (loaded by package \lstinline!bitset!):
CTAN:macros/latex/contrib/oberdiek/bigintcalc.pdf
\item
bitset.sty: CTAN:macros/latex/contrib/oberdiek/bitset.pdf
\item
color.sty (loaded by option \lstinline!colorlinks!):
CTAN:macros/latex/required/graphics/
\item
etexcmds.sty: CTAN:macros/latex/contrib/oberdiek/etexcmds.pdf
\item
gettitlestring.sty (loaded by package \lstinline!nameref!):
CTAN:macros/latex/contrib/oberdiek/gettitlestring.pdf
\item
hycolor.sty: CTAN:macros/latex/contrib/oberdiek/hycolor.pdf
\item
infwarerr.sty (loaded by packages \lstinline!etexcmds!,
\lstinline!stringenc!, \lstinline!atbegshi!, \lstinline!bitset!):
CTAN:macros/latex/contrib/oberdiek/infwarerr.pdf
\item
intcalc.sty: CTAN:macros/latex/contrib/oberdiek/intcalc.pdf
\item
ifpdf.sty (loaded by package \lstinline!atbegshi!):
CTAN:macros/latex/contrib/oberdiek/atbegshi.pdf
\item
ifluatex.sty (loaded by package \lstinline!pdftexcmds!):
CTAN:macros/latex/contrib/oberdiek/ifluatex.pdf
\item
ifvtex.sty: CTAN:macros/latex/contrib/oberdiek/ifvtex.pdf
\item
ifxetex.sty: CTAN:macros/generic/ifxetex/ifxetex.sty
\item
intcalc.sty (loaded by package \lstinline!bitset!):
CTAN:macros/latex/contrib/oberdiek/intcalc.pdf
\item
keyval.sty CTAN:macros/latex/required/graphics/
\item
kvdefinekeys.sty CTAN:macros/latex/contrib/oberdiek/kvsetkeys.pdf
\item
kvoptions.sty: CTAN:macros/latex/contrib/oberdiek/kvoptions.pdf
\item
kvsetkeys.sty: CTAN:macros/latex/contrib/oberdiek/kvsetkeys.pdf
\item
letltxmacro.sty: CTAN:macros/latex/contrib/oberdiek/letltxmacro.pdf
\item
ltxcmds.sty (loaded by package \lstinline!pdftexcmds!):
CTAN:macros/latex/contrib/oberdiek/ltxcmds.pdf
\item
memhfixc.sty (loaded if class \lstinline!memoir! is loaded):
CTAN:macros/latex/contrib/memoir/memhfixc.sty
\item
nameref.sty: CTAN:macros/latex/contrib/hyperref/nameref.dtx
\item
pdfescape.sty (loaded by package \lstinline!stringenc!):
CTAN:macros/latex/contrib/oberdiek/pdfescape.pdf
\item
pdftexcmds.sty CTAN:macros/latex/contrib/oberdiek/pdftexcmds.pdf
\item
refcount.sty (loaded by package \lstinline!nameref!)
CTAN:macros/latex/contrib/oberdiek/refcount.pdf
\item
rerunfilecheck.sty:
CTAN:macros/latex/contrib/oberdiek/rerunfilecheck.pdf
\item
stringenc.sty: CTAN:macros/latex/contrib/oberdiek/stringenc.pdf
\item
tex4ht.sty (loaded by option \lstinline!tex4ht!): CTAN:support/TeX4ht/
\item
uniquecounter.sty (loaded by package \lstinline!rerunfilecheck!):
CTAN:macros/latex/contrib/oberdiek/uniquecounter.pdf
\item
url.sty CTAN:macros/latex/contrib/other/misc/url.sty
\item
vtexhtml.sty (loaded if VTeX is used in HTML mode)
\item
xcolor-patch.sty (loaded by package \lstinline!hycolor!)
CTAN:macros/latex/contrib/oberdiek/hycolor.pdf
\end{itemize}
\section{New Features}\label{new-features}
\subsection{\texorpdfstring{Option
\texttt{pdflinkmargin}}{Option pdflinkmargin}}\label{option-pdflinkmargin}
Option \lstinline!pdflinkmargin! is an experimental option for
specifying a link margin, if the driver supports this. Default is 1 pt
for supporting drivers.
pdfTeX:
\begin{itemize}
\tightlist
\item
The link area also depends on the surrounding box.
\item
Settings have local effect.
\item
When a page is shipped out, pdfTeX uses the current setting of the
link margin for all links on the page.
\end{itemize}
pdfmark:
\begin{itemize}
\tightlist
\item
Settings have global effect.
\end{itemize}
Other drivers: Unsupported.
\subsection{\texorpdfstring{Field option
\texttt{calculatesortkey}}{Field option calculatesortkey}}\label{field-option-calculatesortkey}
Fields with calculated values are calculated in document order by
default. If calculated field values depend on other calculated fields
that appear later in the document, then the correct calculation order
can be specified with option \lstinline!calculatesortkey!. Its value is
used as key to lexicographically sort the calculated fields. The sort
key do not need to be unique. Fields that share the same key are sorted
in document order.
Currently the field option \lstinline!calculatesortkey! is only
supported by the driver for pdfTeX.
\subsection{\texorpdfstring{Option
\texttt{localanchorname}}{Option localanchorname}}\label{option-localanchorname}
When an anchor is set (e.g.~via \lstinline!\refstepcounter!), then the
anchor name is globally set to the current anchor name.
For example:
\begin{lstlisting}[language=TeX]
\section{Foobar}
\begin{equation}\end{equation}
\label{sec:foobar}
\end{lstlisting}
With the default global setting (localanchorname=false) a reference to
\lstinline!sec:foobar! jumps to the equation before. With option
\lstinline!localanchorname! the anchor of the equation is forgotten
after the environment and the reference \lstinline!sec:foobar! jumps to
the section title.
Option \lstinline!localanchorname! is an experimental option, there
might be situations, where the anchor name is not available as expected.
\subsection{\texorpdfstring{Option
\texttt{customdriver}}{Option customdriver}}\label{option-customdriver}
The value of option \lstinline!customdriver! is the name of an external
driver file without extension \lstinline!.def!. The file must have
\lstinline!\ProvidesFile! with a version date and number that match the
date and number of \lstinline!hyperref!, otherwise a warning is given.
Because the interface, what needs to be defined in the driver, is not
well defined and quite messy, the option is mainly intended to ease
developing, testing, debugging the driver part.
\subsection{\texorpdfstring{Option
\texttt{psdextra}}{Option psdextra}}\label{option-psdextra}
LaTeX's NFSS is used to assist the conversion of arbitrary TeX strings
to PDF strings (bookmarks, PDF information entries). Many math command
names (\lstinline!\geq!, \lstinline!\notin!, \ldots{}) are not in
control of NFSS, therefore they are defined with prefix \lstinline!text!
(\lstinline!\textgeq!, \lstinline!\textnotin!, \ldots{}). They can be
mapped to short names during the processing to PDF strings. The
disadvantage is that they are many hundreds macros that need to be
redefined for each PDF string conversion. Therefore this can be enabled
or disabled as option \lstinline!psdextra!. On default the option is
turned off (set to \lstinline!false!). Turning the option on means that
the short names are available. Then \lstinline!\geq! can directly be
used instead of \lstinline!\textgeq!.
\subsection{\texorpdfstring{\texttt{\textbackslash{}XeTeXLinkBox}}{\textbackslash{}XeTeXLinkBox}}\label{xetexlinkbox}
When XeTeX generates a link annotation, it does not look at the boxes
(as the other drivers), but only at the character glyphs. If there are
no glyphs (images, rules, \ldots{}), then it does not generate a link
annotation. Macro \lstinline!\XeTeXLinkBox! puts its argument in a box
and adds spaces at the lower left and upper right corners. An additional
margin can be specified by setting it to the \lstinline!dimen! register
\lstinline!\XeTeXLinkMargin!. The default is 2pt.
Example:
\begin{lstlisting}[language=TeX]
% xelatex
\documentclass{article}
\usepackage{hyperref}
\setlength{\XeTeXLinkMargin}{1pt}
\begin{document}
\section{Hello World}
\newpage
\label{sec:hello}
\hyperref[sec:hello]{%
\XeTeXLinkBox{\rule{10mm}{10mm}}%
}
\end{document}
\end{lstlisting}
\subsection{\texorpdfstring{\texttt{\textbackslash{}IfHyperBooleanExists}
and
\texttt{\textbackslash{}IfHyperBoolean}}{\textbackslash{}IfHyperBooleanExists and \textbackslash{}IfHyperBoolean}}\label{ifhyperbooleanexists-and-ifhyperboolean}
\lstinline!\IfHyperBooleanExists{OPTION}{YES}{NO}!: If a
\lstinline!hyperref! OPTION is a boolean, that means it takes values
\lstinline!true! or \lstinline!false!, then
\lstinline!\IfHyperBooleanExists! calls YES, otherwise NO.
\lstinline!\IfHyperBoolean{OPTION}{YES}{NO}!: Macro
\lstinline!\IfHyperBoolean! calls YES, if OPTION exists as boolean and
is enabled. Otherwise NO is executed.
Both macros are expandable. Additionally option \lstinline!stoppedearly!
is available. It is enabled if \lstinline!\MaybeStopEarly! or
\lstinline!\MaybeStopNow! end \lstinline!hyperref! prematurely.
\subsection{\texorpdfstring{\texttt{\textbackslash{}unichar}}{\textbackslash{}unichar}}\label{unichar}
If a Unicode character is not supported by puenc.def, it can be given by
using \textbackslash{}unichar. It's name and syntax is inherited from
package \lstinline!ucs!. However it is defined independently for use in
\lstinline!hyperref!'s \lstinline!\pdfstringdef! (that converts
arbitrary TeX code to PDF strings or tries to do this).
Macro \lstinline!\unichar! takes a TeX number as argument, examples for
U+263A (WHITE SMILING FACE):
\begin{lstlisting}[language=TeX]
\unichar{"263A}% hexadecimal notation
\unichar{9786}% decimal notation
\end{lstlisting}
`\lstinline!"!' must not be a babel shorthand character or otherwise
active. Otherwise prefix it with \lstinline!\string!:
\begin{lstlisting}[language=TeX]
\unichar{\string"263A}% converts `"` to `"` with catcode 12 (other)
\end{lstlisting}
Users of \lstinline!(n)german! packages or \lstinline!babel! options may
use \lstinline!\dq! instead:
\begin{lstlisting}[language=TeX]
\unichar{\dq 263A}% \dq is double quote with catcode 12 (other)
\end{lstlisting}
\subsection{\texorpdfstring{\texttt{\textbackslash{}ifpdfstringunicode}}{\textbackslash{}ifpdfstringunicode}}\label{ifpdfstringunicode}
Some features of the PDF specification needs PDF strings. Examples are
bookmarks or the entries in the information dictionary. The PDF
specification allows two encodings \lstinline!PDFDocEncoding! (8-bit
encoding) and \lstinline!Unicode! (UTF-16). The user can help using
\lstinline!\texorpdfstring! to replace complicate TeX constructs by a
representation for the PDF string. However \lstinline!\texorpdfstring!
does not distinguish the two encodings. This gap closes
\lstinline!\ifpdfstringunicode!. It is only allowed in the second
argument of \lstinline!\texorpdfstring! and takes two arguments, the
first allows the full range of Unicode. The second is limited to the
characters available in \lstinline!PDFDocEncoding!.
As example we take a macro definition for the Vietnamese name of Han The
Thanh. Correctly written it needs some accented characters, one
character even with a double accent. Class \lstinline!tugboat.cls!
defines a macro for the typesetted name:
\begin{lstlisting}[language=TeX]
\def\Thanh{%
H\`an~%
Th\^e\llap{\raise 0.5ex\hbox{\'{}}}%
~Th\`anh%
}
\end{lstlisting}
It's not entirely correct, the second accent over the \lstinline!e! is
not an acute, but a hook. However standard LaTeX does not provide such
an accent.
Now we can extend the defintion to support \lstinline!hyperref!. The
first and the last word are already supported automatically. Characters
with two or more accents are a difficult business in LaTeX, because the
NFSS2 macros of the LaTeX kernel do not support more than one accent.
Therefore also puenc.def misses support for them. But we can provide it
using \textbackslash{}unichar. The character in question is:
\begin{lstlisting}
% U+1EC3 LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE
\end{lstlisting}
Thus we can put this together:
\begin{lstlisting}[language=TeX]
\def\Thanh{%
H\`an~%
\texorpdfstring{Th\^e\llap{\raise 0.5ex\hbox{\'{}}}}%
{\ifpdfstringunicode{Th\unichar{"1EC3}}{Th\^e}}%
~Th\`anh%
}
\end{lstlisting}
For \lstinline!PDFDocEncoding! (PD1) the variant above has dropped the
second accent. Alternatively we could provide a representation without
accents instead of wrong accents:
\begin{lstlisting}[language=TeX]
\def\Thanh{%
\texorpdfstring{%
H\`an~%
Th\^e\llap{\raise 0.5ex\hbox{\'{}}}}%
~Th\`anh%
}{%
\ifpdfstringunicode{%
H\`an Th\unichar{"1EC3} Th\`anh%
}{%
Han The Thanh%
}%
}%
}
\end{lstlisting}
\subsection{\texorpdfstring{Customizing index style file with
\texttt{\textbackslash{}nohyperpage}}{Customizing index style file with \textbackslash{}nohyperpage}}\label{customizing-index-style-file-with-nohyperpage}
Since version 2008/08/14 v6.78f.
For hyperlink support in the index, \lstinline!hyperref! inserts
\lstinline!\hyperpage! into the index macros. After processing with
\lstinline!Makeindex!, \lstinline!\hyperpage! analyzes its argument to
detect page ranges and page comma lists. However, only the standard
settings are supported directly:
\begin{lstlisting}
delim_r "--"
delim_n ", "
\end{lstlisting}
(See manual page/documentation of Makeindex that explains the keys that
can be used in style files for Makeindex.)
Customized versions of \lstinline!delim_r!, \lstinline!delim_n!,
\lstinline!suffix_2p!, \lstinline!suffix_3p!, \lstinline!suffix_mp!
needs markup that \lstinline!\hyperpage! can detect and knows that this
stuff does not belong to a page number. Makro \lstinline!\nohyperpage!
serves as this markup. Put the customized code for these keys inside
\textbackslash{}nohyperpage, e.g.:
\begin{lstlisting}
suffix_2p "\\nohyperpage{f.}"
suffix_3p "\\nohyperpage{ff.}"
\end{lstlisting}
(Depending on the typesetting tradition some space ``\lstinline!\\,!''
or ``\lstinline!~!'' should be put before the first f inside
\lstinline!\nohyperpage!.)
\subsection{\texorpdfstring{Experimental option
\texttt{ocgcolorlinks}}{Experimental option ocgcolorlinks}}\label{experimental-option-ocgcolorlinks}
The idea are colored links, when viewed, but printed without colors.
This new experimental option \lstinline!ocgcolorlinks! uses Optional
Content Groups, a feature introduced in PDF 1.5.
\begin{itemize}
\item
The option must be given for package loading:
\begin{lstlisting}[language=TeX]
\usepackage[ocgcolorlinks]{hyperref}
\end{lstlisting}
\item
Main disadvantage: Links cannot be broken across lines. PDF reference
1.7: 4.10.2 ``Making Graphical Content Optional'':
\begin{quote}
Graphics state operations, such as setting the color, \ldots{}, are
still applied.
\end{quote}
Therefore the link text is put in a box and set twice, with and
without color.
\item
The feature can be switched off by
\lstinline!\hypersetup{ocgcolorlinks=false}! inside the document.
\item
Supported drivers: pdftex, dvipdfm
\item
The PDF version should be at least 1.5. It is automatically set for
pdfTeX. Users of dvipdfmx set the version on the command line:
\begin{lstlisting}
dvipdfmx -V 5
\end{lstlisting}
\end{itemize}
\subsection{Option pdfa}\label{option-pdfa}
The new option \lstinline!pdfa! tries to avoid violations of PDF/A in
code generated by \lstinline!hyperref!. However, the result is usually
not in PDF/A, because many features aren't controlled by
\lstinline!hyperref! (XMP metadata, fonts, colors, driver dependend low
level stuff, \ldots{}).
Currently, option \lstinline!pdfa! sets and disables the following
items:
\begin{itemize}
\tightlist
\item
Enabled annotation flags: \lstinline!Print!, \lstinline!NoZoom!,
\lstinline!NoRotate! {[}PDF/A 6.5.3{]}.
\item
Disabled annotation flags: \lstinline!Hidden!, \lstinline!Invisible!,
\lstinline!NoView! {[}PDF/A 6.5.3{]}.
\item
Disabled: Launch action (\lstinline!\href{run:...}!) {[}PDF/A
6.6.1{]}.
\item
Restricted: Named actions (\lstinline!\Acrobatmenu!:
\lstinline!NextPage!, \lstinline!PrevPage!, \lstinline!FirstPage!,
\lstinline!LastPage!) {[}PDF/A 6.6.1{]}.
\item
Many things are disabled in PDF formulars:
\begin{itemize}
\tightlist
\item
JavaScript actions {[}PDF/A 6.6.1{]}
\item
Trigger events (additional actions) {[}PDF/A 6.6.2{]}
\item
Push button (because of JavaScript)
\item
Interactive Forms: Flag \lstinline!NeedAppearances! is the default
\lstinline!false! (Because of this, \lstinline!hyperref!'s
implementation of Forms looks ugly). {[}PDF/A 6.9{]}
\end{itemize}
\end{itemize}
The default value of the new option \lstinline!pdfa! is
\lstinline!false!. It influences the loading of the package and cannot
be changed after \lstinline!hyperref! is loaded
(\lstinline!\usepackage{hyperref}!).
ToDo:
\begin{itemize}
\tightlist
\item
XMP support
\item
\ldots{}
\end{itemize}
But perhaps Adobe Acrobat is now happy and can now convert the PDF file
to PDF/A.
\subsection{Option linktoc added}\label{option-linktoc-added}
The new option \lstinline!linktoc! allows more control which part of an
entry in the table of contents is made into a link:
\begin{itemize}
\tightlist
\item
\lstinline!linktoc=none! (no links)
\item
\lstinline!linktoc=section! (default behaviour, same as
\lstinline!linktocpage=false!)
\item
\lstinline!linktoc=page! (same as \lstinline!linktocpage=true!)
\item
\lstinline!linktoc=all! (both the section and page part are links)
\end{itemize}
\subsection{Option pdfnewwindow
changed}\label{option-pdfnewwindow-changed}
Before 6.77b:
\begin{itemize}
\tightlist
\item
\lstinline!pdfnewwindow=true! → \lstinline!/NewWindow true!
\item
\lstinline!pdfnewwindow=false! → (absent)
\item
unused \lstinline!pdfnewwindow! → (absent)
\end{itemize}
Since 6.77b:
\begin{itemize}
\tightlist
\item
\lstinline!pdfnewwindow=true! → \lstinline!/NewWindow true!
\item
\lstinline!pdfnewwindow=false! → \lstinline!/NewWindow false!
\item
\lstinline!pdfnewwindow={}! → (absent)
\item
unused \lstinline!pdfnewwindow! → (absent)
\end{itemize}
Rationale: There is a difference between setting to \lstinline!false!
and an absent entry. In the former case the new document replaces the
old one, in the latter case the PDF viewer application should respect
the user preference.
\subsection{Flag options for PDF
forms}\label{flag-options-for-pdf-forms}
PDF form field macros (\lstinline!\TextField!, \lstinline!\CheckBox!,
\ldots{}) support boolean flag options. The option name is the lowercase
version of the names in the PDF specification (1.7):
\begin{lstlisting}
http://www.adobe.com/devnet/pdf/pdf_reference.html
http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference.pdf
\end{lstlisting}
Options (convert to lowercase) except flags in square brackets:
\begin{itemize}
\item
Table 8.16 Annotation flags (page 608):
\begin{lstlisting}
1 Invisible
2 Hidden (PDF 1.2)
3 Print (PDF 1.2)
4 NoZoom (PDF 1.3)
5 NoRotate (PDF 1.3)
6 NoView (PDF 1.3)
[7 ReadOnly (PDF 1.3)] ignored for widget annotations, see table 8.70
8 Locked (PDF 1.4)
9 ToggleNoView (PDF 1.5)
10 LockedContents (PDF 1.7)
\end{lstlisting}
\item
Table 8.70 Field flags common to all field types (page 676):
\begin{lstlisting}
1 ReadOnly
2 Required
3 NoExport
\end{lstlisting}
\item
Table 8.75 Field flags specific to button fields (page 686):
\begin{lstlisting}
15 NoToggleToOff (Radio buttons only)
16 Radio (set: radio buttons, clear: check box, pushbutton: clear)
17 Pushbutton
26 RadiosInUniso (PDF 1.5)
\end{lstlisting}
\item
Table 8.77 Field flags specific to text fields (page 691):
\begin{lstlisting}
13 Multiline
14 Password
21 FileSelect (PDF 1.4)
23 DoNotSpellCheck (PDF 1.4)
24 DoNotScroll (PDF 1.4)
25 Comb (PDF 1.5)
26 RichText (PDF 1.5)
\end{lstlisting}
\item
Table 8.79 Field flags specific to choice fields (page 693):
\begin{lstlisting}
18 Combo (set: combo box, clear: list box)
19 Edit (only useful if Combo is set)
20 (Sort) for authoring tools, not PDF viewers
22 MultiSelect (PDF 1.4)
23 DoNotSpellCheck (PDF 1.4) (only useful if Combo and Edit are set)
27 CommitOnSelChange (PDF 1.5)
\end{lstlisting}
\item
Table 8.86 Flags for submit-form actions (page 704):
\begin{lstlisting}
[1 Include/Exclude] unsupported, use `noexport` (table 8.70) instead
2 IncludeNoValueFields
[3 ExportFormat] handled by option `export`
4 GetMethod
5 SubmitCoordinates
[6 XFDF (PDF 1.4)] handled by option `export`
7 IncludeAppendSaves (PDF 1.4)
8 IncludeAnnotations (PDF 1.4)
[9 SubmitPDF (PDF 1.4)] handled by option `export`
10 CanonicalFormat (PDF 1.4)
11 ExclNonUserAnnots (PDF 1.4)
12 ExclFKey (PDF 1.4)
14 EmbedForm (PDF 1.5)
\end{lstlisting}
\end{itemize}
New option \lstinline!export! sets the export format of a submit action.
Valid values are (upper- or lowercase):
\begin{itemize}
\tightlist
\item
FDF
\item
HTML
\item
XFDF
\item
PDF (not supported by Acrobat Reader)
\end{itemize}
\subsection{\texorpdfstring{Option
\texttt{pdfversion}}{Option pdfversion}}\label{option-pdfversion}
This is an experimental option. It notifies \lstinline!hyperref! about
the intended PDF version. Currently this is used in code for PDF forms
(implementation notes 116 and 122 of PDF spec 1.7).
Values: 1.2, 1.3, 1.4, 1.5, 1.6, 1.7. Values below 1.2 are not
supported, because most drivers expect higher PDF versions.
The option must be used early, not after
\lstinline!\usepackage{hyperref}!.
In theory this option should also set the PDF version, but this is not
generally supported.
\begin{itemize}
\tightlist
\item
pdfTeX below 1.10a: unsupported. pdfTeX \textgreater{}= 1.10a and
\textless{} 1.30: \lstinline!\pdfoptionpdfminorversion! pdfTeX
\textgreater{}= 1.30: \lstinline!\pdfminorversion!
\item
dvipdfm: configuration file, example: TeX Live 2007,
texmf/dvipdfm/config/config, entry \lstinline!V 2!.
\item
dvipdfmx: configuration file, example: TeX Live 2007,
texmf/dvipdfm/dvipdfmx.cfg, entry \lstinline!V 4!.
\item
Ghostscript: option -dCompatibilityLevel (this is set in
\lstinline!ps2pdf12!, \lstinline!ps2pdf13!, \lstinline!ps2pdf14!).
\end{itemize}
The current PDF version is used as default if this version can be
detected (only pdfTeX \textgreater{}= 1.10a). Otherwise the lowest
version 1.2 is assumed. Thus \lstinline!hyperref! tries to avoid PDF
code that breaks this version, but is free to use ignorable higher PDF
features.
\subsection{Field option name}\label{field-option-name}
Many form objects uses the label argument for several purposes:
\begin{itemize}
\tightlist
\item
Layouted label.
\item
As name in HTML structures.
\end{itemize}
Code that is suitable for layouting with TeX can break in the structures
of the output format. If option \lstinline!name! is given, then its
value is used as name in the different output structures. Thus the value
should consist of letters only.
\subsection{Option pdfencoding}\label{option-pdfencoding}
The PDF format allows two encodings for bookmarks and entries in the
information dictionary: \lstinline!PDFDocEncoding! and
\lstinline!Unicode! as UTF-16BE. Option \lstinline!pdfencoding! selects
between these encodings:
\begin{itemize}
\tightlist
\item
\lstinline!pdfdoc! uses \lstinline!PDFDocEncoding!. It uses just one
byte per character, but the supported characters are limited (244 in
PDF-1.7).
\item
\lstinline!unicode! sets Unicode. It is encoded as UTF-16BE. Two bytes
are used for most characters, surrogates need four bytes.
\item
\lstinline!auto! \lstinline!PDFDocEncoding! if the string does not
contain characters outside the encoding and \lstinline!Unicode!
otherwise.
\end{itemize}
\subsection{Color options/package
hycolor}\label{color-optionspackage-hycolor}
See documentation of package \lstinline!hycolor!.
\subsection{Option pdfusetitle}\label{option-pdfusetitle}
If option \lstinline!pdfusetitle! is set then \lstinline!hyperref! tries
to derive the values for \lstinline!pdftitle! and \lstinline!pdfauthor!
from \lstinline!\title! and \lstinline!\author!. An optional argument
for \lstinline!\title! and \lstinline!\author! is supported (class
\lstinline!amsart!).
\subsection{Starred form of
\textbackslash{}autoref}\label{starred-form-of-autoref}
\lstinline!\autoref*! generates a reference without link as
\lstinline!\ref*! or \lstinline!\pageref*!.
\subsection{Link border style}\label{link-border-style}
Links can be underlined instead of the default rectangle or options
\lstinline!colorlinks!, \lstinline!frenchlinks!. This is done by option
\lstinline!pdfborderstyle={/S/U/W 1}!
Some remarks:
\begin{itemize}
\item
AR7/Linux seems to have a bug, that don't use the default value
\lstinline!1! for the width, but zero, thus that the underline is not
visible without \lstinline!/W 1!. The same applies for dashed boxes,
eg.:
\begin{lstlisting}
pdfborderstyle={/S/D/D[3 2]/W 1}
\end{lstlisting}
\item
The syntax is described in the PDF specification, look for ``border
style'', e.g., Table 8.13 ``Entries in a border style dictionary''
(specification for version 1.6)
\item
The border style is removed by
\begin{lstlisting}
pdfborderstyle={}
\end{lstlisting}
This is automatically done if option \lstinline!colorlinks! is
enabled.
\item
Be aware that not all PDF viewers support this feature, not even
Acrobat Reader itself:
Some support:
\begin{itemize}
\tightlist
\item
AR7/Linux: \lstinline!underline! and \lstinline!dashed!, but the
border width must be given.
\item
xpdf 3.00: \lstinline!underline! and \lstinline!dashed!
\end{itemize}
Unsupported:
\begin{itemize}
\tightlist
\item
AR5/Linux
\item
ghostscript 8.50
\end{itemize}
\end{itemize}
\subsection{Option bookmarksdepth}\label{option-bookmarksdepth}
The depth of the bookmarks can be controlled by the new option
\lstinline!bookmarksdepth!. The option acts globally and distinguishes
three cases:
\begin{itemize}
\item
\lstinline!bookmarksdepth! without value: Then \lstinline!hyperref!
uses the current value of counter \lstinline!tocdepth!. This is the
compatible behaviour and the default.
\item
\lstinline!bookmarksdepth=<number>!, the value is number (also
negative): The depth for the bookmarks are set to this number.
\item
\lstinline!bookmarksdepth=<name>!: The \lstinline!<name>! is a
document division name (part, chapter, \ldots{}). It must not start
with a digit or minus to avoid mixing up with the number case.
Internally \lstinline!hyperref! uses the value of macro
\lstinline!\toclevel@<name>!.
\end{itemize}
Examples:
\begin{lstlisting}[language=TeX]
\hypersetup{bookmarksdepth=paragraph}
\hypersetup{bookmarksdepth=4} % same as before
\hypersetup{bookmarksdepth} % counter "tocdepth" is used
\end{lstlisting}
\subsection{Option pdfescapeform}\label{option-pdfescapeform}
There are many places where arbitrary strings end up as PS or PDF
strings. The PS/PDF strings in parentheses form require the protection
of some characters, e.g.~unmatched left or right parentheses need
escaping or the escape character itself (backslash).
Since 2006/02/12 v6.75a the PS/PDF driver should do this automatically.
However I assume a problem with compatibility, especially regarding the
form part where larger amounts of JavaScript code can be present. It
would be a pain to remove all the escaping, because an additional
escaping layer can falsify the code.
Therefore a new option pdfescapeform was introduced:
\begin{itemize}
\tightlist
\item
\lstinline!pdfescapeform=false!: Escaping for the formulars are
disabled, this is the compatibility behaviour, therefore this is the
default.
\item
\lstinline!pdfescapeform=true!: Then the PS/PDF drivers do all the
necessary escaping. This is the logical choice and the recommended
setting. For example, the user writes JavaScript as JavaScript and do
not care about escaping characters for PS/PDF output.
\end{itemize}
\subsection{Default driver setting}\label{default-driver-setting}
(\lstinline!hyperref! \textgreater{}= 6.72s)
If no driver is given, \lstinline!hyperref! tries its best to guess the
most suitable driver. Thus it loads \lstinline!hpdftex!, if pdfTeX is
detected running in PDF mode. Or it loads the corresponding VTeX driver
for VTeX's working modes.
Unhappily many driver programs run after the TeX compiler, so
\lstinline!hyperref! does not have a chance (dvips, dvipdfm, \ldots{}).
In this case driver \lstinline!hypertex! is loaded that supports the
HyperTeX features that are recognized by xdvi for example. This
behaviour, however, can easily be changed in the configuration file
\lstinline!hyperref.cfg!:
\begin{lstlisting}
\providecommand*{\Hy@defaultdriver}{hdvips}
\end{lstlisting}
for dvips, or
\begin{lstlisting}
\providecommand*{\Hy@defaultdriver}{hypertex}
\end{lstlisting}
for the default behaviour of \lstinline!hyperref!.
See also the new option \lstinline!driverfallback!.
\subsection{Backref entries}\label{backref-entries}
Alternative interface for formatting of backref entries, example:
\begin{lstlisting}[language=TeX]
\documentclass[12pt,UKenglish]{article}
\usepackage{babel}
\usepackage[pagebackref]{hyperref}
% Some language options are detected by package backref.
% This affects the following macros:
% \backrefpagesname
% \backrefsectionsname
% \backrefsep
% \backreftwosep
% \backreflastsep
\renewcommand*{\backref}[1]{
% default interface
% #1: backref list
%
% We want to use the alternative interface,
% therefore the definition is empty here.
}
\renewcommand*{\backrefalt}[4]{%
% alternative interface
% #1: number of distinct back references
% #2: backref list with distinct entries
% #3: number of back references including duplicates
% #4: backref list including duplicates
\par
#3 citation(s) on #1 page(s): #2,\par
\ifnum#1=1 %
\ifnum#3=1 %
1 citation on page %
\else
#3 citations on page %
\fi
\else
#3 citations on #1 pages %
\fi
#2,\par
\ifnum#3=1 %
1 citation located at page %
\else
#3 citations located at pages %
\fi
#4.\par
}
% The list of distinct entries can be further refined:
\renewcommand*{\backrefentrycount}[2]{%
% #1: the original backref entry
% #2: the count of citations of this entry,
% in case of duplicates greater than one
#1%
\ifnum#2>1 %
~(#2)%
\fi
}
\begin{document}
\section{Hello}
\cite{ref1, ref2, ref3, ref4}
\section{World}
\cite{ref1, ref3}
\newpage
\section{Next section}
\cite{ref1}
\newpage
\section{Last section}
\cite{ref1, ref2}
\newpage
\pdfbookmark[1]{Bibliography}{bib}
\begin{thebibliography}{99}
\bibitem{ref1} Dummy entry one.
\bibitem{ref2} Dummy entry two.
\bibitem{ref3} Dummy entry three.
\bibitem{ref4} Dummy entry four.
\end{thebibliography}
\end{document}
\end{lstlisting}
\subsection{\texorpdfstring{\texttt{\textbackslash{}phantomsection}}{\textbackslash{}phantomsection}}\label{phantomsection}
Set an anchor at this location. It is often used in conjunction with
\lstinline!\addcontentsline! for sectionlike things (index,
bibliography, preface). \lstinline!\addcontentsline! refers to the
latest previous location where an anchor is set.
\begin{lstlisting}[language=TeX]
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{\indexname}
\printindex
\end{lstlisting}
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.
\subsection{\texorpdfstring{\texttt{\textbackslash{}hypercalcbp}}{\textbackslash{}hypercalcbp}}\label{hypercalcbp}
See manual.
\section{Package Compatibility}\label{package-compatibility}
Currently only package loading orders are available:
Note: \lstinline!hyperref! loads package \lstinline!nameref! at
\lstinline!\begin{document}!. Sometimes this is too late, thus this
package must be loaded earlier.
\subsection{algorithm}\label{algorithm}
\begin{lstlisting}[language=TeX]
\usepackage{float}
\usepackage{hyperref}
\usepackage[chapter]{algorithm}% eg.
\end{lstlisting}
\subsection{amsmath}\label{amsmath}
The environments \lstinline!equation! and \lstinline!eqnarray! are not
supported too well. For example, there might be spacing problems
(eqnarray isn't recommended anyway, see CTAN:info/l2tabu/, the situation
for equation is unclear, because nobody is interested in investigating).
Consider using the environments that package amsmath provide,
e.g.~gather for equation. The environment equation can even redefined to
use gather:
\begin{lstlisting}[language=TeX]
\usepackage{amsmath}
\let\equation\gather
\let\endequation\endgather
\end{lstlisting}
\subsection{amsrefs}\label{amsrefs}
Package loading order:
\begin{lstlisting}[language=TeX]
\usepackage{hyperref}
\usepackage{amsrefs}
\end{lstlisting}
\subsection{arydshln, longtable}\label{arydshln-longtable}
Package \lstinline!longtable! must be put before \lstinline!hyperref!
and \lstinline!arydshln!, \lstinline!hyperref! after
\lstinline!arydshln! generates an error, thus the resulting package
order is then:
\begin{lstlisting}[language=TeX]
\usepackage{longtable}
\usepacakge{hyperref}
\usepackage{arydshln}
\end{lstlisting}
\subsection{\texorpdfstring{\texttt{babel/magyar.ldf}}{babel/magyar.ldf}}\label{babelmagyar.ldf}
The old version 2005/03/30 v1.4j will not work.
You need at least version 1.5, maintained by Péter Szabó, see
CTAN:language/hungarian/babel/.
\subsection{\texorpdfstring{\texttt{babel/spanish.ldf}}{babel/spanish.ldf}}\label{babelspanish.ldf}
Babel's \lstinline!spanish.ldf! redefines \lstinline!\.! to support
\lstinline!\...!. In bookmarks (\lstinline!\pdfstringdef!) only
\lstinline!\.! is supported. If \lstinline!\...! is needed,
\begin{lstlisting}[language=TeX]
\texorpdfstring{\...}{\dots}
\end{lstlisting}
can be used instead.
\subsection{bibentry}\label{bibentry}
Workaround:
\begin{lstlisting}[language=TeX]
\makeatletter
\let\saved@bibitem\@bibitem
\makeatother
\usepackage{bibentry}
\usepackage{hyperref}
\begin{document}
\begingroup
\makeatletter
\let\@bibitem\saved@bibitem
\nobibliography{database}
\endgroup
\end{lstlisting}
\subsection{bigfoot}\label{bigfoot}
\lstinline!hyperref! does not support package \lstinline!bigfoot!. And
package \lstinline!bigfoot! does not support \lstinline!hyperref!'s
footnotes and disables them (\lstinline!hyperfootnotes=false!).
\subsection{chappg}\label{chappg}
Package \lstinline!chappg! uses @addtoreset that is redefined by
\lstinline!hyperref!. The package order is therefore:
\begin{lstlisting}[language=TeX]
\usepackage{hyperref}
\usepackage{chappg}
\end{lstlisting}
\subsection{cite}\label{cite}
This is from Mike Shell:
\begin{quote}
cite.sty cannot currently be used with \lstinline!hyperref!. However, I
can do a workaround via:
\begin{lstlisting}
\makeatletter
\def\NAT@parse{\typeout{This is a fake Natbib command to fool Hyperref.}}
\makeatother
\usepackage[hypertex]{hyperref}
\end{lstlisting}
so that \lstinline!hyperref! will not redefine any of the biblabel stuff
- so cite.sty will work as normal - although the citations will not be
hyperlinked, of course (But this may not be an issue for many people).
\end{quote}
\subsection{count1to}\label{count1to}
Package \lstinline!count1to! adds several \lstinline!\@addtoreset!
commands that confuse \lstinline!hyperref!. Therefore
\lstinline!\theH<...>! has to be fixed:
\begin{lstlisting}[language=TeX]
\usepackage{count1to}
\AtBeginDocument{% *after* \usepackage{count1to}
\renewcommand*{\theHsection}{\theHchapter.\arabic{section}}%
\renewcommand*{\theHsubsection}{\theHsection.\arabic{subsection}}%
\renewcommand*{\theHsubsubsection}{\theHsubsection.\arabic{subsubsection}}%
\renewcommand*{\theHparagraph}{\theHsubsubsection.\arabic{paragraph}}%
\renewcommand*{\theHsubparagraph}{\theHparagraph.\arabic{subparagraph}}%
}
\end{lstlisting}
\subsection{dblaccnt}\label{dblaccnt}
\lstinline!pd1enc.def! or \lstinline!puenc.def! should be loaded before:
\begin{lstlisting}[language=TeX]
\usepackage{hyperref}
\usepackage{dblaccnt}
\end{lstlisting}
or see entry for \lstinline!vietnam!.
\subsection{easyeqn}\label{easyeqn}
Not compatible, breaks.
\subsection{ellipsis}\label{ellipsis}
This packages redefines \lstinline!\textellipsis!, thus it has to be
loaded after package \lstinline!hyperref!
(\lstinline!pd1enc.def!/\lstinline!puenc.def! should be loaded before):
\begin{lstlisting}[language=TeX]
\usepackage{hyperref}
\usepackage{ellipsis}
\end{lstlisting}
\subsection{float}\label{float}
\begin{lstlisting}[language=TeX]
\usepackage{float}
\usepackage{hyperref}
\end{lstlisting}
\begin{itemize}
\tightlist
\item
Several \lstinline!\caption! commands are not supported inside one
float object.
\item
Anchor are set at top of the float object, if its style is controlled
by \lstinline!float.sty!.
\end{itemize}
\subsection{endnotes}\label{endnotes}
Unsupported.
\subsection{foiltex}\label{foiltex}
Update to version 2008/01/28 v2.1.4b:
Since version 6.77a \lstinline!hyperref! does not hack into
\lstinline!\@begindvi!, it uses package \lstinline!atbegshi! instead,
that hooks into \lstinline!\shipout!. Thus the patch of
\lstinline!foils.cls! regarding \lstinline!hyperref! is now obsolete and
causes an undefined error message about \lstinline!\@hyperfixhead!. This
is fixed in FoilTeX 2.1.4b.
\subsection{footnote}\label{footnote}
This package is not supported, you have to disable
\lstinline!hyperref!'s footnote support by using option
\lstinline!hyperfootnotes=false!.
\subsection{geometry}\label{geometry}
Driver \lstinline!dvipdfm! and program \lstinline!dvipdfm! might
generate a warning:
\begin{lstlisting}
Sorry. Too late to change page size
\end{lstlisting}
Then prefer the program \lstinline!dvipdfmx! or use one of the following
workarounds to move the \textbackslash{}special of geometry to an
earlier location:
\begin{lstlisting}[language=TeX]
\documentclass[dvipdfm]{article}% or other classes
\usepackage{atbegshi}
\AtBeginDocument{%
\let\OrgAtBeginDvi\AtBeginDvi
\let\AtBeginDvi\AtBeginShipoutFirst
}
\usepackage[
paperwidth=170mm,
paperheight=240mm
]{geometry}
\AtBeginDocument{%
\let\AtBeginDvi\OrgAtBeginDvi
}
\usepackage{hyperref}
\end{lstlisting}
or
\begin{lstlisting}[language=TeX]
\documentclass[dvipdfm]{article}% or other classes
\usepackage{atbegshi}
\let\AtBeginDvi\AtBeginShipoutFirst
\usepackage[
paperwidth=170mm,
paperheight=240mm
]{geometry}
\usepackage{hyperref}
\end{lstlisting}
\subsection{\texorpdfstring{\texttt{IEEEtran.cls}}{IEEEtran.cls}}\label{ieeetran.cls}
version \textgreater{}= V1.6b (because of \lstinline!\@makecaption!, see
ChangeLog)
\subsection{index}\label{index}
version \textgreater{}= 1995/09/28 v4.1 (because of
\lstinline!\addcontentsline! redefinition)
\subsection{lastpage}\label{lastpage}
Compatible.
\subsection{linguex}\label{linguex}
\begin{lstlisting}[language=TeX]
\usepackage{hyperref}
\usepackage{linguex}
\end{lstlisting}
\subsection{ltabptch}\label{ltabptch}
\begin{lstlisting}[language=TeX]
\usepackage{longtable}
\usepackage{ltabptch}
\usepackage{hyperref}
\end{lstlisting}
\subsection{mathenv}\label{mathenv}
Unsupported.
Both \lstinline!mathenv! and \lstinline!hyperref! messes around with
environment \lstinline!eqnarray!. You can load \lstinline!mathenv! after
\lstinline!hyperref! to avoid an error message. But \lstinline!\label!
will not work inside environment \lstinline!eqnarray! properly, for
example.
\subsection{minitoc-hyper}\label{minitoc-hyper}
This package is obsolete, use the uptodate original package minitoc
instead.
\subsection{multind}\label{multind}
\begin{lstlisting}[language=TeX]
\usepackage{multind}
\usepackage{hyperref}
\end{lstlisting}
\subsection{natbib}\label{natbib}
\begin{lstlisting}[language=TeX]
\usepackage{natbib}
\usepackage{hyperref}
\end{lstlisting}
\subsection{nomencl}\label{nomencl}
\begin{itemize}
\item
Example for introducing links for the page numbers:
\begin{lstlisting}[language=TeX]
\renewcommand*{\pagedeclaration}[1]{\unskip, \hyperpage{#1}}
\end{lstlisting}
\item
For equations the following might work:
\begin{lstlisting}[language=TeX]
\renewcommand*{\eqdeclaration}[1]{%
\hyperlink{equation.#1}{(Equation~#1)}%
}
\end{lstlisting}
But the mapping from the equation number to the anchor name is not
available in general.
\end{itemize}
\subsection{parskip}\label{parskip}
\begin{lstlisting}[language=TeX]
\usepackage{parskip}
\usepackage{hyperref}[2012/08/20]
\end{lstlisting}
Both packages want to redefine \lstinline!\@starttoc!.
\subsection{prettyref}\label{prettyref}
\begin{lstlisting}[language=TeX]
%%% example for prettyref %%%
\documentclass{article}
\usepackage{prettyref}
\usepackage[pdftex]{hyperref}
%\newrefformat{FIG}{Figure~\ref{#1}}% without hyperref
\newrefformat{FIG}{\hyperref[{#1}]{Figure~\ref*{#1}}}
\begin{document}
This is a reference to \prettyref{FIG:ONE}.
\newpage
\begin{figure}
\caption{This is my figure}
\label{FIG:ONE}
\end{figure}
\end{document}
%%% example for prettyref %%%
\end{lstlisting}
\subsection{ntheorem}\label{ntheorem}
\lstinline!ntheorem-hyper.sty! is an old patched version of
ntheorem.sty. Newer versions of ntheorem know the option
\lstinline!hyperref!:
\begin{lstlisting}[language=TeX]
\usepackage{hyperref}
\usepackage[hyperref]{ntheorem}
\end{lstlisting}
But there are still unsolved problems (options \lstinline!thref!,
\ldots{}).
\subsection{setspace}\label{setspace}
\begin{lstlisting}[language=TeX]
\usepackage{setspace}
\usepackage{hyperref}
\end{lstlisting}
\subsection{sidecap}\label{sidecap}
Before 2002/05/24 v1.5h:
\begin{lstlisting}[language=TeX]
\usepackage{nameref}
\usepackage{hyperref}
\usepackage{sidecap}
\end{lstlisting}
\subsection{subfigure}\label{subfigure}
1995/03/06 v2.0:
\begin{lstlisting}[language=TeX]
\usepackage{subfigure}
\usepackage{hyperref}
% hypertexnames is set to false.
\end{lstlisting}
v2.1:
\begin{lstlisting}[language=TeX]
\usepackage{nameref}
\usepackage{subfigure}
\usepackage{hyperref}
\end{lstlisting}
\begin{lstlisting}
or
\end{lstlisting}
\begin{lstlisting}[language=TeX]
\usepackage{hyperref}
\usepackage{subfigure}
\end{lstlisting}
v2.1.2:
please update
v2.1.3:
\begin{lstlisting}[language=TeX]
\usepackage{hyperref}
\usepackage{subfigure}
\end{lstlisting}
or vice versa?
\subsection{titleref}\label{titleref}
\begin{lstlisting}[language=TeX]
\usepackage{nameref}
\usepackage{titleref}% without usetoc
\usepackage{hyperref}
\end{lstlisting}
\subsection{tabularx}\label{tabularx}
Linked footnotes are not supported inside environment
\lstinline!tabularx!, because they uses the optional argument of
\lstinline!\footnotetext!, see section \lstinline!Limitations!. Before
version 2011/09/28 6.82i \lstinline!hyperref! had disabled footnotes
entirely by \lstinline!hyperfootnotes=false!.
\subsection{titlesec}\label{titlesec}
\lstinline!nameref! supports \lstinline!titlesec!, but
\lstinline!hyperref! does not (unsolved is the anchor setting, missing
with unnumbered section, perhaps problems with page breaks with numbered
ones).
\subsection{ucs/utf8x.def}\label{ucsutf8x.def}
The first time a multibyte UTF8 sequence is called, it does some
calculations and stores the result in a macro for speeding up the next
calls of that UTF8 sequence. However this makes the first call
non-expandable and will break if used in information entries or
bookmarks. Package ``ucs'' offers \lstinline!\PrerenderUnicode! or
\lstinline!\PreloadUnicodePage! to solve this:
\begin{lstlisting}[language=TeX]
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage{hyperref}% or with option unicode
\PrerenderUnicode{^^c3^^b6}% or \PrerenderUnicodePage{1}
\hypersetup{pdftitle={Umlaut example: ^^c3^^b6}}
\end{lstlisting}
The notation with two carets avoids trouble with 8-bit bytes for the
README file, you can use the characters directly.
\subsection{varioref}\label{varioref}
There are too many problems with varioref. Nobody has time to sort them
out. Therefore this package is now unsupported.
Perhaps you are lucky and some of the features of varioref works with
the following loading order:
\begin{lstlisting}[language=TeX]
\usepackage{nameref}
\usepackage{varioref}
\usepackage{hyperref}
\end{lstlisting}
Also some \lstinline!babel! versions can be problematic. For exmample,
2005/05/21 v3.8g contains a patch for varioref that breaks the
\lstinline!hyperref! support for \lstinline!varioref!.
Also unsupported:
\begin{itemize}
\tightlist
\item
\lstinline!\Ref!, \lstinline!\Vref! do not uppercase the first letter.
\item
\lstinline!\vpageref[]{...}!: On the same page a previous space is not
suppressed.
\end{itemize}
\subsection{verse}\label{verse}
Version 2005/08/22 v2.22 contains support for \lstinline!hyperref!.
For older versions see example from de.comp.text.tex (2005/08/11,
slightly modified):
\begin{lstlisting}[language=TeX]
\documentclass{article}
% package order does not matter
\usepackage{verse}
\usepackage{hyperref}
\makeatletter
% make unique poemline anchors
\newcounter{verse@env}
\setcounter{verse@env}{0}
\let\org@verse\verse
\def\verse{%
\stepcounter{verse@env}%
\org@verse
}
\def\theHpoemline{\arabic{verse@env}.\thepoemline}
% add anchor for before \addcontentsline in \@vsptitle
\let\org@vsptitle\@vsptitle
\def\@vsptitle{%
\phantomsection
\org@vsptitle
}
\makeatother
\begin{document}
\poemtitle{Poem 1}
\begin{verse}
An one-liner.
\end{verse}
\newpage
\poemtitle{Poem 2}
\begin{verse}
Another one-liner.
\end{verse}
\end{document}
\end{lstlisting}
\subsection{vietnam}\label{vietnam}
\begin{lstlisting}[language=TeX]
% pd1enc.def should be loaded before package dblaccnt:
\usepackage[PD1,OT1]{fontenc}
\usepackage{vietnam}
\usepackage{hyperref}
\end{lstlisting}
\subsection{XeTeX}\label{xetex}
Default for the encoding of bookmarks is \lstinline!pdfencoding=auto!.
That means the strings are always treated as unicode strings. Only if
the string restricts to the printable ASCII set, it is written as ASCII
string. The reason is that the \lstinline!\special! does not support
\lstinline!PDFDocEncoding!.
XeTeX uses the program xdvipdfmx for PDF output generation. This program
behaves a little different from dvipdfm, because of the supported
Unicode characters. Strings for bookmarks or information entries can be
output directly. The big chars (char code \textgreater{} 255) are
written in UTF-8 and xdvipdfmx tries to convert them to UTF-16BE.
However \lstinline!hyperref! already provides PDF strings encoded in
UTF-16BE, thus the result is a warning
\begin{lstlisting}
Failed to convert input string to UTF16...
\end{lstlisting}
The best way would be, if xdvipdfm could detect the byte order marker
(\textbackslash{}376\textbackslash{}377) and skips the conversion if
that marker is present.
For the time being I added the following to \lstinline!hyperref!, when
option \lstinline!pdfencoding=auto! is set (default for XeTeX): The
string is converted back to big characters thus that the string is
written as UTF-8. But I am very unhappy with this solution. Main
disadvantage:
Two versions of \lstinline!\pdfstringdef! are needed:
\begin{enumerate}
\def\labelenumi{\alph{enumi})}
\tightlist
\item
The string is converted back to big characters for the ``tainted
keys'' of xdvipdfmx (\lstinline!spc_pdfm.c!:
\lstinline!default_taintkeys!). The subset \lstinline!hyperref! uses
is \lstinline!/Title!, \lstinline!/Author!, \lstinline!/Subject!,
\lstinline!/Keywords!, \lstinline!/Creator!, \lstinline!/Producer!,
\lstinline!/T!. Any changes of this set in xdvipdfmx cannot be
detected by \lstinline!hyperref!.
\item
Without conversion for the other strings , providing UTF16be directly.
Examples: Prefix of page labels, some elements of formulars.
\end{enumerate}
Thus \emph{each} application that uses \lstinline!\pdfstringdef! now
must check, if it defines a string for some of the tained keys. If yes,
then the call of \lstinline!\pdfstringdef! should be preceded by
\lstinline!\csname HyPsd@XeTeXBigCharstrue\endcsname!.
Example: package bookmark.
\section{Limitations}\label{limitations}
\subsection{Wrapped/broken link
support}\label{wrappedbroken-link-support}
Only few drivers support automatically wrapped/broken links,
e.g.~pdftex, dvipdfm, hypertex. Other drivers lack this feature,
e.g.~dvips, dvipsone.
Workarounds:
\begin{itemize}
\item
For long section or caption titles in the table of contents or list of
figures/tables option \lstinline!linktocpage! can be used. Then the
page number will be a link, and the overlong section title is not
forced into an one line link with overfull \lstinline!\hbox! warning.
\item
\lstinline!\url!s are caught by package \lstinline!breakurl!.
\item
The option ``breaklinks'' is intended for internal use. But it can be
used to force link wrapping, e.g.~when printing a document. However,
when such a document is converted to PDF and viewed with a PDF viewer,
the active link area will be misplaced.
Another limitation: some penalties are ``optimized'' by TeX, thus
there are missing break points, especially within \lstinline!\url!.
(See thread ``hyperref.sty, breaklinks and url.sty 3.2'' in
comp.text.tex 2005-09).
\end{itemize}
\subsection{Links across pages}\label{links-across-pages}
In general they have problems:
\begin{itemize}
\tightlist
\item
Some driver doesn't support them at all (see above).
\item
The driver allows it, but the link result might include the footer
and/or header, or an error message can occur sometimes.
\end{itemize}
\subsection{Footnotes}\label{footnotes}
LaTeX allows the separation of the footnote mark and the footnote text
(\lstinline!\footnotemark!, \lstinline!\footnotetext!). This interface
might be enough for visual typesetting. But the relation between
\lstinline!\footnotemark! to \lstinline!\footnotetext! is not as strong
as \lstinline!\ref! to \lstinline!\label!. Therefore it is not clear in
general which \lstinline!\footnotemark! references which
\lstinline!\footnotetext!. But that is necessary to implement
hyperlinking. Thus the implementation of \lstinline!hyperref! does not
support the optional argument of \lstinline!\footnotemark! and
\lstinline!\footnotetext!.
\section{Hints}\label{hints}
\subsection{Spaces in option values}\label{spaces-in-option-values}
Unhappily LaTeX strips spaces from options if they are given in
\lstinline!\documentclass! or \lstinline!\usepackage! (or
\lstinline!\RequirePackage!), e.g.:
\begin{lstlisting}[language=TeX]
\usepackage[pdfborder=0 0 1]{hyperref}
\end{lstlisting}
Package \lstinline!hyperref! now gets
\begin{lstlisting}
pdfborder=001
\end{lstlisting}
and the result is an invalid PDF file.
As workaround braces can be used:
\begin{lstlisting}[language=TeX]
\usepackage[pdfborder={0 0 1}]{hyperref}
\end{lstlisting}
Some options can also be given in \textbackslash{}hypersetup:
\begin{lstlisting}[language=TeX]
\hypersetup{pdfborder=0 0 1}
\end{lstlisting}
In \lstinline!\hypersetup! the options are directly processed as key
value options (see package \lstinline!keyval!) without space stripping
in the value part.
Alternatively, LaTeX's option handling system can be adapted to key
value options by one of the packages ``kvoptions-patch'' (from project
``kvoptions'') or ``xkvltxp'' (from project ``xsetkeys'').
\subsection{Index with makeindex}\label{index-with-makeindex}
\begin{itemize}
\item
Package \lstinline!hyperref! adds \lstinline!\hyperpage! commands by
the encap mechanism (see documentation of \lstinline!Makeindex!), if
option \lstinline!hyperindex! is set (default). \lstinline!\hyperpage!
uses the page anchors that are set by \lstinline!hyperref! at each
page (default). However in the default case page numbers are used in
anchor names in arabic form. If the page numbers in other formats are
used (book class with \lstinline!\frontmatter!,
\lstinline!\romannumbering!, \ldots{}), then the page anchors are not
unique. Therefore option \lstinline!plainpages=false! is recommended.
\item
The encap mechanism of \lstinline!Makeindex! allows to use one command
only (see documentation of \lstinline!Makeindex!).
If the user sets such a command, \lstinline!hyperref! suppresses its
\textbackslash{}hyperpage command. With logical markup this situation
can easily be solved:
\begin{lstlisting}[language=TeX]
\usepackage{makeidx}
\makeindex
\usepackage[hyperindex]{hyperref}
\newcommand*{\main}[1]{\textbf{\hyperpage{#1}}}
...
\index{Some example|main}
\end{lstlisting}
\item
Scientic Word/Scientific WorkPlace users can use package robustindex
with \lstinline!hyperindex=false!.
\item
Other encap characters can be set by option \lstinline!encap!. Example
for use of ``?'':
\begin{lstlisting}[language=TeX]
\usepackage[encap=?]{hyperref}
\end{lstlisting}
\item
An other possibility is the insertion of \lstinline!\hyperpage! by a
style file for \lstinline!makeindex!. For this case,
\lstinline!hyperref!'s insertion will be disabled by
\lstinline!hyperindex=false!. \lstinline!\hyperpage! will be defined
regardless of setting of \lstinline!hyperindex!.
\begin{lstlisting}[language=TeX]
%%% cut %%% hyperindex.ist %%% cut %%%
delim_0 ", \\hyperpage{"
delim_1 ", \\hyperpage{"
delim_2 ", \\hyperpage{"
delim_n "}, \\hyperpage{"
delim_t "}"
encap_prefix "}\\"
encap_infix "{\\hyperpage{"
encap_suffix "}"
%%% cut %%% hyperindex.ist %%% cut %%%
\end{lstlisting}
\end{itemize}
\subsection{\texorpdfstring{Warning ``bookmark level for unknown
defaults to
0''}{Warning bookmark level for unknown defaults to 0}}\label{warning-bookmark-level-for-unknown-defaults-to-0}
Getting rid of it:
\begin{lstlisting}[language=TeX]
\makeatletter
\providecommand*{\toclevel@<foobar>}{0}
\makeatother
\end{lstlisting}
\subsection{Link anchors in figures}\label{link-anchors-in-figures}
The caption command increments the counter and here is the place where
\lstinline!hyperref! set the corresponding anchor. Unhappily the caption
is set below the figure, so the figure is not visible if a link jumps to
a figure.
In this cases, try package \lstinline!hypcap.sty! that implements a
method to circumvent the problem.
\subsection{Additional unicode characters in bookmarks and pdf
information
entries:}\label{additional-unicode-characters-in-bookmarks-and-pdf-information-entries}
\begin{lstlisting}[language=TeX]
\documentclass[pdftex]{article}
\usepackage[unicode]{hyperref}
% Support for additional unicode characters:
%
% Example: \.{a} and \d{a}
%
% 1. Get a list with unicode data, eg:
% http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
%
% 2. Identify the characters (\.{a}, \d{a}):
%
% 0227;LATIN SMALL LETTER A WITH DOT ABOVE;...
% 1EA1;LATIN SMALL LETTER A WITH DOT BELOW;...
%
% 3. Calculate the octal code:
% The first characters of the line in the file are
% hex values, convert each byte and prepend them
% with a backslash. (This will go into the PDF file.)
%
% 0227 -> \002\047
% 1EA1 -> \036\241
%
% 4. Transform into a form understood by hyperref:
%
% Hyperref must know where the first byte starts,
% this is marked by "9" (8 and 9 cannot occur in
% octal numbers):
%
% \002\047 -> \9002\047
% \036\241 -> \9036\241
%
% Optional: "8" is used for abbreviations:
% \900 = \80, \901 = \81, \902 = \82, ...
%
% \9002\047 -> \82\047
%
% 5. Declare the character with LaTeX:
%
\DeclareTextCompositeCommand{\.}{PU}{a}{\82\047}
\DeclareTextCompositeCommand{\d}{PU}{a}{\9036\241}
\begin{document}
\section{\={a}, \d{a}, \'{a}, \.{a}}
\end{document}
\end{lstlisting}
\subsection{Footnotes}\label{footnotes-1}
The footnote support is rather limited. It is beyond the scope to use
\lstinline!\footnotemark! and \lstinline!\footnotetext! out of order or
reusing \lstinline!\footnotemark!. Here you can either disable
\lstinline!hyperref!'s footnote support by
\lstinline!hyperfootnotes=false! or fiddle with internal macros, nasty
examples:
\begin{lstlisting}[language=TeX]
\documentclass{article}
\usepackage{hyperref}
\begin{document}
Hello%
\footnote{The first footnote}
World%
\addtocounter{footnote}{-1}%
\addtocounter{Hfootnote}{-1}%
\footnotemark.
\end{document}
\end{lstlisting}
or
\begin{lstlisting}[language=TeX]
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\makeatletter
A%
\footnotemark
\let\saved@Href@A\Hy@footnote@currentHref
% remember link name
B%
\footnotemark
\let\saved@Href@B\Hy@footnote@currentHref
b%
\addtocounter{footnote}{-1}%
\addtocounter{Hfootnote}{-1}% generate the same anchor
\footnotemark
C%
\footnotemark
\let\saved@Href@C\Hy@footnote@currentHref
\addtocounter{footnote}{-2}%
\let\Hy@footnote@currentHref\saved@Href@A
\footnotetext{AAAA}%
\addtocounter{footnote}{1}%
\let\Hy@footnote@currentHref\saved@Href@B
\footnotetext{BBBBB}%
\addtocounter{footnote}{1}%
\let\Hy@footnote@currentHref\saved@Href@C
\footnotetext{CCCC}%
\end{document}
\end{lstlisting}
\subsection{Subordinate counters}\label{subordinate-counters}
Some counters do not have unique values and require the value of other
counters to be unique. For example, sections or figures might be
numbered within chapters or \lstinline!\newtheorem! is used with an
optional counter argument. Internally LaTeX uses
\lstinline!\@addtoreset! to reset a counter in dependency to another
counter. Package \lstinline!hyperref! hooks into
\lstinline!\@addtoreset! to catch this situation. Also
\lstinline!\numberwithin! of package \lstinline!amsmath! is catched by
\lstinline!hyperref!.
However, if the definition of subordinate counters take place before
\lstinline!hyperref! is loaded, the old meaning of
\lstinline!\@addtoreset! is called without \lstinline!hyperref!'s
additions. Then the companion counter macro \lstinline!\theH<counter>!
can be redefined accordingly. Or move the definition of subordinate
counters after \lstinline!hyperref! is loaded.
Example for \lstinline!\newtheorem!, problematic case:
\begin{lstlisting}[language=TeX]
\newtheorem{corA}{CorollaryA}[section]
\usepackage{hyperref}
\end{lstlisting}
Solution a)
\begin{lstlisting}[language=TeX]
\usepackage{hyperref}
\newtheorem{corA}{CorollaryA}[section}
\end{lstlisting}
Solution b)
\begin{lstlisting}[language=TeX]
\newtheorem{corA}{CorollaryA}[section]
\usepackage{hyperref}
\newcommand*{\theHcorA}{\theHsection.\number\value{corA}}
\end{lstlisting}
\section{Authors/Maintainers}\label{authorsmaintainers}
\begin{itemize}
\tightlist
\item
Sebastian Rahtz (died 2016)
\item
Heiko Oberdiek
\end{itemize}
\section{Bug Reports}\label{bug-reports}
A bug report should contain:
\begin{itemize}
\tightlist
\item
Comprehensive problem description. This includes error or warning
messages.
\begin{itemize}
\tightlist
\item
\lstinline!\errorcontextlines=\maxdimen! can be added in the TeX
code to get more informations in TeX error messages.
\end{itemize}
\item
Minimal test file that shows the problem, but does not contain any
unnecessary packages and code.
\item
Used drivers/programs.
\item
Version information about used packages and programs.
\begin{itemize}
\tightlist
\item
If you are using LaTeX, then add \lstinline!\listfiles!. Then a list
of version informations is printed at the end of the LaTeX run.
\end{itemize}
\item
Please no other files than the minimal test file. The other files
.log, .dvi, .ps, .pdf are seldom necessary, so send them only on
request.
\end{itemize}
\subsection{Bug address}\label{bug-address}
A bug tracker is available at GitHub:
\url{https://github.com/ho-tex/oberdiek/issues}
Alternatively bug reports can be send to the support group public email
list:
\subsection{Vietnamese part}\label{vietnamese-part}
Responsible for the Vietnamese translations of the \lstinline!\autoref!
names and \lstinline!puvnenc.def! are:
\begin{itemize}
\tightlist
\item
Han The Thanh
\item
Reinhard Kotucha
\end{itemize}
\subsection{Arabic part}\label{arabic-part}
Responsible for the additions to PU encoding for Arabi is
\begin{itemize}
\tightlist
\item
Youssef Jabri
\end{itemize}
\section{Known Problems}\label{known-problems}
\begin{itemize}
\item
(half-done) hyper images (link from thumbnail in text)
\item
Relative links are not sorted out or documented well.
For PDF generation:
\begin{itemize}
\item
With baseurl: all links are considered relative to this URL.
\item
Without baseurl: a relative link without ``file:'' can be achieved
by:
\begin{lstlisting}[language=TeX]
\begingroup
\hypersetup{linkfileprefix={}}%
\href{../foo/bar.html}{bar.html}
\endgroup
\end{lstlisting}
\end{itemize}
\item
\ldots{}
\end{itemize}
\section{ToDo}\label{todo}
\begin{itemize}
\tightlist
\item
modules
\item
bookmark organisation
\item
documentation
\item
PDF threads
\item
more for PDF forms
\item
per object setting
\item
vary gap between text and box
\item
PostScript driver: the current implementation doesn't relly support
nested links. The start positions should be remembered in a stack, but
there are complications with page breaks.
\item
\ldots{}
\end{itemize}
\section{Versions in TeX
distributions}\label{versions-in-tex-distributions}
\subsection{TeX Live}\label{tex-live}
\begin{itemize}
\tightlist
\item
TL 2016: 2016/05/05 v6.83n (at time of first release)
\item
TL 2011: 2011/04/17 v6.82g (at time of first release)
\item
TL 2010: 2010/06/18 v6.81g (at time of first release)
\item
TL 2009: 2009/10/09 v6.79a (at time of first release)
\item
TL 2008: 2008/08/14 v6.78f (at time of first release)
\item
TL 2007: 2007/02/07 v6.75r
\item
TL 2005: 2003/11/30 v6.74m
\item
TL 2004: 2003/11/30 v6.74m
\item
TL 2003: 2003/09/15 v6.74i
\item
TL 7 (2002): 2002/05/27 v6.72r
\item
TL 6b (2001): 2001/05/26 v6.71g
\item
TL 5d (2000): 2000/07/02 v6.70m
\item
TL 5c (2000): 2000/05/08 v6.70f
\item
TL 4 (1999): 1999/04/13 v6.56
\item
TL 3 (1998): 1998/03/25 v6.19
\end{itemize}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment