summaryrefslogtreecommitdiff
path: root/fonts/libertinust1math/tex/libertinust1math.sty
diff options
context:
space:
mode:
Diffstat (limited to 'fonts/libertinust1math/tex/libertinust1math.sty')
-rw-r--r--fonts/libertinust1math/tex/libertinust1math.sty79
1 files changed, 71 insertions, 8 deletions
diff --git a/fonts/libertinust1math/tex/libertinust1math.sty b/fonts/libertinust1math/tex/libertinust1math.sty
index b70a32d5d6..254c2a2618 100644
--- a/fonts/libertinust1math/tex/libertinust1math.sty
+++ b/fonts/libertinust1math/tex/libertinust1math.sty
@@ -1,10 +1,12 @@
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\def\fileversion{2.0.1}
-\def\filedate{2022/01/05}
+\def\fileversion{2.0.3}
+\def\filedate{2023/12/07}
\ProvidesPackage{libertinust1math}
[\filedate\space v\fileversion---latex support for LibertinusT1Math (msharpe)]
\RequirePackage{xkeyval,etoolbox}
+\def\ifiscseq#1{\ifcat$\expandafter\@gobble\string#1$\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi}
+
\newif\iflibus@upint %\libus@upintfalse
\newif\iflibus@ams % amsfonts
\newif\iflibus@frenchm
@@ -15,13 +17,28 @@
\newif\iflibus@reuseMathAlphabets
\newif\iflibus@mathsfit %
\let\libus@lcgc\mathord
+\newif\iflibus@thrm
\newif\iflibus@sbc
\newif\iflibus@subsfile
\newcommand{\enablesbcorrection}{\libus@sbctrue\AtBeginDocument{\mathcode`\_=\string"8000 \catcode`\_=12\relax}}
\newif\ifntx@amsthm
\def\ntxmath@vecsep{.25ex}
+\def\libus@spc{.32em}
+\def\libus@stretch{.16em}
+\def\libus@shrink{.10em}
+
+\DeclareOptionX{spacing}{%
+\def\libus@spc{#1}
+}
+\DeclareOptionX{stretch}{%
+\def\libus@stretch{#1}
+}
+\DeclareOptionX{shrink}{%
+\def\libus@shrink{#1}
+}
+\DeclareOptionX{theoremfont}{\libus@thrmtrue}
\DeclareOptionX{subscriptcorrectionfile}{\def\libus@subs{#1}\libus@subsfiletrue}
\DeclareOptionX{nosubscriptcorrection}{\libus@sbcfalse}
\DeclareOptionX{subscriptcorrection}{\libus@sbctrue}
@@ -38,8 +55,8 @@
\DeclareOptionX{scale} {\def\libus@scale{#1}}
\DeclareOptionX{scaled} {\def\libus@scale{#1}}
\DeclareOptionX{amsthm}{\ntx@amsthmtrue}
-\ProcessOptionsX\relax
+\ProcessOptionsX\relax
\iflibus@frenchm\libus@slantedGfalse\fi
\iflibus@sansmath\libus@nosanstrue\fi
@@ -152,7 +169,7 @@
% Should test for which math italic font and customize these numbers.
\def\tx@sb@dflt{% default subscript kerns, usually negative
\if\next f\mkern-2mu\else
- \if\next j\mkern-3mu\else
+ \if\next j\mkern-2mu\else
\if\next p\mkern-2mu\else
\if\next y\mkern-\@ne mu\else
\if\next A\mkern-3mu\else
@@ -191,7 +208,7 @@
\tx@tA\expandafter{\the\expandafter\tx@tA\the\tx@tB}
\expandafter\def\expandafter\tx@sb\expandafter{\the\tx@tA}}
-\def\tx@subs{libertinus-subs.tex}
+\def\libus@subs{libertinus-subs.tex}
\newread\tx@su
\def\readsufile#1{%
@@ -213,11 +230,11 @@
%\traceon
\iflibus@sbc
\expandafter\ifx\csname xyversion\endcsname\relax \else
- \PackageError{newtxmath}{xy package is not compatible with the subscriptcorrection macros}{Either remove xy or disable
+ \PackageError{libust1math}{xy package is not compatible with the subscriptcorrection macros}{Either remove xy or disable
subscriptcorrection by means of package option nosubscriptcorrection}
\fi
- \IfFileExists{\tx@subs}{\loadsubfile{\tx@subs}}%
- {\def\tx@sb{\tx@sb@dflt}\message{File \tx@subs\space not found. Using internal defaults for subscript correction.^^J}}
+ \IfFileExists{\libus@subs}{\loadsubfile{\libus@subs}}%
+ {\def\tx@sb{\tx@sb@dflt}\message{File \libus@subs\space not found. Using internal defaults for subscript correction.^^J}}
\fi
%\traceoff
}
@@ -245,6 +262,52 @@
\sb{\tx@sb \tx@next@}} % \tx@sb provides mkern to insert before first tok
\fi
+% Replacement handling of theorem italic in libertinus
+% to make for better spacing between text italics and math fragments
+\def\libus@spacing{%
+ \fontdimen2\font=\libus@spc
+ \fontdimen3\font=\libus@stretch
+ \fontdimen4\font=\libus@shrink}
+\expandafter\ifx\csname LibertinusSerif@scale\endcsname\relax
+ \let\LibertinusSerif@@scale\@empty
+\else
+ \edef\LibertinusSerif@@scale{s*[\csname LibertinusSerif@scale\endcsname]}%
+\fi
+\DeclareRobustCommand\thfamily % new family for theorem font
+ {\not@math@alphabet\thfamily\relax
+ \fontfamily\thdefault\selectfont}
+\newcommand*{\thdefault}{LibertinusSerifTH-tlf}
+\DeclareTextFontCommand{\textth}{\thfamily}
+
+\DeclareFontFamily{T1}{LibertinusSerifTH-tlf}{\libus@spacing}
+\DeclareFontShape{T1}{LibertinusSerifTH-tlf}{m}{it}{<-> \LibertinusSerif@@scale LibertinusSerifTH-Italic-tlf-t1}{\libus@spacing}
+\DeclareFontShape{T1}{LibertinusSerifTH-tlf}{m}{n}{<-> ssub * LibertinusSerifTH-tlf/m/it}{}
+
+\DeclareFontFamily{OT1}{LibertinusSerifTH-tlf}{\libus@spacing}
+\DeclareFontShape{OT1}{LibertinusSerifTH-tlf}{m}{it}{<-> \LibertinusSerif@@scale LibertinusSerifTH-Italic-tlf-ot1}{}
+\DeclareFontShape{OT1}{LibertinusSerifTH-tlf}{m}{n}{<-> ssub * LibertinusSerifTH-tlf/m/it}{}
+
+\iflibus@thrm
+ %\RequirePackage{amsmath,amsthm} % in case of theoremfont
+ \ifdefined\newtheoremstyle %amsthm and ntheorem, not theorem.sty
+ \@ifpackageloaded{ntheorem}\relax{%
+ \newtheoremstyle{plain}
+ {\medskipamount} % ABOVESPACE, was \topsep
+ {\medskipamount} % BELOWSPACE, was \topsep
+ {\thfamily} % BODYFONT--\thfamily is italic with upright figures and punctuation
+ {} % INDENT (empty value is the same as 0pt)
+ {\bfseries} % HEADFONT--you may want to add \tlfstyle so the number is tab lining, regardless of text figure selection
+ {.} % HEADPUNCT
+ {5pt plus 1pt minus 1pt} % HEADSPACE
+ {} % CUSTOM-HEAD-SPEC\newtheorem{thm}{Theorem}[section]
+ } % end @ifpackageloaded
+ \fi%
+ \@ifundefined{theoremstyle}{}{%
+ \theoremstyle{plain}
+ \patchcmd{\th@plain}{\itshape}{\thfamily}{\message{Replaced itshape by thfamily in theorem style plain.}}{\message{Unable to replace itshape by thfamily in theorem style plain.}}
+ }
+\fi%}
+
\libus@MathSymbol{\upGamma} {\mathalpha}{operators}{"00}
\libus@MathSymbol{\upDelta} {\mathalpha}{operators}{"01}