Simplify hyperref usage.

The different usage for `xetex` appears to have been a workaround for bugs fixed in 2009 (see my question on this at <http://tex.stackexchange.com/questions/273339/what-hyperref-options-should-be-used-for-correct-unicode-output>), meaning that the same options can be used for all engines. The `subtitle` is used to set the PDF subject, following ConTeXt. The `bookmarks` option is enabled by default and does not need to be repeated.
This commit is contained in:
Andrew Dunning 2015-10-19 18:21:58 -04:00
parent 60228b4005
commit 17f380f089

View file

@ -52,32 +52,20 @@ $endif$
$if(geometry)$ $if(geometry)$
\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry} \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
$endif$ $endif$
\makeatletter \usepackage{hyperref}
\@ifpackageloaded{hyperref}{}{% \PassOptionsToPackage{usenames,dvipsnames}{color} % color is loaded by hyperref
\ifxetex
\usepackage[setpagesize=false, % page size defined by xetex
unicode=false, % unicode breaks when used with xetex
xetex]{hyperref}
\else
\usepackage[unicode=true]{hyperref}
\fi
}
\@ifpackageloaded{color}{
\PassOptionsToPackage{usenames,dvipsnames}{color}
}{%
\usepackage[usenames,dvipsnames]{color}
}
\makeatother
\hypersetup{breaklinks=true, \hypersetup{breaklinks=true,
bookmarks=true, unicode=true,$if(title-meta)$
pdfauthor={$author-meta$}, pdftitle={$title-meta$},$endif$$if(author-meta)$
pdftitle={$title-meta$}, pdfauthor={$author-meta$},$endif$$if(subtitle)$
pdfsubject={$subtitle$},$endif$$if(keywords)$
pdfkeywords={$keywords$},$endif$
colorlinks=true, colorlinks=true,
citecolor=$if(citecolor)$$citecolor$$else$blue$endif$, citecolor=$if(citecolor)$$citecolor$$else$blue$endif$,
urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$, urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$, linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
pdfborder={0 0 0} pdfborder={0 0 0}$if(hidelinks)$,
$if(hidelinks)$,hidelinks,$endif$} hidelinks$endif$}
\urlstyle{same} % don't use monospace font for urls \urlstyle{same} % don't use monospace font for urls
$if(lang)$ $if(lang)$
\ifxetex \ifxetex