aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-01-03 10:47:48 -0800
committerGitHub <noreply@github.com>2019-01-03 10:47:48 -0800
commit9746938d0649ee5ce2bf0ab88af6bf91645b086d (patch)
treed103c556a2a5e290332e476b693eaf148dfa115c /data
parente8fba105a5e0d63b5fdbc7505d657eda13a52b59 (diff)
parentf3709ccba3b86146b5f3e135acd0521f92511c66 (diff)
downloadpandoc-9746938d0649ee5ce2bf0ab88af6bf91645b086d.tar.gz
LaTeX Template: Improve package selections (#5193)
* Use Babel for LuaTeX. There are a number of bugs in Polyglossia under LuaLaTeX with common languages, e.g. <https://github.com/reutenauer/polyglossia/issues/182>. * Load xcolor. The `xcolor` package must be loaded before the `footnote` package, which we load to fix foonotes in tables. Closes #4861. * Load xurl if available. This breaks URLs in more locations. Only available with TeX Live 2018 and later. * Remove obsolete fixltx2e package * Reindent. Use two spaces to be consistent internally and with other templates. * Use `bookmark` if available. The `bookmark` package can sometimes correct the levels of headings where `hyperref` cannot: see <https://komascript.de/release3.26>. * Update LaTeX tests
Diffstat (limited to 'data')
-rw-r--r--data/templates/default.latex129
1 files changed, 76 insertions, 53 deletions
diff --git a/data/templates/default.latex b/data/templates/default.latex
index 6e8fda613..723e0091f 100644
--- a/data/templates/default.latex
+++ b/data/templates/default.latex
@@ -2,14 +2,40 @@
\PassOptionsToPackage{hyphens}{url}
$if(colorlinks)$
\PassOptionsToPackage{dvipsnames,svgnames*,x11names*}{xcolor}
-$endif$$if(dir)$$if(latex-dir-rtl)$
+$endif$
+$if(dir)$
+$if(latex-dir-rtl)$
\PassOptionsToPackage{RTLdocument}{bidi}
-$endif$$endif$%
-\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$babel-lang$,$endif$$if(papersize)$$papersize$paper,$endif$$if(beamer)$ignorenonframetext,$if(handout)$handout,$endif$$if(aspectratio)$aspectratio=$aspectratio$,$endif$$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
+$endif$
+$endif$
+%
+\documentclass[
+$if(fontsize)$
+ $fontsize$,
+$endif$
+$if(lang)$
+ $babel-lang$,
+$endif$
+$if(papersize)$
+ $papersize$paper,
+$endif$
+$if(beamer)$
+ ignorenonframetext,
+$if(handout)$
+ handout,
+$endif$
+$if(aspectratio)$
+ aspectratio=$aspectratio$,
+$endif$
+$endif$
+$for(classoption)$
+ $classoption$$sep$,
+$endfor$
+]{$documentclass$}
$if(beamer)$
$if(background-image)$
\usebackgroundtemplate{%
-\includegraphics[width=\paperwidth]{$background-image$}%
+ \includegraphics[width=\paperwidth]{$background-image$}%
}
$endif$
\usepackage{pgfpages}
@@ -25,22 +51,22 @@ $endfor$
\raggedbottom
$if(section-titles)$
\setbeamertemplate{part page}{
-\centering
-\begin{beamercolorbox}[sep=16pt,center]{part title}
- \usebeamerfont{part title}\insertpart\par
-\end{beamercolorbox}
+ \centering
+ \begin{beamercolorbox}[sep=16pt,center]{part title}
+ \usebeamerfont{part title}\insertpart\par
+ \end{beamercolorbox}
}
\setbeamertemplate{section page}{
-\centering
-\begin{beamercolorbox}[sep=12pt,center]{part title}
- \usebeamerfont{section title}\insertsection\par
-\end{beamercolorbox}
+ \centering
+ \begin{beamercolorbox}[sep=12pt,center]{part title}
+ \usebeamerfont{section title}\insertsection\par
+ \end{beamercolorbox}
}
\setbeamertemplate{subsection page}{
-\centering
-\begin{beamercolorbox}[sep=8pt,center]{part title}
- \usebeamerfont{subsection title}\insertsubsection\par
-\end{beamercolorbox}
+ \centering
+ \begin{beamercolorbox}[sep=8pt,center]{part title}
+ \usebeamerfont{subsection title}\insertsubsection\par
+ \end{beamercolorbox}
}
\AtBeginPart{
\frame{\partpage}
@@ -70,7 +96,6 @@ $if(linestretch)$
$endif$
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
-\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
\usepackage[utf8]{inputenc}
@@ -87,19 +112,19 @@ $else$
$endif$
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
$for(fontfamilies)$
- \newfontfamily{$fontfamilies.name$}[$fontfamilies.options$]{$fontfamilies.font$}
+ \newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$}
$endfor$
$if(mainfont)$
- \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
+ \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
$endif$
$if(romanfont)$
- \setromanfont[$for(romanfontoptions)$$romanfontoptions$$sep$,$endfor$]{$romanfont$}
+ \setromanfont[$for(romanfontoptions)$$romanfontoptions$$sep$,$endfor$]{$romanfont$}
$endif$
$if(sansfont)$
- \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
+ \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
$endif$
$if(monofont)$
- \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$}
+ \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$}
$endif$
$if(mathfont)$
$if(mathspec)$
@@ -152,51 +177,49 @@ $endif$
$endif$
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
-% use microtype if available
-\IfFileExists{microtype.sty}{%
-\usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}
-\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
+\IfFileExists{microtype.sty}{% use microtype if available
+ \usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}
+ \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
$if(indent)$
$else$
\makeatletter
-\@ifundefined{KOMAClassName}{%
+\@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
-}{% else
+}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
$endif$
$if(verbatim-in-note)$
\usepackage{fancyvrb}
$endif$
-$if(colorlinks)$
\usepackage{xcolor}
-$endif$
-\usepackage{hyperref}
+\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
+\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
$if(title-meta)$
- pdftitle={$title-meta$},
+ pdftitle={$title-meta$},
$endif$
$if(author-meta)$
- pdfauthor={$author-meta$},
+ pdfauthor={$author-meta$},
$endif$
$if(keywords)$
- pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},
+ pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},
$endif$
$if(colorlinks)$
- colorlinks=true,
- linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$,
- filecolor=$if(filecolor)$$filecolor$$else$Maroon$endif$,
- citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$,
- urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$,
+ colorlinks=true,
+ linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$,
+ filecolor=$if(filecolor)$$filecolor$$else$Maroon$endif$,
+ citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$,
+ urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$,
$else$
- pdfborder={0 0 0},
+ pdfborder={0 0 0},
$endif$
- breaklinks=true}
+ breaklinks=true}
\urlstyle{same} % don't use monospace font for urls
$if(verbatim-in-note)$
\VerbatimFootnotes % allows verbatim text in footnotes
@@ -264,12 +287,12 @@ $if(subparagraph)$
$else$
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
-\let\oldparagraph\paragraph
-\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
+ \let\oldparagraph\paragraph
+ \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
-\let\oldsubparagraph\subparagraph
-\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
+ \let\oldsubparagraph\subparagraph
+ \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
$endif$
$endif$
@@ -286,12 +309,12 @@ $for(header-includes)$
$header-includes$
$endfor$
$if(lang)$
-\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
+\ifnum 0\ifxetex 1\fi=0 % if pdftex or luatex
\usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
$if(babel-newcommands)$
$babel-newcommands$
$endif$
-\else
+\else % if xetex
% load polyglossia as late as possible as it *could* call bidi if RTL lang (e.g. Hebrew or Arabic)
\usepackage{polyglossia}
\setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$}
@@ -373,9 +396,9 @@ $endif$
$if(beamer)$
\begin{frame}
$if(toc-title)$
-\frametitle{$toc-title$}
+ \frametitle{$toc-title$}
$endif$
-\tableofcontents[hideallsubsections]
+ \tableofcontents[hideallsubsections]
\end{frame}
$else$
{
@@ -406,9 +429,9 @@ $endif$
$endif$
$if(beamer)$
\begin{frame}[allowframebreaks]{$biblio-title$}
-\bibliographytrue
+ \bibliographytrue
$endif$
-\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
+ \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
$if(beamer)$
\end{frame}
$endif$
@@ -418,8 +441,8 @@ $endif$
$if(biblatex)$
$if(beamer)$
\begin{frame}[allowframebreaks]{$biblio-title$}
-\bibliographytrue
-\printbibliography[heading=none]
+ \bibliographytrue
+ \printbibliography[heading=none]
\end{frame}
$else$
\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$