summaryrefslogtreecommitdiff
path: root/fonts/scholax/tex/scholax.sty
blob: b2d715049b692ee69887ced213114ad6f479db15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
%%
\NeedsTeXFormat{LaTeX2e}
\def\fileversion{1.027}
\def\filedate{2020/11/30}
\ProvidesPackage{scholax}
    [\filedate\space v\fileversion]

\message{'scholax' v\fileversion, \filedate\space (msharpe) Style file for TeXGyreScholaX.}

\RequirePackage[LY1,T1]{fontenc}
\RequirePackage{textcomp}
\RequirePackage{etoolbox}
\IfFileExists{mweights.sty}{\RequirePackage{mweights}}{}
\IfFileExists{fontaxes.sty}{
    \RequirePackage{fontaxes}
    \fa@naming@exception{figures}{{superior}{proportional}}{Sup}
    \fa@naming@exception{figures}{{superior}{tabular}}{Sup}
    \def\sufigures{\@nomath\sufigures
        \fontfigurestyle{superior}\selectfont}
    \DeclareTextFontCommand{\textsu}{\sufigures}
    \let\textsuperior\textsu


    \fa@naming@exception{figures}{{superior}{proportional}}{Sup}
    \fa@naming@exception{figures}{{superior}{tabular}}{Sup}
    \def\sufigures{\@nomath\sufigures%
        \fontfigurestyle{superior}\selectfont}
    \DeclareTextFontCommand{\textsu}{\sufigures}
    \let\textsuperior\textsu

    \fa@naming@exception{figures}{{inferior}{proportional}}{Inf}
    \fa@naming@exception{figures}{{inferior}{tabular}}{Inf}
    \def\infigures{\@nomath\infigures%
        \fontfigurestyle{inferior}\selectfont}
    \DeclareTextFontCommand{\textin}{\infigures}
    \let\textinferior\textin
    \providecommand*{\textfrac}[2]{%
    \raise \zcs@raisefrac \hbox{\textsu{##1}\kern \zcs@foresolidus \textfractionsolidus\kern \zcs@aftsolidus \textin{##2}}}
}{}


\IfFileExists{xkeyval.sty}{
    \newcommand*{\TeXGyreScholaX@scale}{1}
    \RequirePackage{xkeyval}
    \DeclareOptionX{scale}{\renewcommand*{\TeXGyreScholaX@scale}{##1}}
    \DeclareOptionX{scaled}{\renewcommand*{\TeXGyreScholaX@scale}{##1}}
}{
    \let\DeclareOptionX\DeclareOption
    \let\ExecuteOptionsX\ExecuteOptions
    \let\ProcessOptionsX\ProcessOptions
}
\let\orig@footnote=\thefootnote
\let\orig@makefnmark=\@makefnmark
\newif\ifzcs@KOMA
\@ifundefined{KOMAClassName}{}{\zcs@KOMAtrue}
\@ifundefined{ver@scrextend.sty}{}{\zcs@KOMAtrue}
\newif\if@zcs@sups


\newif\if@zcs@scosf
\def\useosf{\edef\TeXGyreScholaX@figurestyle{OsF}}
\@onlypreamble\useosf
\def\useproportional{\edef\TeXGyreScholaX@figurealign{}}
\@onlypreamble\useproportional
\newif\ifzcs@thrm

\def\zcs@foresolidus{-.1em}
\def\zcs@aftsolidus{-.11em}
\def\zcs@raisefrac{.111em}
\edef\bfseries@rm{b}
\edef\mdseries@rm{m}
\def\zcs@spc{.278em}
\def\zcs@stretch{.139em}
\def\zcs@shrink{.093em}
\DeclareOptionX{spacing}{\gdef\zcs@spc{#1}}
\DeclareOptionX{stretch}{\gdef\zcs@stretch{#1}}
\DeclareOptionX{shrink}{\gdef\zcs@shrink{#1}}\DeclareOptionX{foresolidus}{\gdef\zcs@foresolidus{#1}}
\DeclareOptionX{aftsolidus}{\gdef\zcs@aftsolidus{#1}}
\DeclareOptionX{raisefrac}{\gdef\zcs@raisefrac{#1}}

\DeclareOptionX{theoremfont}{\zcs@thrmtrue}
\DeclareOptionX{scosf}{\@zcs@scosftrue}
\DeclareOptionX{sups}{\@zcs@supstrue}
\DeclareOptionX{lining}{\edef\TeXGyreScholaX@figurestyle{LF}}
\DeclareOptionX{lf}{\edef\TeXGyreScholaX@figurestyle{LF}}
\DeclareOptionX{oldstyle}{\useosf}
\DeclareOptionX{osf}{\useosf}
\DeclareOptionX{tabular}{\edef\TeXGyreScholaX@figurealign{T}}
\DeclareOptionX{p}{\useproportional}
\DeclareOptionX{proportional}{\useproportional}
\DeclareOptionX{mainfont}{
    \renewcommand{\familydefault}{\rmdefault}}
%\DeclareOption{tighter}{%
%\gdef\zpl@spc{.25em}\gdef\zpl@stretch{.125em}\gdef\zpl@shrink{.1em}}
\DeclareOptionX{looser}{%
\gdef\zcs@spc{.3em}\gdef\zcs@stretch{.2em}\gdef\zcs@shrink{.1em}}
\DeclareOptionX{loosest}{%
\gdef\zcs@spc{.333em}\gdef\zcs@stretch{.222em}\gdef\zcs@shrink{.111em}}

\ExecuteOptionsX{lining,tabular}
\ProcessOptionsX
\def\zcs@spacing{%
	\fontdimen2\font=\zcs@spc
	\fontdimen3\font=\zcs@stretch
	\fontdimen4\font=\zcs@shrink
}
\ExecuteOptionsX{tabular,lining,mainfont}
\ProcessOptionsX\relax

\DeclareRobustCommand{\lfstyle}{%
  \not@math@alphabet\lfstyle\relax
  \fontfamily{TeXGyreScholaX-LF}\selectfont %
}% to get lf
\DeclareRobustCommand{\tlfstyle}{%
  \not@math@alphabet\tlfstyle\relax
  \fontfamily{TeXGyreScholaX-TLF}\selectfont %
}% to get tlf
\DeclareRobustCommand{\osfstyle}{%
  \not@math@alphabet\osfstyle\relax
  \fontfamily{TeXGyreScholaX-OsF}\selectfont %
}% to get osf
\DeclareRobustCommand{\tosfstyle}{%
  \not@math@alphabet\tosfstyle\relax
  \fontfamily{TeXGyreScholaX-TOsF}\selectfont %
}% to get tosf
\DeclareRobustCommand{\textlf}[1]{%
  {\lfstyle #1}%
}% to get lf
\DeclareRobustCommand{\texttlf}[1]{%
  {\tlfstyle #1}%
}% to get tlf
\DeclareRobustCommand{\textosf}[1]{%
  {\osfstyle #1}%
}% to get osf
\DeclareRobustCommand{\texttosf}[1]{%
  {\tosfstyle #1}%
}% to get tosf
\if@zcs@scosf %
\DeclareRobustCommand{\textsc}[1]{%
{\fontfamily{TeXGyreScholaX-\TeXGyreScholaX@figurealign%
OsF}\fontshape{sc}\selectfont #1}%
}\fi% use OsF in small caps

\renewcommand*{\rmdefault}{TeXGyreScholaX-TLF} % always TLF in math
\renewcommand*{\familydefault}{\rmdefault}

\if@zcs@sups %
 \ifzcs@KOMA \else % not using a KOMA class
 \ifdefined\sufigures
  \def\f@@tn@te{footnote}
  \def\@makefnmark{%
    \ifx\@mpfn\f@@tn@te%not in a minipage
      \ifx\thefootnote\orig@footnote%
        \hbox{\sufigures\hspace*{.04em}\@thefnmark\hspace*{.04em}}%
      \else%
        \orig@makefnmark%
      \fi%
    \else%
      \orig@makefnmark%
    \fi}%
 \fi\fi%
\fi

\DeclareRobustCommand\thfamily
        {\not@math@alphabet\thfamily\relax
         \fontfamily\thdefault\selectfont}

%\show\th@plain
%\ifzcs@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 defined to be \itshape 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%
%\fi%}		


\AtEndPreamble{%
\renewcommand*{\rmdefault}%
 {TeXGyreScholaX-\TeXGyreScholaX@figurealign\TeXGyreScholaX@figurestyle}
\newcommand*{\thdefault}{zcsth-\TeXGyreScholaX@figurestyle}
\ifzcs@thrm
    \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
\normalfont}

\endinput