summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/utf8add/utf8hax.sty
blob: ab82c7295f739837750213df8124e49424b9636d (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
% Copyright 2020 Palle Jorgensen, hamselv@pallej.dk
%
% This file is part of utf8add.
%
% utf8add is free software: you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% utf8add is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
% General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with utf8add. If not, see <https://www.gnu.org/licenses/>.
\ProvidesPackage{utf8hax}[2020/05/26 Palle Jorgensen]

%% Package dependencies
\RequirePackage{xkeyval}
\RequirePackage[utf8]{inputenc}

%% Options
\DeclareOptionX{autochar}{\DeclareUnicodeCharacter{#1}{\@automath@}}
\DeclareOptionX{mathchar}{\DeclareUnicodeCharacter{#1}{\ensuremath}}
%% Short cuts
%% Mathchar
\DeclareOptionX{currmath}{%
  \DeclareUnicodeCharacter{00A4}{\ensuremath}} %% Generic currency symbol
\DeclareOptionX{yenmath}{%
  \DeclareUnicodeCharacter{00A5}{\ensuremath}} %% Generic currency symbol
\DeclareOptionX{sterlingmath}{%
  \DeclareUnicodeCharacter{00A3}{\ensuremath}} %% Generic currency symbol
%% Auto char
\DeclareOptionX{copyauto}{%
  \DeclareUnicodeCharacter{00A9}{\@automath@}} %% Copyright symbol
\DeclareOptionX{regauto}{%
  \DeclareUnicodeCharacter{00AE}{\@automath@}} %% Registeret symbol
%% Defining some defaults. The author's favourite
\DeclareOptionX{default}{%
  \DeclareUnicodeCharacter{00A4}{\ensuremath} %% Generic currency symbol
  \DeclareUnicodeCharacter{00A9}{\@automath@} %% Copyright symbol
}
\ProcessOptionsX

%% Providing the undefined greek characters
\AtBeginDocument{%
  \providecommand*\omicron{\mathit{o}}
  \providecommand*\Alpha{\mathit{A}}
  \providecommand*\Beta{\mathit{B}}
  \providecommand*\Chi{\mathit{X}}
  \providecommand*\Epsilon{\mathit{E}}
  \providecommand*\Eta{\mathit{H}}
  \providecommand*\Iota{\mathit{I}}
  \providecommand*\Kappa{\mathit{K}}
  \providecommand*\Mu{\mathit{M}}
  \providecommand*\Nu{\mathit{N}}
  \providecommand*\Omicron{\mathit{O}}
  \providecommand*\Rho{\mathit{P}}
  \providecommand*\Tau{\mathit{T}}
  \providecommand*\Zeta{\mathit{Z}}}

\def\newautomath#1#2{\@namedef{@automath@#1}{\ensuremath{#2}}}

%% Math automation
\protected\def\@automath@#1{\csname @automath@#1\endcsname}
\def\@automath@a{\ensuremath{\alpha}}
\def\@automath@b{\ensuremath{\beta}}
\def\@automath@c{\ensuremath{\chi}}
\def\@automath@d{\ensuremath{\delta}}
\def\@automath@e{\@ifstar{\ensuremath{\varepsilon}}{\ensuremath{\epsilon}}}
\def\@automath@f{\@ifstar{\ensuremath{\varphi}}{\ensuremath{\phi}}}
\def\@automath@g{\ensuremath{\gamma}}
\def\@automath@h{\ensuremath{\eta}}
\def\@automath@i{\ensuremath{\iota}}
\def\@automath@k{\ensuremath{\kappa}}
\def\@automath@l{\ensuremath{\lambda}}
\def\@automath@m{\ensuremath{\mu}}
\def\@automath@n{\ensuremath{\nu}}
\def\@automath@o{\ensuremath{\omicron}}
\def\@automath@w{\ensuremath{\omega}}
\def\@automath@p{\@ifstar{\ensuremath{\varpi}}{\ensuremath{\pi}}}
\def\@automath@r{\@ifstar{\ensuremath{\varrho}}{\ensuremath{\rho}}}
\def\@automath@s{\@ifstar{\ensuremath{\varsigma}}{\ensuremath{\sigma}}}
\def\@automath@v{\ensuremath{\psi}}
\def\@automath@t{\ensuremath{\tau}}
\def\@automath@q{\@ifstar{\ensuremath{\vartheta}}{\ensuremath{\theta}}}
\def\@automath@u{\ensuremath{\upsilon}}
\def\@automath@y{\ensuremath{\upsilon}}
\def\@automath@x{\ensuremath{\xi}}
\def\@automath@z{\ensuremath{\zeta}}

\def\@automath@A{\ensuremath{\Alpha}}
\def\@automath@B{\ensuremath{\Beta}}
\def\@automath@C{\ensuremath{\Chi}}
\def\@automath@D{\ensuremath{\Delta}}
\def\@automath@E{\ensuremath{\Epsilon}}
\def\@automath@F{\ensuremath{\Phi}}
\def\@automath@G{\ensuremath{\Gamma}}
\def\@automath@H{\ensuremath{\Eta}}
\def\@automath@I{\ensuremath{\Iota}}
\def\@automath@K{\ensuremath{\Kappa}}
\def\@automath@L{\ensuremath{\Lambda}}
\def\@automath@M{\ensuremath{\Mu}}
\def\@automath@N{\ensuremath{\Nu}}
\def\@automath@O{\ensuremath{\Omicron}}
\def\@automath@W{\ensuremath{\Omega}}
\def\@automath@P{\ensuremath{\Pi}}
\def\@automath@R{\ensuremath{\mathrm{P}}}
\def\@automath@S{\ensuremath{\Sigma}}
\def\@automath@V{\ensuremath{\Psi}}
\def\@automath@T{\ensuremath{\Tau}}
\def\@automath@Q{\ensuremath{\Theta}}
\def\@automath@U{\ensuremath{\Upsilon}}
\def\@automath@Y{\ensuremath{\Upsilon}}
\def\@automath@X{\ensuremath{\Xi}}
\def\@automath@Z{\ensuremath{\Zeta}}
\expandafter\def\csname @automath@=\endcsname{\ensuremath{\approx}}
\expandafter\def\csname @automath@-\endcsname{\ensuremath{\div}}
\expandafter\def\csname @automath@+\endcsname{\@ifstar{\ensuremath{\mp}}{\ensuremath{\pm}}}
\expandafter\def\csname @automath@*\endcsname{\@ifstar{\ensuremath{\times}}{\ensuremath{\cdot}}}
\expandafter\def\csname @automath@!\endcsname{\textcopyright}
\endinput