% From mitthesis package
% Version: 1.00, 2023/06/17
% Documentation: https://ctan.org/pkg/mitthesis

%% Linux Libertine (serif) text font with newtxmath[libertine] (pdftex) or Libertinus (unicode) math font
%
%  These fonts are available here https://ctan.org/tex-archive/fonts/libertine/opentype 
%						 and here https://github.com/alerque/libertinus
% install these as system fonts on your computer
%
\ifpdftex
	\typeout{^^JLoading newtx-libertine text and math fonts with insolata typewriter font^^J}
    \usepackage[lining,semibold]{libertine} 
    \usepackage[T1]{fontenc}
    \usepackage[varqu,varl]{inconsolata}% typewriter
%    \usepackage{amsthm}% must be loaded before newtxmath
    \usepackage[libertine,vvarbb]{newtxmath}
    \usepackage{bm}% load after all math to give access to bold math
\else
	\typeout{^^JLoading Linux Libertine (serif) text font with Libertinus math font^^J}
	%
    \usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math}
    % suppress tiresome warnings about lack of integration between mathtools and unicode-math
    % unicode math loads the fontspec package
 	%
    \setmainfont{LinLibertine}[% Linux Libertine O  
    	Extension = .otf,
    	UprightFont = *_R,
    	ItalicFont = *_RI,
    	BoldFont = *_RZ, % Libertine O Semibold
    	BoldItalicFont = *_RZI, % Libertine O Semibold Italic
    %	Ligatures=Rare,% TeX
    %	Numbers=OldStyle,%
    	RawFeature={+ss05},% +ss02 would change J, K, R; +ss05 changes W	
        ]    
    \setmonofont{LinLibertine}[% Linux Libertine Mono O
    	Scale=0.9,
	    Extension = .otf,
    	UprightFont = *_M,
    	ItalicFont = *_MO,% oblique
    	BoldFont = *_MB,
	    BoldItalicFont = *_MBO,% oblique
	]    
    \setsansfont{LinBiolinum}[% Linux Biolinum O
    	Extension = .otf,
    	UprightFont = *_R,
    	ItalicFont = *_RI,
    	BoldFont = *_RB,
	    BoldItalicFont = *_RBO,% oblique
    	Scale=MatchUppercase]
	%    	
    %% a Libertine-style math font
    \setmathfont{libertinusmath-regular}[%
     	Extension = .otf,   
    	Scale=MatchUppercase,
		BoldFont = *,% This font lacks a bold version
    	RawFeature={+ss08},% +ss08 gives slanted integrals (no other features) 	
    	]
    \newcommand*{\FRAC}[1]{{\addfontfeature{Fractions=On}#1}}% use OpenType feature for fractions, \FRAC{1/2}   
\fi
