%This package provides support for the mlmodern fonts. See mlmodern.pdf
%for more information.
%This work may be distributed and/or modified under the conditions
%of the LaTeX Project Public License, either version 1.3c of this
%license or (at your option) any later version.
%Copyright 2003--2009 by B. Jackowski and J.M. Nowacki.
%Copyright 2021--2026 by Daniel Benjamin Miller.
%This work has the LPPL maintenance status "maintained".
%The Current Maintainer of this work is Daniel Benjamin Miller.
\ProvidesPackage{mlmodern}[2026/10/13 v2.0 Modified Latin Modern Fonts]
\renewcommand{\rmdefault}{mlmr}
\renewcommand{\sfdefault}{mlmss}
\renewcommand{\ttdefault}{mlmtt}
\renewcommand{\bfdefault}{bx}
%Prevent fontspec from resetting \rmdefault, \sfdefault and \ttdefault to Latin Modern
\def\mlm@ttdefault{mlmtt}
\AddToHook{package/fontspec/after}{%
\renewcommand{\rmdefault}{mlmr}%
\renewcommand{\sfdefault}{mlmss}%
\let\ttdefault\mlm@ttdefault
}
\DeclareOption{nomath}{\endinput}
\DeclareOption{variablett}{%
\renewcommand{\ttdefault}{mlmvtt}
\def\mlm@ttdefault{mlmvtt}
}
\DeclareOption{lighttt}{%
\let\mlmtt@use@light@as@normal\@empty
}
\ProcessOptions\relax
%Make MLModern Math the unicode-math default when no math font is set
\ExplSyntaxOn
\cs_new_protected:Npn\__mlm_unicode_math_default:
{
\cs_if_exist:NT\__um_load_lm:
{
\cs_set:Npn\__um_load_lm:
{\setmathfont{mlmodern-math.otf}[BoldFont={mlmodern-math.otf}]}
}
}
\@ifpackageloaded{unicode-math}
{\__mlm_unicode_math_default:}
{\AddToHook{package/unicode-math/after}{\__mlm_unicode_math_default:}}
\ExplSyntaxOff
%If unicode-math is already loaded
\@ifpackageloaded{unicode-math}{\endinput}{}
%Keep fontspec from replacing the math setup below with Computer Modern
\PassOptionsToPackage{no-math}{fontspec}
\ExplSyntaxOn
\@ifpackageloaded{fontspec}
{\bool_if_exist:NT\g__fontspec_math_bool{\bool_gset_false:N\g__fontspec_math_bool}}
{}
\ExplSyntaxOff
\SetSymbolFont{operators}{normal}{OT1}{mlmr}{m}{n}
\SetSymbolFont{letters}{normal}{OML}{mlmm}{m}{it}
\SetSymbolFont{symbols}{normal}{OMS}{mlmsy}{m}{n}
\SetSymbolFont{largesymbols}{normal}{OMX}{mlmex}{m}{n}
\SetSymbolFont{operators}{bold}{OT1}{mlmr}{bx}{n}
\SetSymbolFont{letters}{bold}{OML}{mlmm}{b}{it}
\SetSymbolFont{symbols}{bold}{OMS}{mlmsy}{b}{n}
\SetSymbolFont{largesymbols}{bold}{OMX}{mlmex}{m}{n}
\SetMathAlphabet{\mathbf}{normal}{OT1}{mlmr}{bx}{n}
\SetMathAlphabet{\mathsf}{normal}{OT1}{mlmss}{m}{n}
\SetMathAlphabet{\mathit}{normal}{OT1}{mlmr}{m}{it}
\SetMathAlphabet{\mathtt}{normal}{OT1}{mlmtt}{m}{n}
\SetMathAlphabet{\mathbf}{bold}{OT1}{mlmr}{bx}{n}
\SetMathAlphabet{\mathsf}{bold}{OT1}{mlmss}{bx}{n}
\SetMathAlphabet{\mathit}{bold}{OT1}{mlmr}{bx}{it}
\SetMathAlphabet{\mathtt}{bold}{OT1}{mlmtt}{m}{n}
\def\mathsterling{\mathit{\mathchar"70BF}}
\endinput
