summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pm-isomath/pm-isomath.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-05-02 03:03:15 +0000
committerNorbert Preining <norbert@preining.info>2021-05-02 03:03:15 +0000
commitdb2a2e7b5c4ca1335618a0b5f5c574229bf459f6 (patch)
treed0f4c73e3a871ce1ff86e9e94ac3bcca055bf6e5 /macros/latex/contrib/pm-isomath/pm-isomath.dtx
parent33ca54806c387d16002fc16e31418d3a28c2dd63 (diff)
CTAN sync 202105020303
Diffstat (limited to 'macros/latex/contrib/pm-isomath/pm-isomath.dtx')
-rw-r--r--macros/latex/contrib/pm-isomath/pm-isomath.dtx107
1 files changed, 92 insertions, 15 deletions
diff --git a/macros/latex/contrib/pm-isomath/pm-isomath.dtx b/macros/latex/contrib/pm-isomath/pm-isomath.dtx
index 106ca10d1d..dba0560e67 100644
--- a/macros/latex/contrib/pm-isomath/pm-isomath.dtx
+++ b/macros/latex/contrib/pm-isomath/pm-isomath.dtx
@@ -57,7 +57,7 @@ This work consists of this file pm-isomath.dtx, a README.txt file
%<style>\ProvidesPackage{pm-isomath}[%
%<txt>\ProvidesFile{README.txt}[%
%<*driver,style,txt>
- 2020/11/06 v.1.0.07
+ 2021/05/01 v.1.1.00
%<txt> README file for pm-isomath.sty]
%<style>Poor man package for typesetting ISO compliant math when using pdfLaTeX]
%</driver,style,txt>
@@ -103,7 +103,7 @@ This work consists of this file pm-isomath.dtx, a README.txt file
%</driver>
% \fi
%
-% \CheckSum{436}%
+% \CheckSum{459}%
% \begin{abstract}
% The ISO regulations for typesetting math in the field of physics
% and technology are pretty stringent and imply legal questions
@@ -651,6 +651,30 @@ This work consists of this file pm-isomath.dtx, a README.txt file
%\end{tabular}\end{lrbox}
%\noindent\resizebox{\textwidth}{!}{\usebox{0}}\egroup
%
+% \subparagraph{ISO upright partial differential}
+% Among the fonts used to typeset math when using \prog{pdflatex},
+% only the LibertinusT1math font contains the upright partial
+% differential symbol that conforms the ISO regulations. All other
+% fonts at the moment available to typeset mathematics do not
+% contain an upright symbol, but they contain the original slanted
+% symbol as used with the CM fonts. With a poor-man trick it is
+% possible ti have available an upright symbol so as to describe
+% the Electrical field as the opposite of the electric potential
+% gradient. Compare the following formulas, where the second one
+% is ISO compliant:
+%\begin{align}
+%E =-\nabla V = -\left(
+%\frac{\partial V}{\partial x}\MathLatin{e}[b](it)_x +
+%\frac{\partial V}{\partial y}\MathLatin{e}[b](it)_y +
+%\frac{\partial V}{\partial z}\MathLatin{e}[b](it)_z +
+%\right)\\[\baselineskip]
+%E =-\nabla V = -\left(
+%\frac{\uppartial V}{\uppartial x}\MathLatin{e}[b](it)_x +
+%\frac{\uppartial V}{\uppartial y}\MathLatin{e}[b](it)_y +
+%\frac{\uppartial V}{\uppartial z}\MathLatin{e}[b](it)_z +
+%\right)\\[\baselineskip]
+%\end{align}
+%
%\section{Final remarks}
% This package |pm-isomath| is far from perfect, and its results are
% questionable; of course poor man solutions are just patches;
@@ -665,6 +689,7 @@ This work consists of this file pm-isomath.dtx, a README.txt file
% by Günter Milde, but tackles the problem of insufficient maximum
% number of math font groups so as to avoid any problem with such
% group limitation, and therefore all the caveats in Milde's package.
+%
% That package is much more comfortable to use than this one; but
% it is subject to a number of conditions that, depending on the
% user environment, may even result in a complete failure. This
@@ -694,18 +719,18 @@ This work consists of this file pm-isomath.dtx, a README.txt file
%\iffalse
%<*style>
%\fi
-% \begin{macrocode}
% Then we verify if the document is being typeset with \pdfLaTeX;
% if it is not, an error flag is raised and reading of this
% package is immediately interrupted. For this purpose we need
% an engine-detecting package, and we generally use the |iftex| one.
+% \begin{macrocode}
\@ifpackageloaded{iftex}{}{\RequirePackage{iftex}}
\unless\ifPDFTeX
\PackageError{pm-isomath}{%
******************************************\MessageBreak
This package should be used only when \MessageBreak
typesetting with pdfLaTeX. \MessageBreak
- Skipping loading the package \MessageBreak
+ Loading this package is skipped \MessageBreak
******************************************\MessageBreak
}{%
******************************************\MessageBreak
@@ -728,12 +753,13 @@ This work consists of this file pm-isomath.dtx, a README.txt file
% option is for deciding if the imaginary unit should be
% defined as ‘i’ or ‘j’. As we have remarked in the previous
% documentation, engineers, especially those who deal with
-% electricity and electrical quantities, but also electronics, control
+% electricity and electrical quantities, but also electronics, control,
% and telecommunications engineers, use ‘j’; all these
% varieties of engineers could not do anything in their profession
% if they don't use complex numbers and quantities (the latter
% called phasors). Possibly they are the applied scientists
-% who use complex numbers more than any other scientist.
+% who use complex numbers more often than any other scientist.
+%
% Note: this option has \emph{not} been used to prepare this
% very document.
% \begin{macrocode}
@@ -741,11 +767,25 @@ This work consists of this file pm-isomath.dtx, a README.txt file
\DeclareOption{engineer}{\engineertrue}
\ProcessOptions*\relax
% \end{macrocode}
-% Are the necessary packages already loaded?
+% Are the necessary packages already loaded? Notice that in previous
+% versions we just loaded |xparse| unless it was already loaded;
+% since 2020 the main functionalities of this package are already
+% contained into the \LaTeX\ kernel, But we are going to use one
+% of those “deprecated” functionalities that did not make their way
+% to the \LaTeX\ kernel. We also use the |xfp| floating point
+% computations available with the \LaTeX3 language.
% \begin{macrocode}
\@ifpackageloaded{amsmath}{}{\RequirePackage{amsmath}}
\@ifpackageloaded{etoolbox}{}{\RequirePackage{etoolbox}}
-\@ifpackageloaded{xparse}{}{\RequirePackage{xparse}}
+\RequirePackage{xparse,xfp}
+% \end{macrocode}
+%
+% Since a trick on the ISO compliant upright partial differential
+% symbol requires the functionalities of the |rotate| and |scale|
+% functionalities, we load also the |graphicx| package if it has not
+% been already loaded.
+% \begin{macrocode}
+\@ifpackageloaded{graphicx}{}{\RequirePackage{graphicx}}
% \end{macrocode}
% Now we have almost all software instruments available. We
% define a macro to switch the definitions of certain math
@@ -860,7 +900,7 @@ This work consists of this file pm-isomath.dtx, a README.txt file
% commands are constructed in such a way as to have a default
% family, series and shape common to both Latin and Greek fonts;
% therefore with three optional arguments that the user can
-% specify with different delimiters but respecting their order,
+% specify with different delimiters, but respecting their order,
% the user can get eight different choice combinations that
% allow the selection of a large number of different looks.
%
@@ -869,9 +909,9 @@ This work consists of this file pm-isomath.dtx, a README.txt file
% mostly differ in the encoding choice for Latin or Greek letters.
%
% The user macros are defined by means of the defining commands
-% provided by the |xparse| package, while the service macros use
-% normal \LaTeX\ commands. The user commands follow this special
-% syntax:
+% provided by the |xparse| package functionalities, while the service
+% macros use normal \LaTeX\ commands. The user commands follow this
+% special syntax:
%\begin{ttsintassi}
%\cs{MathLatin}\marg{Latin letter}\marg{family}\oarg{series}\parg{shape}
%\cs{MathGreek}\marg{Greek letter}\marg{family}\oarg{series}\parg{shape}
@@ -968,9 +1008,9 @@ This work consists of this file pm-isomath.dtx, a README.txt file
\csname M@OT1\endcsname{9}}
% \end{macrocode}
% Imitating the |ISOmath| package we define also the macros
-% for selecting the bold italics (produces results similar
-% to those obtained with package |bm|, but it does not require
-% any math group), and sans serif in both normal and bold
+% for selecting the bold italics math fonts (with results similar
+% to those obtained with package |bm|,without requiring
+% any math group), and sans serif in both normal and bold
% slanted shape.
% \begin{macrocode}
\AtBeginDocument{%
@@ -1030,6 +1070,34 @@ This work consists of this file pm-isomath.dtx, a README.txt file
% the thin space |\,| is absolute and does not change depending
% on the preceding math atom.
%
+% The ISO regulations require that any letter-like symbol that
+% does not refer to a measurable quantity be set in upright shape;
+% we already applied the regulation to the regular differential
+% symbol, that may appear in both the derivative fractions and
+% in the differential integrators. With partial derivatives the
+% default symbol is slanted since the very beginning of \TeX, when the
+% OMS Computer Modern Symbol font was defined; according to the
+% ISO regulations such symbol should be upright. For use with
+% \pdfLaTeX the only font distributed with any \TeX system that
+% contains such an upright symbol is the LibertinusT1math one;
+% all other OMS encoded fonts do no contain it. The defined
+% command |\uppartial| name is identical to the one used by the
+% LibertinusT1math font; therefore it is easy to check if this
+% symbol has already been defined
+%
+% On \texttt{tex.stachexchange.com} some questions were asked on
+% how to produce a suitable upright partial differential symbol,
+% when fonts did not have one available. The solutions we found
+% there are based on rotating and scaling the available slanted
+% partial differential symbol. We follow a similar approach,
+% although a shearing process would be a better solution;
+% we avoid to redefine this symbol if it is already available.
+% The default counterclockwise rotation is fixed to 22°, but may
+% be changed by means of an optional argument. Of course this
+% solution is a patch; we tested it at several sizes but only
+% with the Latin Modern Type~1 fonts. May be with other fonts
+% the results might need some adjustments.
+%
% The command |\unit| for appending the units of measure to
% the numerical value of the measure is added if no packages
% have already defined it; package |siunitx| is a particularly
@@ -1068,6 +1136,15 @@ This work consists of this file pm-isomath.dtx, a README.txt file
\providecommand*\diff{}
\renewcommand*\diff{\ensuremath{\mathop{}\!\MathLatin{d}(n)}}
%
+\newbox{\PMpartial}
+\AtBeginDocument{%
+\@ifdefinable{\uppartial}%
+ {\NewDocumentCommand\uppartial{O{22}}{\setbox\PMpartial\hbox{$\partial$}%
+ \setbox\PMpartial=\hbox{%
+ \scalebox{1}[\fpeval{cosd #1}]{\rotatebox[origin=br]{#1}{\box\PMpartial}}%
+ }\raisebox{0.35ex}{\box\PMpartial}\mkern-1.25mu}}%
+}
+%
\providecommand*\micro{}
\AtBeginDocument{\@ifpackageloaded{textcomp}%
{\renewcommand*\micro{\textormath{\textmu}{\ISOmu(rs)}}}%