aboutsummaryrefslogtreecommitdiff
path: root/test/writers-lang-and-dir.latex
diff options
context:
space:
mode:
authorAndrew Dunning <adunning@users.noreply.github.com>2019-03-13 20:22:28 -0400
committerJohn MacFarlane <jgm@berkeley.edu>2019-03-13 18:22:28 -0600
commitbbe2da390e5ec49ce6c88e00ba5f1c7f2b4c7c80 (patch)
tree88a21744322ef4bd74d51c6f70323541147d62a1 /test/writers-lang-and-dir.latex
parent8d58c6170242bea5b281f8ff78e16b2008f1eb50 (diff)
downloadpandoc-bbe2da390e5ec49ce6c88e00ba5f1c7f2b4c7c80.tar.gz
LaTeX template: Improve readability (#5363)
+ LaTeX template: Improve template readability Use `hidelinks` option for hyperref, which has the same effect as `pdfborder={0 0 0}`, but its purpose is clearer. Use a simpler conditional for Polyglossia/Babel. Format comments more consistently. + Update tests + Remove hyperref breaklinks option. According to the documentation, hyperref sets this automatically as appropriate to the driver.
Diffstat (limited to 'test/writers-lang-and-dir.latex')
-rw-r--r--test/writers-lang-and-dir.latex37
1 files changed, 19 insertions, 18 deletions
diff --git a/test/writers-lang-and-dir.latex b/test/writers-lang-and-dir.latex
index 6db49d1a9..d98b79cea 100644
--- a/test/writers-lang-and-dir.latex
+++ b/test/writers-lang-and-dir.latex
@@ -1,4 +1,5 @@
-\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
+% Options for packages loaded elsewhere
+\PassOptionsToPackage{unicode=true}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
@@ -16,7 +17,7 @@
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
-% use upquote if available, for straight quotes in verbatim environments
+% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
@@ -36,10 +37,10 @@
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
- pdfborder={0 0 0},
- breaklinks=true}
-\urlstyle{same} % don't use monospace font for urls
-\setlength{\emergencystretch}{3em} % prevent overfull lines
+ hidelinks,
+}
+\urlstyle{same} % disable monospaced font for URLs
+\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
@@ -53,12 +54,21 @@
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
-% set default figure placement to htbp
+% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
-\ifnum 0\ifxetex 1\fi=0 % if pdftex or luatex
+\ifxetex
+ % Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic)
+ \usepackage{polyglossia}
+ \setmainlanguage[]{english}
+ \setotherlanguage[]{german}
+ \setotherlanguage[variant=british]{english}
+ \setotherlanguage[variant=swiss]{german}
+ \setotherlanguage[]{spanish}
+ \setotherlanguage[]{french}
+\else
\usepackage[shorthands=off,ngerman,british,nswissgerman,spanish,french,main=english]{babel}
\newcommand{\textgerman}[2][]{\foreignlanguage{ngerman}{#2}}
\newenvironment{german}[2][]{\begin{otherlanguage}{ngerman}}{\end{otherlanguage}}
@@ -69,18 +79,9 @@
\AddBabelHook{spanish}{afterextras}{\renewcommand{\textspanish}[2][]{\foreignlanguage{spanish}{##2}}}
\newcommand{\textfrench}[2][]{\foreignlanguage{french}{#2}}
\newenvironment{french}[2][]{\begin{otherlanguage}{french}}{\end{otherlanguage}}
-\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[]{english}
- \setotherlanguage[]{german}
- \setotherlanguage[variant=british]{english}
- \setotherlanguage[variant=swiss]{german}
- \setotherlanguage[]{spanish}
- \setotherlanguage[]{french}
\fi
\ifxetex
- % load bidi as late as possible as it modifies e.g. graphicx
+ % Load bidi as late as possible as it modifies e.g. graphicx
\usepackage{bidi}
\fi
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex