Skip to content

Commit

Permalink
LaTeX/Beamer template changes.
Browse files Browse the repository at this point in the history
- Split fonts.latex partial into two parts: fonts.latex and
  font-settings.latex.
- In beamer template, load beamer theme between fonts.latex and
  font-settings.latex. This allows a theme (such as metropolis)
  to set its own default font, while still allowing the user to
  override it.

This fixes a regression in pandoc 3.5.

Users who have custom templates based on pandoc 3.5 templates will
need to add `font-settings.latex()` after `fonts.latex()` in the
latex template. In a beamer template, the beamer theme-setting
code needs to be moved between these two partials.

Closes #10297.
  • Loading branch information
jgm committed Oct 24, 2024
1 parent cd5dab1 commit 516931f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 121 deletions.
37 changes: 19 additions & 18 deletions data/templates/default.beamer
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,24 @@ $endif$
$for(beameroption)$
\setbeameroption{$beameroption$}
$endfor$
% Prevent slide breaks in the middle of a paragraph
\widowpenalties 1 10000
\raggedbottom
$if(section-titles)$
\AtBeginPart{
\frame{\partpage}
}
\AtBeginSection{
\ifbibliography
\else
\frame{\sectionpage}
\fi
}
\AtBeginSubsection{
\frame{\subsectionpage}
}
$endif$
$fonts.latex()$
$-- Set Beamer theme before user font settings so they can override theme
$if(theme)$
\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}
Expand All @@ -81,24 +99,7 @@ $endif$
$if(outertheme)$
\useoutertheme[$for(outerthemeoptions)$$outerthemeoptions$$sep$,$endfor$]{$outertheme$}
$endif$
% Prevent slide breaks in the middle of a paragraph
\widowpenalties 1 10000
\raggedbottom
$if(section-titles)$
\AtBeginPart{
\frame{\partpage}
}
\AtBeginSection{
\ifbibliography
\else
\frame{\sectionpage}
\fi
}
\AtBeginSubsection{
\frame{\subsectionpage}
}
$endif$
$fonts.latex()$
$font-settings.latex()$
$common.latex()$
$for(header-includes)$
$header-includes$
Expand Down
1 change: 1 addition & 0 deletions data/templates/default.latex
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ $else$
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
$endif$
$fonts.latex()$
$font-settings.latex()$
$common.latex()$
$for(header-includes)$
$header-includes$
Expand Down
103 changes: 0 additions & 103 deletions data/templates/fonts.latex
Original file line number Diff line number Diff line change
Expand Up @@ -21,106 +21,3 @@ $else$
$-- Set default font before Beamer theme so the theme can override it
\usepackage{lmodern}
$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)$
$if(mainfontfallback)$
\ifLuaTeX
\usepackage{luaotfload}
\directlua{luaotfload.add_fallback("mainfontfallback",{
$for(mainfontfallback)$"$mainfontfallback$"$sep$,$endfor$
})}
\fi
$endif$
\setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$$if(mainfontfallback)$,RawFeature={fallback=mainfontfallback}$endif$]{$mainfont$}
$endif$
$if(sansfont)$
$if(sansfontfallback)$
\ifLuaTeX
\usepackage{luaotfload}
\directlua{luaotfload.add_fallback("sansfontfallback",{
$for(sansfontfallback)$"$sansfontfallback$"$sep$,$endfor$
})}
\fi
$endif$
\setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$$if(sansfontfallback)$,RawFeature={fallback=sansfontfallback}$endif$]{$sansfont$}
$endif$
$if(monofont)$
$if(monofontfallback)$
\ifLuaTeX
\usepackage{luaotfload}
\directlua{luaotfload.add_fallback("monofontfallback",{
$for(monofontfallback)$"$monofontfallback$"$sep$,$endfor$
})}
\fi
$endif$
\setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$if(monofontfallback)$,RawFeature={fallback=monofontfallback}$endif$]{$monofont$}
$endif$
$for(fontfamilies)$
\newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$}
$endfor$
$if(mathfont)$
$if(mathspec)$
\ifXeTeX
\setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
\else
\setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
\fi
$else$
\setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
$endif$
$endif$
$if(CJKmainfont)$
\ifXeTeX
\usepackage{xeCJK}
\setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
$if(CJKsansfont)$
\setCJKsansfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKsansfont$}
$endif$
$if(CJKmonofont)$
\setCJKmonofont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmonofont$}
$endif$
\fi
$endif$
$if(luatexjapresetoptions)$
\ifLuaTeX
\usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset}
\fi
$endif$
$if(CJKmainfont)$
\ifLuaTeX
\usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec}
\setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
\fi
$endif$
\fi
$if(zero-width-non-joiner)$
%% Support for zero-width non-joiner characters.
\makeatletter
\def\zerowidthnonjoiner{%
% Prevent ligatures and adjust kerning, but still support hyphenating.
\texorpdfstring{%
\TextOrMath{\nobreak\discretionary{-}{}{\kern.03em}%
\ifvmode\else\nobreak\hskip\z@skip\fi}{}%
}{}%
}
\makeatother
\ifPDFTeX
\DeclareUnicodeCharacter{200C}{\zerowidthnonjoiner}
\else
\catcode`^^^^200c=\active
\protected\def ^^^^200c{\zerowidthnonjoiner}
\fi
%% End of ZWNJ support
$endif$
% 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}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}

0 comments on commit 516931f

Please sign in to comment.