summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-01-07 21:26:34 +0000
committerKarl Berry <karl@freefriends.org>2024-01-07 21:26:34 +0000
commit5eb5c2bd75077417694f9ca3e361d48456d5aec5 (patch)
treeba68a6b3e3d763b2e65e6aff70b6f406ece6b0e6 /Master/texmf-dist/tex/latex
parentde3f4265bc7c8c0a53616804c4d9e03dc39a0b47 (diff)
isphysicalmath (6jan24)
git-svn-id: svn://tug.org/texlive/trunk@69334 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/isphysicalmath/isphysicalmath.sty168
1 files changed, 150 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/latex/isphysicalmath/isphysicalmath.sty b/Master/texmf-dist/tex/latex/isphysicalmath/isphysicalmath.sty
index 8de492a4f9d..c16db962b60 100644
--- a/Master/texmf-dist/tex/latex/isphysicalmath/isphysicalmath.sty
+++ b/Master/texmf-dist/tex/latex/isphysicalmath/isphysicalmath.sty
@@ -8,7 +8,7 @@
%%
%% This is a generated file.
%%
-%% Copyright (C) 2023 by Mario Fantini <marfant7@gmail.com>
+%% Copyright (C) 2024 by Mario Fantini <marfant7@gmail.com>
%%
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3 of this license
@@ -22,30 +22,155 @@
%%
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{isphysicalmath}
-[2023/09/18 v1.0.0 .dtx isphysicalmath file]
-% option [dc]: changes dots in commas.
+[2024/01/03 v1.1.0 .dtx isphysicalmath file]
+\RequirePackage{xstring}
+%
+% Notation section:
+% option [dc]: changes dots in commas (\ispmc), or commas in dots (\ispmrc).
\DeclareOption{dc}{
-\def\ispmdc#1.#2{{#1,#2}}
+\def\ispmc#1.#2{{#1,#2}}
+\def\ispmrc#1,#2{{#1.#2}}
}
-% option [comma]: scientific international notation for thousands.
+%
+% option [comma]: scientific international notation for thousands and their multiples.
\DeclareOption{comma}{
- \def\ispmnovem#1#2#3#4#5#6#7#8#9{#1#2#3,#4#5#6,#7#8#9}
- \def\ispmocto#1#2#3#4#5#6#7#8{#1#2,#3#4#5,#6#7#8}
- \def\ispmseptem#1#2#3#4#5#6#7{#1,#2#3#4,#5#6#7}
- \def\ispmsex#1#2#3#4#5#6{#1#2#3,#4#5#6}
- \def\ispmquinque#1#2#3#4#5{#1#2,#3#4#5}
- \def\ispmquattuor#1#2#3#4{#1,#2#3#4}
+\def\ispmc#1{%
+\StrLen{#1}[\temp]%
+\ifnum\temp=4%
+\StrChar{#1}{1}[\unoq]%
+\StrChar{#1}{2}[\dueq]%
+\StrChar{#1}{3}[\treq]%
+\StrChar{#1}{4}[\quattroq]%
+\unoq,\dueq\treq\quattroq%
+\fi%
+\ifnum\temp=5%
+\StrChar{#1}{1}[\unoq]%
+\StrChar{#1}{2}[\dueq]%
+\StrChar{#1}{3}[\treq]%
+\StrChar{#1}{4}[\quattroq]%
+\StrChar{#1}{5}[\cinqueq]%
+\unoq\dueq,\treq\quattroq\cinqueq%
+\fi%
+\ifnum\temp=6%
+\StrChar{#1}{1}[\unoq]%
+\StrChar{#1}{2}[\dueq]%
+\StrChar{#1}{3}[\treq]%
+\StrChar{#1}{4}[\quattroq]%
+\StrChar{#1}{5}[\cinqueq]%
+\StrChar{#1}{6}[\seiq]%
+\unoq\dueq\treq,\quattroq\cinqueq\seiq%
+\fi%
+\ifnum\temp=7%
+\StrChar{#1}{1}[\unoq]%
+\StrChar{#1}{2}[\dueq]%
+\StrChar{#1}{3}[\treq]%
+\StrChar{#1}{4}[\quattroq]%
+\StrChar{#1}{5}[\cinqueq]%
+\StrChar{#1}{6}[\seiq]%
+\StrChar{#1}{7}[\setteq]%
+\unoq,\dueq\treq\quattroq,\cinqueq\seiq\setteq%
+\fi%
+\ifnum\temp=8%
+\StrChar{#1}{1}[\unoq]%
+\StrChar{#1}{2}[\dueq]%
+\StrChar{#1}{3}[\treq]%
+\StrChar{#1}{4}[\quattroq]%
+\StrChar{#1}{5}[\cinqueq]%
+\StrChar{#1}{6}[\seiq]%
+\StrChar{#1}{7}[\setteq]%
+\StrChar{#1}{8}[\ottoq]%
+\unoq\dueq,\treq\quattroq\cinqueq,\seiq\setteq\ottoq%
+\fi%
+\ifnum\temp=9%
+\StrChar{#1}{1}[\unoq]%
+\StrChar{#1}{2}[\dueq]%
+\StrChar{#1}{3}[\treq]%
+\StrChar{#1}{4}[\quattroq]%
+\StrChar{#1}{5}[\cinqueq]%
+\StrChar{#1}{6}[\seiq]%
+\StrChar{#1}{7}[\setteq]%
+\StrChar{#1}{8}[\ottoq]%
+\StrChar{#1}{9}[\noveq]%
+\unoq\dueq\treq,\quattroq\cinqueq\seiq,\setteq\ottoq\noveq%
+\fi%
+}
}
\ExecuteOptions{dc}
\ExecuteOptions{comma}
\ProcessOptions\relax
-% space between value and measurement unit
-\newcommand{\ispms}{\hspace{0.5mm}}
+%
+% command \ispmcomma: scientific international notation for thousands and their multiples.
+\newcommand{\ispmcomma}[1]{%
+\StrLen{#1}[\temp]%
+\ifnum\temp=4%
+\StrChar{#1}{1}[\unoq]%
+\StrChar{#1}{2}[\dueq]%
+\StrChar{#1}{3}[\treq]%
+\StrChar{#1}{4}[\quattroq]%
+\unoq,\dueq\treq\quattroq%
+\fi%
+\ifnum\temp=5%
+\StrChar{#1}{1}[\unoq]%
+\StrChar{#1}{2}[\dueq]%
+\StrChar{#1}{3}[\treq]%
+\StrChar{#1}{4}[\quattroq]%
+\StrChar{#1}{5}[\cinqueq]%
+\unoq\dueq,\treq\quattroq\cinqueq%
+\fi%
+\ifnum\temp=6%
+\StrChar{#1}{1}[\unoq]%
+\StrChar{#1}{2}[\dueq]%
+\StrChar{#1}{3}[\treq]%
+\StrChar{#1}{4}[\quattroq]%
+\StrChar{#1}{5}[\cinqueq]%
+\StrChar{#1}{6}[\seiq]%
+\unoq\dueq\treq,\quattroq\cinqueq\seiq%
+\fi%
+\ifnum\temp=7%
+\StrChar{#1}{1}[\unoq]%
+\StrChar{#1}{2}[\dueq]%
+\StrChar{#1}{3}[\treq]%
+\StrChar{#1}{4}[\quattroq]%
+\StrChar{#1}{5}[\cinqueq]%
+\StrChar{#1}{6}[\seiq]%
+\StrChar{#1}{7}[\setteq]%
+\unoq,\dueq\treq\quattroq,\cinqueq\seiq\setteq%
+\fi%
+\ifnum\temp=8%
+\StrChar{#1}{1}[\unoq]%
+\StrChar{#1}{2}[\dueq]%
+\StrChar{#1}{3}[\treq]%
+\StrChar{#1}{4}[\quattroq]%
+\StrChar{#1}{5}[\cinqueq]%
+\StrChar{#1}{6}[\seiq]%
+\StrChar{#1}{7}[\setteq]%
+\StrChar{#1}{8}[\ottoq]%
+\unoq\dueq,\treq\quattroq\cinqueq,\seiq\setteq\ottoq%
+\fi%
+\ifnum\temp=9%
+\StrChar{#1}{1}[\unoq]%
+\StrChar{#1}{2}[\dueq]%
+\StrChar{#1}{3}[\treq]%
+\StrChar{#1}{4}[\quattroq]%
+\StrChar{#1}{5}[\cinqueq]%
+\StrChar{#1}{6}[\seiq]%
+\StrChar{#1}{7}[\setteq]%
+\StrChar{#1}{8}[\ottoq]%
+\StrChar{#1}{9}[\noveq]%
+\unoq\dueq\treq,\quattroq\cinqueq\seiq,\setteq\ottoq\noveq%
+\fi%
+}
+%
+%
+% Formatting section:
+% a small space between value and measurement unit
+\newcommand{\ispms}{\,}
% normal text rendering for first measurement unit
\newcommand{\ispmntone}[1]{\textnormal{#1}}
-% jolly: the default setting is --- normal text rendering for a generic 'entity'.
+% jolly: the default setting consists in --- a $0.15\ispmone{mm}$ of space
+% and normal text rendering for a generic 'entity'.
% If you are a developer, you can modify it when and how you want.
-\newcommand{\ispm}[1]{\textnormal{#1}}
+\newcommand{\ispm}[1]{\hspace{0.15mm}\textnormal{#1}}
% normal text rendering for first and second measurement units
\newcommand{\ispmnttwo}[2]{\textnormal{#1}\textnormal{#2}}
% space between first and second measurement units
@@ -56,11 +181,18 @@
% \ispm if you have two measurement units
% e.g. $L = 20 \ispmtwo{N}{m}$
\newcommand{\ispmtwo}[2]{\ispms\ispmnttwo\ispmss{#1}\ispmnttwo\ispmss{#2}}
-% normal text rendering for third measurement unit
-\newcommand{\ispmntr}[1]{\textnormal{#1}}
% ispm if you have three measurement units
% e.g. $V = 8 \ispmtwo{m}{m}\ispmthird{m}$
-\newcommand{\ispmthird}[1]{\ispmss\ispmntr{#1}}
+\newcommand{\ispmthird}[1]{\ispmss\ispm{#1}}
+% and so on until ninth measurement unit
+\newcommand{\ispmfourth}[1]{\ispmss\ispm{#1}}
+\newcommand{\ispmfifth}[1]{\ispmss\ispm{#1}}
+\newcommand{\ispmsixth}[1]{\ispmss\ispm{#1}}
+\newcommand{\ispmseventh}[1]{\ispmss\ispm{#1}}
+\newcommand{\ispmeighth}[1]{\ispmss\ispm{#1}}
+\newcommand{\ispmninth}[1]{\ispmss\ispm{#1}}
+% If you don't want numerical order, you could use generic \ispmn command
+\newcommand{\ispmn}[1]{\ispmss\ispm{#1}}
\endinput
%%
%% End of file `isphysicalmath.sty'.