Debian Codegraph @

texmf-dist/source/latex/txgreeks/txgreeks.dtx

raw
1 % \iffalse meta-comment
2 % File `txgreeks.dtx'
3 %
4 % Copyright (C) 2011 by Jean-Francois Burnol
5 %
6 % This file may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License,
8 % either version 1.3 of this license or (at your
9 % option) any later version. The latest version of
10 % this license is in
11 % http://www.latex-project.org/lppl.txt
12 % and version 1.3 or later is part of all distributions of
13 % LaTeX version 2003/12/01 or later.
14 %
15 % Please report errors to jfbu (at) free (dot) fr
16 %
17 % \fi
18 % \iffalse
19 %<*dtx>
20 \ProvidesFile{txgreeks.dtx}
21 [2011/03/16 1.0 shape selection for the TX fonts Greek letters]
22 %</dtx>
23 %
24 %<*driver>
25 \documentclass[a4paper]{ltxdoc}
26 \usepackage{amsmath} % for the logo
27 \usepackage[hscale=0.6]{geometry}
28 \usepackage[pdfstartview=FitH,pdfpagemode=UseNone]{hyperref}
29 %\RecordChanges
30 %\OnlyDescription
31 \begin{document}
32 \DocInput{txgreeks.dtx}
33 \end{document}
34 %</driver>
35 % \fi
36 % \changes{1.0}{2011/03/16}{Initial version.}
37 %
38 % \GetFileInfo{txgreeks.dtx}
39 %
40 % \begin{center}
41 % {\Large The \texttt{txgreeks} package}\\
42 % Jean-Fran\c cois \textsc{Burnol}\\
43 % \texttt{jfbu (at) free (dot) fr}
44 % \end{center}
45 %
46 % \begin{abstract}
47 % The TX Fonts \footnote{package
48 % \url{http://mirrors.ctan.org/help/Catalogue/entries/txfonts.html}}
49 % of \textsc{Young~Ryu} provide a very complete replacement for
50 % the default math fonts of \TeX{} and \LaTeX{}, containing all
51 % CM symbols and even all symbols from the \AmS{} fonts, and
52 % more. In particular upright shapes for the Greek letters are
53 % available (they are necessary in French mathematical
54 % typography). The |txgreeks| package\footnote{This document
55 % describes |txgreeks| version \fileversion\ (\filedate).}
56 % allows \LaTeX{} users who use the TX fonts to easily select
57 % the shapes (italic or upright) for the Greek lowercase and
58 % uppercase letters. This is compatible with using arbitrary
59 % text fonts in the document.
60 % \end{abstract}
61 %
62 % \section{Features}
63 %
64 % The shape of the Greek letters is decided according to the
65 % options passed to the package: |TeX| (=|sloped|, the default:
66 % lowercase italic and uppercase upright), |upright|
67 % (=|French|=|upgreek|, lowercase and uppercase upright), |ISO|
68 % (=|itgreek|, lowercase and uppercase italic), |itGreek| (italic
69 % uppercase) and |upGreek| (upright uppercase). Use both of
70 % |itGreek| and |upgreek| to get lowercase upright and uppercase
71 % italic.
72 %
73 % The uppercase Greek letters are not taken from the TX roman
74 % font |txr| (`operators') but from either the alternate math
75 % italic font |txmia| (`lettersA', which in fact provides upright
76 % Greek in OML encoding), or from the math italic font |txmi|
77 % (`letters', where uppercase Greek is in italic shape). This
78 % means that if some other package redefines the `operators' font
79 % used in math (presumably to co\"incide with the `roman' font
80 % used for the document text), this will have no impact on the
81 % Greek uppercase letters. If some package modifies the `letters'
82 % font used in math (which typically is the font for Latin
83 % letters and lowercase Greek letters, and with |txgreeks| is
84 % also used for the italic uppercase Greek letters), then of
85 % course the glyphs will be from the new font. But the upright
86 % glyphs will still be from the TX Font |txmia| (`lettersA').
87 %
88 % Following the model of the |fourier| package, the alternative
89 % shape of the Greek letters is accessible via the \cs{other...}
90 % prefix: \cs{otheralpha} will be upright if \cs{alpha} is
91 % italic, and vice versa. For the lowercase Greek letters there
92 % are also the macros ending in |up| (\cs{alphaup}, \dots) which
93 % are already defined by |txfonts|.
94 %
95 % Regarding the uppercase letters, the package defines (replacing
96 % the |amsmath| definitions) \cs{varGamma}, etc\dots{} as synonyms for
97 % \cs{otherGamma}, etc\dots, but does not define additional
98 % macros \cs{Gammaup} as this was not done by the package
99 % |txfonts|. Use rather \cs{otherGamma} if
100 % necessary.\footnote{contrarily to |amsmath| we define the
101 % \cs{varGamma}, etc\dots{} to be of type \cs{mathalpha} so they
102 % obey, like the default \LaTeX{} \cs{Gamma}, etc \dots{} the math
103 % alphabet changing commands; however to access the bold glyphs I
104 % recommend using either the \cs{bm} command from the |bm|
105 % package or the \cs{boldsymbol} command from the |amsbsy|
106 % package and not \cs{mathbf} which by default will use the TX
107 % roman font |txr|.}
108 %
109 % The package defines \cs{omicron}, \cs{otheromicron}, and
110 % \cs{omicronup}. But there is no upright omicron in the |txmia|
111 % font, so we have to use the construct |\mathrm{\omicron}| (this
112 % will a priori use the TX roman font |txr|).
113 %
114 % It is not necessary to write |\usepackage{txfonts}| prior to
115 % |\usepackage{txgreeks}| as this is done by |txgreeks| itself,
116 % but for clarity of the \LaTeX{} source of the document to be
117 % typeset, this is highly recommended, as |txgreeks| does very
118 % minor things compared to |txfonts|.
119 %
120 % Using |txgreeks| should be hopefully compatible with any
121 % package which is already compatible with |txfonts|.
122 %
123 %
124 % \StopEventually{}
125 %
126 % \section{Implementation}
127 %
128 %
129 % \begin{macrocode}
130 \NeedsTeXFormat{LaTeX2e}
131 \ProvidesPackage{txgreeks}
132 [2011/03/16 v1.0 shape selection for the TX fonts Greek letters]
133 \RequirePackage{txfonts}
134 \newif\iftgs@uplower
135 \newif\iftgs@itupper
136 \def\tgs@Greek@sh{0}
137 \DeclareOption{itgreek}{\tgs@uplowerfalse\tgs@ituppertrue}
138 \DeclareOption{upgreek}{\tgs@uplowertrue\tgs@itupperfalse}
139 \DeclareOption{itGreek}{\def\tgs@Greek@sh{1}}
140 \DeclareOption{upGreek}{\def\tgs@Greek@sh{2}}
141 \DeclareOption{TeX}{\tgs@uplowerfalse\tgs@itupperfalse} %default
142 \DeclareOption{sloped}{\ExecuteOptions{TeX}}
143 \DeclareOption{upright}{\ExecuteOptions{upgreek}}
144 \DeclareOption{French}{\ExecuteOptions{upright}}
145 \DeclareOption{ISO}{\ExecuteOptions{itgreek}}
146 \DeclareOption*{\PackageWarning{txgreeks}{Unknown option `\CurrentOption'}}
147 \ProcessOptions\relax
148 \ifcase\tgs@Greek@sh\or\tgs@ituppertrue\or\tgs@itupperfalse\fi
149 % \end{macrocode}
150 % macro \cs{re@DeclareMathSymbol} defined in txfonts.sty\\
151 % symbol font lettersA=txmia defined in txfonts.sty (contains upright Greek)
152 % \begin{macrocode}
153 \re@DeclareMathSymbol{\Gamma}{\mathalpha}{lettersA}{0}
154 \re@DeclareMathSymbol{\Delta}{\mathalpha}{lettersA}{1}
155 \re@DeclareMathSymbol{\Theta}{\mathalpha}{lettersA}{2}
156 \re@DeclareMathSymbol{\Lambda}{\mathalpha}{lettersA}{3}
157 \re@DeclareMathSymbol{\Xi}{\mathalpha}{lettersA}{4}
158 \re@DeclareMathSymbol{\Pi}{\mathalpha}{lettersA}{5}
159 \re@DeclareMathSymbol{\Sigma}{\mathalpha}{lettersA}{6}
160 \re@DeclareMathSymbol{\Upsilon}{\mathalpha}{lettersA}{7}
161 \re@DeclareMathSymbol{\Phi}{\mathalpha}{lettersA}{8}
162 \re@DeclareMathSymbol{\Psi}{\mathalpha}{lettersA}{9}
163 \re@DeclareMathSymbol{\Omega}{\mathalpha}{lettersA}{10}
164 % \end{macrocode}
165 % \cs{varGamma} etc... defined in amsmath, but with type \cs{mathord}
166 % \begin{macrocode}
167 \re@DeclareMathSymbol{\varGamma}{\mathalpha}{letters}{0}
168 \re@DeclareMathSymbol{\varDelta}{\mathalpha}{letters}{1}
169 \re@DeclareMathSymbol{\varTheta}{\mathalpha}{letters}{2}
170 \re@DeclareMathSymbol{\varLambda}{\mathalpha}{letters}{3}
171 \re@DeclareMathSymbol{\varXi}{\mathalpha}{letters}{4}
172 \re@DeclareMathSymbol{\varPi}{\mathalpha}{letters}{5}
173 \re@DeclareMathSymbol{\varSigma}{\mathalpha}{letters}{6}
174 \re@DeclareMathSymbol{\varUpsilon}{\mathalpha}{letters}{7}
175 \re@DeclareMathSymbol{\varPhi}{\mathalpha}{letters}{8}
176 \re@DeclareMathSymbol{\varPsi}{\mathalpha}{letters}{9}
177 \re@DeclareMathSymbol{\varOmega}{\mathalpha}{letters}{10}
178 \re@DeclareMathSymbol{\omicron}{\mathalpha}{letters}{`o}
179 % \end{macrocode}
180 % unfortunately no upright omicron in lettersA=txmia
181 % \begin{macrocode}
182 \let\omicronup\undefined\newcommand{\omicronup}{\mathrm{o}}
183 \iftgs@uplower % upright lowercase Greek letters
184 \let\otheralpha\alpha
185 \let\otherbeta\beta
186 \let\othergamma\gamma
187 \let\otherdelta\delta
188 \let\otherepsilon\epsilon
189 \let\otherzeta\zeta
190 \let\othereta\eta
191 \let\othertheta\theta
192 \let\otheriota\iota
193 \let\otherkappa\kappa
194 \let\otherlambda\lambda
195 \let\othermu\mu
196 \let\othernu\nu
197 \let\otherxi\xi
198 \let\otherpi\pi
199 \let\otherrho\rho
200 \let\othersigma\sigma
201 \let\othertau\tau
202 \let\otherupsilon\upsilon
203 \let\otherphi\phi
204 \let\otherchi\chi
205 \let\otherpsi\psi
206 \let\otheromega\omega
207 \let\othervarepsilon\varepsilon
208 \let\othervartheta\vartheta
209 \let\othervarpi\varpi
210 \let\othervarrho\varrho
211 \let\othervarsigma\varsigma
212 \let\othervarphi\varphi
213 \let\otheromicron\omicron
214 %%
215 \let\alpha\alphaup
216 \let\beta\betaup
217 \let\gamma\gammaup
218 \let\delta\deltaup
219 \let\epsilon\epsilonup
220 \let\zeta\zetaup
221 \let\eta\etaup
222 \let\theta\thetaup
223 \let\iota\iotaup
224 \let\kappa\kappaup
225 \let\lambda\lambdaup
226 \let\mu\muup
227 \let\nu\nuup
228 \let\xi\xiup
229 \let\pi\piup
230 \let\rho\rhoup
231 \let\sigma\sigmaup
232 \let\tau\tauup
233 \let\upsilon\upsilonup
234 \let\phi\phiup
235 \let\chi\chiup
236 \let\psi\psiup
237 \let\omega\omegaup
238 \let\varepsilon\varepsilonup
239 \let\vartheta\varthetaup
240 \let\varpi\varpiup
241 \let\varrho\varrhoup
242 \let\varsigma\varsigmaup
243 \let\varphi\varphiup
244 \let\omicron\omicronup
245 \else % italic lowercase Greek letters (default)
246 \let\otheralpha\alphaup
247 \let\otherbeta\betaup
248 \let\othergamma\gammaup
249 \let\otherdelta\deltaup
250 \let\otherepsilon\epsilonup
251 \let\otherzeta\zetaup
252 \let\othereta\etaup
253 \let\othertheta\thetaup
254 \let\otheriota\iotaup
255 \let\otherkappa\kappaup
256 \let\otherlambda\lambdaup
257 \let\othermu\muup
258 \let\othernu\nuup
259 \let\otherxi\xiup
260 \let\otherpi\piup
261 \let\otherrho\rhoup
262 \let\othersigma\sigmaup
263 \let\othertau\tauup
264 \let\otherupsilon\upsilonup
265 \let\otherphi\phiup
266 \let\otherchi\chiup
267 \let\otherpsi\psiup
268 \let\otheromega\omegaup
269 \let\othervarepsilon\varepsilonup
270 \let\othervartheta\varthetaup
271 \let\othervarpi\varpiup
272 \let\othervarrho\varrhoup
273 \let\othervarsigma\varsigmaup
274 \let\othervarphi\varphiup
275 \let\otheromicron\omicronup
276 \fi
277 %%
278 \iftgs@itupper % italic uppercase Greek
279 \let\otherGamma\Gamma
280 \let\otherDelta\Delta
281 \let\otherTheta\Theta
282 \let\otherLambda\Lambda
283 \let\otherXi\Xi
284 \let\otherPi\Pi
285 \let\otherSigma\Sigma
286 \let\otherUpsilon\Upsilon
287 \let\otherPhi\Phi
288 \let\otherPsi\Psi
289 \let\otherOmega\Omega
290 \let\Gamma\varGamma
291 \let\Delta\varDelta
292 \let\Theta\varTheta
293 \let\Lambda\varLambda
294 \let\Xi\varXi
295 \let\Pi\varPi
296 \let\Sigma\varSigma
297 \let\Upsilon\varUpsilon
298 \let\Phi\varPhi
299 \let\Psi\varPsi
300 \let\Omega\varOmega
301 \let\varGamma\otherGamma
302 \let\varDelta\otherDelta
303 \let\varTheta\otherTheta
304 \let\varLambda\otherLambda
305 \let\varXi\otherXi
306 \let\varPi\otherPi
307 \let\varSigma\otherSigma
308 \let\varUpsilon\otherUpsilon
309 \let\varPhi\otherPhi
310 \let\varPsi\otherPsi
311 \let\varOmega\otherOmega
312 \else % upright uppercase Greek (default)
313 \let\otherGamma\varGamma
314 \let\otherDelta\varDelta
315 \let\otherTheta\varTheta
316 \let\otherLambda\varLambda
317 \let\otherXi\varXi
318 \let\otherPi\varPi
319 \let\otherSigma\varSigma
320 \let\otherUpsilon\varUpsilon
321 \let\otherPhi\varPhi
322 \let\otherPsi\varPsi
323 \let\otherOmega\varOmega
324 \fi
325 \endinput
326 % \end{macrocode}
327 % \iffalse
328 %</code>
329 %<*dtx>
330 % \fi
331 %
332 % \CharacterTable
333 % {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
334 % 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
335 % Digits \0\1\2\3\4\5\6\7\8\9
336 % Exclamation \! Double quote \" Hash (number) \#
337 % Dollar \$ Percent \% Ampersand \&
338 % Acute accent \' Left paren \( Right paren \)
339 % Asterisk \* Plus \+ Comma \,
340 % Minus \- Point \. Solidus \/
341 % Colon \: Semicolon \; Less than \<
342 % Equals \= Greater than \> Question mark \?
343 % Commercial at \@ Left bracket \[ Backslash \\
344 % Right bracket \] Circumflex \^ Underscore \_
345 % Grave accent \` Left brace \{ Vertical bar \|
346 % Right brace \} Tilde \~}
347 %
348 % \iffalse
349 %</dtx>
350 % \fi
351 %
352 % \CheckSum{528}
353 % \Finale
354 \endinput