Debian Codegraph @

texmf-dist/source/latex/pm-isomath/pm-isomath.dtx

raw
1 % \iffalse meta-comment
2 %<*internal>
3 \begingroup
4 \input docstrip.tex
5 \keepsilent
6
7
8 \preamble
9 ______________________________________________________
10 The PM-ISOmath bundle
11 Copyright (C) 2017-2021 Claudio Beccari
12 All rights reserved
13
14 License information appended
15
16 \endpreamble
17 \postamble
18
19
20 Distributable under the LaTeX Project Public License,
21 version 1.3c or higher (your choice). The latest version of
22 this license is at: http://www.latex-project.org/lppl.txt
23
24 This work is "maintained"
25
26 This work consists of this file pm-isomath.dtx, a README.txt file
27 and the derived files:
28 pm-isomath.sty, pm-isomath.pdf.
29
30 \endpostamble
31
32 \askforoverwritefalse
33
34 \generate{\file{pm-isomath.sty}{\from{pm-isomath.dtx}{style}}
35 % \file{README.txt}{\from{pm-isomath.dtx}{txt}}
36 }
37
38 \def\tmpa{plain}
39 \ifx\tmpa\fmtname\endgroup\expandafter\bye\fi
40 \endgroup
41 %</internal>
42 %
43 % Copyright 2017-2021 Claudio Beccari
44 %
45 % This file is part of the PM-ISOmath bundle
46 % -------------------------------------------
47 %
48 %
49 % \fi
50 %
51 % \iffalse
52 %^^A The following trick uses the same date for every file header.
53 %<style>\NeedsTeXFormat{LaTeX2e}[2019/01/01]
54 %<*driver>
55 \ProvidesFile{pm-isomath.dtx}[%
56 %</driver>
57 %<style>\ProvidesPackage{pm-isomath}[%
58 %<txt>\ProvidesFile{README.txt}[%
59 %<*driver,style,txt>
60 2021/08/24 v.1.2.00
61 %<txt> README file for pm-isomath.sty]
62 %<style>Poor man package for typesetting ISO compliant math when using pdfLaTeX]
63 %</driver,style,txt>
64 %<*driver>
65 ]
66 %</driver>
67 %<*driver>
68 \documentclass{ltxdoc}
69 \GetFileInfo{pm-isomath.dtx}
70 \title{\texttt{PM-ISOmath}\\The Poor Man ISO math bundle}
71 \date{\fileversion\space--- \filedate}
72 \author{Claudio Beccari\thanks{E-mail: \texttt{claudio dot beccari at gmail dot com}}}
73
74 \usepackage{metalogo,multicol,enumitem,url,booktabs}
75 \usepackage[utf8]{inputenc}
76 \usepackage[LGR,T1]{fontenc}
77 \usepackage{lmodern,textcomp}
78 %\usepackage{libertinus,libertinust1math}
79 \usepackage{pm-isomath}
80 \usepackage{siunitx}
81 \let\originalmeta\meta
82 \renewcommand\meta[1]{{\normalfont\originalmeta{#1}}}
83 \def\prog#1{\textsf{#1}}
84 \def\pack#1{\textsf{\slshape#1}}
85 \def\env#1{\textit{#1}}\let\amb\env
86 \def\file#1{\texttt{#1}}
87 \def\marg#1{{\normalfont\texttt{\{}\meta{#1}\texttt{\}}}}
88 \def\Marg#1{{\texttt{\{#1\}}}}
89 \def\opz#1{{normalfont\textsl{#1}}}
90 \def\oarg#1{{\normalfont\texttt{[\meta{#1}]}}}
91 \def\Oarg#1{{\normalfont\texttt{[#1]}}}
92 \def\parg#1{{\normalfont\texttt{(\meta{#1})}}}
93 \def\Parg#1{{\normalfont\texttt{(#1)}}}
94 \providecommand\pdfLaTeX{pdf\/\LaTeX}
95 \providecommand\pdfTeX{pdf\/\TeX}
96 \newenvironment{ttsintassi}{\flushleft\ttfamily\obeylines}{\endflushleft}
97 \begin{document}\errorcontextlines=9
98 \maketitle
99 \begin{multicols}{2}
100 \tableofcontents
101 \end{multicols}
102 \setlength\hfuzz{20pt}
103 \DocInput{pm-isomath.dtx}
104 \end{document}
105 %</driver>
106 % \fi
107 %
108 % \CheckSum{511}
109 % \begin{abstract}
110 % The ISO regulations for typesetting math in the field of physics
111 % and technology are pretty stringent and imply legal questions
112 % that we do not treat here; it suffices to say that in certain
113 % countries an ``Expertise'' for a Legal Court that does not
114 % fulfil such regulations may be rejected by the Court,
115 % independently from its expert contents.
116 %
117 % Authors may not like them, but in the field of \emph{applied
118 % sciences}, or better, of \emph{experimental sciences}, that
119 % use measured quantities and units of measure, they are compulsory.
120 %
121 % With \LuaLaTeX\ and \XeLaTeX, while using OpenType math fonts
122 % there should not be any difficulty in fulfilling the regulations,
123 % but with \pdfLaTeX things are not so simple. There exist some
124 % facilities, but sometimes they do not work.
125 %
126 % This package provides some robust work-arounds to bypass the
127 % difficulties experienced by some \pdfLaTeX\ users.
128 % \end{abstract}
129
130 % \section{Introduction}
131 % The ISO regulations (formerly ISO\,31/XI, now ISO\,80000) are
132 % stringent rules to typeset mathematics in the domains of physics
133 % and experimental sciences; their title explicitly mentions “physics
134 % and physical sciences”, but their careful reading lets us understand
135 % that they apply to all sciences that use the “mathematics of
136 % quantities”. Such entities form a special group or space,
137 % where the elements are couples of two ordered entities $(x, y)$,
138 % where $y$ represents the unit of measure and $x$ represents the
139 % ratio of the quantity to the unit of measure. Such paired
140 % entities may not be separated, therefore some special
141 % mathematical rules are established in order to operate on
142 % quantities.
143 %
144 % Add to these special mathematical bases the fact that the
145 % measure component of the quantity is pretty fuzzy and it
146 % is always accompanied by a certain degree of uncertainty;
147 % metrologists are the masters in measuring quantities
148 % and handling their measures and uncertainties, but although
149 % for simplicity laypeople handle measures as if hey were rational
150 % numbers (after all aren't they the ratio of something to be
151 % measured and the unit of measure?) we are facing the domain
152 % of fuzzy sets.
153 %
154 % Furthermore quantities are so many that any work in applied
155 % sciences should contain a nomenclature list in order to
156 % explain which symbol is used for which quantity. This is
157 % where the ISO regulations set some order and establish
158 % a long list of named quantities with their preferred symbols
159 % and their “normal” units according to the prescriptions
160 % of the Comité International des Poids et Mesures, that
161 % established the International System of measures
162 % (Système International, SI).
163 %
164 % This ISO nomenclature is used uniformly by most, if not all,
165 % people involved in applied sciences; therefore among the few
166 % letters of the Latin and Greek alphabets almost none is available
167 % to be used for other purposes.
168 %
169 % This means that the usual math italic alphabet can be used for
170 % very few symbols if confusion is to be avoided. Other series
171 % and shapes must be judiciously used and the ISO regulations
172 % say how.
173 %
174 % There are no problems when typesetting applied science
175 % documents with \LuaLaTeX\ or \XeLaTeX, at least if the
176 % proper OpenType math fonts are used; such fonts have
177 % available so many slots (code points) that may contain
178 % any variation of any glyph; it suffices to specify the
179 % option |math style = ISO| to the math handling package
180 % |unicode-math| and to select an OpenType math font. The
181 % only problem, if any, is to know which font series and
182 % shapes should be used according to the ISO regulations.
183 %
184 % These regulations can be purchased from the ISO site in
185 % Switzerland; they are quite expensive and the cost is
186 % affordable by associated professional studios and large
187 % academic and/or research institutions.
188 %
189 % For private users I'd suggest to download the PDF document
190 % \url{https://www.nist.gov/pml/special-publication-811-extended- contents}.
191 % This document has been produced by the National
192 % Institute for Science and Technology, the Institution that
193 % several years ago was appointed to replace the United States
194 % National Bureau of Standards. Their staff is made essentially
195 % by metrologists and this guide is written to give precise
196 % instructions for handling the applied science mathematics
197 % according to the ISO regulations; it establishes also several
198 % rules for writing text about mathematics and metrology. It
199 % is extremely valuable for anglophones, but, with the due
200 % differences concerning the mother languages, it is extremely
201 % useful also for people using languages different from English.
202 %
203 % \section{The \pdfLaTeX\ handicaps}
204 % Users of \pdfLaTeX, on the opposite are in trouble. In facts
205 % this typesetting program suffers from an inherited limitation:
206 % math fonts are encoded with the old 128 glyph encodings; this
207 % is not a limitation set forth by the underlying interpreter
208 % \pdfTeX. Matter of fact there exists the quite recent
209 % LibertinusT1math fonts for \pdfLaTeX, created by Michael Sharpe,
210 % that, to my best knowledge, are the only math 8-bit encoded fonts
211 % with 256 glyphs. Package |libertinust1math| accepts the |ISO| option
212 % that allows to fulfil the ISO regulations; it accepts other
213 % options; depending on which ones are specified, the number
214 % of math groups, beyond the essential first four ones, increases
215 % by three to six units, reaching a maximum of ten; there remains
216 % enough free math groups to satisfy most user requirements.
217 %
218 % But even while using such LibertinusT1math fonts, \pdfTeX\
219 % suffers from another handicap derived from the knuthian
220 % original \TeX-the-program and by the NFSS (New Font Selection
221 % Scheme, that dates back to 1994, when \LaTeXe\ started its life.).
222 % I am not complaining about these \pdfTeX\ and
223 % \LaTeX\ limitations; for decades people have been happily
224 % typesetting math with results that are much superior to any
225 % other typesetting program at least when the latter does not
226 % use some \TeX\ software.
227 %
228 % By now, the handicap I am talking about is the way math alphabets
229 % are handled by \pdfTeX\ and \LaTeX; such alphabets
230 % are loaded in the form of math groups, the number of which
231 % cannot exceed 16 (numbered from 0 to 15); each group loads
232 % three sizes: for normal math style, for script style and for
233 % script-script style. Taking into account the bold version, the
234 % number of math groups would risk to exceed its capabilities;
235 % in order to avoid exceeding the number limit on the math
236 % groups usable in any math environment, only the
237 % medium \emph{or} the bold series is loaded and the math version
238 % (bold or unbold) must be chosen before entering the math
239 % environment. Packages that allow mixed series math formulas
240 % load both versions and become very critical for using other
241 % math alphabets.
242 %
243 % By default four groups are always loaded; group~0 for
244 % operators; group~1 for letters; group~2 for symbols;
245 % group~3 for large operators and delimiters; users very
246 % often load also the two symbol-fonts provided by the
247 % American Mathematical Society, and this means two more
248 % math groups. Apparently there are ten more groups for
249 % other math groups. It seems that this number is abundantly
250 % sufficient to handle any situation, but it is not so. The
251 % author of this extension already reached the limit of~16
252 % without doing anything special -- at least he thought so,
253 % but evidently he was wrong. Users who use packages such
254 % as the Fourier or the KPfonts have to pay special attention
255 % to the package documentation because they might specify
256 % options that imply loading up to 14 math groups.
257 %
258 % Several authors provided packages to help users produce
259 % perfect documents that fulfil the ISO regulations; I would
260 % like to cite the excellent Package |ISOmath| by Günter Milde,
261 % entitled “Mathematical style for science and technology”.
262 % It should be the perfect package to use in order to fulfil
263 % the ISO regulations; sometimes it succeeds with excellent
264 % results, but more often than not the results are just partial,
265 % because of the limitations of the math fonts available to
266 % \pdfLaTeX\ that are in contrast with the requirements of
267 % the ISO regulations.
268 %
269 % Therefore, dear reader, before using the poor man solutions
270 % of this package, try |ISOmath|, if your font set passes all
271 % the requirements described in that package documentation,
272 % you don't need the poor man patches offered by this package.
273 %
274 % \section{ISO rules summary}
275 % This summary does not replace the original ISO document nor
276 % what is written in the instructions published by NIST. It
277 % simply recalls those rules that this package tries to implement.
278 % In what follows the word \emph{quantity} is used to represent
279 % any physical entity that may be measured according to the
280 % metrological practice; the word \emph{variable} is used to
281 % represent a mathematical entity that may assume several values.
282 %\begin{enumerate}[noitemsep]
283 % \item
284 % All quantity and variable symbols are represented by one
285 % letter (with as many appositions are needed); but no acronyms
286 % are allowed; in computer science programming, many strings
287 % are called variables, in the sense that they may represent
288 % variable data; but computer programs are not mathematics,
289 % rather they are a special language that tells the computer
290 % what to do, even mathematics, but the language is not the
291 % one that represents math. Unfortunately some acronyms have
292 % gained strong popularity and wide usage, but they are
293 % forbidden by the ISO rules; example: \emph{CMRR} is often
294 % used to mean “common mode rejection ratio”, but this is
295 % an improper usage of mathematics. Obviously this rule
296 % must be applied by the user, because \LaTeX\ is a
297 % typesetting language and does not understand the real
298 % meaning of what it is being typeset.
299 % \item
300 % All quantity symbols must be set in italics; slanted roman type
301 % is allowed, but serifed italics should be preferred unless
302 % the ISO rules prescribe a sans serif font. This implies that
303 % the differential symbol be in upright font to avoid confusion
304 % with the physical quantity $d$; the Napier number ‘e’ must be
305 % set in upright font to avoid confusion with the elementary
306 % electric charge $e$; the imaginary unit j in electrical
307 % engineering, (i in other applied sciences) must be set in
308 % upright font in order to avoid confusion with the electric
309 % current density $j$ or the electric current $i$; more
310 % difficult: the transcendental number $\ISOpi=3.14159\dots$
311 % should be distinguished from the plane angle $\pi$; and similar
312 % other numerical constants represented by Latin or Greek letters.
313 % \item
314 % All symbols that do not represent quantities should be
315 % typeset in an upright font, preferably a serifed font,
316 % except when the ISO rules require a sans serif font.
317 % This rule includes numbers and their digits, symbols that
318 % represent constant numeric values, all appositions both
319 % in subscript and superscript position. Subscripts require
320 % special attention: for example in $V_i$, the
321 % subscript $i$ is a variable because it represents the $i$-th
322 % element in a sequence, such as $V_0, V_1, V_2, \dots$; on
323 % the opposite $V_{\mathrm{i}}$ the subscript is an apposition
324 % because ‘i’ may mean, say, ‘input’.
325 % \item
326 % Upright bold roman or black board bold symbols represent sets.
327 % \item
328 % Italic bold symbols represent matrices; one column matrices
329 % may represent vectors in an algebraic way and should be
330 % treated as any other matrix; in general multirow and multicolumn
331 % matrices are typeset with uppercase letters, while lowercase
332 % ones are reserved for vectors; but in some sciences also vectors
333 % may be represented by uppercase letters. Geometrical vectors that
334 % might be typeset with a medium series upper or lowercase italic
335 % letter with an arrow on top of it, are not treated by the ISO
336 % regulations that speak of vectors irrespective if they are
337 % considered as one column matrices or oriented segments;
338 % apparently oriented segments should be treated the same as
339 % one column matrices.
340 % \item
341 % Labels to geometrical entities, such as points, segments,
342 % angles (not their measures) should be set in upright
343 % medium series sans serif fonts; the same rule applies
344 % to labels used in sketches and drawings representing
345 % machinery, electric circuitry, and the like when the label
346 % refers to an object and not to its measure: “the lens
347 % $\mathsf{L}_1$, “the switch $\mathsf{S}_2$”, “the
348 % planetary gear $\mathsf{G}_3$”, and so on.
349 % \item
350 % Tensors should be set in slanted bold sans serif font.
351 % \item
352 % The above rules apply to both Latin and Greek
353 % letters.\label{enum:latin-greek}
354 %\end{enumerate}
355 %
356 % Such font rules for families, series and shapes are difficult
357 % to implement with \pdfLaTeX\ for many reasons that do not imply
358 % only the limited number of math groups, but also the categories
359 % of symbols; Greek letters in particular are troublesome for a
360 % couple of reasons connected with rule~\ref{enum:latin-greek}:
361 %\begin{itemize}[noitemsep]
362 %\item
363 % Uppercase greek letters are taken from the “operators”
364 % alphabet and are letter symbols; they are upright;
365 % but if they represent quantities they must be in italics,
366 % or at least slanted;
367 %\item
368 % Lowercase Greek letters are taken from the “letters” math alphabet
369 % and are ordinary symbols; they are oblique, and this is fine,
370 % but as ordinary math symbols they cannot be modified by commands
371 % such as |\mathrm|; furthermore upright lowercase Greek letters
372 % are not available, at least not directly.
373 %\end{itemize}
374 %
375 % \section{Some existing solutions}
376 % Several packages to be used with \pdfLaTeX\ allow for upright
377 % Greek letters, especially those packages for French typography,
378 % where the national rules (in contrast with the ISO regulations)
379 % require that all math entities typeset with Greek letters be
380 % upright. Among such packages there are |fourier| and |kpfonts|.
381 % Other packages such as |newpxmath| and |newtxmath| are intended
382 % for general use, but with suitable options and extra math groups
383 % let the user employ upright lowercase Greek letters as well as
384 % oblique uppercase ones.
385 %
386 % Package |libertinust1math| allows the use of the 256~glyph
387 % encoded fonts and are less sensitive to the limit of 16~math
388 % groups. Its many options allow to use the various font styles
389 % without requiring the |\boldmath| declaration; this implies
390 % that medium and bold series are both preloaded without
391 % actually using extra math alphabets beyond the small number
392 % it uses for its full functionality. An option |ISO| is
393 % already available to fulfil the ISO regulations. Maybe
394 % the only drawback of such fonts is that they are intended to
395 % match the Libertinus text fonts that are blacker than the
396 % standard Computer or Latin Modern ones. The auxiliary font
397 % selection commands used in the |ISOmath| package are already
398 % implemented with this |libertinust1math| one.
399 %
400 % Of course the |ISOmath| package might solve all problems if the
401 % user math environment has the necessary functionalities, in
402 % particular all the math alphabets needed for the task and if
403 % there are no difficulties with the number of math groups.
404 %
405 % \section{The poor man solution}
406 % The poor man solution described in this document is very simple in
407 % theory; it handles text fonts in math expressions through the |\text|
408 % command provided by the |amsmath| package; of course there are
409 % functionalities to chose families series and shapes in a
410 % comfortable~way by means of the powerful command definition commands
411 % provided by the |xparse| package; for Greek letters it uses the
412 % functionalities of the |alphabeta| package, that allows to use
413 % in text mode the same control sequences that are used
414 % in math mode. The default families for Latin and Greek letters
415 % are the Latin Modern ones that allow a piecewise continuous
416 % scaling of any available particular font of the collection.
417 %
418 % It goes without saying that this poor man solution has advantages and
419 % disadvantages over the other indicated solutions.
420 %
421 % The main advantage is that no math groups are involved,
422 % therefore the user may couple any font family with any
423 % series and shape that family allows; the default
424 % family for Greek fonts are the Latin Modern compliant
425 % LGR encoded collection of CBfonts; they are always
426 % available with any up-to-date and complete \TeX\ system
427 % installation.^^A VERIFICARE! -- PUÒ DARSI CHE NON FUNZIONI CON FAMIGLIE DIVERSE
428 %
429 % This is also a disadvantage, in the sense that Latin Modern
430 % fonts might not be the best ones to use with any specific
431 % text font; for example they have an x-height smaller than
432 % the Palatino ones, and a larger `em' unit compared to the
433 % Times ones; they have also a slightly lighter “color”
434 % compared to most other fonts.
435 %
436 % Nevertheless they work very well with the ISO regulations
437 % and in spite of the disadvantages listed above, they are
438 % usable without problems. This very documentation is typeset
439 % with Latin Modern fonts. The examples shown in a following
440 % section show the ease with which the ISO regulations may be
441 % fulfilled. Some problems, though, still remain, and require the
442 % user intervention.
443 %
444 % There are other Greek fonts that may be used in place of
445 % those of the CBfonts collection, especially those distributed
446 % by the Greek Font Society (GFS) that are already part of the
447 % \TeX\ system distribution; they are LGR encoded and have their
448 % specific |.fd| files. They are not so rich in series and shapes
449 % (some of them may lack the bold extended series and sometimes
450 % lack also the bold series); I would say the the GFS Bodoni
451 % family is sufficiently rich of series and shapes, and may be used
452 % also for the Latin fonts.
453 %
454 % There are also the Greek fonts that are “companions” to the
455 % Times fonts. So the user is not limited to the Latin Modern
456 % fonts, but admittedly there is not a great choice and, if it
457 % is necessary, the disadvantage of an unmatching Greek font is
458 % the price to pay if the user has to use \pdfLaTeX.
459 %
460 % \section{Usage}
461 % The usage of the package is very simple; in your preamble
462 % add the line
463 %\begin{ttsintassi}
464 %\cs{usepackage}\Oarg{engineer}\Marg{pm-isomath}
465 %\end{ttsintassi}
466 % The |engineer| option is used to set the imaginary unit the
467 % way electrical engineers usually do.
468 %
469 % The main macros that support the whole package, and that may
470 % be used also by the end user, are:
471 %\begin{ttsintassi}
472 %\cs{MathLatin}\marg{letter}\marg{family}\oarg{series}\parg{shape}
473 %\end{ttsintassi}
474 %and
475 %\begin{ttsintassi}
476 %\cs{MathGreek}\marg{letter}\marg{family}\oarg{series}\parg{shape}
477 %\end{ttsintassi}
478 % where \cs{MathLatin} sets the text encoding to |T1|, while
479 % \cs{MathGreek} sets it to |LGR|. In both commands the arguments
480 % specified with \marg{family}\oarg{series}\parg{shape} are all
481 % optional, including the first one in spite of being surrounded
482 % by curly braces. In both cases the default values for each
483 % argument are respectively |lmr|, |m|, and |n| (normal, upright).
484 % Notice the codes: |lmr|, |m|, and |n| are the codes that appear in
485 % the |.fd| file to declare the possible family, series, and shape
486 % combinations available for a given family. Further
487 % information is given below in table~\ref{tab:lmr-series-shapes} on
488 % page~\pageref{tab:lmr-series-shapes}, and how to discover these codes.
489 %
490 % Such default values, after loading |pm-isomath|, may be globally
491 % redefined by using in the preamble:
492 %\begin{ttsintassi}
493 %\cs{renewcommand}\Marg{ISOfam}\marg{family}
494 %\cs{renewcommand}\Marg{ISOser}\marg{series}
495 %\cs{renewcommand}\Marg{ISOsha}\marg{shape}
496 %\end{ttsintassi}
497 % We discourage this global redefinitions unless the user really
498 % knows what s/he is doing; in practice it must be checked that
499 % T1 encoded families and LGR encoded ones have the same family
500 % names. If the encoding+family|.fd| files are not available
501 % either they have to be created, or such default values should
502 % not be redefined.
503 %
504 % For Latin letters to use in the |\MathLatin| command mandatory
505 % argument there are no problems.
506 %
507 % For Greek letters you might use |\MathGreek| and the math letter
508 % commands |\alpha|, |\beta|,\dots, |\Omega| commands, but it is
509 % much simpler to avoid|\MathGreek| and
510 % use the package commands |\ISOalpha|, |\ISObeta|,\dots,
511 % |\ISOOmega|. All these commands follow the syntax:
512 %\begin{ttsintassi}
513 %\cs{ISO}\meta{lettername}\marg{family}\oarg{series}\parg{shape}
514 %\end{ttsintassi}
515 % where all the arguments are optional, including the first one
516 % in spite of being surrounded by curly braces. Such optional
517 % arguments must follow that order but all possible combinations
518 % are usable, for example:
519 %\begin{ttsintassi}
520 %\cs{ISOalpha}
521 %\cs{ISOalpha}\marg{family}
522 %\cs{ISOalpha}\oarg{series}
523 %\cs{ISOalpha}\parg{shape}
524 %\cs{ISOalpha}\oarg{series}\parg{shape}
525 %\cs{ISOalpha}\marg{family}\oarg{series}
526 %\cs{ISOalpha}\marg{family}\parg{shape}
527 %\cs{ISOalpha}\marg{family}\oarg{series}\parg{shape}
528 %\end{ttsintassi}
529 % This offers the maximum flexibility in using the necessary commands.
530 %
531 % The package defines other macros for fulfilling the rules
532 % relative to the differential symbol and the numerical constants
533 % represented with letters; furthermore it defines the commands
534 % for the |\ohm| unit of measure and the |\micro| SI prefix;
535 % this latter macro uses a special shape of the CBfonts where
536 % an upright shape with serifed lowercase Greek letters is
537 % available; if another family, lacking this shape, is being used,
538 % then the normal upright shape is used. In typesetting this
539 % documentation, evidently there are no problems, but with other
540 % font selections, especially with Greek fonts, there might be
541 % some mismatching shapes.
542 %
543 % Commands similar to those defined by the |ISOmath| package
544 % are also defined so as to simplify the font selection for
545 % vectors, matrices and tensors.
546 %
547 % \section{Examples}
548 % \subparagraph{ISO Greek letters}
549 % In the examples represented in table~\ref{tab:isoletters}, we typeset
550 % an array in math mode, where we show all the Greek letters that
551 % can be typeset with the \cs{ISO}\meta{lettername} macros; the
552 % array is typeset in normal math style, but the ISO letters are
553 % in bold style so that there is no confusion with a normal
554 % bold math setting; some letters, equal to the Latin ones, are
555 % also defined because some users have experienced difficulties
556 % in remembering the correct signs especially while labelling
557 % diagrams. The array in table~\ref{tab:isoletters} may be a
558 % useful reference.
559 %\begin{table}[!tb]
560 %\def\T#1{\cs{ISO#1} & \csuse{ISO#1}[bx]}
561 %\[\begin{array}{lclclclc}
562 %\T{alpha} & \T{beta} &
563 %\T{gamma} & \T{delta} \\
564 %\T{epsilon} & \T{zeta} &
565 %\T{eta} & \T{theta} \\
566 %\T{iota} & \T{kappa} &
567 %\T{lambda} & \T{mu} \\
568 %\T{nu} & \T{xi} &
569 %\T{omicron} & \T{pi} \\
570 %\T{rho} & \T{sigma} &
571 %\T{tau} & \T{upsilon} \\
572 %\T{phi} & \T{chi} &
573 %\T{psi} & \T{omega} \\
574 %\T{Gamma} & \T{Delta} &
575 %\T{Eta} & \T{Theta} \\
576 %\T{Lambda} & \T{Xi} &
577 %\T{Pi} & \T{Rho} \\
578 %\T{Sigma} & \T{Upsilon} &
579 %\T{Phi} & \T{Chi} \\
580 %&&\T{Psi} & \T{Omega}
581 %\end{array}\]
582 %\caption{The \cs{ISO}\meta{letter} macros and their rendering in bold style}
583 %\label{tab:isoletters}
584 %\end{table}
585 % \subparagraph{A small matrix equation}
586 %\[ \vectorsymbol{b} = \matrixsymbol{M}\vectorsymbol{a} \] is
587 % typeset with the following code
588 %\begin{verbatim}
589 %\[ \vectorsymbol{b} = \matrixsymbol{M}\vectorsymbol{a} \]
590 %\end{verbatim}
591 %
592 % \subparagraph{A resistivity value}
593 % The resistivity of copper is $1.68\,\micro\ohm\,\mathrm{cm}$ (in text mode: 1.68\unit{\micro\ohm\,cm})^^A VERIFICARE PERCHÉ IL DUE MI SONO DIVERSI -- perché \ISOfam per il greco non funziona
594 % is typeset with the following code
595 %\begin{verbatim}
596 %$1.68\,\micro\ohm\,\mathrm{cm}$ (in text mode: 1.68\unit{\micro\ohm\,cm})
597 %\end{verbatim}
598 % If the |siunitx| package has been loaded (as it is for typesetting
599 % this documentation) its unit |ohm| is redefined so as to always be
600 % an upright capital omega.
601 %
602 %\subparagraph{A tensor}
603 %\[ \vectorsymbol{D} =\epsilon_0\tensorsymbol{\epsilon}\ped{r}\vectorsymbol{E}\]
604 %is typeset with the following code
605 %\begin{verbatim}
606 %\[
607 %\vectorsymbol{D} = \epsilon_0\tensorsymbol{\epsilon}\ped{r}\vectorsymbol{E}
608 %\]
609 %\end{verbatim}
610 %
611 %\subparagraph{Solid angle}
612 % An energy flux of light form an isomorphic source that irradiates
613 % the power $P$ through the solid angle $\Omega$ generates
614 % a flux \[\Phi = \frac{P}{\Omega}\] is typeset with the following
615 % code
616 %\begin{verbatim}
617 %\[\Phi = \frac{P}{\Omega}\]
618 %\end{verbatim}
619 % where, as you see the uppercase Greek letters are slanted,
620 % as the ISO rules require, instead of upright, as \LaTeX\ sets
621 % them by default.
622 %
623 % \subparagraph{A bold formula}
624 % This is the very important inverse Laplace transform\footnote{Some
625 % packages may have a control sequence to insert a Cauchy principal
626 % value integral sign into a math expression; here we fake it by
627 % means of the superposition of a normal integral sign to a minus sign.}
628 %{\boldmath\[
629 %f(t) = \frac{1}{2\ISOpi\iu} -\mkern-19mu\int_{\sigma-\iu\infty}^{\sigma+\iu\infty}\eu^{pt}\diff p \qquad \text{for } \sigma > \sigma\ped{c}
630 %\]}
631 % typeset with the following code
632 %\begin{verbatim}
633 %{\boldmath\[
634 %f(t) = \frac{1}{2\ISOpi\iu} -\mkern-19mu
635 % \int_{\sigma-\iu\infty}^{\sigma+\iu\infty}\eu^{pt}\diff p
636 % \qquad \text{for } \sigma > \sigma\ped{c}
637 %\]}
638 %\end{verbatim}
639 % Notice the the use of |\boldmath| does not imply the use
640 % of new math groups; but the bold upright $\ISOpi$ is rendered
641 % without any problem.
642 %
643 % \subparagraph{Various styles of Greek fonts} Here are some
644 % examples of Greek fonts in various styles; within the same
645 % table bold and medium series fonts stay side by side, as well
646 % as glyphs coming from different families.\medskip
647 %
648 %\bgroup\begin{lrbox}{0}
649 %\begin{tabular}{@{}ll@{}}
650 %\cs{ISOgamma}, \cs{ISOzeta}, \cs{ISOeta}, \cs{ISOOmega}&
651 %$\ISOgamma, \ISOzeta, \ISOeta, \ISOOmega$\\
652 %\cs{ISOgamma}[bx], \cs{ISOzeta}[bx], \cs{ISOeta}[bx], \cs{ISOOmega}[bx]&
653 %$\ISOgamma[bx], \ISOzeta[bx], \ISOeta[bx], \ISOOmega[bx]$\\
654 %\cs{ISOgamma}\{lmss\}, \cs{ISOzeta}\{lmss\}, \cs{ISOeta}\{lmss\}, \cs{ISOOmega}\{lmss\}&
655 %$\ISOgamma{lmss}, \ISOzeta{lmss}, \ISOeta{lmss}, \ISOOmega{lmss}$\\
656 %\cs{ISOgamma}\{artemisia\}, \cs{ISOzeta}\{artemisia\}, \cs{ISOeta}\{artemisia\}, \cs{ISOOmega}\{artemisia\}&
657 %$\ISOgamma{artemisia}, \ISOzeta{artemisia}, \ISOeta{artemisia}, \ISOOmega{artemisia}$\\
658 %\cs{ISOgamma}(rs), \cs{ISOzeta}(rs), \cs{ISOeta}(rs), \cs{ISOOmega}(rs)&
659 %$\ISOgamma(rs), \ISOzeta(rs), \ISOeta(rs), \ISOOmega(rs)$\\
660 %\end{tabular}\end{lrbox}
661 %\noindent\resizebox{\textwidth}{!}{\usebox{0}}\egroup
662 %
663 % \subparagraph{ISO upright partial differential}
664 % Among the fonts used to typeset math when using \prog{pdflatex},
665 % only the LibertinusT1math fonts contain the upright partial
666 % differential symbol that conforms the ISO regulations. All other
667 % fonts at the moment available to typeset mathematics do not
668 % contain an upright symbol, but they contain the original slanted
669 % symbol as used with the CM fonts. With a poor-man trick it is
670 % possible to have available an upright symbol so as to describe
671 % the Electrical field as the opposite of the electric potential
672 % gradient. Compare the following formulas, where the second one
673 % is ISO compliant:
674 %\begin{align}
675 %\vectorsymbol{E} &=-\nabla V = -\left(
676 %\frac{\partial V}{\partial x}\vectorsymbol{e}_x +
677 %\frac{\partial V}{\partial y}\vectorsymbol{e}_y +
678 %\frac{\partial V}{\partial z}\vectorsymbol{e}_z
679 %\right)\\[\baselineskip]
680 %\vectorsymbol{E} &=-\nabla V = -\left(
681 %\frac{\uppartial V}{\uppartial x}\vectorsymbol{e}_x +
682 %\frac{\uppartial V}{\uppartial y}\vectorsymbol{e}_y +
683 %\frac{\uppartial V}{\uppartial z}\vectorsymbol{e}_z
684 %\right)
685 %\end{align}
686 %
687 %\section{Final remarks}
688 % This package |pm-isomath| is far from perfect, and its results are
689 % questionable; of course poor man solutions are just patches,
690 % incomplete solutions; nevertheless the results are not so bad. It has
691 % the indubitable advantage that is does not use any other math groups,
692 % therefore there is no risk to exceed the limit of 16~groups.
693 %
694 % As patches are not perfect, the above display of examples shows
695 % what can be done without human intervention. Attentive users
696 % have shown that the commands for vectors, matrices, and command
697 % do not perform well in certain circumstances. Such cases require
698 % some spacing corrections, but we were not capable to create
699 % sufficiently intelligent commands that could avoid human
700 % intervention. See below where, when and why human intervention
701 % is required.
702 %
703 %\section{Acknowledgements}
704 % I want to thank very much Laurent Van Deik, who remarked several
705 % typos and bugs; in particular he convinced me that the partial
706 % differential symbol, that in my previous version of this package
707 % was obtained by rotating and scaling the slanted one, had a
708 % different style from the other math glyphs; therefore I recreated
709 % the macro by applying an affine shearing transformation; I believe
710 % that this new solution, thanks to Laurent Van Deik's suggestion,
711 % is better suited to typeset ISO compliant math in a better way.
712 % He also helped a lot with the vector, matrix, and tensor macro
713 % testing. Thanks to him, this new version of |pm-isomath| is
714 % supposed to work as expected when using the
715 % Libertinus+LibertinusTimath fonts and other fonts where the
716 % textual fonts can handle also the LGR encoding; in previous
717 % versions there was a remarkable mismatch in certain math styles
718 %
719 % \StopEventually{}
720 %
721 % \section{The code}
722 % This package was loosely inspired by the |ISOmath| package
723 % by Günter Milde, but tackles the problem of insufficient maximum
724 % number of math font groups so as to avoid any problem with such
725 % group limitation, and therefore to avoid all the caveats in
726 % Milde's package.
727 %
728 % That package is much more comfortable to use than this one; but
729 % it is subject to a number of conditions that, depending on the
730 % user environment, may even result in a complete failure. This
731 % package avoids problems with math font groups because it does
732 % not use any, but it is not so comfortable to use because sometimes
733 % optional settings and spacing commands have to be specified.
734 %
735 % The preliminary lines have been already defined; therefore we
736 % start with real code.
737 %
738 % The trick of this package is that all fonts different from the
739 % four or six ones (including the AMS symbol fonts) are textual fonts
740 % used in math typesetting through the intermediate action of
741 % the |\text| command defined by the |amsmath| package.
742 % Therefore we start by verifying if packages |amsmath|,
743 % |alphabeta| and |xparse| have already been loaded in the document
744 % preamble; this implies a weak loading order, that is this
745 % package must be loaded after all the above packages are loaded;
746 % in facts if such packages are not, they get loaded by this
747 % one, but without any option. The package
748 % loading mechanism assures avoiding conflicts if packages are
749 % loaded without options; this is why if one of the three packages
750 % is loaded after this one but with some option specified, an
751 % “Option clash” error flag is raised; this is where the
752 % “weak” loading order error becomes a very “strong” one.
753
754 %\iffalse
755 %<*style>
756 %\fi
757 % Then we verify if the document is being typeset with \pdfLaTeX;
758 % if it is not, an error flag is raised and reading of this
759 % package is immediately interrupted. For this purpose we need
760 % an engine-detecting package, and we use the |iftex| one.
761 % \begin{macrocode}
762 \@ifpackageloaded{iftex}{}{\RequirePackage{iftex}}
763 \unless\ifPDFTeX
764 \PackageError{pm-isomath}{%
765 ******************************************\MessageBreak
766 This package should be used only when \MessageBreak
767 typesetting with pdfLaTeX. \MessageBreak
768 Loading this package is skipped \MessageBreak
769 ******************************************\MessageBreak
770 }{%
771 ******************************************\MessageBreak
772 Press the X key and restart typesetting \MessageBreak
773 while using pdfLaTeX\MessageBreak
774 ******************************************\MessageBreak
775 }
776 \expandafeter\@firstoftwo
777 \else
778 \PackageInfo{pm-isomath}{%
779 ******************************************\MessageBreak
780 Typesetting this document with pdfLaTeX! \MessageBreak
781 ******************************************\MessageBreak
782 }
783 \expandafter\@secondoftwo
784 \fi
785 {\endinput}{\relax}
786 % \end{macrocode}
787 %
788 % Actually this package accepts an option: |engineer|. This
789 % option is for deciding if the imaginary unit should be
790 % defined as ‘i’ or as ‘j’. As we have remarked in the previous
791 % documentation, engineers, especially those who deal with
792 % electricity and electrical quantities, but also electronics,
793 % automatic control systems, and telecommunications engineers, use ‘j’;
794 % all these varieties of engineers could not do anything in their
795 % profession if they don't use complex numbers and quantities (the
796 % latter called phasors). Possibly they are the applied scientists
797 % who use complex numbers more often than any other scientist.
798 %
799 % Notice: this option has \emph{not} been used to prepare this
800 % very document.
801 % \begin{macrocode}
802 \newif\ifengineer \engineerfalse
803 \DeclareOption{engineer}{\engineertrue}
804 \ProcessOptions*\relax
805 % \end{macrocode}
806 %
807 % Are the necessary packages already loaded? Notice that in previous
808 % versions we just loaded |xparse| unless it was already loaded;
809 % since 2020 the main functionalities of this package are already
810 % contained into the \LaTeX\ kernel, but we are going to use one
811 % of those “deprecated” functionalities that did not make their way
812 % to the \LaTeX\ kernel.
813 % \begin{macrocode}
814 \@ifpackageloaded{amsmath}{}{\RequirePackage{amsmath}}
815 \@ifpackageloaded{etoolbox}{}{\RequirePackage{etoolbox}}
816 \RequirePackage{xparse}
817 % \end{macrocode}
818 %
819 % Now we have almost all software instruments available. We
820 % define a macro to switch the definitions of certain math
821 % Greek symbols; some of these are defined in the \LaTeX\
822 % kernel: the lowercase Greek variant letters; some others
823 % are defined in the |amsmath| package: the uppercase slanted
824 % greek letters. All these variant letters have a name identical
825 % to the regular ones but prefixed with the string |var|;
826 % example |\epsilon| and |\varepsilon|, |\Omega| and |\varOmega|.
827 % We switch the control sequence definitions between the |var|-less
828 % and the |var|-prefixed ones. The first group of lowercase
829 % letters is switched because the glyphs give a better match with
830 % those produced with the textual Greek glyphs obtained when the ISO
831 % macros are used. Especially the Greek lowercase letter group is
832 % not appreciated by certain users, because they need to correct
833 % any previously typeset document that uses the standard \LaTeX\
834 % symbols. They may easily revert to the previous settings by
835 % applying again the global switching macros
836 % \cs{switchvarlowercasegreekletters} and or
837 % \cs{switchvaruppercasegreekletters}. We discourage such reset,
838 % but users are free to chose what they need.
839 % \begin{macrocode}
840 \newcommand\switchvarsymbols[1]{%
841 \letcs{\tempA}{#1}\csletcs{#1}{var#1}\cslet{var#1}{\tempA}}
842 %%%%
843 \newcommand\switchvarlowercasegreekletters{%
844 \switchvarsymbols{epsilon}
845 \switchvarsymbols{theta}
846 \switchvarsymbols{rho}
847 \switchvarsymbols{phi}}
848 %%%%
849 \newcommand\switchvaruppercasegreekletters{%
850 \switchvarsymbols{Gamma}
851 \switchvarsymbols{Delta}
852 \switchvarsymbols{Theta}
853 \switchvarsymbols{Lambda}
854 \switchvarsymbols{Xi}
855 \switchvarsymbols{Pi}
856 \switchvarsymbols{Sigma}
857 \switchvarsymbols{Upsilon}
858 \switchvarsymbols{Phi}
859 \switchvarsymbols{Psi}
860 \switchvarsymbols{Omega}}
861 %%%%%
862 \switchvarlowercasegreekletters
863 \switchvaruppercasegreekletters
864 % \end{macrocode}
865 %
866 % Eventually we load the |alphabeta| package; it
867 % allows using the same macros used in math mode while
868 % typesetting in text mode. We find it very useful in this
869 % package.
870 % \begin{macrocode}
871 \@ifpackageloaded{alphabeta}{}{\RequirePackage{alphabeta}}
872 % \end{macrocode}
873 %
874 % The next line defines the default family, series and shape
875 % to be used in the macros that follow; as it can be seen,
876 % the default family is the Latin Modern roman;
877 % the series is medium one and the shape is normal (or upright) one.
878 % The codes used are the same used in the font description
879 % files with extension |.fd|. The name of these |.fd| files
880 % is obtained by merging the encoding name with the family name;
881 % therefore the default font description file for Latin characters
882 % is |t1lmr.fd| while the one for Greek characters is |lgrlmr.fd|; these
883 % files define the series they contain and that are identified
884 % with codes such as |m| (medium); |bx| (bold extended);
885 % |b| (bold). Other fonts, with different series may have
886 % also other codes. For each series the |.fd| file defines the
887 % codes for shapes, and for every valid combination of
888 % series, shape and size it defines the specific font file
889 % to use.
890 %
891 % If the document preamble specifies a different textual font
892 % from the default Latin Modern the family name default should
893 % be changed; this is delayed at the execution of the
894 % |\begin{document}| command. But this might have strange effects
895 % on the corresponding Greek fonts, because they might be missing.
896 % Example: the GFS Bodoni fonts are chosen, they are good for both
897 % Latin and Greek text and no problems show up. The Libertinus
898 % fonts contain the Latin glyphs In various encodings), and the
899 % LGR encoded Greek ones, the Cyrillic fonts in various encodings.
900 % Apparently the Libertinus fonts are the most flexible available
901 % fonts for use with \pdfLaTeX. Only the typewriter type text font
902 % may be replaced with better results with other fonts; it is not
903 % important for mathematics, but I preferred to write this
904 % documentation with Latin Roman, because it contains several
905 % stretches of typewriter type texts.
906
907
908 % We should not care for the font names, but in order to use
909 % different font families, series, and shapes the user should
910 % know their codes. this is generally a difficult task, but
911 % not impossible; it ``suffices'' to open the packages that
912 % allow to use the desired fonts, read the code and find out
913 % the names of the |.fd| files; then search these files on the
914 % trees of the \TeX\ system, and eventually find out the
915 % codes for the available series and shapes.
916 %
917 % For the Modern Latin and Greek |.fd| files we have the series
918 % and shapes shown in table~\ref{tab:lmr-series-shapes}.
919 %
920 %\begin{table}[!tb]\centering
921 %\begin{tabular}{llllll}
922 %\toprule
923 % & & \multicolumn2c{Latin (T1)}
924 % & \multicolumn2c{Greek (LGR)} \\
925 %\cmidrule(r){3-4} \cmidrule(l){5-6}
926 %Series & Code & Shape & Code & Shape & Code \\
927 %\midrule
928 %medium & m & normal & n & normal & n \\
929 % & & italics & it & italics & it \\
930 % & & slanted & sl & slanted & sl \\
931 % & & & & lipsian & li \\
932 % & & & & serif & rs \\
933 % & & & & serif oblique & ro \\
934 % & & upright italics & ui & upright italics& ui \\
935 % & & small caps & sc & small caps & sc \\
936 %\midrule
937 % bold & b & & & lipsian & li \\
938 % & & normal & n & & \\
939 % & & slanted & sl & & \\
940 %\midrule
941 % bold extended& bx & normal & n & normal & n \\
942 % & & italics & it & italics & it \\
943 % & & slanted & sl & slanted & sl \\
944 % & & & & lipsian & li \\
945 % & & & & serif & rs \\
946 % & & & & serif oblique & rs \\
947 % & & & & upright italics & ui \\
948 % & & & & small caps & sc \\
949 %\bottomrule
950 %\end{tabular}
951 %\caption{Series and shapes available with the Latin Modern regular family with Latin and Greek fonts}
952 %\label{tab:lmr-series-shapes}
953 %\end{table}
954 %
955 % \begin{macrocode}
956 \def\Def@Fam{lmr}\edef\ISOfam{\Def@Fam}
957 \def\ISOser{m}
958 \def\ISOsha{n}
959 \AtBeginDocument{%
960 \unless\ifx\f@family\Def@Fam\edef\ISOfam{\f@family}\fi
961 }
962
963 % \end{macrocode}
964 %
965 % As explained in the initial documentation, all font changing
966 % commands are constructed in such a way as to have a default
967 % family, series and shape common to both Latin and Greek fonts;
968 % therefore with three optional arguments that the user can
969 % specify with different delimiters, but respecting their order;
970 % the user can get eight different choice combinations that
971 % allow the selection of a large number of different looks.
972 %
973 % We now define the main and service macros that allow
974 % such font selection; we have to create similar macros that
975 % mostly differ in the encoding choice for Latin or Greek letters.
976 %
977 % The user macros are defined by means of the defining commands
978 % provided by the |xparse| package functionalities, while the service
979 % macros use normal \LaTeX\ commands. The user commands follow this
980 % special syntax:
981 %\begin{ttsintassi}
982 %\cs{MathLatin}\marg{Latin letter}\marg{family}\oarg{series}\parg{shape}
983 %\cs{MathGreek}\marg{Greek letter}\marg{family}\oarg{series}\parg{shape}
984 %\end{ttsintassi}
985 % where in both cases the last three arguments are differently
986 % delimited optional values, even the first one of the three, in
987 % spite of being delimited by curly braces. In both cases the only
988 % mandatory argument is the Latin or Greek letter; the latter
989 % one may be specified by the macros |\alpha|, |\beta|,\dots,
990 % |\Omega|, the same ones that are normally used in math (although
991 % they are going to be used in text mode).
992 % \begin{macrocode}
993 \NewDocumentCommand\MathLatin{m g O{m} D(){it}}{%
994 \bgroup\edef\y{\IfNoValueTF{#2}{\ISOfam}{#2}}%
995 \edef\x{\noexpand\egroup\noexpand\MLatin{\noexpand#1}{\y}}\x{#3}{#4}%
996 }
997
998 \providecommand\MLatin[4]{\text{\def\ISOfam{#2}\def\ISOsha{#4}%
999 \ifcsstring{math@version}{bold}{\def\ISOser{bx}}{\def\ISOser{#3}}%
1000 \usefont{T1}{\ISOfam}{\ISOser}{\ISOsha}#1}}
1001
1002 \NewDocumentCommand\MathGreek{ m g O{m} d()}{%
1003 \edef\y{\IfNoValueTF{#2}{\ISOfam}{#2}}%
1004 \edef\x{\IfNoValueTF{#4}{\ISOsha}{#4}}%
1005 \MGreek{#1}{\y}{#3}{\x}}
1006
1007 \newcommand{\MGreek}[4]{\text{\def\ISOfam{#2}\def\ISOsha{#4}%
1008 \ifcsstring{math@version}{bold}{\def\ISOser{bx}}{\def\ISOser{#3}}%
1009 {\usefont{LGR}{\ISOfam}{\ISOser}{\ISOsha}#1}}}
1010
1011 % \end{macrocode}
1012 % It is convenient to notice that for Greek letters the default
1013 % encoding is LGR, the only encoding that \pdfLaTeX\ understands
1014 % without the necessity of other packages. If the default text
1015 % font family does not handle the Greek encoding, errors show
1016 % up in different forms that difficult to handle. Therefore it
1017 % is better to use the above commands with an explicit font
1018 % family code, for example |lmr|, and accept the consequent
1019 % font mismatch. After examining the result the author may
1020 % accept the mismatch, but s/he might prefer to select a
1021 % different textual Greek font the glyphs of which have a
1022 % less noticeable mismatch; even better, s/he might prefer
1023 % to use a couple of matching Latin and Greek fonts, so that
1024 % it is possible to get e perfect match. This is why we suggest
1025 % to typeset the document either with Latin Modern, or Libertinus
1026 % (that is usable also with slavic languages typeset in Cyrillic);
1027 % among the fonts provided by the Greek Font Society (GFS), the
1028 % Bodoni collection is available with matching Latin and Greek
1029 % families. These are just examples; the user can explore its
1030 % own \TeX\ system installation where PFB fonts are stored and
1031 % discover the multitude of available fonts.
1032 %
1033 % We now define the macros for all lowercase Greek letters
1034 % and several uppercase ones (even some that are identical
1035 % to some Latin letters) that should save several keystrokes
1036 % when entering such letters in the source file. The shorter
1037 % the code to type in, the smaller the the number of potential typos.
1038 % \begin{macrocode}
1039 \newcommand\ISOalpha{\MathGreek{\alpha}}
1040 \newcommand\ISObeta{\MathGreek{\beta}}
1041 \newcommand\ISOgamma{\MathGreek{\gamma}}
1042 \newcommand\ISOdelta{\MathGreek{\delta}}
1043 \newcommand\ISOepsilon{\MathGreek{\epsilon}}
1044 \newcommand\ISOzeta{\MathGreek{\zeta}}
1045 \newcommand\ISOeta{\MathGreek{\eta}}
1046 \newcommand\ISOtheta{\MathGreek{\theta}}
1047 \newcommand\ISOiota{\MathGreek{\iota}}
1048 \newcommand\ISOkappa{\MathGreek{\kappa}}
1049 \newcommand\ISOlambda{\MathGreek{\lambda}}
1050 \newcommand\ISOmu{\MathGreek{\mu}}
1051 \newcommand\ISOnu{\MathGreek{\nu}}
1052 \newcommand\ISOxi{\MathGreek{\xi}}
1053 \newcommand\ISOomicron{\MathGreek{\omicron}}
1054 \newcommand\ISOpi{\MathGreek{\pi}}
1055 \newcommand\ISOrho{\MathGreek{\rho}}
1056 \newcommand\ISOsigma{\MathGreek{\sigma}}
1057 \newcommand\ISOtau{\MathGreek{\tau}}
1058 \newcommand\ISOupsilon{\MathGreek{\upsilon}}
1059 \newcommand\ISOphi{\MathGreek{\phi}}
1060 \newcommand\ISOchi{\MathGreek{\chi}}
1061 \newcommand\ISOpsi{\MathGreek{\psi}}
1062 \newcommand\ISOomega{\MathGreek{\omega}}
1063 \newcommand\ISOGamma{\MathGreek{\Gamma}}
1064 \newcommand\ISODelta{\MathGreek{\Delta}}
1065 \newcommand\ISOEta{\MathGreek{\Eta}}
1066 \newcommand\ISOTheta{\MathGreek{\Theta}}
1067 \newcommand\ISOLambda{\MathGreek{\Lambda}}
1068 \newcommand\ISOXi{\MathGreek{\Xi}}
1069 \newcommand\ISOPi{\MathGreek{\Pi}}
1070 \newcommand\ISORho{\MathGreek{\Rho}}
1071 \newcommand\ISOSigma{\MathGreek{\Sigma}}
1072 \newcommand\ISOUpsilon{\MathGreek{\Upsilon}}
1073 \newcommand\ISOPhi{\MathGreek{\Phi}}
1074 \newcommand\ISOChi{\MathGreek{\Chi}}
1075 \newcommand\ISOPsi{\MathGreek{\Psi}}
1076 \newcommand\ISOOmega{\MathGreek{\Omega}}
1077 % \end{macrocode}
1078 % We redefine also the |\mathrm| and |\mathit| so that if they
1079 % have to contain Greek letters the default shape is set equal
1080 % to that of the enclosing command. Such macros are just those
1081 % defined in the \LaTeX\ kernel where the |\ISOsha| redefinition
1082 % is added.
1083 % \begin{macrocode}
1084 \DeclareRobustCommand{\mathrm}%
1085 {\relax\ifmmode\else\expandafter\non@alpherr
1086 \csname mathrm \endcsname\fi
1087 \def\ISOsha{n}\expandafter\use@mathgroup
1088 \csname M@OT1\endcsname\symoperators}
1089
1090 \DeclareRobustCommand{\mathit}%
1091 {\relax\ifmmode\expandafter\non@alpherr
1092 \csname mathit \endcsname\fi
1093 \def\ISOsha{it}\expandafter\use@mathgroup
1094 \csname M@OT1\endcsname{9}}
1095 % \end{macrocode}
1096 % Imitating the |ISOmath| package we define also the macros
1097 % for selecting the bold italics math fonts (with results similar
1098 % to those obtained with package |bm|,without requiring
1099 % any math group), and sans serif in both normal and bold
1100 % slanted shape.
1101 % \begin{macrocode}
1102 \AtBeginDocument{%
1103 \providecommand\mathrmbf[1]{\MathLatin{#1}{lmr}[bx](n)}
1104 \providecommand\mathbfit[1]{\MathLatin{#1}{lmr}[bx](it)}
1105 \providecommand\mathsfit[1]{\MathLatin{#1}{lmss}[m](sl)}
1106 \providecommand\mathsfbfit[1]{\MathLatin{#1}{lmss}[bx](sl)}
1107 \providecommand\mathsfbf[1]{\MathLatin{#1}{lmss}[bx](n)}
1108 }
1109 % \end{macrocode}
1110 % Package |ISOmath| defines macros for typesetting vectors,
1111 % matrices and tensors; we do the same, but avoid the
1112 % abbreviation |sym| and replace it with |symbol|.
1113 % The strange test with the digit ‘9’ is a dirty trick (described in
1114 % the \TeX\-book) in order to discover if the symbol is a digit or a
1115 % letter; with digits the vector and tensor symbols should be upright,
1116 % while with letters they should be italic or slanted. The italic
1117 % correction |\/| contained by the font selection command is useful
1118 % in situations where the “text” produced by such command is followed
1119 % by a tall or raised object
1120 % \begin{macrocode}
1121 \AtBeginDocument{%
1122 \unless\ifdefined\vectorsymbol
1123 \NewDocumentCommand\vectorsymbol{s m}{%
1124 \ifnum 9<1#2\relax
1125 \mathrmbf{#2}%
1126 \else
1127 \IfBooleanTF{#1}{\!}{}\mathbfit{#2\/}%
1128 \fi}%
1129 \fi
1130 \unless\ifdefined\matrixsymbol\let\matrixsymbol\vectorsymbol\fi
1131 \unless\ifdefined\tensorsymbol
1132 \NewDocumentCommand\tensorsymbol{s m}{%
1133 \ifnum 9<1#2\relax
1134 \mathsfbf{#2}%
1135 \else
1136 \IfBooleanT{#1}{\!}\mathsfbfit{#2\/}%
1137 \fi}%
1138 \fi
1139 }
1140 % \end{macrocode}
1141 %
1142 % As shown in the previous various examples, such macros work pretty
1143 % well, but in some circumstances they require human help; when the
1144 % symbol is parenthesised, for example when it is the argument of a
1145 % function, or when it is at the beginning of a math sub\,expression,
1146 % either it is not centred between the parentheses, or it has
1147 % extra blank space at its left; this happens only if the vector or
1148 % tensor symbol is a letter, while if it is a digit such extra space
1149 % does not appear; such considerations hold true also for the
1150 % |\matrixsymbol| command.
1151 % Therefore a negative math kerning is required at the left of the
1152 % literal symbol. For this purpose such commands have the variant with
1153 % asterisk, therefore their syntax have these two similar forms:
1154 %\begin{flushleft}\obeylines
1155 %|\vectorsymbol|\marg{symbol}
1156 %|\vectorsymbol*|\marg{symbol}
1157 %|\tensorsymbol|\marg{symbol}
1158 %|\tensorsymbol*|\marg{symbol}
1159 %\end{flushleft}
1160 % where the asterisk can be used by the author in order to eliminate
1161 % spurious left blanc spaces; if the symbol is numeric, the asterisk
1162 % presence is ignored: see the following examples:
1163 %\begin{quote}
1164 %Vector $\vectorsymbol{T}$ is null: $\vectorsymbol{T}=\vectorsymbol{0}$\\
1165 %Vector $\vectorsymbol*{T}$ is null: $\vectorsymbol*{T}=\vectorsymbol*{0}$\\
1166 %Tensor $\tensorsymbol{T}$ is null: $\tensorsymbol{T}=\tensorsymbol{0}$\\
1167 %Tensor $\tensorsymbol*{T}$ is null: $\tensorsymbol*{T}=\tensorsymbol{0}$
1168 %\end{quote}
1169 %They are typeset with the following code:
1170 %\begin{verbatim}
1171 %Vector $\vectorsymbol{T}$ is null: $\vectorsymbol{T}=\vectorsymbol{0}$\\
1172 %Vector $\vectorsymbol*{T}$ is null: $\vectorsymbol*{T}=\vectorsymbol*{0}$\\
1173 %Tensor $\tensorsymbol{T}$ is null: $\tensorsymbol{T}=\tensorsymbol{0}$\\
1174 %Tensor $\tensorsymbol*{T}$ is null: $\tensorsymbol*{T}=\tensorsymbol{0}$
1175 %\end{verbatim}
1176 %
1177 %
1178 % We now define the macros required to set some elements with the
1179 % proper fonts; the idea is the same as that for vectors,
1180 % matrices and tensors, except that these macros produce
1181 % directly the desired symbol without using arguments, if
1182 % possible.
1183 %
1184 % The imaginary unit is subject to the state of the |engineer|
1185 % switch, set with the proper option on calling the package.
1186 % If such option has been specified in calling this package,
1187 % the |\iu| command is let to |\junit|, otherwise it's let
1188 % to |\iunit|. In spite of this option-driven aliases, both
1189 % commands |\iunit| and |\junit| are still available to the
1190 % user.
1191 %
1192 % The Napier number ‘e’ is defined in roman type, but as an
1193 % operator; this number is not an operator in the mathematical
1194 % sense, but it is most often used as the base of an exponential;
1195 % therefore such math “atom” must be treated as an
1196 % operator as well as when the official operator macro |\exp|
1197 % is used.
1198 %
1199 % The transcendental number $\ISOpi$, different from the plane
1200 % angle $\pi$, is defined so as to be typeset in upright
1201 % style; similar definitions may be used for other numerical
1202 % constants; we define just |\uppi| because we think it is the
1203 % most used symbol in any kind of mathematics. The
1204 % $\ISOpi{lmss}(n)$ Greek letter in upright sans serif font
1205 % may indicate the subatomic particle “pion” so that a
1206 % similar macro, say, |\pion| may be given a suitable definition.
1207 %
1208 % The differential symbol is not an operator, but it requires
1209 % a special treatment; a macro |\diff| for the differential
1210 % symbol uses an empty ‘operator’ and a negative shift to typeset
1211 % an upright letter ‘d’ with an operator spacing on its left,
1212 % so that proper spacing is used in math typesetting; notice
1213 % that the given definition does not perform as the direct
1214 % use of a thin math space before the upright ‘d’, because
1215 % spacing between math atoms depends on their category, while
1216 % the thin space |\,| is absolute and does not change depending
1217 % on the preceding math atom.
1218 %
1219 % The ISO regulations require that any letter-like symbol that
1220 % does not refer to a measurable quantity be set in upright shape;
1221 % we already applied the regulation to the regular differential
1222 % symbol, that may appear in both the derivative fractions and
1223 % in the differential integrators. With partial derivatives the
1224 % default symbol is slanted since the very beginning of \TeX, when the
1225 % OMS Computer Modern Symbol font was defined; according to the
1226 % ISO regulations such symbol should be upright. For use with
1227 % \pdfLaTeX the only font distributed with any \TeX system that
1228 % contains such an upright symbol is the LibertinusT1math one;
1229 % all other OMS encoded fonts available today do not contain it.
1230 % The defined command |\uppartial| name is identical to the one used
1231 % by the LibertinusT1math font; therefore it is easy to check if
1232 % this symbol has already been defined.
1233 %
1234 % On \texttt{tex.stachexchange.com} some questions were asked on
1235 % how to produce a suitable upright partial differential symbol,
1236 % when fonts did not have one available. The solutions we found
1237 % in that site were of different kinds: some were based on rotating and
1238 % scaling the available slanted sign, while others used a shearing
1239 % affine transformation of the available partial differential
1240 % symbol. We follow a similar approach, but we avoid to redefine
1241 % this symbol if it is already available. The used commands
1242 % \cs{pdfsave}, \cs{pdfrestore}, and \cs{pdfsetmatrix} are little
1243 % known internal commands of the |pdftex| interpreter\footnote{See
1244 % the documentation with \texttt{texdoc pdftex-a} at §8.20}; they are
1245 % sort of intermediate between \TeX\ and the PDF internals; they
1246 % are used to form something similar to a group, within which some
1247 % PDF settings are locally modified; in this case an affine
1248 % shearing transformation is defined by means of a matrix (apparently
1249 % made up of one row and four columns, but in reality it represents
1250 % the alignment of the rows of a $2\times2$ matrix) that can do
1251 % many things in a way that is more comfortable for the programmer
1252 % compared to writing the actual PDF language~code.
1253 %
1254 % The default \meta{shearing coefficient} is fixed to 0.25, but it may
1255 % be changed by means of an optional argument; see below. Of course this
1256 % solution is a patch; we tested it at several sizes but only
1257 % with the Latin Modern Type~1 fonts. May be with other fonts
1258 % the results might need some adjustments. We also fixed some
1259 % kerning adjustments so that the normal math spacings take place.
1260 % The whole syntax is the following
1261 %\begin{flushleft}
1262 %\cs{uppartial}\oarg{shearing coefficient}
1263 %\end{flushleft}
1264 %
1265 % The command |\unit| for appending the units of measure to
1266 % the numerical value of the measure is added if no packages
1267 % have already defined it; package |siunitx| is a particularly
1268 % recommended one, but its units and prefixes expressed by means
1269 % of Greek letters must be used only within its |\si| and |\SI|
1270 % commands. Similar considerations hold true for the
1271 % |\ap| and |\ped| (apex and pedex, respectively; i.e\
1272 % superscript and subscript); therefore such command definitions
1273 % are deferred to the start of the document so as to be sure
1274 % to avoid damaging other package settings. All these commands
1275 % may be used in both text and math modes; therefore a robust
1276 % macro |\textormath| is (re)defined even if often such command
1277 % is already available; the |\DeclareRobustCommand| unconditionally
1278 % declares and redeclares robust commands even if they are
1279 % already defined; possibly an information line is written in
1280 % the |.log| file in case a redefinition takes palace. These
1281 % commands typeset their arguments in upright math fonts, but
1282 % with the current font in text mode.
1283 %
1284 % The |\ohm| and |\micro| macros produce their symbols in
1285 % upright style while in math mode, and with the current
1286 % font and shape in text mode.
1287 %
1288 % \begin{macrocode}
1289 \newcommand\iunit{\MathLatin{i}(n)}
1290 \newcommand\junit{\MathLatin{j}(n)}
1291 \ifengineer
1292 \let\iu\junit
1293 \else
1294 \let\iu\iunit
1295 \fi
1296 % i
1297 \let\eu\undefined
1298 \DeclareMathOperator\eu{\MathLatin{e}(n)}
1299 \providecommand\uppi{}
1300 \renewcommand\uppi{\ISOpi(n)}
1301 %
1302 \providecommand*\diff{}
1303 \renewcommand*\diff{\ensuremath{\mathop{}\!\MathLatin{d}(n)}}
1304 %
1305 \newbox{\PMpartialbox}
1306 \AtBeginDocument{%
1307 \unless\ifdefined\uppartial%
1308 \NewDocumentCommand\uppartial{O{0.25}}{\bgroup%
1309 \setbox\PMpartialbox\hbox{%
1310 $\mkern1mu\partial$}\hspace{1.3\wd\PMpartialbox}%
1311 \pdfsave\pdfsetmatrix{1 0 -#1 1}\llap{\box\PMpartialbox}\pdfrestore
1312 \mkern-1.5mu\egroup}
1313 \fi}
1314 %
1315 \providecommand*\micro{}
1316 \AtBeginDocument{\@ifpackageloaded{textcomp}%
1317 {\renewcommand*\micro{\textormath{\textmu}{\ISOmu(rs)}}}%
1318 {\renewcommand*\micro{\ISOmu(rs)}}%
1319 }
1320 %
1321 \providecommand*\ohm{}\def\ISOohm{\ISOOmega(n)}
1322 \AtBeginDocument{%
1323 \@ifpackageloaded{siunitx}{\let\ohm\ISOohm}{\let\ohm\ISOohm}%
1324 }%
1325
1326 %
1327 \global\csletcs{bbl@it@ped}{undefined}
1328 \global\csletcs{bbl@it@ap}{undefined}
1329 %
1330 \DeclareRobustCommand\textormath{%
1331 \unless\ifmmode\expandafter\@firstoftwo
1332 \else\expandafter\@secondoftwo\fi}
1333 %
1334 \AfterEndPreamble{\let\ped\undefined\let\ap\undefined
1335 \DeclareRobustCommand*\ped[1]{%
1336 \textormath{\textsubscript{#1}}{_{\mathrm{#1}}}}%
1337 %
1338 \DeclareRobustCommand\ap[1]{%
1339 \textormath{\textsuperscript{#1}}{^{\mathrm{#1}}}}%
1340 %
1341 \unless\ifcsname unit\endcsname
1342 \DeclareRobustCommand{\unit}[1]{\,\textormath{#1}{\mathrm{#1}}}
1343 \fi}
1344
1345 \endinput
1346 % \end{macrocode}
1347 %^^A This is the end
1348 %\begin{center}
1349 %\LARGE HAPPY \TeX{}ing\,!
1350 %\end{center}
1351 %\iffalse
1352 %</style>
1353 %\fi
1354 %\iffalse
1355 %<*txt>
1356 %\fi
1357 ^^A% \begin{macrocode}
1358 ^^A
1359 ^^A This bundle has the LPPL maintenance status "author-maintained".
1360 ^^A
1361 ^^A The list of all files belonging to the PM-ISOmath bundle is
1362 ^^A pm-isomath.dtx, a README.txt file
1363 ^^A with the derived files: pm-isomath.sty, pm-isomath.pdf.
1364 ^^A
1365 ^^A The set of derived (unpacked) files belonging to the distribution
1366 ^^A and covered by LPPL is created by the self unpacking file
1367 ^^A pm-isomath.dtx which is the principal part of the distribution.
1368 ^^A
1369 ^^A In the TDS composed of various branches they should be in the
1370 ^^A following folders:
1371 ^^A .../tex/latex/pm-isomath/ contains pm-isomath.sty
1372 ^^A .../doc/latex/pm-isomath/ contains pm-isomath.pdf and README.txt
1373 ^^A .../source/latex/pm-isomath contians pm-isomath.dtx
1374 ^^A% \end{macrocode}
1375 %\iffalse
1376 %</txt>
1377 %\fi
1378
1379 %\Finale
1380 % \endinput