summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/hep-font/hep-font.sty
blob: 3cd4fb3e68c4361548479949a833b331996f8c46 (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
%%
%% This is file `hep-font.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% hep-font-implementation.dtx  (with options: `package')
%% This is a generated file.
%% Copyright (C) 2019-2020 by Jan Hajer
%% This file 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. The latest version of this license is in:
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{hep-font}[2021/09/01 v1.0 hep-font]

\RequirePackage{kvoptions}
\SetupKeyvalOptions{
  family=hepfont,
  prefix=hepfont@
}
\DeclareBoolOption[true]{lining}
\DeclareComplementaryOption{oldstyle}{lining}
\ProcessKeyvalOptions*
\RequirePackage{ifluatex}
\RequirePackage{ifxetex}
\newif\ifxetexorluatex
\ifxetex\xetexorluatextrue
\else\ifluatex\xetexorluatextrue
  \else\xetexorluatexfalse\fi
\fi
\def\hep@encoding{T\ifxetexorluatex U\else 1\fi}
\RequirePackage[\hep@encoding]{fontenc}
\RequirePackage{fix-cm}
\RequirePackage{microtype}
\ifxetexorluatex
  \RequirePackage{nfssext-cfr}
  \RequirePackage{lmodern}
\else
  \ifhepfont@lining
    \RequirePackage[rm={lining},sf={lining},tt={lining}]{cfr-lm}
  \else
    \RequirePackage{cfr-lm}
  \fi
\fi
\RequirePackage{textcomp}
\newcommand{\hep@sf@fontshape}[3]{%
  \DeclareFontShape{\hep@encoding}{\sfdefault}{#1}{#2}{#3}{}%
}
\newcommand{\hep@rm@fontshape}[3]{%
  \DeclareFontShape{\hep@encoding}{\rmdefault}{#1}{#2}{#3}{}%
}
\ifxetexorluatex
  \RequirePackage{fontspec}
  \setmainfont{Latin Modern Roman}[
    UprightFeatures={SmallCapsFont={[lmromancaps10-regular.otf]}},
    BoldFeatures={
      SmallCapsFeatures={Letters=SmallCaps},
      SmallCapsFont={[cmunbx.otf]}
    }
  ]
  \hep@sf@fontshape{bx}{sc}{<->cmssbxcsc10}{}
  \hep@sf@fontshape{b}{sc}{<->cmssbxcsc10}{}
  \hep@sf@fontshape{m}{scit}{<->cmsscsci10}{}
  \hep@sf@fontshape{m}{sc}{%
    <-9>cmsscsc8<9-10>cmsscsc9<10->cmsscsc10%
  }{}
\else
  \rmfamily
  \ifhepfont@lining
    \RequirePackage{slantsc}
    \hep@rm@fontshape{b}{sc}{<->ssub*cmr/bx/sc}{}
    \hep@rm@fontshape{bx}{sc}{<->ssub*cmr/bx/sc}{}
    \hep@rm@fontshape{b}{scsl}{<->ssub*cmr/bx/scsl}{}
    \hep@rm@fontshape{bx}{scsl}{<->ssub*cmr/bx/scit}{}
    \hep@rm@fontshape{b}{scit}{<->ssub*cmr/bx/scsl}{}
    \hep@rm@fontshape{bx}{scit}{<->ssub*cmr/bx/scit}{}
  \else
    \DeclareFontFamily{\hep@encoding}{hfor}{}
    \DeclareFontShape{\hep@encoding}{hfor}{bx}{sc}{
      <-6>hfoxc0500<6-7>hfoxc0600<7-8>hfoxc0700<8-9>hfoxc0800
      <9-10>hfoxc0900<10-12>hfoxc1000<12-17>hfoxc1200<17->hfoxc1728
    }{}
    \DeclareFontShape{\hep@encoding}{hfor}{bx}{scsl}{
      <-6>hfooc0500<6-7>hfooc0600<7-8>hfooc0700<8-9>hfooc0800
      <9-10>hfooc0900<10-12>hfooc1000<12-17>hfooc1200<17->hfooc1728
    }{}
    \hep@rm@fontshape{b}{sc}{<->ssub*hfor/bx/sc}{}
    \hep@rm@fontshape{bx}{sc}{<->ssub*hfor/bx/sc}{}
    \hep@rm@fontshape{bx}{scsl}{<->ssub*hfor/bx/scsl}{}
    \hep@rm@fontshape{b}{scit}{<->ssub*hfor/bx/scsl}{}
    \hep@rm@fontshape{bx}{scit}{<->ssub*hfor/bx/scsl}{}
    \hep@rm@fontshape{b}{scsl}{<->ssub*hfor/bx/scsl}{}
  \fi
  \sffamily
  \hep@sf@fontshape{m}{sc}{<->ssub*xcmss/m/sc}{}
  \hep@sf@fontshape{b}{sc}{<->ssub*xcmss/bx/sc}{}
  \hep@sf@fontshape{bx}{sc}{<->ssub*xcmss/bx/sc}{}
  \hep@sf@fontshape{m}{scit}{<->ssub*xcmss/m/scit}{}
  \hep@sf@fontshape{b}{scit}{<->ssub*xcmss/bx/scit}{}
  \hep@sf@fontshape{bx}{scit}{<->ssub*xcmss/bx/scit}{}
  \hep@sf@fontshape{m}{scsl}{<->ssub*xcmss/m/scit}{}
  \hep@sf@fontshape{b}{scsl}{<->ssub*xcmss/bx/scit}{}
  \hep@sf@fontshape{bx}{scsl}{<->ssub*xcmss/bx/scit}{}
  \hep@sf@fontshape{m}{ui}{<->cmssu10}{}
\fi
\ifxetexorluatex\else\RequirePackage[utf8]{inputenc}\fi
\ifhepfont@lining\else
    \RequirePackage{units}
    \RequirePackage{xpatch}
    \xpatchcmd{\unit}{\else#1}{%
      \else\ifthenelse{\boolean{mmode}}{#1}{\textl{#1}}%
    }{}{}
    \xpatchcmd{\unitfrac}{\else#1}{%
      \else\ifthenelse{\boolean{mmode}}{#1}{\textl{#1}}%
    }{}{}
\fi

\endinput
%%
%% End of file `hep-font.sty'.