From bbe2da390e5ec49ce6c88e00ba5f1c7f2b4c7c80 Mon Sep 17 00:00:00 2001 From: Andrew Dunning Date: Wed, 13 Mar 2019 20:22:28 -0400 Subject: 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. --- data/templates/default.latex | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'data/templates') diff --git a/data/templates/default.latex b/data/templates/default.latex index fd15e5b15..bb83755e0 100644 --- a/data/templates/default.latex +++ b/data/templates/default.latex @@ -1,4 +1,5 @@ -\PassOptionsToPackage{unicode=true$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref} % options for packages loaded elsewhere +% Options for packages loaded elsewhere +\PassOptionsToPackage{unicode=true$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref} \PassOptionsToPackage{hyphens}{url} $if(colorlinks)$ \PassOptionsToPackage{dvipsnames,svgnames*,x11names*}{xcolor} @@ -46,7 +47,7 @@ $endif$ $for(beameroption)$ \setbeameroption{$beameroption$} $endfor$ -% Prevent slide breaks in the middle of a paragraph: +% Prevent slide breaks in the middle of a paragraph \widowpenalties 1 10000 \raggedbottom $if(section-titles)$ @@ -173,7 +174,7 @@ $if(outertheme)$ \useoutertheme{$outertheme$} $endif$ $endif$ -% 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[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype} @@ -218,10 +219,10 @@ $if(colorlinks)$ citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$, urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$, $else$ - pdfborder={0 0 0}, + hidelinks, $endif$ - breaklinks=true} -\urlstyle{same} % don't use monospace font for urls +} +\urlstyle{same} % disable monospaced font for URLs $if(verbatim-in-note)$ \VerbatimFootnotes % allows verbatim text in footnotes $endif$ @@ -247,7 +248,7 @@ $if(tables)$ \usepackage{longtable,booktabs} $if(beamer)$ \usepackage{caption} -% These lines are needed to make table captions work with longtable: +% Make caption package work with longtable \makeatletter \def\fnum@table{\tablename~\thetable} \makeatother @@ -274,10 +275,10 @@ $if(links-as-notes)$ $endif$ $if(strikeout)$ \usepackage[normalem]{ulem} -% avoid problems with \sout in headers with hyperref: +% Avoid problems with \sout in headers with hyperref \pdfstringdefDisableCommands{\renewcommand{\sout}{}} $endif$ -\setlength{\emergencystretch}{3em} % prevent overfull lines +\setlength{\emergencystretch}{3em} % prevent overfull lines \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} $if(numbersections)$ @@ -304,7 +305,7 @@ $if(pagestyle)$ \pagestyle{$pagestyle$} $endif$ -% set default figure placement to htbp +% Set default figure placement to htbp \makeatletter \def\fps@figure{htbp} \makeatother @@ -313,23 +314,23 @@ $for(header-includes)$ $header-includes$ $endfor$ $if(lang)$ -\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 % if xetex - % load polyglossia as late as possible as it *could* call bidi if RTL lang (e.g. Hebrew or Arabic) +\ifxetex + % Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic) \usepackage{polyglossia} \setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$} $for(polyglossia-otherlangs)$ \setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$} $endfor$ +\else + \usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel} +$if(babel-newcommands)$ + $babel-newcommands$ +$endif$ \fi $endif$ $if(dir)$ \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 -- cgit v1.2.3