From f3fcdd52c8bc722862ea73958d41fe53ec03ec1d Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Sun, 13 Mar 2022 10:48:09 -0700
Subject: LaTeX template: move hyperref near end of preamble.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It now comes after header-includes and right before title, author, date,
abstract.

The hyperref documentation says: “Make sure it comes last of your loaded
packages”. The reason is that it redefines many LaTeX commands.

For example, loading it after titlesec (which might be loaded in
header-includes) causes links in the table of contents to point to
the wrong page (#7960).

Closes #5811.

Note:  Users who presuppose hyperref in their header-includes
will now have to add `\usepackage{hyperref}` to their header-includes
to make it available there.  (The redundant `\usepackage` will
do no harm in this case.)
---
 test/writer.latex | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'test/writer.latex')

diff --git a/test/writer.latex b/test/writer.latex
index a89078b31..33a09e23c 100644
--- a/test/writer.latex
+++ b/test/writer.latex
@@ -35,12 +35,6 @@
 \usepackage{fancyvrb}
 \usepackage{xcolor}
 \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
-\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
-\hypersetup{
-  pdftitle={Pandoc Test Suite},
-  pdfauthor={John MacFarlane; Anonymous},
-  hidelinks,
-  pdfcreator={LaTeX via pandoc}}
 \urlstyle{same} % disable monospaced font for URLs
 \VerbatimFootnotes % allow verbatim text in footnotes
 \usepackage{graphicx}
@@ -66,6 +60,12 @@
 \ifLuaTeX
   \usepackage{selnolig}  % disable illegal ligatures
 \fi
+\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
+\hypersetup{
+  pdftitle={Pandoc Test Suite},
+  pdfauthor={John MacFarlane; Anonymous},
+  hidelinks,
+  pdfcreator={LaTeX via pandoc}}
 
 \title{Pandoc Test Suite}
 \author{John MacFarlane \and Anonymous}
-- 
cgit v1.2.3

