diff options
| author | Jeremie Knuesel <[email protected]> | 2022-09-23 18:00:38 +0200 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2022-10-06 10:14:38 -0700 |
| commit | 644c9841696263bcb8118538fa0f3fae9e5e89fb (patch) | |
| tree | 886e36eea3693c84cd95d848ef0d0625c42c505f | |
| parent | afbf732a830074cb01804d9808cc8334a1572c8e (diff) | |
latex template: set fonts after Beamer theme
Beamer themes such as metropolis and saintpetersburg change the default
fonts. This change gives precedence to the user font settings by moving
them after the loading of the Beamer theme.
| -rw-r--r-- | data/templates/default.latex | 66 | ||||
| -rw-r--r-- | test/lhs-test.latex | 7 | ||||
| -rw-r--r-- | test/lhs-test.latex+lhs | 7 | ||||
| -rw-r--r-- | test/writer.latex | 7 | ||||
| -rw-r--r-- | test/writers-lang-and-dir.latex | 7 |
5 files changed, 57 insertions, 37 deletions
diff --git a/data/templates/default.latex b/data/templates/default.latex index 7b02262a3..1e76be34b 100644 --- a/data/templates/default.latex +++ b/data/templates/default.latex @@ -82,11 +82,6 @@ $if(beamerarticle)$ \usepackage{beamerarticle} % needs to be loaded first $endif$ \usepackage{amsmath,amssymb} -$if(fontfamily)$ -\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$} -$else$ -\usepackage{lmodern} -$endif$ $if(linestretch)$ \usepackage{setspace} $endif$ @@ -98,15 +93,48 @@ $endif$ \else % if luatex or xetex $if(mathspec)$ \ifXeTeX - \usepackage{mathspec} + \usepackage{mathspec} % this also loads fontspec \else - \usepackage{unicode-math} + \usepackage{unicode-math} % this also loads fontspec \fi $else$ - \usepackage{unicode-math} + \usepackage{unicode-math} % this also loads fontspec $endif$ - \defaultfontfeatures{Scale=MatchLowercase} + \defaultfontfeatures{Scale=MatchLowercase}$-- must come before Beamer theme \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} +\fi +$if(fontfamily)$ +$else$ +$-- Set default font before Beamer theme so the theme can override it +\usepackage{lmodern} +$endif$ +$-- Set Beamer theme before user font settings so they can override theme +$if(beamer)$ +$if(theme)$ +\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$} +$endif$ +$if(colortheme)$ +\usecolortheme{$colortheme$} +$endif$ +$if(fonttheme)$ +\usefonttheme{$fonttheme$} +$endif$ +$if(mainfont)$ +\usefonttheme{serif} % use mainfont rather than sansfont for slide text +$endif$ +$if(innertheme)$ +\useinnertheme{$innertheme$} +$endif$ +$if(outertheme)$ +\useoutertheme{$outertheme$} +$endif$ +$endif$ +$-- User font settings (must come after default font and Beamer theme) +$if(fontfamily)$ +\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$} +$endif$ +\ifPDFTeX\else + % xetex/luatex font selection $if(mainfont)$ \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$} $endif$ @@ -167,26 +195,6 @@ $if(zero-width-non-joiner)$ \fi %% End of ZWNJ support $endif$ -$if(beamer)$ -$if(theme)$ -\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$} -$endif$ -$if(colortheme)$ -\usecolortheme{$colortheme$} -$endif$ -$if(fonttheme)$ -\usefonttheme{$fonttheme$} -$endif$ -$if(mainfont)$ -\usefonttheme{serif} % use mainfont rather than sansfont for slide text -$endif$ -$if(innertheme)$ -\useinnertheme{$innertheme$} -$endif$ -$if(outertheme)$ -\useoutertheme{$outertheme$} -$endif$ -$endif$ % Use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{} \IfFileExists{microtype.sty}{% use microtype if available diff --git a/test/lhs-test.latex b/test/lhs-test.latex index 435d1dfef..d496399b4 100644 --- a/test/lhs-test.latex +++ b/test/lhs-test.latex @@ -5,17 +5,20 @@ \documentclass[ ]{article} \usepackage{amsmath,amssymb} -\usepackage{lmodern} \usepackage{iftex} \ifPDFTeX \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provide euro and other symbols \else % if luatex or xetex - \usepackage{unicode-math} + \usepackage{unicode-math} % this also loads fontspec \defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} \fi +\usepackage{lmodern} +\ifPDFTeX\else + % xetex/luatex font selection +\fi % Use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{} \IfFileExists{microtype.sty}{% use microtype if available diff --git a/test/lhs-test.latex+lhs b/test/lhs-test.latex+lhs index 6c11e99bd..e12f253f3 100644 --- a/test/lhs-test.latex+lhs +++ b/test/lhs-test.latex+lhs @@ -5,17 +5,20 @@ \documentclass[ ]{article} \usepackage{amsmath,amssymb} -\usepackage{lmodern} \usepackage{iftex} \ifPDFTeX \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provide euro and other symbols \else % if luatex or xetex - \usepackage{unicode-math} + \usepackage{unicode-math} % this also loads fontspec \defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} \fi +\usepackage{lmodern} +\ifPDFTeX\else + % xetex/luatex font selection +\fi % Use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{} \IfFileExists{microtype.sty}{% use microtype if available diff --git a/test/writer.latex b/test/writer.latex index 0b47a069e..3d0cf9851 100644 --- a/test/writer.latex +++ b/test/writer.latex @@ -5,17 +5,20 @@ \documentclass[ ]{article} \usepackage{amsmath,amssymb} -\usepackage{lmodern} \usepackage{iftex} \ifPDFTeX \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provide euro and other symbols \else % if luatex or xetex - \usepackage{unicode-math} + \usepackage{unicode-math} % this also loads fontspec \defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} \fi +\usepackage{lmodern} +\ifPDFTeX\else + % xetex/luatex font selection +\fi % Use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{} \IfFileExists{microtype.sty}{% use microtype if available diff --git a/test/writers-lang-and-dir.latex b/test/writers-lang-and-dir.latex index d4d3feb68..0966a8312 100644 --- a/test/writers-lang-and-dir.latex +++ b/test/writers-lang-and-dir.latex @@ -5,17 +5,20 @@ \documentclass[ ]{article} \usepackage{amsmath,amssymb} -\usepackage{lmodern} \usepackage{iftex} \ifPDFTeX \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provide euro and other symbols \else % if luatex or xetex - \usepackage{unicode-math} + \usepackage{unicode-math} % this also loads fontspec \defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} \fi +\usepackage{lmodern} +\ifPDFTeX\else + % xetex/luatex font selection +\fi % Use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{} \IfFileExists{microtype.sty}{% use microtype if available |
