summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/txgreeks/txgreeks.dtx
blob: b7f271b3c41e46e676a72c4ec14f922420d4a9da (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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
% \iffalse meta-comment
%    File `txgreeks.dtx'
%    
%    Copyright (C) 2011 by Jean-Francois Burnol
%   
%    This file may be distributed and/or modified under the
%    conditions of the LaTeX Project Public License,
%    either version 1.3 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.3 or later is part of all distributions of
%    LaTeX version 2003/12/01 or later.  
%
%    Please report errors to jfbu (at) free (dot) fr
%    
% \fi 
% \iffalse
%<*dtx>    
\ProvidesFile{txgreeks.dtx}
       [2011/03/16 1.0 shape selection for the TX fonts Greek letters]
%</dtx>
% 
%<*driver>
\documentclass[a4paper]{ltxdoc}
\usepackage{amsmath} % for the logo
\usepackage[hscale=0.6]{geometry}
\usepackage[pdfstartview=FitH,pdfpagemode=UseNone]{hyperref}
%\RecordChanges
%\OnlyDescription
\begin{document}
 \DocInput{txgreeks.dtx}
\end{document}
%</driver>
% \fi
% \changes{1.0}{2011/03/16}{Initial version.}
%
% \GetFileInfo{txgreeks.dtx}
%
% \begin{center}
%   {\Large The \texttt{txgreeks} package}\\
%   Jean-Fran\c cois \textsc{Burnol}\\
%   \texttt{jfbu (at) free (dot) fr}
% \end{center}
%
%  \begin{abstract}
%    The TX Fonts \footnote{package
%    \url{http://mirrors.ctan.org/help/Catalogue/entries/txfonts.html}}
%    of \textsc{Young~Ryu} provide a very complete replacement for
%    the default math fonts of \TeX{} and \LaTeX{}, containing all
%    CM symbols and even all symbols from the \AmS{} fonts, and
%    more.  In particular upright shapes for the Greek letters are
%    available (they are necessary in French mathematical
%    typography).  The |txgreeks| package\footnote{This document
%    describes |txgreeks| version \fileversion\ (\filedate).}
%    allows \LaTeX{} users who use the TX fonts to easily select
%    the shapes (italic or upright) for the Greek lowercase and
%    uppercase letters. This is compatible with using arbitrary
%    text fonts in the document.
%  \end{abstract}
%
%  \section{Features}
%
%  The shape of the Greek letters is decided according to the
%  options passed to the package: |TeX| (=|sloped|, the default:
%  lowercase italic and uppercase upright), |upright|
%  (=|French|=|upgreek|, lowercase and uppercase upright), |ISO|
%  (=|itgreek|, lowercase and uppercase italic), |itGreek| (italic
%  uppercase) and |upGreek| (upright uppercase). Use both of
%  |itGreek| and |upgreek| to get lowercase upright and uppercase
%  italic.
%
%  The uppercase Greek letters are not taken from the TX roman
%  font |txr| (`operators') but from either the alternate math
%  italic font |txmia| (`lettersA', which in fact provides upright
%  Greek in OML encoding), or from the math italic font |txmi|
%  (`letters', where uppercase Greek is in italic shape). This
%  means that if some other package redefines the `operators' font
%  used in math (presumably to co\"incide with the `roman' font
%  used for the document text), this will have no impact on the
%  Greek uppercase letters. If some package modifies the `letters'
%  font used in math (which typically is the font for Latin
%  letters and lowercase Greek letters, and with |txgreeks| is
%  also used for the italic uppercase Greek letters), then of
%  course the glyphs will be from the new font. But the upright
%  glyphs will still be from the TX Font |txmia| (`lettersA').
%
%  Following the model of the |fourier| package, the alternative
%  shape of the Greek letters is accessible via the \cs{other...}
%  prefix: \cs{otheralpha} will be upright if \cs{alpha} is
%  italic, and vice versa. For the lowercase Greek letters there
%  are also the macros ending in |up| (\cs{alphaup}, \dots) which
%  are already defined by |txfonts|.
%
%  Regarding the uppercase letters, the package defines (replacing
%  the |amsmath| definitions) \cs{varGamma}, etc\dots{} as synonyms for
%  \cs{otherGamma}, etc\dots, but does not define additional
%  macros \cs{Gammaup} as this was not done by the package
%  |txfonts|. Use rather \cs{otherGamma} if
%  necessary.\footnote{contrarily to |amsmath| we define the
%  \cs{varGamma}, etc\dots{} to be of type \cs{mathalpha} so they
%  obey, like the default \LaTeX{} \cs{Gamma}, etc \dots{} the math
%  alphabet changing commands; however to access the bold glyphs I
%  recommend using either the \cs{bm} command from the |bm|
%  package or the \cs{boldsymbol} command from the |amsbsy|
%  package and not \cs{mathbf} which by default will use the TX
%  roman font |txr|.}
%
%  The package defines \cs{omicron}, \cs{otheromicron}, and
%  \cs{omicronup}. But there is no upright omicron in the |txmia|
%  font, so we have to use the construct |\mathrm{\omicron}| (this
%  will a priori use the TX roman font |txr|).
%
%  It is not necessary to write |\usepackage{txfonts}| prior to
%  |\usepackage{txgreeks}| as this is done by |txgreeks| itself,
%  but for clarity of the \LaTeX{} source of the document to be
%  typeset, this is highly recommended, as |txgreeks| does very
%  minor things compared to |txfonts|.
%
%  Using |txgreeks| should be hopefully compatible with any
%  package which is already compatible with |txfonts|.
%
%
% \StopEventually{}
% 
%  \section{Implementation}
%
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{txgreeks}
	[2011/03/16 v1.0 shape selection for the TX fonts Greek letters]
\RequirePackage{txfonts}
\newif\iftgs@uplower
\newif\iftgs@itupper
\def\tgs@Greek@sh{0}
\DeclareOption{itgreek}{\tgs@uplowerfalse\tgs@ituppertrue}
\DeclareOption{upgreek}{\tgs@uplowertrue\tgs@itupperfalse}
\DeclareOption{itGreek}{\def\tgs@Greek@sh{1}}
\DeclareOption{upGreek}{\def\tgs@Greek@sh{2}}
\DeclareOption{TeX}{\tgs@uplowerfalse\tgs@itupperfalse} %default
\DeclareOption{sloped}{\ExecuteOptions{TeX}}
\DeclareOption{upright}{\ExecuteOptions{upgreek}}
\DeclareOption{French}{\ExecuteOptions{upright}}
\DeclareOption{ISO}{\ExecuteOptions{itgreek}}
\DeclareOption*{\PackageWarning{txgreeks}{Unknown option `\CurrentOption'}}
\ProcessOptions\relax
\ifcase\tgs@Greek@sh\or\tgs@ituppertrue\or\tgs@itupperfalse\fi
%    \end{macrocode}
% macro \cs{re@DeclareMathSymbol} defined in txfonts.sty\\
% symbol font lettersA=txmia defined in txfonts.sty (contains upright Greek)
%    \begin{macrocode}
\re@DeclareMathSymbol{\Gamma}{\mathalpha}{lettersA}{0}
\re@DeclareMathSymbol{\Delta}{\mathalpha}{lettersA}{1}
\re@DeclareMathSymbol{\Theta}{\mathalpha}{lettersA}{2}
\re@DeclareMathSymbol{\Lambda}{\mathalpha}{lettersA}{3}
\re@DeclareMathSymbol{\Xi}{\mathalpha}{lettersA}{4}
\re@DeclareMathSymbol{\Pi}{\mathalpha}{lettersA}{5}
\re@DeclareMathSymbol{\Sigma}{\mathalpha}{lettersA}{6}
\re@DeclareMathSymbol{\Upsilon}{\mathalpha}{lettersA}{7}
\re@DeclareMathSymbol{\Phi}{\mathalpha}{lettersA}{8}
\re@DeclareMathSymbol{\Psi}{\mathalpha}{lettersA}{9}
\re@DeclareMathSymbol{\Omega}{\mathalpha}{lettersA}{10}
%    \end{macrocode}
% \cs{varGamma} etc... defined in amsmath, but with type \cs{mathord}
%    \begin{macrocode}
\re@DeclareMathSymbol{\varGamma}{\mathalpha}{letters}{0}
\re@DeclareMathSymbol{\varDelta}{\mathalpha}{letters}{1}
\re@DeclareMathSymbol{\varTheta}{\mathalpha}{letters}{2}
\re@DeclareMathSymbol{\varLambda}{\mathalpha}{letters}{3}
\re@DeclareMathSymbol{\varXi}{\mathalpha}{letters}{4}
\re@DeclareMathSymbol{\varPi}{\mathalpha}{letters}{5}
\re@DeclareMathSymbol{\varSigma}{\mathalpha}{letters}{6}
\re@DeclareMathSymbol{\varUpsilon}{\mathalpha}{letters}{7}
\re@DeclareMathSymbol{\varPhi}{\mathalpha}{letters}{8}
\re@DeclareMathSymbol{\varPsi}{\mathalpha}{letters}{9}
\re@DeclareMathSymbol{\varOmega}{\mathalpha}{letters}{10}
\re@DeclareMathSymbol{\omicron}{\mathalpha}{letters}{`o}
%    \end{macrocode}
% unfortunately no upright omicron in lettersA=txmia
%    \begin{macrocode}
\let\omicronup\undefined\newcommand{\omicronup}{\mathrm{o}}
\iftgs@uplower % upright lowercase Greek letters
\let\otheralpha\alpha
\let\otherbeta\beta
\let\othergamma\gamma
\let\otherdelta\delta
\let\otherepsilon\epsilon
\let\otherzeta\zeta
\let\othereta\eta
\let\othertheta\theta
\let\otheriota\iota
\let\otherkappa\kappa
\let\otherlambda\lambda
\let\othermu\mu
\let\othernu\nu
\let\otherxi\xi
\let\otherpi\pi
\let\otherrho\rho
\let\othersigma\sigma
\let\othertau\tau
\let\otherupsilon\upsilon
\let\otherphi\phi
\let\otherchi\chi
\let\otherpsi\psi
\let\otheromega\omega
\let\othervarepsilon\varepsilon
\let\othervartheta\vartheta
\let\othervarpi\varpi
\let\othervarrho\varrho
\let\othervarsigma\varsigma
\let\othervarphi\varphi
\let\otheromicron\omicron
%%
\let\alpha\alphaup
\let\beta\betaup
\let\gamma\gammaup
\let\delta\deltaup
\let\epsilon\epsilonup
\let\zeta\zetaup
\let\eta\etaup
\let\theta\thetaup
\let\iota\iotaup
\let\kappa\kappaup
\let\lambda\lambdaup
\let\mu\muup
\let\nu\nuup
\let\xi\xiup
\let\pi\piup
\let\rho\rhoup
\let\sigma\sigmaup
\let\tau\tauup
\let\upsilon\upsilonup
\let\phi\phiup
\let\chi\chiup
\let\psi\psiup
\let\omega\omegaup
\let\varepsilon\varepsilonup
\let\vartheta\varthetaup
\let\varpi\varpiup
\let\varrho\varrhoup
\let\varsigma\varsigmaup
\let\varphi\varphiup
\let\omicron\omicronup
\else % italic lowercase Greek letters (default)
\let\otheralpha\alphaup
\let\otherbeta\betaup
\let\othergamma\gammaup
\let\otherdelta\deltaup
\let\otherepsilon\epsilonup
\let\otherzeta\zetaup
\let\othereta\etaup
\let\othertheta\thetaup
\let\otheriota\iotaup
\let\otherkappa\kappaup
\let\otherlambda\lambdaup
\let\othermu\muup
\let\othernu\nuup
\let\otherxi\xiup
\let\otherpi\piup
\let\otherrho\rhoup
\let\othersigma\sigmaup
\let\othertau\tauup
\let\otherupsilon\upsilonup
\let\otherphi\phiup
\let\otherchi\chiup
\let\otherpsi\psiup
\let\otheromega\omegaup
\let\othervarepsilon\varepsilonup
\let\othervartheta\varthetaup
\let\othervarpi\varpiup
\let\othervarrho\varrhoup
\let\othervarsigma\varsigmaup
\let\othervarphi\varphiup
\let\otheromicron\omicronup
\fi
%%
\iftgs@itupper % italic uppercase Greek
\let\otherGamma\Gamma
\let\otherDelta\Delta
\let\otherTheta\Theta
\let\otherLambda\Lambda
\let\otherXi\Xi
\let\otherPi\Pi
\let\otherSigma\Sigma
\let\otherUpsilon\Upsilon
\let\otherPhi\Phi
\let\otherPsi\Psi
\let\otherOmega\Omega
\let\Gamma\varGamma
\let\Delta\varDelta
\let\Theta\varTheta
\let\Lambda\varLambda
\let\Xi\varXi
\let\Pi\varPi
\let\Sigma\varSigma
\let\Upsilon\varUpsilon
\let\Phi\varPhi
\let\Psi\varPsi
\let\Omega\varOmega
\let\varGamma\otherGamma
\let\varDelta\otherDelta
\let\varTheta\otherTheta
\let\varLambda\otherLambda
\let\varXi\otherXi
\let\varPi\otherPi
\let\varSigma\otherSigma
\let\varUpsilon\otherUpsilon
\let\varPhi\otherPhi
\let\varPsi\otherPsi
\let\varOmega\otherOmega
\else % upright uppercase Greek (default)
\let\otherGamma\varGamma
\let\otherDelta\varDelta
\let\otherTheta\varTheta
\let\otherLambda\varLambda
\let\otherXi\varXi
\let\otherPi\varPi
\let\otherSigma\varSigma
\let\otherUpsilon\varUpsilon
\let\otherPhi\varPhi
\let\otherPsi\varPsi
\let\otherOmega\varOmega
\fi
\endinput
%    \end{macrocode}
% \iffalse
%</code>
%<*dtx>
% \fi
%
% \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
%</dtx>
% \fi
%
% \CheckSum{528}
% \Finale
\endinput