summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/elmath/elmath.dtx
blob: fc2a397fbdb8150303ae9b98a464b976d5f303c0 (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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%\iffalse
%
% (c) copyright 2004 Yannis Potamianos and Apostolos Syropoulos
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
% Please report errors or suggestions for improvement to
%
%    Yannis Potamianos     and/or    Apostolos Syropoulos
%    potamianos@sch.gr               apostolo@obelix.ee.duth.gr
%
%\fi
% \CheckSum{1030}
% \iffalse This is a Metacomment
%
%<elmath, >\ProvidesFile{elmath.sty}
%
%<elmath, >[2004/11/20 v1.2 Package `elmath.sty']
%
%    \begin{macrocode}
%<*driver>
\documentclass{ltxdoc}
\GetFileInfo{elmath.drv}
\begin{document}
   \DocInput{elmath.dtx}
\end{document}
%</driver>
%    \end{macrocode}
% \fi
%\StopEventually{}
%\MakeShortVerb{\|}
%\title{The `elmath' package}
%\author{Yannis Potamianos and Apostolos Syropoulos}
% \date{2004/11/20}
%\maketitle
% \begin{abstract}
% This package has been designed to partially implement the elmath-new input
% encoding in both and text and math modes. As such it supersedes package
% \textsf{elmath}, which was designed by the same authors. Note that if package
% \textsf{elmath-new} is used, then one should not use the (unofficial)
% \texttt{elmath-new} option of the \textsf{inputenc} package.
%\end{abstract}
%
% \section{Introduction and Usage}
% The package has been designed so to allow users with a Greek keyboard to
% type both Greek text and Greek mathematical symbols without any need to
% use special commands.
%
% Users of the package need only a standard ISO8859-7 keyboard, but obviously
% it is not difficult to adapt the package for other encoding.
%
% \section{The Implementation}
%
% Initially, we need to make sure that all the Greek letters are actually
% active. We assume that |~| is actually an active character.
%    \begin{macrocode}
%<*elmath>
\ifcat\noexpand~\noexpand^^e1\relax\else\catcode`\^^e1=\active\fi
\ifcat\noexpand~\noexpand^^e2\relax\else\catcode`\^^e2=\active\fi
\ifcat\noexpand~\noexpand^^e3\relax\else\catcode`\^^e3=\active\fi
\ifcat\noexpand~\noexpand^^e4\relax\else\catcode`\^^e4=\active\fi
\ifcat\noexpand~\noexpand^^e5\relax\else\catcode`\^^e5=\active\fi
\ifcat\noexpand~\noexpand^^e6\relax\else\catcode`\^^e6=\active\fi
\ifcat\noexpand~\noexpand^^e7\relax\else\catcode`\^^e7=\active\fi
\ifcat\noexpand~\noexpand^^e8\relax\else\catcode`\^^e8=\active\fi
\ifcat\noexpand~\noexpand^^e9\relax\else\catcode`\^^e9=\active\fi
\ifcat\noexpand~\noexpand^^ea\relax\else\catcode`\^^ea=\active\fi
\ifcat\noexpand~\noexpand^^eb\relax\else\catcode`\^^eb=\active\fi
\ifcat\noexpand~\noexpand^^ec\relax\else\catcode`\^^ec=\active\fi
\ifcat\noexpand~\noexpand^^ed\relax\else\catcode`\^^ed=\active\fi
\ifcat\noexpand~\noexpand^^ee\relax\else\catcode`\^^ee=\active\fi
\ifcat\noexpand~\noexpand^^ef\relax\else\catcode`\^^ef=\active\fi
\ifcat\noexpand~\noexpand^^f0\relax\else\catcode`\^^f0=\active\fi
\ifcat\noexpand~\noexpand^^f1\relax\else\catcode`\^^f1=\active\fi
\ifcat\noexpand~\noexpand^^f3\relax\else\catcode`\^^f3=\active\fi
\ifcat\noexpand~\noexpand^^f2\relax\else\catcode`\^^f2=\active\fi
\ifcat\noexpand~\noexpand^^f4\relax\else\catcode`\^^f4=\active\fi
\ifcat\noexpand~\noexpand^^f5\relax\else\catcode`\^^f5=\active\fi
\ifcat\noexpand~\noexpand^^f6\relax\else\catcode`\^^f6=\active\fi
\ifcat\noexpand~\noexpand^^f7\relax\else\catcode`\^^f7=\active\fi
\ifcat\noexpand~\noexpand^^f8\relax\else\catcode`\^^f8=\active\fi
\ifcat\noexpand~\noexpand^^f9\relax\else\catcode`\^^f9=\active\fi
\ifcat\noexpand~\noexpand^^c1\relax\else\catcode`\^^c1=\active\fi
\ifcat\noexpand~\noexpand^^c2\relax\else\catcode`\^^c2=\active\fi
\ifcat\noexpand~\noexpand^^c3\relax\else\catcode`\^^c3=\active\fi
\ifcat\noexpand~\noexpand^^c4\relax\else\catcode`\^^c4=\active\fi
\ifcat\noexpand~\noexpand^^c5\relax\else\catcode`\^^c5=\active\fi
\ifcat\noexpand~\noexpand^^c6\relax\else\catcode`\^^c6=\active\fi
\ifcat\noexpand~\noexpand^^c7\relax\else\catcode`\^^c7=\active\fi
\ifcat\noexpand~\noexpand^^c8\relax\else\catcode`\^^c8=\active\fi
\ifcat\noexpand~\noexpand^^c9\relax\else\catcode`\^^c9=\active\fi
\ifcat\noexpand~\noexpand^^ca\relax\else\catcode`\^^ca=\active\fi
\ifcat\noexpand~\noexpand^^cb\relax\else\catcode`\^^cb=\active\fi
\ifcat\noexpand~\noexpand^^cc\relax\else\catcode`\^^cc=\active\fi
\ifcat\noexpand~\noexpand^^cd\relax\else\catcode`\^^cd=\active\fi
\ifcat\noexpand~\noexpand^^ce\relax\else\catcode`\^^ce=\active\fi
\ifcat\noexpand~\noexpand^^cf\relax\else\catcode`\^^cf=\active\fi
\ifcat\noexpand~\noexpand^^d0\relax\else\catcode`\^^d0=\active\fi
\ifcat\noexpand~\noexpand^^d1\relax\else\catcode`\^^d1=\active\fi
\ifcat\noexpand~\noexpand^^d3\relax\else\catcode`\^^d3=\active\fi
\ifcat\noexpand~\noexpand^^d4\relax\else\catcode`\^^d4=\active\fi
\ifcat\noexpand~\noexpand^^d5\relax\else\catcode`\^^d5=\active\fi
\ifcat\noexpand~\noexpand^^d6\relax\else\catcode`\^^d6=\active\fi
\ifcat\noexpand~\noexpand^^d7\relax\else\catcode`\^^d7=\active\fi
\ifcat\noexpand~\noexpand^^d8\relax\else\catcode`\^^d8=\active\fi
\ifcat\noexpand~\noexpand^^d9\relax\else\catcode`\^^d9=\active\fi
\ifcat\noexpand~\noexpand^^a2\relax\else\catcode`\^^a2=\active\fi
\ifcat\noexpand~\noexpand^^b6\relax\else\catcode`\^^b6=\active\fi
\ifcat\noexpand~\noexpand^^b8\relax\else\catcode`\^^b8=\active\fi
\ifcat\noexpand~\noexpand^^b9\relax\else\catcode`\^^b9=\active\fi
\ifcat\noexpand~\noexpand^^ba\relax\else\catcode`\^^ba=\active\fi
\ifcat\noexpand~\noexpand^^bc\relax\else\catcode`\^^bc=\active\fi
\ifcat\noexpand~\noexpand^^be\relax\else\catcode`\^^be=\active\fi
\ifcat\noexpand~\noexpand^^bf\relax\else\catcode`\^^bf=\active\fi
\ifcat\noexpand~\noexpand^^c0\relax\else\catcode`\^^c0=\active\fi
\ifcat\noexpand~\noexpand^^da\relax\else\catcode`\^^da=\active\fi
\ifcat\noexpand~\noexpand^^db\relax\else\catcode`\^^db=\active\fi
\ifcat\noexpand~\noexpand^^dc\relax\else\catcode`\^^dc=\active\fi
\ifcat\noexpand~\noexpand^^dd\relax\else\catcode`\^^dd=\active\fi
\ifcat\noexpand~\noexpand^^de\relax\else\catcode`\^^de=\active\fi
\ifcat\noexpand~\noexpand^^df\relax\else\catcode`\^^df=\active\fi
\ifcat\noexpand~\noexpand^^e0\relax\else\catcode`\^^e0=\active\fi
\ifcat\noexpand~\noexpand^^fa\relax\else\catcode`\^^fa=\active\fi
\ifcat\noexpand~\noexpand^^fb\relax\else\catcode`\^^fb=\active\fi
\ifcat\noexpand~\noexpand^^fc\relax\else\catcode`\^^fc=\active\fi
\ifcat\noexpand~\noexpand^^fd\relax\else\catcode`\^^fd=\active\fi
\ifcat\noexpand~\noexpand^^fe\relax\else\catcode`\^^fe=\active\fi
\ifcat\noexpand~\noexpand^^ab\relax\else\catcode`\^^ab=\active\fi
\ifcat\noexpand~\noexpand^^bb\relax\else\catcode`\^^bb=\active\fi
%    \end{macrocode}
% Now we define a command that defines all Greek characters as commands, which when
% expanded produce the expected command.
%    \begin{macrocode}
\def\el@math{%
    \def^^e1{\relax\ifmmode\alpha\else\textgreek{a}\fi}%
    \def^^c1{\relax\ifmmode{A}\else\textgreek{A}\fi}%
    \def^^dc{\textgreek{'a}}%
    \def^^a2{\textgreek{'A}}%
    \def^^b6{\textgreek{'A}}%
    \def^^e2{\relax\ifmmode\beta\else\textgreek{b}\fi}%
    \def^^c2{\relax\ifmmode{B}\else\textgreek{B}\fi}%
    \def^^e3{\relax\ifmmode\gamma\else\textgreek{g}\fi}%
    \def^^c3{\relax\ifmmode\Gamma\else\textgreek{G}\fi}%
    \def^^e4{\relax\ifmmode\delta\else\textgreek{d}\fi}%
    \def^^c4{\relax\ifmmode\Delta\else\textgreek{D}\fi}%
    \def^^e5{\relax\ifmmode\epsilon\else\textgreek{e}\fi}%
    \def^^c5{\relax\ifmmode{E}\else\textgreek{E}\fi}%
    \def^^dd{\textgreek{'e}}%
    \def^^b8{\textgreek{'E}}%
    \def^^e6{\relax\ifmmode\zeta\else\textgreek{z}\fi}%
    \def^^c6{\relax\ifmmode{Z}\else\textgreek{Z}\fi}%
    \def^^e7{\relax\ifmmode\eta\else\textgreek{h}\fi}%
    \def^^c7{\relax\ifmmode{H}\else\textgreek{H}\fi}%
    \def^^de{\textgreek{'h}}%
    \def^^b9{\textgreek{'H}}%
    \def^^e8{\relax\ifmmode\theta\else\textgreek{j}\fi}%
    \def^^c8{\relax\ifmmode{\Theta}\else\textgreek{J}\fi}%
    \def^^e9{\relax\ifmmode\iota\else\textgreek{i}\fi}%
    \def^^c9{\relax\ifmmode{I}\else\textgreek{I}\fi}%
    \def^^df{\textgreek{'i}}%
    \def^^fa{\textgreek{"i}} %
    \def^^c0{\textgreek{"'i}} %
    \def^^ba{\textgreek{'I}}%
    \def^^da{\textgreek{"I}}%
    \def^^ea{\relax\ifmmode\kappa\else\textgreek{k}\fi}%
    \def^^ca{\relax\ifmmode{K}\else\textgreek{K}\fi}%
    \def^^eb{\relax\ifmmode\lambda\else\textgreek{l}\fi}%
    \def^^cb{\relax\ifmmode\Lambda\else\textgreek{L}\fi}%
    \def^^ec{\relax\ifmmode\mu\else\textgreek{m}\fi}%
    \def^^cc{\relax\ifmmode{M}\else\textgreek{M}\fi}%
    \def^^ed{\relax\ifmmode\nu\else\textgreek{n}\fi}%
    \def^^cd{\relax\ifmmode{N}\else\textgreek{N}\fi}%
    \def^^ee{\relax\ifmmode\xi\else\textgreek{x}\fi}%
    \def^^ce{\relax\ifmmode\Xi\else\textgreek{X}\fi}%
    \def^^ef{\relax\ifmmode{o}\else\textgreek{o}\fi}%
    \def^^cf{\relax\ifmmode{O}\else\textgreek{O}\fi}%
    \def^^fc{\textgreek{'o}}%
    \def^^bc{\textgreek{'O}}%
    \def^^f0{\relax\ifmmode\pi\else\textgreek{p}\fi}%
    \def^^d0{\relax\ifmmode\Pi\else\textgreek{P}\fi}%
    \def^^f1{\relax\ifmmode\rho\else\textgreek{r}\fi}%
    \def^^d1{\relax\ifmmode{P}\else\textgreek{R}\fi}%
    \def^^f2{\relax\ifmmode\varsigma\else\textgreek{c}\fi}%
    \def^^f3{\relax\ifmmode\sigma\else\textgreek{sv}\fi}%
    \def^^d3{\relax\ifmmode\Sigma\else\textgreek{S}\fi}%
    \def^^f4{\relax\ifmmode\tau\else\textgreek{t}\fi}%
    \def^^d4{\relax\ifmmode{T}\else\textgreek{T}\fi}%
    \def^^f5{\relax\ifmmode\upsilon\else\textgreek{u}\fi}%
    \def^^d5{\relax\ifmmode{Y}\else\textgreek{U}\fi}%
    \def^^fd{\textgreek{'u}}%
    \def^^fb{\textgreek{"u}} %
    \def^^e0{\textgreek{"'u}} %
    \def^^be{\textgreek{'U}}%
    \def^^f6{\relax\ifmmode\phi\else\textgreek{f}\fi}%
    \def^^d6{\relax\ifmmode{\Phi}\else\textgreek{F}\fi}%
    \def^^f7{\relax\ifmmode\chi\else\textgreek{q}\fi}%
    \def^^d7{\relax\ifmmode{X}\else\textgreek{Q}\fi}%
    \def^^f8{\relax\ifmmode\psi\else\textgreek{y}\fi}%
    \def^^d8{\relax\ifmmode{\Psi}\else\textgreek{Y}\fi}%
    \def^^f9{\relax\ifmmode\omega\else\textgreek{w}\fi}%
    \def^^d9{\relax\ifmmode{\Omega}\else\textgreek{W}\fi}%
    \def^^fe{\textgreek{'w}}%
    \def^^bf{\textgreek{'W}}%
}%
%    \end{macrocode}
% Now, we need to invoke the command |\el@math| every time we enter a math mode. For
% this reason we redefine the tokens |\everymath| and |\everydisplay| as follows:
%    \begin{macrocode}
\everymath\expandafter{\the\everymath
   \relax\el@math}
\everydisplay\expandafter{\the\everydisplay
   \relax\el@math}
%</elmath>
%    \end{macrocode}
% \Finale
% That's all!