Skip to content

Commit bb36f12

Browse files
committed
LaTeX template: include bookmark package unconditionally.
This package produces better PDF bookmarks than hyperref and does it on the first pass. As a consequence, we now default to running LaTeX only once in producing a PDF (instead of twice). If a table of contents is present, we still have to run three times to get the page numbers.
1 parent 5132f1e commit bb36f12

File tree

7 files changed

+9
-10
lines changed

7 files changed

+9
-10
lines changed

MANUAL.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ When using LaTeX, the following packages need to be available
139139
[`iftex`], [`listings`] (if the
140140
`--listings` option is used), [`fancyvrb`], [`longtable`],
141141
[`booktabs`], [`graphicx`] (if the document
142-
contains images), [`hyperref`], [`xcolor`],
142+
contains images), [`bookmark`], [`xcolor`],
143143
[`soul`], [`geometry`] (with the `geometry` variable set),
144144
[`setspace`] (with `linestretch`), and
145145
[`babel`] (with `lang`). If `CJKmainfont` is set, [`xeCJK`]
@@ -157,9 +157,8 @@ output quality if present, but pandoc does not require them to
157157
be present: [`upquote`] (for straight quotes in verbatim
158158
environments), [`microtype`] (for better spacing adjustments),
159159
[`parskip`] (for better inter-paragraph spaces), [`xurl`] (for
160-
better line breaks in URLs), [`bookmark`] (for better PDF
161-
bookmarks), and [`footnotehyper`] or [`footnote`] (to allow
162-
footnotes in tables).
160+
better line breaks in URLs), and [`footnotehyper`] or
161+
[`footnote`] (to allow footnotes in tables).
163162

164163
[TeX Live]: https://www.tug.org/texlive/
165164
[`amsfonts`]: https://ctan.org/pkg/amsfonts

data/templates/default.latex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ $endif$
425425
$if(csquotes)$
426426
\usepackage{csquotes}
427427
$endif$
428-
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
428+
\usepackage{bookmark}
429429
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
430430
\urlstyle{$if(urlstyle)$$urlstyle$$else$same$endif$}
431431
$if(links-as-notes)$

src/Text/Pandoc/PDF.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ tex2pdf :: (PandocMonad m, MonadIO m)
267267
tex2pdf program args tmpDir source = do
268268
let numruns | takeBaseName program == "latexmk" = 1
269269
| "\\tableofcontents" `T.isInfixOf` source = 3 -- to get page numbers
270-
| otherwise = 2 -- 1 run won't give you PDF bookmarks
270+
| otherwise = 1
271271
(exit, log', mbPdf) <- runTeXProgram program args numruns tmpDir source
272272
case (exit, mbPdf) of
273273
(ExitFailure _, _) -> do

test/lhs-test.latex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
\ifLuaTeX
8282
\usepackage{selnolig} % disable illegal ligatures
8383
\fi
84-
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
84+
\usepackage{bookmark}
8585
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
8686
\urlstyle{same}
8787
\hypersetup{

test/lhs-test.latex+lhs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
\ifLuaTeX
4949
\usepackage{selnolig} % disable illegal ligatures
5050
\fi
51-
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
51+
\usepackage{bookmark}
5252
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
5353
\urlstyle{same}
5454
\hypersetup{

test/writer.latex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
\ifLuaTeX
6464
\usepackage{selnolig} % disable illegal ligatures
6565
\fi
66-
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
66+
\usepackage{bookmark}
6767
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
6868
\urlstyle{same}
6969
\VerbatimFootnotes % allow verbatim text in footnotes

test/writers-lang-and-dir.latex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
\newenvironment{RTL}{\beginR}{\endR}
6565
\newenvironment{LTR}{\beginL}{\endL}
6666
\fi
67-
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
67+
\usepackage{bookmark}
6868
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
6969
\urlstyle{same}
7070
\hypersetup{

0 commit comments

Comments
 (0)