summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/utf8add/utf8hax.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/utf8add/utf8hax.sty')
-rw-r--r--macros/latex/contrib/utf8add/utf8hax.sty123
1 files changed, 123 insertions, 0 deletions
diff --git a/macros/latex/contrib/utf8add/utf8hax.sty b/macros/latex/contrib/utf8add/utf8hax.sty
new file mode 100644
index 0000000000..ab82c7295f
--- /dev/null
+++ b/macros/latex/contrib/utf8add/utf8hax.sty
@@ -0,0 +1,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 \ No newline at end of file