Skip to content

Commit

Permalink
only include Euler for pdfLaTeX and switch default math font to FiraM…
Browse files Browse the repository at this point in the history
…ath for XeLaTeX (with option to switch back to Euler)
  • Loading branch information
michaelroland committed Mar 7, 2024
1 parent 1cc7d52 commit 5e895b0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
23 changes: 20 additions & 3 deletions beamerfontthemejku.sty
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,15 @@
% Option [no]mathastext: use standard document fonts (and default to sans-serif font) in math mode
\newbool{jkubeamer@mathastext}
%\booltrue{jkubeamer@mathastext}%
\DeclareOptionBeamer{mathastext}[true]{\setbool{jkubeamer@mathastext}{#1}}
\DeclareOptionBeamer{mathastext}[true]{\setbool{jkubeamer@mathastext}{#1}\ifbool{jkubeamer@mathastext}{\boolfalse{jkubeamer@eulermath}}{}}
\DeclareOptionBeamer{nomathastext}{\boolfalse{jkubeamer@mathastext}}

% Option [no]eulermath: use Euler math fonts (instead of Fira Sans) in math mode (legacy behavior)
\newbool{jkubeamer@eulermath}
%\booltrue{jkubeamer@eulermath}%
\DeclareOptionBeamer{eulermath}[true]{\setbool{jkubeamer@eulermath}{#1}\ifbool{jkubeamer@mathastext}{\boolfalse{jkubeamer@mathastext}}{}}
\DeclareOptionBeamer{noeulermath}{\boolfalse{jkubeamer@eulermath}}

\ProcessOptionsBeamer

%%
Expand All @@ -81,7 +87,9 @@
\RequirePackage{lmodern}
\RequirePackage{inconsolata}
\RequirePackage{helvet}
\RequirePackage{euler}
\ifxetex\else%
\RequirePackage{euler}
\fi
\RequirePackage{fontawesome5}
\ifxetex\else%
% fix potentially mis-packaged FA5 in TeX Live 2017, see https://tex.stackexchange.com/q/497792/290236
Expand All @@ -98,7 +106,16 @@
\fi

\ifbool{jkubeamer@xetexfonts}{%
\RequirePackage[no-math]{fontspec}
\ifbool{jkubeamer@eulermath}{
\@ifpackageloaded{unicode-math}{%
\setmathfont{Euler-Math.otf}
}{%
\RequirePackage{euler-math}%
}%
}{%
\RequirePackage{firamath-otf}%
%\RequirePackage[no-math]{fontspec}
}
% discover font path
\expandafter\IfFileExists\expandafter{\jkubeamer@fontpath PublicSans-Regular.ttf}{%
\IfFontExistsTF{\jkubeamer@fontpath PublicSans-Regular.ttf}{%
Expand Down
2 changes: 2 additions & 0 deletions beamerthemejku.sty
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@
\DeclareOptionBeamer{nocompactmono}{\PassOptionsToPackage{nocompactmono}{beamerfontthemejku}}
\DeclareOptionBeamer{mathastext}[true]{\PassOptionsToPackage{mathastext=#1}{beamerfontthemejku}}
\DeclareOptionBeamer{nomathastext}{\PassOptionsToPackage{nomathastext}{beamerfontthemejku}}
\DeclareOptionBeamer{eulermath}[true]{\PassOptionsToPackage{eulermath=#1}{beamerfontthemejku}}
\DeclareOptionBeamer{noeulermath}{\PassOptionsToPackage{noeulermath}{beamerfontthemejku}}

\ProcessOptionsBeamer

Expand Down
5 changes: 2 additions & 3 deletions main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,9 @@
%% * mac ... Use adapted color palette for screen display on Mac.
%% * legacyitemizestyle ... Use old bullet style in itemization.
%%
%% Experimental options:
%% * mathastext ... Use standard document fonts (and default to sans-serif font) in math mode
%%
%% Advanced options:
%% * mathastext ... Use standard document fonts in math mode
%% * eulermath ... Use Euler fonts (instead of Fira sans-serif font) in math mode with XeTeX
%% * nooptpackages ... Do not load additional convenience packages (which are only there
%% to provide interoperability to the behavior of previous versions of
%% this theme but are not actually required for the current version).
Expand Down

0 comments on commit 5e895b0

Please sign in to comment.