summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-10-28 20:05:30 +0000
committerKarl Berry <karl@freefriends.org>2023-10-28 20:05:30 +0000
commit60531ec8166dd3925fe4be5535c4225f86306969 (patch)
treed61edd0e82d1bfc570126540e98386df16781ef5 /Master/texmf-dist/tex
parentd93e3df00e981575874688e8dca296579c9d5acb (diff)
calcfrac (28oct23)
git-svn-id: svn://tug.org/texlive/trunk@68684 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/generic/calcfrac/calcfrac.sty23
-rw-r--r--Master/texmf-dist/tex/generic/calcfrac/calcfrac.tex44
2 files changed, 49 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/generic/calcfrac/calcfrac.sty b/Master/texmf-dist/tex/generic/calcfrac/calcfrac.sty
index 09512151974..38baea8ba8a 100644
--- a/Master/texmf-dist/tex/generic/calcfrac/calcfrac.sty
+++ b/Master/texmf-dist/tex/generic/calcfrac/calcfrac.sty
@@ -1,13 +1,28 @@
+% ____________________________________
+
+% calcfrac
+% v0.2
+% 28/10/2023
+
+% TeX & LaTeX package
+% ____________________________________
+
+% Author : TeXpérimental
+% Email : texperimental@mailo.fr
+% Licence : Released under the LaTeX Project Public License v1.3c or
+% later, see http://www.latex-project.org/lppl.txt
+% Status : maintained
+
\input calcfrac.tex
-\ProvidesPackage{\calcfracname}[\calcfracver\space Calcul d'expressions avec fractions]
+\ProvidesPackage{\calcfracname}[\calcfracdate\space\calcfracver\space Calcul d'expressions avec fractions]
\def\cfdisp#1#2#3{%
\ensuremath
- {\ifnum#11=-1 -\fi
- {\ifnum#3=1
+ {%
+ \ifnum#11=-1 -\fi
+ \ifnum#3=1
#2%
\else
\frac{#2}{#3}%
\fi
}%
- }%
} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/calcfrac/calcfrac.tex b/Master/texmf-dist/tex/generic/calcfrac/calcfrac.tex
index 7d46762f95e..c2c64f225a8 100644
--- a/Master/texmf-dist/tex/generic/calcfrac/calcfrac.tex
+++ b/Master/texmf-dist/tex/generic/calcfrac/calcfrac.tex
@@ -1,8 +1,8 @@
% ____________________________________
% calcfrac
-% v0.1
-% 26/10/2023
+% v0.2
+% 28/10/2023
% TeX & LaTeX package
% ____________________________________
@@ -16,8 +16,8 @@
\csname calcfraconce\endcsname
\let\calcfraconce\endinput
\def\calcfracname{calcfrac}
-\def\calcfracver{0.1}
-\def\calcfracdate{2023/10/26}
+\def\calcfracver{v0.2}
+\def\calcfracdate{2023/10/28}
\catcode`\@11
\def\cf@test@ifx#1{%
@@ -54,22 +54,33 @@
\newcount\cf@tmp@count
\newcount\cf@frac@cnt
\newif\if@inparen
-\def\calcfrac@err#1#2\relax{%
+\def\calcfrac@err{%
+ \cf@test@ifnum{\currentgrouplevel>\cf@nestparen\relax}
+ {%
+ \endgroup
+ \calcfrac@err
+ }
+ {%
+ \calcfrac@err@a
+ }%
+}
+\def\calcfrac@err@a#1#2\relax{%
\errmessage{Illegal char "#1", "#2" ignored}%
}
\def\calcfrac{%
+ \xdef\cf@nestparen{\the\currentgrouplevel}%
\begingroup
\catcode32=9 % espaces ignorés
\calcfrac@a
}
\def\calcfrac@a#1{%
- \endgroup
- \ifcat\relax\detokenize{#1}\relax
- \else
+ \ifcat\relax\detokenize{#1}\relax\expandafter\cf@execfirst\else\expandafter\cf@execsecond\fi
+ {}
+ {%
\cf@frac@cnt=0
\@inparenfalse
\expandafter\cf@read@frac\detokenize{#1}\relax
- \fi
+ }%
}
\def\cf@read@frac{% [1 signe optionnel + ou-]<entier non signé>[1 signe / ou * suivi d'un entier non signé]*n
\advance\cf@frac@cnt1
@@ -95,7 +106,7 @@
\afterassignment\cf@update@afterint
\cf@tmp@count#1%
}
- {% TODO : si #1=parenthèse
+ {% si #1=parenthèse
\if(#1\expandafter\cf@execfirst\else\expandafter\cf@execsecond\fi
{%
\begingroup
@@ -223,13 +234,13 @@
\expandafter\cf@read@int\expanded{\cf@paren@numer\if*\cf@current@op/\else*\fi\cf@paren@denom}%
}
{%
+ \expandafter
+ \endgroup
\expandafter\cfdisp\expanded{{\cf@result@sign}{\cf@result@numer}{\cf@result@denom}}%
}%
}
\def\cfdisp#1#2#3{%
- \ifmmode\expandafter\cf@execfirst\else\expandafter\cf@execsecond\fi
- {\cf@execarg}
- {\cf@matharg}
+ \ifmmode\expandafter\cf@execarg\else\expandafter\cf@matharg\fi
{\ifnum#11=-1 -\fi
{\ifnum#3=1
#2%
@@ -243,4 +254,9 @@
\endinput
VERSIONS :
-v0.1 : version initiale \ No newline at end of file
+v0.1 26/10/2023
+ version initiale
+v0.2 28/10/2023
+ corrections de bugs
+ améliorations du code
+ ajout d'un fichier pdf (manuel succint + exemples) \ No newline at end of file