From e91af0a8a32d68af4c533fdf4b7caaafade577ef Mon Sep 17 00:00:00 2001 From: Andrew Dunning <adunning@users.noreply.github.com> Date: Sat, 23 Mar 2019 00:35:55 -0400 Subject: [PATCH] LaTeX template: Group graphics-related code (#5389) * LaTeX template: Group graphics-related code The default figure placement was added in <https://github.com/jgm/pandoc/commit/f3ab4bc2b99e9f7f3917708a9110d6500aa051a0>; there does not appear to have been a reason for placing it at the end of the preamble. * Update tests --- data/templates/default.latex | 13 ++++++------- test/lhs-test.latex | 9 ++------- test/lhs-test.latex+lhs | 9 ++------- test/writer.latex | 13 ++++++------- test/writers-lang-and-dir.latex | 9 ++------- 5 files changed, 18 insertions(+), 35 deletions(-) diff --git a/data/templates/default.latex b/data/templates/default.latex index 8cd64b866..11726c0e3 100644 --- a/data/templates/default.latex +++ b/data/templates/default.latex @@ -1,5 +1,5 @@ % Options for packages loaded elsewhere -\PassOptionsToPackage{unicode=true$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref} +\PassOptionsToPackage{unicode$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref} \PassOptionsToPackage{hyphens}{url} $if(colorlinks)$ \PassOptionsToPackage{dvipsnames,svgnames*,x11names*}{xcolor} @@ -100,7 +100,7 @@ $endif$ \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provides euro and other symbols -\else % if luatex or xelatex +\else % if luatex or xetex $if(mathspec)$ \ifxetex \usepackage{mathspec} @@ -267,6 +267,10 @@ $if(graphics)$ % margins by default, and it is still possible to overwrite the defaults % using explicit options in \includegraphics[width, height, ...]{} \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} +% Set default figure placement to htbp +\makeatletter +\def\fps@figure{htbp} +\makeatother $endif$ $if(links-as-notes)$ % Make links footnotes instead of hotlinks: @@ -304,11 +308,6 @@ $if(pagestyle)$ \pagestyle{$pagestyle$} $endif$ -% Set default figure placement to htbp -\makeatletter -\def\fps@figure{htbp} -\makeatother - $for(header-includes)$ $header-includes$ $endfor$ diff --git a/test/lhs-test.latex b/test/lhs-test.latex index 9b5d2790a..fe3020054 100644 --- a/test/lhs-test.latex +++ b/test/lhs-test.latex @@ -1,5 +1,5 @@ % Options for packages loaded elsewhere -\PassOptionsToPackage{unicode=true}{hyperref} +\PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url} % \documentclass[ @@ -11,7 +11,7 @@ \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provides euro and other symbols -\else % if luatex or xelatex +\else % if luatex or xetex \usepackage{unicode-math} \defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} @@ -91,11 +91,6 @@ \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} \fi -% Set default figure placement to htbp -\makeatletter -\def\fps@figure{htbp} -\makeatother - \date{} diff --git a/test/lhs-test.latex+lhs b/test/lhs-test.latex+lhs index 0b9f3d1b5..7f0eaf32c 100644 --- a/test/lhs-test.latex+lhs +++ b/test/lhs-test.latex+lhs @@ -1,5 +1,5 @@ % Options for packages loaded elsewhere -\PassOptionsToPackage{unicode=true}{hyperref} +\PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url} % \documentclass[ @@ -11,7 +11,7 @@ \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provides euro and other symbols -\else % if luatex or xelatex +\else % if luatex or xetex \usepackage{unicode-math} \defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} @@ -58,11 +58,6 @@ \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} \fi -% Set default figure placement to htbp -\makeatletter -\def\fps@figure{htbp} -\makeatother - \date{} diff --git a/test/writer.latex b/test/writer.latex index e96c663f8..6db1aa90e 100644 --- a/test/writer.latex +++ b/test/writer.latex @@ -1,5 +1,5 @@ % Options for packages loaded elsewhere -\PassOptionsToPackage{unicode=true}{hyperref} +\PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url} % \documentclass[ @@ -11,7 +11,7 @@ \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provides euro and other symbols -\else % if luatex or xelatex +\else % if luatex or xetex \usepackage{unicode-math} \defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} @@ -52,6 +52,10 @@ % margins by default, and it is still possible to overwrite the defaults % using explicit options in \includegraphics[width, height, ...]{} \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} +% Set default figure placement to htbp +\makeatletter +\def\fps@figure{htbp} +\makeatother \usepackage[normalem]{ulem} % Avoid problems with \sout in headers with hyperref \pdfstringdefDisableCommands{\renewcommand{\sout}{}} @@ -69,11 +73,6 @@ \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} \fi -% Set default figure placement to htbp -\makeatletter -\def\fps@figure{htbp} -\makeatother - \title{Pandoc Test Suite} \author{John MacFarlane \and Anonymous} diff --git a/test/writers-lang-and-dir.latex b/test/writers-lang-and-dir.latex index d98b79cea..c765f358a 100644 --- a/test/writers-lang-and-dir.latex +++ b/test/writers-lang-and-dir.latex @@ -1,5 +1,5 @@ % Options for packages loaded elsewhere -\PassOptionsToPackage{unicode=true}{hyperref} +\PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url} % \documentclass[ @@ -12,7 +12,7 @@ \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provides euro and other symbols -\else % if luatex or xelatex +\else % if luatex or xetex \usepackage{unicode-math} \defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} @@ -54,11 +54,6 @@ \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} \fi -% Set default figure placement to htbp -\makeatletter -\def\fps@figure{htbp} -\makeatother - \ifxetex % Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic) \usepackage{polyglossia}