From cd2d035c39e23ef720cdd58ad3e377f7c60e9858 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 29 Feb 2024 03:02:00 +0000 Subject: CTAN sync 202402290301 --- macros/latex/contrib/didec/CHANGES.md | 27 + macros/latex/contrib/didec/README.md | 42 + macros/latex/contrib/didec/didec.doc.sty | 157 ++++ macros/latex/contrib/didec/didec.pdf | Bin 0 -> 495045 bytes macros/latex/contrib/didec/didec.sty | 1349 +++++++++++++++++++++++++++ macros/latex/contrib/didec/didec.tex | 1209 ++++++++++++++++++++++++ macros/latex/contrib/easybook/easybook.dtx | 10 +- macros/latex/contrib/easybook/easybook.pdf | Bin 604258 -> 604372 bytes macros/latex/contrib/easybook/easybook.tex | 8 +- macros/latex/contrib/mandi/mandi.dtx | 147 ++- macros/latex/contrib/mandi/mandi.ins | 4 +- macros/latex/contrib/mandi/mandi.pdf | Bin 514465 -> 516791 bytes macros/latex/contrib/mandi/mandiexp.dtx | 8 +- macros/latex/contrib/mandi/mandistudent.dtx | 14 +- 14 files changed, 2877 insertions(+), 98 deletions(-) create mode 100644 macros/latex/contrib/didec/CHANGES.md create mode 100644 macros/latex/contrib/didec/README.md create mode 100644 macros/latex/contrib/didec/didec.doc.sty create mode 100644 macros/latex/contrib/didec/didec.pdf create mode 100644 macros/latex/contrib/didec/didec.sty create mode 100644 macros/latex/contrib/didec/didec.tex (limited to 'macros/latex') diff --git a/macros/latex/contrib/didec/CHANGES.md b/macros/latex/contrib/didec/CHANGES.md new file mode 100644 index 0000000000..388a94cf06 --- /dev/null +++ b/macros/latex/contrib/didec/CHANGES.md @@ -0,0 +1,27 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on +[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to +[Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Added +### Changed +### Deprecated +### Removed +### Fixed +### Security + + + +## [1.0.0] - 2024-02-28 + +### Added +- Initial public release + + +## [-.-.-] +- Not public releases diff --git a/macros/latex/contrib/didec/README.md b/macros/latex/contrib/didec/README.md new file mode 100644 index 0000000000..d3027e39f5 --- /dev/null +++ b/macros/latex/contrib/didec/README.md @@ -0,0 +1,42 @@ +# The LaTeX package didec - version 1.0.0 (2024/02/28) + +> Copyright (c) 2024-2024 by Prof. Dr. Dr. Thomas F. Sturm + +> This work may be distributed and/or modified under the +> conditions of the LaTeX Project Public License, either version 1.3 +> of this license or (at your option) any later version. +> The latest version of this license is in +> http://www.latex-project.org/lppl.txt +> and version 1.3 or later is part of all distributions of LaTeX +> version 2005/12/01 or later. + +> This work has the LPPL maintenance status `author-maintained`. + +> This work consists of all files listed in README.md + + +The `didec` package supports fixed-point arithmetic with two +decimal places (di-decimal) which is typical for financial +transactions in many currencies. +The intended use case is (personal) bookkeeping. + + +## Contents of the package + +- `README.md` this file +- `CHANGES.md` log of changes (history) +- `didec.sty` LaTeX package file (style file) +- `didec.pdf` Documentation for didec +- `didec.tex` Source code of the documentation +- `didec.doc.sty` Source code of the documentation + + +## Installation + +Copy the contents of the `didec.tds.zip` from CTAN to your local TeX file tree. + +Alternatively, put the files to their respective locations within the TeX installation: + +- `didec.sty` -> /tex/latex/didec +- all other files -> /doc/latex/didec + diff --git a/macros/latex/contrib/didec/didec.doc.sty b/macros/latex/contrib/didec/didec.doc.sty new file mode 100644 index 0000000000..0e5944e43f --- /dev/null +++ b/macros/latex/contrib/didec/didec.doc.sty @@ -0,0 +1,157 @@ +% !TeX root = didec.tex +% !TeX encoding=UTF-8 +%% The LaTeX package didec - version 1.0.0 (2024/02/28) +%% didec.doc.sty: style file for the documentation +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2024-2024 by Prof. Dr. Dr. Thomas F. Sturm +%% ------------------------------------------------------------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `author-maintained'. +%% +%% This work consists of all files listed in README.md +%% +% include file (style) of didec.tex (manual of the LaTeX package didec) + +\def\version{1.0.0}% +\def\datum{2024/02/28}% + +\IfFileExists{didec.doc.cfg}{\input{didec.doc.cfg}}{} + +\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}} +\renewcommand*\l@subsubsection{\@dottedtocline{3}{4.2em}{3.2em}} + +\RequirePackage[T1]{fontenc} +\RequirePackage[english]{babel} +\RequirePackage{lmodern,parskip,array} +\RequirePackage[svgnames,table]{xcolor} +\RequirePackage{tikz} +\RequirePackage{varioref} +\RequirePackage[makeindex]{imakeidx} +\RequirePackage[bookmarks,raiselinks,pageanchor,hyperindex,colorlinks]{hyperref} +\RequirePackage{cleveref} +\RequirePackage{varwidth,incgraph} +\RequirePackage[official]{eurosym} + +\RequirePackage[a4paper,left=2.5cm,right=2.5cm,top=1.5cm,bottom=1.5cm, + marginparsep=3mm,marginparwidth=18mm, + headheight=0mm,headsep=0cm, + footskip=1.5cm,includeheadfoot%,showframe + ]{geometry} +\RequirePackage{fancyhdr} +\fancyhf{} +\fancyfoot[C]{\thepage}% +\renewcommand{\headrulewidth}{0pt} +\renewcommand{\footrulewidth}{0pt} +\pagestyle{fancy} +\tolerance=2000% +\setlength{\emergencystretch}{20pt}% + +\RequirePackage{array,tabularx,booktabs} +\RequirePackage{lipsum} +\RequirePackage[extendedchars,encoding,filenameencoding=utf-8]{grffile} +\RequirePackage{siunitx,xfp} + +\RequirePackage{tcolorbox} +\tcbuselibrary{skins,minted,breakable,documentation,raster} + +\ifdefined\didecpackageprefix + \RequirePackage{\didecpackageprefix didec} +\else + \RequirePackage{didec} +\fi + +\definecolor{Green_Dark}{rgb}{0.078431,0.407843,0.176471} +\definecolor{Blue_Dark}{rgb}{0.090196,0.211765,0.364706} +\definecolor{Blue_Bright}{rgb}{0.858824,0.898039,0.945098} + +\colorlet{Blue_Gray}{blue!50!gray} + +\tcbset{skin=enhanced, + doc head={colback=yellow!10!white,interior style=fill}, + doc head key={colback=magenta!5!white,interior style=fill}, + color key=DarkViolet, + color value=Teal, + color color=Teal, + color counter=Orange!85!black, + color length=Orange!85!black, + index colorize, + index annotate, + beforeafter example/.style={ + before skip=4pt plus 2pt minus 1pt, + after skip=8pt plus 4pt minus 2pt + }, + docexample/.style={bicolor, + beforeafter example, + arc=0.66mm, + boxrule=0.33mm, + fonttitle=\bfseries, + fontlower=\footnotesize, + colframe=Blue_Gray, + colback=Blue_Gray!5!white, + colbacklower=white, + drop small lifted shadow, + listing engine=minted, + documentation minted options={tabsize=2,fontsize=\small,breaklines,autogobble}, + documentation minted style=colorful, + }, +} +\urlstyle{sf} + +\newtcblisting{fullexample}[1]{docexample,minted style=colorful, + listing and comment,pdf comment,freeze pdf,compilable listing,#1} + +\DeclareTotalTCBox{\myverb}{ O{} v }{tile,fontupper=\ttfamily,nobeforeafter, + tcbox raise base,boxsep=0.5mm,top=0pt,bottom=0pt,left=0pt,right=0pt,boxrule=0.3mm, + colback=yellow!10, + borderline horizontal={0.3mm}{0pt}{red!50}, + #1}{#2} + +\renewcommand*{\tcbdocnew}[1]{\textcolor{green!50!black}{\sffamily\bfseries N} #1} +\renewcommand*{\tcbdocupdated}[1]{\textcolor{blue!75!black}{\sffamily\bfseries U} #1} + +\newcommand{\formatPackageOption}[1]{package option} +\newcommand{\formatPackageOptions}[1]{Package options} + +\tcbmakedocSubKey[doc key prefix=]{docDidecKey}{didec} +\tcbmakedocSubKeys[doc key prefix=]{docDidecKeys}{didec} +\tcbmakedocSubKey[doc key prefix=, + index key formatter=\formatPackageOption, + index keys formatter=\formatPackageOptions +]{docPackageOption}{didec} +\tcbmakedocSubKeys[doc key prefix=, + index key formatter=\formatPackageOption, + index keys formatter=\formatPackageOptions +]{docPackageOptions}{didec} + + +\tcbset{ + deprecated*/.style={% + doc head={colback=black!1!white,interior style=fill}, + doc head key={colback=black!3!white,interior style=fill}, + color command={black!80!white}, + color option={black!60!white}, + }, + deprecated/.style={% + deprecated*, + before doc body command={\textcolor{black!80!white}{\textsc{Deprecated! }}} + }, +} + +\ExplSyntaxOn +\NewDocumentCommand \docColorExample { m } + { + \color_group_begin: + \color_select:n { #1 } + \rule[-1mm]{5mm}{4mm}~\docColor{#1} + \color_group_end: + } +\ExplSyntaxOff diff --git a/macros/latex/contrib/didec/didec.pdf b/macros/latex/contrib/didec/didec.pdf new file mode 100644 index 0000000000..b9d867eb7c Binary files /dev/null and b/macros/latex/contrib/didec/didec.pdf differ diff --git a/macros/latex/contrib/didec/didec.sty b/macros/latex/contrib/didec/didec.sty new file mode 100644 index 0000000000..885e28b258 --- /dev/null +++ b/macros/latex/contrib/didec/didec.sty @@ -0,0 +1,1349 @@ +%% The LaTeX package didec - version 1.0.0 (2024/02/28) +%% didec.sty: numbers with two decimal places +%% !TeX encoding=UTF-8 +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2024-2024 by Prof. Dr. Dr. Thomas F. Sturm +%% ------------------------------------------------------------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `author-maintained'. +%% +%% This work consists of all files listed in README.md +%% +\NeedsTeXFormat{LaTeX2e}[2023-11-01] +\ProvidesExplPackage{didec}{2024/02/28}{1.0.0} + {Fixed-point arithmetic with two decimal places} + +%------- package options ------------------- + +\DeclareKeys + { + int .code:n = + { + \prg_set_conditional:Nnn \didec_if_kernel_int: { p, T, TF } { \prg_return_true: } + \prg_set_conditional:Nnn \didec_if_kernel_fp: { p, T, TF } { \prg_return_false: } + }, + fp .code:n = + { + \prg_set_conditional:Nnn \didec_if_kernel_int: { p, T, TF } { \prg_return_false: } + \prg_set_conditional:Nnn \didec_if_kernel_fp: { p, T, TF } { \prg_return_true: } + }, + } + +\ProcessKeyOptions + +\cs_if_exist:NF \didec_if_kernel_int_p: + { + \SetKeys{ int } + } + +%------- integer kernel (int) ------------------- + +\if_predicate:w \didec_if_kernel_int_p: + +\str_const:Nn \c_didec_kernel_str { int } + +% +% test on existence of didec variable #1 +% adapted from \cs_if_exist:c +\prg_new_conditional:Npnn \didec_if_exist:n #1 { p, T, F, TF } + { + \if_cs_exist:w g_didec_var_#1_int \cs_end: + \exp_after:wN \use_i:nn + \else: + \exp_after:wN \use_ii:nn + \fi: + { + \exp_after:wN \if_meaning:w \cs:w g_didec_var_#1_int \cs_end: \scan_stop: + \prg_return_false: + \else: + \prg_return_true: + \fi: + } + \prg_return_false: + } + +% +% #1 integer value +\prg_new_conditional:Npnn \__didec_if_negative:n #1 { TF } + { + \if_int_compare:w #1 < \c_zero_int + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + +% +% #1 didec variable +\prg_new_conditional:Npnn \didec_if_negative:n #1 { p, T, F, TF } + { + \if_int_compare:w \didec_to_int:n { #1 } < \c_zero_int + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + +% +% #1 didec variable +\prg_new_conditional:Npnn \didec_if_positive:n #1 { p, T, F, TF } + { + \if_int_compare:w \didec_to_int:n { #1 } > \c_zero_int + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + +% +% #1 didec variable +\prg_new_conditional:Npnn \didec_if_zero:n #1 { p, T, F, TF } + { + \if_int_compare:w \didec_to_int:n { #1 } = \c_zero_int + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + +% +% #1 didec variable +% #2 relation +% #3 didec variable +\prg_new_conditional:Npnn \didec_compare:nNn #1#2#3 { p, T, F, TF } + { + \if_int_compare:w \__didec_eval:n { #1 } #2 \__didec_eval:n { #3 } + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + +% +% #1 didec variable +\cs_new:Npn \didec_to_int:n #1 + { + \int_use:c { g_didec_var_#1_int } + } + +% +% #1 didec variable +\cs_new_protected:Npn \didec_new:n #1 + { + \didec_if_exist:nTF { #1 } + { + \msg_error:nne { didec }{ already-defined }{ #1 } + } + { + \int_new:c { g_didec_var_#1_int } + } + } + +% +% Sets didec variable #1 to the current value of didec variable #2 +\cs_new_protected:Npn \didec_gset_eq:nn #1#2 + { + \int_gset_eq:cc { g_didec_var_#1_int }{ g_didec_var_#2_int } + } + +% +% set didec variable #1 to integer value #2 +\cs_new_protected:Npn \__didec_gset_int:nn #1#2 + { + \int_gset:cn { g_didec_var_#1_int }{ #2 } + } + +% +% add integer #2 to didec variable #1 +\cs_new_protected:Npn \__didec_gadd_int:nn #1#2 + { + \int_gadd:cn { g_didec_var_#1_int }{ #2 } + } + +\fi: + +%------- floating point kernel (fp) ------------------- + +\if_predicate:w \didec_if_kernel_fp_p: + +\str_const:Nn \c_didec_kernel_str { fp } + +% +% test on existence of didec variable #1 +% adapted from \cs_if_exist:c +\prg_new_conditional:Npnn \didec_if_exist:n #1 { p, T, F, TF } + { + \if_cs_exist:w g_didec_var_#1_fp \cs_end: + \exp_after:wN \use_i:nn + \else: + \exp_after:wN \use_ii:nn + \fi: + { + \exp_after:wN \if_meaning:w \cs:w g_didec_var_#1_fp \cs_end: \scan_stop: + \prg_return_false: + \else: + \prg_return_true: + \fi: + } + \prg_return_false: + } + +% +% #1 large integer value +\prg_new_conditional:Npnn \__didec_if_negative:n #1 { TF } + { + \exp_last_unbraced:Ne \token_if_eq_charcode:NNTF { \tl_head:n { #1 } }{ - } + { + \prg_return_true: + } + { + \prg_return_false: + } + } + +% +% #1 didec variable +\prg_new_conditional:Npnn \didec_if_negative:n #1 { p, T, F, TF } + { + \exp_last_unbraced:Ne \token_if_eq_charcode:NNTF { \exp_args:Ne \tl_head:n { \didec_to_int:n { #1 } } }{ - } + { + \prg_return_true: + } + { + \prg_return_false: + } + } + +% +% #1 didec variable +\prg_new_conditional:Npnn \didec_if_positive:n #1 { p, T, F, TF } + { + \exp_args:Ne \__didec_if_positive_token:n { \exp_args:Ne \tl_head:n { \didec_to_int:n { #1 } } } + } + +% +% #1 didec variable +\cs_new:Npn \__didec_if_positive_token:n #1 + { + \token_if_eq_charcode:NNTF { #1 }{ - } + { + \prg_return_false: + } + { + \token_if_eq_charcode:NNTF { #1 }{ 0 } + { + \prg_return_false: + } + { + \prg_return_true: + } + } + } + +% +% #1 didec variable +\prg_new_conditional:Npnn \didec_if_zero:n #1 { p, T, F, TF } + { + \exp_last_unbraced:Ne \token_if_eq_charcode:NNTF { \exp_args:Ne \tl_head:n { \didec_to_int:n { #1 } } }{ 0 } + { + \prg_return_true: + } + { + \prg_return_false: + } + } + +% +% #1 didec variable +% #2 relation +% #3 didec variable +\prg_new_conditional:Npnn \didec_compare:nNn #1#2#3 { p, T, F, TF } + { + \fp_compare:nNnTF { \__didec_eval:n { #1 } } #2 { \__didec_eval:n { #3 } } + { + \prg_return_true: + } + { + \prg_return_false: + } + } + +% +% #1 didec variable +\cs_new:Npn \didec_to_int:n #1 + { + \fp_use:c { g_didec_var_#1_fp } + } + +% +% #1 didec variable +\cs_new_protected:Npn \didec_new:n #1 + { + \didec_if_exist:nTF { #1 } + { + \msg_error:nne { didec }{ already-defined }{ #1 } + } + { + \fp_new:c { g_didec_var_#1_fp } + } + } + +% +% Sets didec variable #1 to the current value of didec variable #2 +\cs_new_protected:Npn \didec_gset_eq:nn #1#2 + { + \fp_gset_eq:cc { g_didec_var_#1_fp }{ g_didec_var_#2_fp } + } + +% +% set didec variable #1 to integer value #2 +\cs_new_protected:Npn \__didec_gset_int:nn #1#2 + { + \fp_gset:cn { g_didec_var_#1_fp }{ #2 } + } + +% +% add integer #2 to didec variable #1 +\cs_new_protected:Npn \__didec_gadd_int:nn #1#2 + { + \fp_gadd:cn { g_didec_var_#1_fp }{ #2 } + } + + +\fi: + + +%------- didec variables ------------------- + + +\cs_new:Npn \__didec_if_exist_else_error:nT #1#2 + { + \didec_if_exist:nTF { #1 } + { + #2 + } + { + \msg_error:nne { didec }{ no-variable }{ #1 } + } + } + + +% set didec variable #1 to didec expression #2 +% #1 didec variable +% #2 didec expression +\cs_new_protected:Npn \didec_gset:nn #1#2 + { + \__didec_gset_int:nn { #1 }{ \__didec_eval:n { #2 } } + } + + +% set didec variable #1 to didec expression #2 +% #1 didec variable +% #2 didec expression +\cs_new_protected:Npn \didec_gset_negative:nn #1#2 + { + \__didec_gset_int:nn { #1 }{ - \__didec_eval:n { #2 } } + } + + +% set didec variable #1 to floating-point expression #2 +% #1 didec variable +% #2 floating-point expression +\cs_new_protected:Npn \didec_gset_fp:nn #1#2 + { + \__didec_gset_int:nn { #1 }{ \fp_to_int:n { (#2)*100 } } + } + + +% add didec expression #2 to didec variable #1 +% #1 didec variable +% #2 didec expression +\cs_new_protected:Npn \didec_gadd:nn #1#2 + { + \__didec_gadd_int:nn { #1 }{ \__didec_eval:n { #2 } } + } + + +% add sum of didec expression #2 and #3 to didec variable #1 +% #1 didec variable +% #2 didec expression +% #3 didec expression +\cs_new_protected:Npn \didec_gadd_to:nnn #1#2#3 + { + \__didec_gset_int:nn { #1 }{ \__didec_eval:n { #2 } + \__didec_eval:n { #3 } } + } + + +% subtract didec expression #2 from didec variable #1 +% #1 didec variable +% #2 didec expression +\cs_new_protected:Npn \didec_gsub:nn #1#2 + { + \__didec_gadd_int:nn { #1 }{ - \__didec_eval:n { #2 } } + } + + +% set didec variable #1 to the difference of didec expression #2 and #3 +% #1 didec variable +% #2 didec expression +% #3 didec expression +\cs_new_protected:Npn \didec_gsub_to:nnn #1#2#3 + { + \__didec_gset_int:nn { #1 }{ \__didec_eval:n { #2 } - \__didec_eval:n { #3 } } + } + + +% multiply didec variable #1 with floating-point expression #2 +% #1 didec variable +% #2 floating-point expression +\cs_new_protected:Npn \didec_gmul_fp:nn #1#2 + { + \__didec_gset_int:nn { #1 }{ \fp_to_int:n { \didec_to_int:n { #1 } * (#2) } } + } + + +% set didec variable #1 to the product of didec variable #2 with floating-point expression #3 +% #1 didec variable +% #2 didec variable +% #3 floating-point expression +\cs_new_protected:Npn \didec_gmul_fp_to:nnn #1#2#3 + { + \__didec_gset_int:nn { #1 }{ \fp_to_int:n { \didec_to_int:n { #2 } * (#3) } } + } + + +% divide didec variable #1 by floating-point expression #2 +% #1 didec variable +% #2 floating-point expression +\cs_new_protected:Npn \didec_gdiv_fp:nn #1#2 + { + \__didec_gset_int:nn { #1 }{ \fp_to_int:n { \didec_to_int:n { #1 } / (#2) } } + } + + +% set didec variable #1 to the quotient of didec variable #2 with floating-point expression #3 +% #1 didec variable +% #2 didec variable +% #3 floating-point expression +\cs_new_protected:Npn \didec_gdiv_fp_to:nnn #1#2#3 + { + \__didec_gset_int:nn { #1 }{ \fp_to_int:n { \didec_to_int:n { #2 } / (#3) } } + } + + +%------- formatting didec variables ------------------- + + +% fp value of didec variable #1 +% #1 didec variable +\cs_new:Npn \didec_to_fp:n #1 + { + \exp_args:Nf \__didec_format:nn { \didec_to_int:n {#1} }{ . } + } + + +% fp value of didec variable #1 +% #1 didec variable +\cs_new:Npn \didec_to_fc:n #1 + { + \exp_args:Nf \__didec_format:nn { \didec_to_int:n {#1} }{ , } + } + + +% #1 (large) integer value (from didec variable) +% #2 decimal separator +\cs_new:Npn \__didec_format:nn #1#2 + { + \__didec_if_negative:nTF { #1 } + { - \exp_args:No \__didec_format_pos:nn { \use_none:n #1 }{ #2 } } + { \__didec_format_pos:nn { #1 }{ #2 } } + } + +\cs_new:Npn \__didec_format_pos:nn #1#2 + { + \exp_args:Ne \__didec_format_pos_i:w { \tl_count:n {#1} }{ #2 } #1 \q_nil \q_nil \q_nil \q_nil \q_nil \q_nil \q_stop + } + +\cs_new:Npn \__didec_format_pos_i:w #1#2#3#4#5#6#7#8#9 \q_stop + { + \if_case:w #1 \exp_stop_f: + \or: 0 #2 0 #3 % 1 + \or: 0 #2 #3#4 % 2 + \or: #3 #2 #4#5 % 3 + \or: #3#4 #2 #5#6 % 4 + \or: #3#4#5 #2 #6#7 % 5 + \or: #3#4#5#6 #2 #7#8 % 6 + \or: #3#4#5#6#7 #2 #8 \__didec_format_pos_ii:w { 0 }{ #2 } #9 \q_stop % 7 + \or: #3#4#5#6#7#8 #2 \__didec_format_pos_ii:w { 1 }{ #2 } #9 \q_stop % 8 + \or: #3#4#5#6#7#8 \__didec_format_pos_ii:w { 2 }{ #2 } #9 \q_stop % 9 + \or: #3#4#5#6#7#8 \__didec_format_pos_ii:w { 3 }{ #2 } #9 \q_stop % 10 + \or: #3#4#5#6#7#8 \__didec_format_pos_ii:w { 4 }{ #2 } #9 \q_stop % 11 + \or: #3#4#5#6#7#8 \__didec_format_pos_ii:w { 5 }{ #2 } #9 \q_stop % 12 + \or: #3#4#5#6#7#8 \__didec_format_pos_ii:w { 6 }{ #2 } #9 \q_stop % 13 + \or: #3#4#5#6#7#8 \__didec_format_pos_ii:w { 7 }{ #2 } #9 \q_stop % 14 + \or: #3#4#5#6#7#8 \__didec_format_pos_ii:w { 8 }{ #2 } #9 \q_stop % 15 + \or: #3#4#5#6#7#8 \__didec_format_pos_ii:w { 9 }{ #2 } #9 \q_stop % 16 + \else 0 #2 00 % error + \fi: + } + +\cs_new:Npn \__didec_format_pos_ii:w #1#2#3#4#5#6#7#8#9 \q_stop + { + \if_case:w #1 \exp_stop_f: + #3 % 0 = 7 = 13 + \or: #3#4 % 1 = 8 = 14 + \or: #3 #2 #4#5 % 2 = 9 = 15 + \or: #3#4 #2 #5#6 % 3 = 10 = 16 + \or: #3#4#5 #2 #6#7 % 4 = 11 + \or: #3#4#5#6 #2 #7#8 % 5 = 12 + \or: #3#4#5#6#7 #2 #8 \__didec_format_pos_ii:w { 0 }{ #2 } #9 \q_stop % 6 = 13 + \or: #3#4#5#6#7#8 #2 \__didec_format_pos_ii:w { 1 }{ #2 } #9 \q_stop % 7 = 14 + \or: #3#4#5#6#7#8 \__didec_format_pos_ii:w { 2 }{ #2 } #9 \q_stop % 8 = 15 + \or: #3#4#5#6#7#8 \__didec_format_pos_ii:w { 3 }{ #2 } #9 \q_stop % 9 = 16 + \fi: + } + + +% #1 (large) integer value (from didec variable) +% #2 positive extra +% #3 negative extra +\cs_new:Npn \__didec_format_group:nnn #1#2#3 + { + \__didec_if_negative:nTF { #1 } + { + #3 + \l__didec_currency_negative_prefix_tl + \exp_args:No \__didec_format_group_pos:nnn + { \use_none:n #1 } + { \l__didec_decimal_separator_tl } + { \l__didec_grouping_separator_tl } + \l__didec_currency_negative_postfix_tl + } + { + #2 + \l__didec_currency_prefix_tl + \__didec_format_group_pos:nnn + { #1 } + { \l__didec_decimal_separator_tl } + { \l__didec_grouping_separator_tl } + \l__didec_currency_postfix_tl + } + } + +\cs_new:Npn \__didec_format_group_pos:nnn #1#2#3 + { + \exp_args:Ne \__didec_format_group_pos_i:w { \tl_count:n {#1} }{ #2 }{ #3 } #1 \q_nil \q_nil \q_nil \q_nil \q_nil \q_stop + } + +\cs_new:Npn \__didec_format_group_pos_i:w #1#2#3#4#5#6#7#8#9 \q_stop + { + \if_case:w #1 \exp_stop_f: + \or: 0 #2 0 #4 % 1 + \or: 0 #2 #4#5 % 2 + \or: #4 #2 #5#6 % 3 + \or: #4#5 #2 #6#7 % 4 + \or: #4#5#6 #2 #7#8 % 5 + \or: #4 #3 #5#6#7 #2 #8 \__didec_format_group_pos_ii:w { 0 }{ #2 }{ #3 } #9 \q_stop % 6 + \or: #4#5 #3 #6#7#8 #2 \__didec_format_group_pos_ii:w { 1 }{ #2 }{ #3 } #9 \q_stop % 7 + \or: #4#5#6 #3 #7#8 \__didec_format_group_pos_ii:w { 2 }{ #2 }{ #3 } #9 \q_stop % 8 + \or: #4 #3 #5#6#7 #3 #8 \__didec_format_group_pos_ii:w { 3 }{ #2 }{ #3 } #9 \q_stop % 9 + \or: #4#5 #3 #6#7#8 #3 \__didec_format_group_pos_ii:w { 4 }{ #2 }{ #3 } #9 \q_stop % 10 + \or: #4#5#6 #3 #7#8 \__didec_format_group_pos_ii:w { 5 }{ #2 }{ #3 } #9 \q_stop % 11 + \or: #4 #3 #5#6#7 #3 #8 \__didec_format_group_pos_ii:w { 6 }{ #2 }{ #3 } #9 \q_stop % 12 + \or: #4#5 #3 #6#7#8 #3 \__didec_format_group_pos_ii:w { 7 }{ #2 }{ #3 } #9 \q_stop % 13 + \or: #4#5#6 #3 #7#8 \__didec_format_group_pos_ii:w { 8 }{ #2 }{ #3 } #9 \q_stop % 14 + \or: #4 #3 #5#6#7 #3 #8 \__didec_format_group_pos_ii:w { 9 }{ #2 }{ #3 } #9 \q_stop % 15 + \or: #4#5 #3 #6#7#8 #3 \__didec_format_group_pos_ii:w { 10 }{ #2 }{ #3 } #9 \q_stop % 16 + \else 1 #2 00 % error + \fi: + } + +\cs_new:Npn \__didec_format_group_pos_ii:w #1#2#3#4#5#6#7#8#9 \q_stop + { + \if_case:w #1 \exp_stop_f: + #4 % 0 = 6 = 11 + \or: #4#5 % 1 = 7 = 12 + \or: #4 #2 #5#6 % 2 = 8 = 13 + \or: #4#5 #2 #6#7 % 3 = 9 = 14 + \or: #4#5#6 #2 #7#8 % 4 = 10 = 15 + \or: #4 #3 #5#6#7 #2 #8 \__didec_format_group_pos_ii:w { 0 }{ #2 }{ #3 } #9 \q_stop % 5 = 11 = 16 + \or: #4#5 #3 #6#7#8 #2 \__didec_format_group_pos_ii:w { 1 }{ #2 }{ #3 } #9 \q_stop % 6 = 12 + \or: #4#5#6 #3 #7#8 \__didec_format_group_pos_ii:w { 2 }{ #2 }{ #3 } #9 \q_stop % 7 = 13 + \or: #4 #3 #5#6#7 #3 #8 \__didec_format_group_pos_ii:w { 3 }{ #2 }{ #3 } #9 \q_stop % 8 = 14 + \or: #4#5 #3 #6#7#8 #3 \__didec_format_group_pos_ii:w { 4 }{ #2 }{ #3 } #9 \q_stop % 9 = 15 + \or: #4#5#6 #3 #7#8 \__didec_format_group_pos_ii:w { 5 }{ #2 }{ #3 } #9 \q_stop % 10 = 16 + \fi: + } + + +% #1 didec variable +% #2 stream +\cs_new_protected:Npn \didec_write:nn #1#2 + { + \iow_now:Ne #2 + { + \c_backslash_str didecset + { #1 } + { \didec_to_fp:n { #1 } } + \c_percent_str + } + } + + +% #1 didec variable +% #2 stream +\cs_new_protected:Npn \didec_write_check:nn #1#2 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_write:nn { #1 }{ #2 } + } + } + + + +%------- number scanner ------------------- + +% Evaluates #1 and leaves the result in the input stream as an integer denotation +% #1 can be a single didec variable or a number with floating-comma or floating-point +\cs_new:Npn \__didec_eval:n #1 + { + \exp_args:Ne \__didec_eval_expanded:n { \exp_args:Ne \tl_trim_spaces:n { #1 } } + } + + +\cs_new:Npn \__didec_eval_expanded:n #1 + { + \didec_if_exist:nTF { #1 } + { + \didec_to_int:n { #1 } + } + { + \__didec_eval_p_a:w #1.\q_nil \q_stop + } + } + + +\cs_new:Npn \__didec_eval_p_a:w #1.#2#3 \q_stop + { + \quark_if_nil:NTF #2 + { + \__didec_eval_c_a:w #1,\q_nil\q_stop + } + { + #1\__didec_eval_p_b:w #2#3 + } + } + +\cs_new:Npn \__didec_eval_p_b:w #1. \q_nil + { + \__didec_eval_c:w #1 00 \q_stop + } + +\cs_new:Npn \__didec_eval_c_a:w #1,#2#3 \q_stop + { + \quark_if_nil:NTF #2 + { + #100 + } + { + #1\__didec_eval_c_b:w #2#3 + } + } + +\cs_new:Npn \__didec_eval_c_b:w #1, \q_nil + { + \__didec_eval_c:w #1 00 \q_stop + } + +\cs_new:Npn \__didec_eval_c:w #1#2#3 \q_stop + { + #1#2 + } + + +%------- didec variables (extended) ------------------- + +% #1 didec variable +\cs_new_protected:Npn \didec_show:n #1 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_if_kernel_int:T + { + \int_show:c { g_didec_var_#1_int } + } + \didec_if_kernel_fp:T + { + \fp_show:c { g_didec_var_#1_fp } + } + } + } + +% #1 didec variable +\cs_new:Npn \didec_to_int_check:n #1 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_to_int:n { #1 } + } + } + +% #1 didec variable +\cs_new:Npn \didec_to_fp_check:n #1 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_to_fp:n { #1 } + } + } + +% #1 didec variable +\cs_new:Npn \didec_to_fc_check:n #1 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_to_fc:n { #1 } + } + } + + +% set didec variable #1 to integer value #2 +\cs_new_protected:Npn \__didec_gset_int_check:nn #1#2 + { + \__didec_if_exist_else_error:nT { #1 } + { + \__didec_gset_int:nn { #1 }{ #2 } + } + } + +% Sets didec variable #1 to the current value of didec variable #2 +\cs_new_protected:Npn \didec_gset_eq_check:nn #1#2 + { + \__didec_if_exist_else_error:nT { #1 } + { + \__didec_if_exist_else_error:nT { #2 } + { + \didec_gset_eq:nn { #1 }{ #2 } + } + } + } + +% set didec variable #1 to didec expression #2 +% #1 didec variable +% #2 didec expression +\cs_new_protected:Npn \didec_gset_check:nn #1#2 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_gset:nn { #1 }{ #2 } + } + } + +% set didec variable #1 to didec expression #2 +% #1 didec variable +% #2 didec expression +\cs_new_protected:Npn \didec_gset_negative_check:nn #1#2 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_gset_negative:nn { #1 }{ #2 } + } + } + +% set didec variable #1 to floating-point expression #2 +% #1 didec variable +% #2 floating-point expression +\cs_new_protected:Npn \didec_gset_fp_check:nn #1#2 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_gset_fp:nn { #1 }{ #2 } + } + } + +% add didec expression #2 to didec variable #1 +% #1 didec variable +% #2 didec expression +\cs_new_protected:Npn \didec_gadd_check:nn #1#2 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_gadd:nn { #1 }{ #2 } + } + } + +% add sum of didec expression #2 and #3 to didec variable #1 +% #1 didec variable +% #2 didec expression +% #3 didec expression +\cs_new_protected:Npn \didec_gadd_to_check:nnn #1#2#3 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_gadd_to:nnn { #1 }{ #2 }{ #3 } + } + } + +% subtract didec expression #2 from didec variable #1 +% #1 didec variable +% #2 didec expression +\cs_new_protected:Npn \didec_gsub_check:nn #1#2 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_gsub:nn { #1 }{ #2 } + } + } + +% set didec variable #1 to the difference of didec expression #2 and #3 +% #1 didec variable +% #2 didec expression +% #3 didec expression +\cs_new_protected:Npn \didec_gsub_to_check:nnn #1#2#3 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_gsub_to:nnn { #1 }{ #2 }{ #3 } + } + } + +% multiply didec variable #1 with floating-point expression #2 +% #1 didec variable +% #2 floating-point expression +\cs_new_protected:Npn \didec_gmul_fp_check:nn #1#2 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_gmul_fp:nn { #1 }{ #2 } + } + } + +% set didec variable #1 to the product of didec variable #2 with floating-point expression #3 +% #1 didec variable +% #2 didec variable +% #3 floating-point expression +\cs_new_protected:Npn \didec_gmul_fp_to_check:nnn #1#2#3 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_gmul_fp_to:nnn { #1 }{ #2 }{ #3 } + } + } + +% divide didec variable #1 by floating-point expression #2 +% #1 didec variable +% #2 floating-point expression +\cs_new_protected:Npn \didec_gdiv_fp_check:nn #1#2 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_gdiv_fp:nn { #1 }{ #2 } + } + } + +% set didec variable #1 to the quotient of didec variable #2 with floating-point expression #3 +% #1 didec variable +% #2 didec variable +% #3 floating-point expression +\cs_new_protected:Npn \didec_gdiv_fp_to_check:nnn #1#2#3 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_gdiv_fp_to:nnn { #1 }{ #2 }{ #3 } + } + } + + +%------- formatting didec variables (extended) ------------------- + +\tl_new:N \l__didec_decimal_separator_tl +\tl_new:N \l__didec_grouping_separator_tl +\tl_new:N \l__didec_currency_prefix_tl +\tl_new:N \l__didec_currency_postfix_tl +\tl_new:N \l__didec_currency_negative_prefix_tl +\tl_new:N \l__didec_currency_negative_postfix_tl + +\keys_define:nn { didec } + { + decimal-separator .tl_set:N = \l__didec_decimal_separator_tl, + grouping-separator .tl_set:N = \l__didec_grouping_separator_tl, + currency .code:n = + { + \tl_set:No \l__didec_currency_prefix_tl { \use_i:nn #1 } + \tl_set:No \l__didec_currency_postfix_tl { \use_ii:nn #1 } + \tl_set:No \l__didec_currency_negative_prefix_tl { \use_i:nn #1 - } + \tl_set:No \l__didec_currency_negative_postfix_tl { \use_ii:nn #1 } + }, + currency-negative .code:n = + { + \tl_set:No \l__didec_currency_negative_prefix_tl { \use_i:nn #1 } + \tl_set:No \l__didec_currency_negative_postfix_tl { \use_ii:nn #1 } + }, + german .meta:n = + { + decimal-separator = {,}, + grouping-separator = {.}, + currency = {}{}, + }, + english .meta:n = + { + decimal-separator = {.}, + grouping-separator = {,}, + currency = {}{}, + }, + french .meta:n = + { + decimal-separator = {,}, + grouping-separator = {\;}, + currency = {}{}, + }, + float .meta:n = + { + decimal-separator = {.}, + grouping-separator = , + currency = {}{}, + }, + color-positive .code:n = + { + \color_set:nn { didec-positive }{ #1 } + }, + color-negative .code:n = + { + \color_set:nn { didec-negative }{ #1 } + }, + } + +\color_set:nn { didec-gray }{ black!85!white } + +\color_set:nnn { didec-green }{ rgb }{ 0, 0.35, 0 } +\color_set:nnn { didec-red }{ rgb }{ 0.35, 0, 0 } +\color_set:nnn { didec-blue }{ rgb }{ 0, 0, 0.35 } + + +\keys_set:nn { didec } + { + german, + color-positive = didec-green, + color-negative = didec-red, + } + +% #1 didec variable +\cs_new:Npn \didec_use:n #1 + { + \exp_args:Nf \__didec_format_group:nnn { \didec_to_int:n {#1} }{}{} + } + +% #1 didec variable +\cs_new:Npn \didec_use_check:n #1 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_use:n { #1 } + } + } + +% #1 didec variable +\cs_new:Npn \didec_color_use:n #1 + { + \color_group_begin: + \exp_args:Nf \__didec_format_group:nnn { \didec_to_int:n {#1} } + { \color_select:n { didec-positive } } + { \color_select:n { didec-negative } } + \color_group_end: + } + +% #1 didec variable +\cs_new:Npn \didec_color_use_check:n #1 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_color_use:n { #1 } + } + } + +% #1 didec variable +\cs_new:Npn \didec_color_inverse_use:n #1 + { + \color_group_begin: + \exp_args:Nf \__didec_format_group:nnn { \didec_to_int:n {#1} } + { \color_select:n { didec-negative } } + { \color_select:n { didec-positive } } + \color_group_end: + } + +% #1 didec variable +\cs_new:Npn \didec_color_inverse_use_check:n #1 + { + \__didec_if_exist_else_error:nT { #1 } + { + \didec_color_inverse_use:n { #1 } + } + } + + +%------- messages ------------------- + +\msg_new:nnnn { didec }{ already-defined } + { Didec~variable~'#1'~already~defined. } + { You~tried~to~create~a~new~didec~variable~'#1',~but~it~was~already~defined~elsewhere. } + + +\msg_new:nnnn { didec }{ no-variable } + { Unknown~didec~variable~'#1'. } + { The~didec~variable~'#1'~you~used~is~unknown. } + + + +%------- didec user functions ------------------- + +% #1 didec variable +\NewExpandableDocumentCommand \didectoint { m } + { + \exp_args:Ne \didec_to_int_check:n{ \tl_trim_spaces:n { #1 } } + } + +% #1 didec variable +\NewExpandableDocumentCommand \didectofp { m } + { + \exp_args:Ne \didec_to_fp_check:n{ \tl_trim_spaces:n { #1 } } + } + +% #1 didec variable +\NewExpandableDocumentCommand \didectofc { m } + { + \exp_args:Ne \didec_to_fc_check:n{ \tl_trim_spaces:n { #1 } } + } + +% #1 didec variable +\NewDocumentCommand \didecnew { m } + { + \exp_args:Ne \didec_new:n{ \tl_trim_spaces:n { #1 } } + } +\NewCommandCopy \didecnewvar \didecnew + +% Sets didec variable #1 to the current value of didec variable #2 +\NewDocumentCommand \didecsetequal { m m } + { + \exp_args:Nee \didec_gset_eq_check:nn { \tl_trim_spaces:n { #1 } }{ \tl_trim_spaces:n { #2 } } + } + +% set didec variable #1 to didec expression #2 +% #1 didec variable +% #2 didec expression +\NewDocumentCommand \didecset { m m } + { + \exp_args:Ne \didec_gset_check:nn { \tl_trim_spaces:n { #1 } }{ #2 } + } + +% set didec variable #1 to didec expression #2 +% #1 didec variable +% #2 didec expression +\NewDocumentCommand \didecsetnegative { m m } + { + \exp_args:Ne \didec_gset_negative_check:nn { \tl_trim_spaces:n { #1 } }{ #2 } + } + +% set didec variable #1 to floating-point expression #2 +% #1 didec variable +% #2 floating-point expression +\NewDocumentCommand \didecsetfp { m m } + { + \exp_args:Ne \didec_gset_fp_check:nn { \tl_trim_spaces:n { #1 } }{ #2 } + } + + +% #1 didec variable +% #2 didec expression / variable +% #3 didec expression +\NewDocumentCommand \didecadd { o m m } + { + \IfNoValueTF {#1} + { + \exp_args:Ne \didec_gadd_check:nn { \tl_trim_spaces:n { #2 } }{ #3 } + } + { + \exp_args:Ne \didec_gadd_to_check:nnn { \tl_trim_spaces:n { #1 } }{ #2 }{ #3 } + } + } + + +% #1 didec variable +% #2 didec expression / variable +% #3 didec expression +\NewDocumentCommand \didecsub { o m m } + { + \IfNoValueTF {#1} + { + \exp_args:Ne \didec_gsub_check:nn { \tl_trim_spaces:n { #2 } }{ #3 } + } + { + \exp_args:Ne \didec_gsub_to_check:nnn { \tl_trim_spaces:n { #1 } }{ #2 }{ #3 } + } + } + +% #1 didec variable +% #2 didec variable +% #3 floating-point expression +\NewDocumentCommand \didecmulfp { o m m } + { + \IfNoValueTF {#1} + { + \exp_args:Ne \didec_gmul_fp_check:nn { \tl_trim_spaces:n { #2 } }{ #3 } + } + { + \exp_args:Nee \didec_gmul_fp_to_check:nnn { \tl_trim_spaces:n { #1 } }{ \tl_trim_spaces:n { #2 } }{ #3 } + } + } + +% #1 didec variable +% #2 didec variable +% #3 floating-point expression +\NewDocumentCommand \didecdivfp { o m m } + { + \IfNoValueTF {#1} + { + \exp_args:Ne \didec_gdiv_fp_check:nn { \tl_trim_spaces:n { #2 } }{ #3 } + } + { + \exp_args:Nee \didec_gdiv_fp_to_check:nnn { \tl_trim_spaces:n { #1 } }{ \tl_trim_spaces:n { #2 } }{ #3 } + } + } + + +% Deprecated +\NewDocumentCommand \didecmul { >{\TrimSpaces} O{#2} >{\TrimSpaces} m >{\TrimSpaces} m } + { + \__didec_gset_int_check:nn { #1 }{ \fp_to_int:n { \__didec_eval:n { #2 } / 100 * \__didec_eval:n { #3 } } } + } + + +% Deprecated +\NewDocumentCommand \didecdiv { >{\TrimSpaces} O{#2} >{\TrimSpaces} m >{\TrimSpaces} m } + { + \__didec_gset_int_check:nn { #1 }{ \fp_to_int:n { \__didec_eval:n { #2 } / \__didec_eval:n { #3 } * 100 } } + } + + +% Deprecated +\NewDocumentCommand \didecpercent { >{\TrimSpaces} O{#2} >{\TrimSpaces} m >{\TrimSpaces} m } + { + \__didec_gset_int_check:nn { #1 }{ \fp_to_int:n { \__didec_eval:n { #2 } / \__didec_eval:n { #3 } * 10000 } } + } + + +\cs_new:Npn \__didec_sum:w #1#2+#3#4 \q_stop + { + \exp_args:Nne \didec_gadd:nn { #1 }{ #2 } + \quark_if_nil:NF #3 + { + \__didec_sum:w {#1} #3#4 \q_stop + } + } + +\didec_new:n {__@temp@__} + +% #1 didec variable +% #2 sum of didec expressions +\NewDocumentCommand \didecsetsum { m m } + { + \__didec_if_exist_else_error:nT { #1 } + { + \__didec_gset_int:nn {__@temp@__}{ 0 } + \__didec_sum:w {__@temp@__} #2 + \q_nil \q_stop + \didec_gset_eq:nn { #1 }{__@temp@__} + } + } + + +% Deprecated +% #1 type (german,english,float) +% #2 didec expression +\NewDocumentCommand \didecprint { O{german} m } + { + \didecset{__@temp@__}{ #2 } + \didecuse [ #1 ]{__@temp@__} + } + + +\tl_new:N \g__didec_temp_tl + +% Deprecated +% #1 type (german,english,float) +% #2 didec expression +% #3 target macro without backslash +\NewDocumentCommand \didecstore { O{german} m >{\TrimSpaces}m } + { + \didecset{__@temp@__}{ #2 } + \group_begin: + \keys_set:nn { didec }{ #1 } + \tl_gset:Ne \g__didec_temp_tl { \didec_use:n { __@temp@__ } } + \group_end: + \cs_set_eq:cN { #3 } \g__didec_temp_tl + } + +% #1 key list +% #2 didec variable +\NewDocumentCommand \didecuse { o m } + { + \IfNoValueTF {#1} + { + \exp_args:Ne \didec_use_check:n { \tl_trim_spaces:n { #2 } } + } + { + \group_begin: + \keys_set:nn { didec }{ #1 } + \exp_args:Ne \didec_use_check:n { \tl_trim_spaces:n { #2 } } + \group_end: + } + } + +% #1 key list +% #2 didec variable +\NewDocumentCommand \dideccoluse { o m } + { + \IfNoValueTF {#1} + { + \exp_args:Ne \didec_color_use_check:n { \tl_trim_spaces:n { #2 } } + } + { + \group_begin: + \keys_set:nn { didec }{ #1 } + \exp_args:Ne \didec_color_use_check:n { \tl_trim_spaces:n { #2 } } + \group_end: + } + } + +% #1 key list +% #2 didec variable +\NewDocumentCommand \dideccolinvuse { o m } + { + \IfNoValueTF {#1} + { + \exp_args:Ne \didec_color_inverse_use_check:n { \tl_trim_spaces:n { #2 } } + } + { + \group_begin: + \keys_set:nn { didec }{ #1 } + \exp_args:Ne \didec_color_inverse_use_check:n { \tl_trim_spaces:n { #2 } } + \group_end: + } + } + +% #1 key list +% #2 didec expression +\NewDocumentCommand \didecformat { o m } + { + \didec_gset:nn { __@temp@__ }{ #2 } + \IfNoValueTF {#1} + { + \didec_use:n { __@temp@__ } + } + { + \group_begin: + \keys_set:nn { didec }{ #1 } + \didec_use:n { __@temp@__ } + \group_end: + } + } + +% #1 key list +% #2 didec expression +\NewDocumentCommand \dideccolformat { o m } + { + \didec_gset:nn { __@temp@__ }{ #2 } + \IfNoValueTF {#1} + { + \didec_color_use:n { __@temp@__ } + } + { + \group_begin: + \keys_set:nn { didec }{ #1 } + \didec_color_use:n { __@temp@__ } + \group_end: + } + } + +% #1 key list +% #2 didec expression +\NewDocumentCommand \dideccolinvformat { o m } + { + \didec_gset:nn { __@temp@__ }{ #2 } + \IfNoValueTF {#1} + { + \didec_color_inverse_use:n { __@temp@__ } + } + { + \group_begin: + \keys_set:nn { didec }{ #1 } + \didec_color_inverse_use:n { __@temp@__ } + \group_end: + } + } + +% #1 key list +\NewDocumentCommand \didecsetup { m } + { + \keys_set:nn { didec }{ #1 } + } + +% #1 didec variable +% #2 stream +\NewDocumentCommand \didecwrite { m m } + { + \exp_args:Ne \didec_write_check:nn { \tl_trim_spaces:n { #1 } }{ #2 } + } + + +%------- didec conditionals ------------------- + +% #1 didec variable +\NewDocumentCommand \didecifnegative { m } + { + \exp_args:Ne \didec_if_negative:nTF { \tl_trim_spaces:n { #1 } } + } +\NewCommandCopy \didecifnegativ \didecifnegative % Deprecated + +% #1 didec variable +\NewDocumentCommand \didecifpositive { m } + { + \exp_args:Ne \didec_if_positive:nTF { \tl_trim_spaces:n { #1 } } + } +\NewCommandCopy \didecifpositiv \didecifpositive % Deprecated + +% #1 didec variable +\NewDocumentCommand \didecifzero { m } + { + \exp_args:Ne \didec_if_zero:nTF { \tl_trim_spaces:n { #1 } } + } +\NewCommandCopy \didecifnull \didecifzero % Deprecated + +% #1 didec expression +% #2 didec expression +\NewDocumentCommand \dideciflowerthan { m m } + { + \didec_compare:nNnTF { #1 } < { #2 } + } + +% #1 didec expression +% #2 didec expression +\NewDocumentCommand \didecifequal { m m } + { + \didec_compare:nNnTF { #1 } = { #2 } + } + +% #1 didec expression +% #2 didec expression +\NewDocumentCommand \didecifgreaterthan { m m } + { + \didec_compare:nNnTF { #1 } > { #2 } + } diff --git a/macros/latex/contrib/didec/didec.tex b/macros/latex/contrib/didec/didec.tex new file mode 100644 index 0000000000..fd3d26e0a3 --- /dev/null +++ b/macros/latex/contrib/didec/didec.tex @@ -0,0 +1,1209 @@ +% \LaTeX-Main\ +% !TeX encoding=UTF-8 +% !TeX spellcheck=en_US +%% +%% The LaTeX package didec - version 1.0.0 (2024/02/28) +%% didec.tex: Manual +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2024-2024 by Prof. Dr. Dr. Thomas F. Sturm +%% ------------------------------------------------------------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `author-maintained'. +%% +%% This work consists of all files listed in README +%% +\documentclass[a4paper,11pt]{ltxdoc} +\usepackage{didec.doc} + +\hypersetup{ + pdftitle={Manual for the didec package}, + pdfauthor={Thomas F. Sturm}, + pdfsubject={Calculations with two decimal places}, + pdfkeywords={fixed-point arithmetic, two decimal places, calculations, cash book, bookkeeping, accountancy} +} + +\makeindex + +\pdfsuppresswarningpagegroup=1 + +\DeclareUnicodeCharacter{20AC}{\euro{}} +\didecsetup{ + decimal-separator = {,}, + grouping-separator = {.}, + currency = {}{\;€}, +} + +\didecnew{A} +\didecnew{B} +\didecnew{C} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + +\begin{center} +\begin{tcolorbox}[enhanced,hbox,tikznode,left=8mm,right=8mm,boxrule=0.4pt, + colback=white,colframe=Blue_Gray, + drop lifted shadow=Blue_Gray!50,arc is angular, + before=\par\vspace*{5mm},after=\par\bigskip] +{\bfseries\LARGE The didec package}\\[3mm] +{\large Manual for version \version\ (\datum)} +\end{tcolorbox} +{\large Thomas F.~Sturm% + \footnote{Prof.~Dr.~Dr.~Thomas F.~Sturm, Institut f\"{u}r Mathematik und Informatik, + University of the Bundeswehr Munich, D-85577 Neubiberg, Germany; + email: \href{mailto:thomas.sturm@unibw.de}{thomas.sturm@unibw.de}}\par\medskip +\normalsize% +\url{https://www.ctan.org/pkg/didec}\par +\url{https://github.com/T-F-S/didec} +} +\end{center} +\bigskip +\begin{absquote} + \begin{center}\bfseries Abstract\end{center} + The \texttt{didec} package supports fixed-point arithmetic with two + decimal places (\emph{di-decimal}) which is typical for financial transactions + in many currencies. The intended use case is (personal) bookkeeping. +\end{absquote} + +\tableofcontents + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\clearpage +\section{Quick start}% +For the impatient: this package provides fixed-point arithmetic with +two decimal places. You may use it for any purpose where exactly two decimal +places are needed or suffice, but the main application case is (personal) bookkeeping. + +Say, John wants to keep track about his money. With +\begin{dispListing} +\didecnew{John} +\end{dispListing} +\didecnew{John} +a so-called \emph{didec variable} is created to store currency values. + +Now, lets fill in some money: +\begin{dispListing} +\didecset{John}{1000} +\end{dispListing} +\didecset{John}{1000} + +How much money has John now? +\begin{dispExample} +\didecuse{John} +\end{dispExample} + +Obviously, John has Euros and the amount is displayed in a German style manor. +Of course, this can be adapted to your liking, see \refCom{didecsetup}. +But now, let us spend some money. +\begin{dispExample} +\didecsub{John}{19.75} +\didecuse{John} +\end{dispExample} + +Preferably, the package functions are used inside convenient user commands. +You can choose between \LaTeX2e and \LaTeX3 programming layer functions. + +For this quick start, we make some convenience commands for John. +|\transaction| shall be one purchase made in cash and |\transaction*| one made +by credit card. +\begin{dispExample*}{breakable} +%\usepackage{booktabs} +\didecsetup{english, + currency = {\pounds}{}, + currency-negative = {-\pounds}{}, +} + +%\didecnew{John} +\didecnew{cash} +\didecnew{credit} +\didecnew{transaction} + +% Let's keep record in a table +\NewDocumentEnvironment{householdbook}{}{% + \begin{center} + \begin{tabular}{lp{9cm}rr}\toprule% + & Transaction & Expenses & Budget\\\midrule + }{% + \midrule% + \multicolumn{3}{r}{Cash} & \dideccoluse{cash}\\% + \multicolumn{3}{r}{Credit card} & \dideccoluse{credit}\\\bottomrule% + \end{tabular}% + \end{center} + } + +% One transaction +\NewDocumentCommand \transaction{ s m m } + { + \didecset{transaction}{#3}% + \didecsub{John}{transaction}% + \IfBooleanTF {#1}% + {\didecsub{credit}{transaction}CC}% + {\didecsub{cash}{transaction}}% + & #2 + & \dideccolinvuse{transaction} + & \dideccoluse{John}\\% + } + +% Ready to start our tiny accountancy + +\didecset{John}{1000} % John's money +\didecsetequal{cash}{John} % in cash +\didecset{credit}{0} % blank credit card + +\begin{householdbook} + \transaction{Coffee break with snack}{19.75} + \transaction*{Refuel}{62.87} + \transaction{Gift from Aunt Mary for helping her}{-30} + \transaction{Parking meter}{4.50} + \transaction*{Shopping for weekend}{147.23} + \transaction*{Fancy thing on the Internet}{270} + \transaction*{Cinema}{17.70} +\end{householdbook} + +\end{dispExample*} + + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\clearpage +\section{Didec kernels and didec expressions}% + +All calculations are done on cent basis as integer operations, but all +displayed figures have two decimal places which give the name for the package +(\emph{di}-\emph{dec}imal). + +The package provides two numerical kernels which can be selected mutually +by package options \refKey{didec/int} or \refKey{didec/fp}. +The \refKey{didec/int} kernel is faster, but provides a smaller number range, +while the \refKey{didec/int} kernel is slower with a larger number range. +For ordinary people like you and me, the \refKey{didec/int} kernel will suffice +to do all personal financial calculations. +Upgrading later from \refKey{didec/int} to \refKey{didec/fp} is a matter of +just switching the package option setting. + +%------------------------------------------------------------------------------- +\begin{docPackageOptions}{{ + doc name = int, + doc description = {no value, initially set}, + }} +Selects the \meta{int} (integer) based numerical kernel with up to +9.33\footnote{joke for the mathematicians} significant figures and fast computation. +The number range for valid figures $n$ is: +\begin{center} +$ -21\;474\;836.47 \le n \le 21\;474\;836.47 $ +\end{center} +\begin{dispListing} +\usepackage[int]{didec} +\end{dispListing} +Using figures outside the valid range will result in \LaTeX\ errors complaining +about too large numbers. +\end{docPackageOptions} +%------------------------------------------------------------------------------- + + +%------------------------------------------------------------------------------- +\begin{docPackageOptions}{{ + doc name = fp, + doc description = {no value, initially unset}, + }} +Selects the \meta{fp} (floating-point) based numerical kernel with up to +16 significant figures and somewhat slower computation. +The number range for valid figures $n$ is: +\begin{center} +$ -99\;999\;999\;999\;999.99 \le n \le 99\;999\;999\;999\;999.99 $ +\end{center} +\begin{dispListing} +\usepackage[fp]{didec} +\end{dispListing} +Using figures outside the valid range will result in \emph{silent calculation errors}, +because \LaTeX3 \meta{fp} can use much larger numbers but is restricted to 16 +significant figures. +\end{docPackageOptions} +%------------------------------------------------------------------------------- + +\medskip + +In the following, a \meta{didec expr} (didec expression) denotes one of +the following: +\begin{itemize} +\item a number in floating-point notation, e.g. |123.45| +\item a number in floating-comma notation, e.g. |123,45| +\item a \meta{didec var} (didec variable), e.g. |expenses|. +\end{itemize} +Note that the notation \meta{didec expr} is inspired by \meta{int expr} and \meta{fp expr} +from \LaTeX3 but is in comparison very restricted and allows only the three choices above. +A \meta{didec expr} is always expanded and spaces are trimmed. + +\medskip + +Many provided commands or functions of the package come in three flavors, for +example: +\begin{itemize} +\item \refCom{didecadd}: This is a user command where arguments are space trimmed + and some check on variable existence is done. + Not existing variables are reported by speaking error messages (not in all cases!). +\item \refCom{didec_gadd_check:nn}: This a programming layer function + with no space trimming for arguments, but some check on variable existence is done. + Not existing variables are reported by speaking error messages (not in all cases!). +\item \refCom{didec_gadd:nn}: This a programming layer function + with no space trimming for arguments and no check on variable existence. + Not existing variables give strange errors. + This is the fasted function and base of the others above. +\end{itemize} + + +\clearpage +The following tables compare the computation time for selected functions of +the package for the two numerical kernels. Time values will differ on other +computers and also depend on selected values for the examples calculations. +Nevertheless, you get an impression of the differences. + + +%------------------------------------------------------------------------------- +\begin{tcbverbatimwrite}{\jobname.temp} +\begin{tcblisting}{ + blankest, + pdf comment, + comment style={raster columns=1,blankest,enhanced/.style=}, + comment only, + freeze pdf, + compilable listing, + run pdflatex +} +\IfFileExists{didec.doc.cfg}{\input{didec.doc.cfg}}{\def\didecpackageprefix{}} +\documentclass[a4paper,11pt]{ltxdoc} +\usepackage[a4paper,textwidth=8cm]{geometry} +\usepackage{lmodern,array,booktabs,incgraph} +\usepackage[skins,documentation]{tcolorbox} +\input{didec.tempinc} +\usepackage{l3benchmark,siunitx} +\begin{document} +\begin{inctext} +\begin{tcolorbox}[blankest] +\makeatletter +\ExplSyntaxOn +\cs_new_protected:Npn \didec_benchmark:n #1 +{ + \benchmark:n { #1 } + \tablenum[table-format=4.0]{ \fp_to_decimal:n { round( \g_benchmark_time_fp * 1 000 000 ) } }\,\unit{\micro\second} +} +\didecnew{A}\didecnew{B} +\fp_set:Nn \g_benchmark_duration_target_fp { 1 } +\begin{center} +\begin{tabular}{lr}\toprule +\multicolumn{2}{c}{ + kernel:~\texttt{\c_didec_kernel_str},~engine:~\texttt{\c_sys_engine_str} +}\\\midrule +\docAuxCommand*{didec_gset:nn} & \didec_benchmark:n{ \didec_gset:nn{A}{-9876,324} } +\\\docAuxCommand*{didec_gset_check:nn} & \didec_benchmark:n{ \didec_gset_check:nn{A}{-9876,324} } +\\\docAuxCommand*{didecset} & \didec_benchmark:n{ \didecset{A}{-9876,324} } +\\\midrule +\docAuxCommand*{didec_gset_eq:nn} & \didecset{B}{1234.56} \didec_benchmark:n{ \didec_gset_eq:nn{A}{B} } +\\\docAuxCommand*{didec_gset_eq_check:nn} & \didecset{B}{1234.56} \didec_benchmark:n{ \didec_gset_eq_check:nn{A}{B} } +\\\docAuxCommand*{didecsetequal} & \didecset{B}{1234.56} \didec_benchmark:n{ \didecsetequal{A}{B} } +\\\midrule +\docAuxCommand*{didec_gset_fp:nn} & \didec_benchmark:n{ \didec_gset_fp:nn{A}{51234.56} } +\\\docAuxCommand*{didec_gset_fp_check:nn} & \didec_benchmark:n{ \didec_gset_fp_check:nn{A}{51234.56} } +\\\docAuxCommand*{didecsetfp} & \didec_benchmark:n{ \didecsetfp{A}{51234.56} } +\\\midrule +\docAuxCommand*{didec_gadd:nn} & \didecset{A}{-987.34} \didec_benchmark:n{ \didec_gadd:nn{A}{12345} } +\\\docAuxCommand*{didec_gadd_check:nn} & \didecset{A}{-987.34}\didec_benchmark:n{ \didec_gadd_check:nn{A}{12345} } +\\\docAuxCommand*{didecadd} & \didecset{A}{-987.34} \didec_benchmark:n{ \didecadd{A}{12345} } +\\\midrule +\docAuxCommand*{didec_gadd_to:nnn} & \didec_benchmark:n{ \didec_gadd_to:nnn{A}{-4564}{12345} } +\\\docAuxCommand*{didec_gadd_to_check:nnn} & \didec_benchmark:n{ \didec_gadd_to_check:nnn{A}{-4564}{12345} } +\\\docAuxCommand*{didecadd} & \didec_benchmark:n{ \didecadd[A]{-4564}{12345} } +\\\midrule +\docAuxCommand*{didec_gmul_fp:nn} & \didecset{A}{-987.34} \didec_benchmark:n{ \didec_gmul_fp:nn{A}{0.99} } +\\\docAuxCommand*{didec_gmul_fp_check:nn} & \didecset{A}{-987.34}\didec_benchmark:n{ \didec_gmul_fp_check:nn{A}{0.99} } +\\\docAuxCommand*{didecmulfp} & \didecset{A}{-987.34} \didec_benchmark:n{ \didecmulfp{A}{0.99} } +\\\midrule +% +\docAuxCommand*{didec_if_positive:nTF} & \didecset{A}{-987.34} \didec_benchmark:n{ \didec_if_positive:nTF{A}{}{} } +\\\docAuxCommand*{didecifpositive} & \didecset{A}{-987.34} \didec_benchmark:n{ \didecifpositive{A}{}{} } +\\\docAuxCommand*{didec_compare:nNnTF} & \didecset{A}{-987.34} \didec_benchmark:n{ \didec_compare:nNnTF{A}>{12345}{}{} } +\\\docAuxCommand*{didecifgreaterthan} & \didecset{A}{-987.34} \didec_benchmark:n{ \didecifgreaterthan{A}{12345}{}{} } +\\\midrule +\docAuxCommand*{didec_to_fp:n} & \didecset{A}{-1234987.34} \didec_benchmark:n{ \setbox\z@\hbox{\didec_to_fp:n{A}} } +\\\docAuxCommand*{didec_to_fp_check:n} & \didecset{A}{-1234987.34} \didec_benchmark:n{ \setbox\z@\hbox{\didec_to_fp_check:n{A}} } +\\\docAuxCommand*{didectofp} & \didecset{A}{-1234987.34} \didec_benchmark:n{ \setbox\z@\hbox{\didectofp{A}} } +\\\midrule +\docAuxCommand*{didec_use:n} & \didecset{A}{-1234987.34} \didec_benchmark:n{ \setbox\z@\hbox{\didec_use:n{A}} } +\\\docAuxCommand*{didec_use_check:n} & \didecset{A}{-1234987.34} \didec_benchmark:n{ \setbox\z@\hbox{\didec_use_check:n{A}} } +\\\docAuxCommand*{didecuse} & \didecset{A}{-1234987.34} \didec_benchmark:n{ \setbox\z@\hbox{\didecuse{A}} } +\\\docAuxCommand*{didecformat} & \didec_benchmark:n{ \setbox\z@\hbox{\didecformat{-1234987.34}} } +\\\docAuxCommand*{didec_color_use:n} & \didecset{A}{-1234987.34} \didec_benchmark:n{ \setbox\z@\hbox{\didec_color_use:n{A}} } +\\\docAuxCommand*{didec_color_use_check:n} & \didecset{A}{-1234987.34} \didec_benchmark:n{ \setbox\z@\hbox{\didec_color_use_check:n{A}} } +\\\docAuxCommand*{dideccoluse} & \didecset{A}{-1234987.34} \didec_benchmark:n{ \setbox\z@\hbox{\dideccoluse{A}} } +\\\docAuxCommand*{dideccolformat} & \didec_benchmark:n{ \setbox\z@\hbox{\dideccolformat{-1234987.34}} } +\\\bottomrule +\end{tabular} +\end{center} +\ExplSyntaxOff +\makeatother +\end{tcolorbox} +\end{inctext} +\end{document} +\end{tcblisting} +\end{tcbverbatimwrite} +% +\begin{tcbraster}[raster column skip=0pt] +\begin{tcbverbatimwrite}{\jobname.tempinc} +\usepackage[int]{\didecpackageprefix didec} +\end{tcbverbatimwrite} +\input{\jobname.temp} +% +\begin{tcbverbatimwrite}{\jobname.tempinc} +\usepackage[fp]{\didecpackageprefix didec} +\end{tcbverbatimwrite} +\input{\jobname.temp} +\end{tcbraster} +%------------------------------------------------------------------------------- + + +\clearpage +If needed, the selected kernel can be questioned by the following: + +%------------------------------------------------------------------------------- +\begin{docCommands}[ + % doc parameter = \marg{didec var}, + ] +{ + { doc name = c_didec_kernel_str }, +} +The current kernel given as a lower case string: one of +\docValue*{int} or \docValue*{fp}. +\begin{dispExample} +\ExplSyntaxOn +\c_didec_kernel_str +\ExplSyntaxOff +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + + +%------------------------------------------------------------------------------- +\begin{docCommands}[ + % doc parameter = \marg{didec var}, + ] +{ + { doc name = didec_if_kernel_int_p: }, + { doc name = didec_if_kernel_int:T, doc parameter = ~\marg{true code} }, + { doc name = didec_if_kernel_int:TF, doc parameter = ~\marg{true code}\marg{false code} }, + { doc name = didec_if_kernel_fp_p: }, + { doc name = didec_if_kernel_fp:T, doc parameter = ~\marg{true code} }, + { doc name = didec_if_kernel_fp:TF, doc parameter = ~\marg{true code}\marg{false code} }, +} +Conditionals which allow kernel-specific code to be used. The names follow +naturally from those of the kernels. +\begin{dispExample} +\ExplSyntaxOn +\didec_if_kernel_int:T { Integer~kernel~used. }\par +Floating~point~kernel +\didec_if_kernel_fp:TF { ~used. }{ ~not~used. } +\ExplSyntaxOff +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\clearpage +\section{Creating didec variables}% + +%------------------------------------------------------------------------------- +\begin{docCommands}[ + doc parameter = \marg{didec var}, + ] +{ + { doc name = didecnew }, + { doc name = didec_new:n }, + } +Creates a new \meta{didec var} or raises an error if the name is already taken. +\refCom{didecnew} trims spaces while \refCom{didec_new:n} does not. +\begin{dispExample} +\didecnew{konto} +\didecset{konto}{99.75} +\didecuse{konto} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + +%\clearpage +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Setting didec variables}% + + +%------------------------------------------------------------------------------- +\begin{docCommands}[ + doc parameter = \marg{didec var}\marg{didec expr}, + ] +{ + { doc name = didecset }, + { doc name = didec_gset:nn }, + { doc name = didec_gset_check:nn }, + } +Sets \meta{didec var} to the value of \meta{didec expr} which can be +\begin{itemize} +\item a number in floating-point notation, +\item a number in floating-comma notation, +\item another \meta{didec var}. +\end{itemize} +\refCom{didecset} trims spaces and performs an existence check for \meta{didec var}. +\refCom{didec_gset_check:nn} performs an existence check for \meta{didec var}. +Decimals places 3 and beyond are cut not rounded. +If rounding is an issue, use \refCom{didecsetfp} instead. +\begin{dispExample} +\didecset{A}{1234.56} +\didecuse{A} + +\didecset{A}{2345,6789} +\didecuse{A} + +\didecset{B}{-3500} +\didecset{A}{B} +\didecuse{A} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + + +%------------------------------------------------------------------------------- +\begin{docCommands}[ + doc parameter = \marg{didec var\textsubscript{1}}\marg{didec var\textsubscript{2}}, + ] +{ + { doc name = didecsetequal }, + { doc name = didec_gset_eq:nn }, + { doc name = didec_gset_eq_check:nn }, + } +Sets the \meta{didec var\textsubscript{1}} to the current value of \meta{didec var\textsubscript{2}} +\begin{dispExample} +\didecset{A}{1234.56} +\didecsetequal{B}{A} +\didecuse{A} +\didecuse{B} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + +\clearpage +%------------------------------------------------------------------------------- +\begin{docCommands}[ + doc parameter = \marg{didec var}\marg{didec expr}, + ] +{ + { doc name = didecsetnegative }, + { doc name = didec_gset_negative:nn }, + { doc name = didec_gset_negative_check:nn }, + } +Sets \meta{didec var} to the negated (opposite) value of \meta{didec expr}. +\refCom{didecsetnegative} trims spaces and performs an existence check for \meta{didec var}. +\begin{dispExample} +\didecsetnegative{A}{1234.56} +\didecuse{A} + +\didecsetnegative{A}{-42.55} +\didecuse{A} + +\didecset{B}{-3500} +\didecsetnegative{A}{B} +\didecuse{A} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + + +%------------------------------------------------------------------------------- +\begin{docCommands}[ + doc parameter = \marg{didec var}\marg{fp expr}, + ] +{ + { doc name = didecsetfp }, + { doc name = didec_gset_fp:nn }, + { doc name = didec_gset_fp_check:nn }, + } +Sets \meta{didec var} to the value of \meta{fp expr} which can +by any \LaTeX3 floating-point expression. +\refCom{didecsetfp} trims spaces and performs an existence check for \meta{didec var}. +Other didec variables can be used inside \meta{fp expr} if guarded with \refCom{didectofp}. +The result is rounded to 2 decimal places. +\refCom{didec_gset_fp_check:nn} performs an existence check for \meta{didec var}. +\begin{dispExample} +\didecsetfp{A}{2345.6789} +\didecuse{A} + +\didecsetfp{A}{ ln( 12345678 ) } +\didecuse{A} + +\didecset{A}{123456,78} +\didecsetfp{B}{ \didectofp{A} * 2.35 / 100 } +2.35\% of \didecuse{A} are \didecuse{B}. +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + +\clearpage +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = didecadd, doc parameter = \oarg{didec var}\marg{didec expr\textsubscript{1}}\marg{didec expr\textsubscript{2}} }, + { doc name = didec_gadd:nn, doc parameter = \marg{didec var}\marg{didec expr} }, + { doc name = didec_gadd_check:nn, doc parameter = \marg{didec var}\marg{didec expr} }, + { doc name = didec_gadd_to:nnn, doc parameter = \marg{didec var}\marg{didec expr\textsubscript{1}}\marg{didec expr\textsubscript{2}} }, + { doc name = didec_gadd_to_check:nnn, doc parameter = \marg{didec var}\marg{didec expr\textsubscript{1}}\marg{didec expr\textsubscript{2}} }, + } +\begin{itemize} +\item Adds the result of computing the \meta{didec expr} to the \meta{didec var} +\item or sets \meta{didec var} to the sum of \meta{didec expr\textsubscript{1}} and \meta{didec expr\textsubscript{2}}. +\item For \refCom{didecadd}, if the optional \meta{didec var} is not available, + the sum is stored into \meta{didec expr\textsubscript{1}} which has to be a \meta{didec var} + in this case. +\end{itemize} +\begin{dispExample} +\didecset{A}{123} +\didecset{B}{5,88} +\didecadd{A}{B} +\didecuse{A} + +\didecadd[A]{B}{1000} +\didecuse{A} + +\didecadd{A}{-2750} +\didecuse{A} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + +%\clearpage +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = didecsub, doc parameter = \oarg{didec var}\marg{didec expr\textsubscript{1}}\marg{didec expr\textsubscript{2}} }, + { doc name = didec_gsub:nn, doc parameter = \marg{didec var}\marg{didec expr} }, + { doc name = didec_gsub_check:nn, doc parameter = \marg{didec var}\marg{didec expr} }, + { doc name = didec_gsub_to:nnn, doc parameter = \marg{didec var}\marg{didec expr\textsubscript{1}}\marg{didec expr\textsubscript{2}} }, + { doc name = didec_gsub_to_check:nnn, doc parameter = \marg{didec var}\marg{didec expr\textsubscript{1}}\marg{didec expr\textsubscript{2}} }, + } +\begin{itemize} +\item Subtracts the result of computing the \meta{didec expr} to the \meta{didec var} +\item or sets \meta{didec var} to the difference of \meta{didec expr\textsubscript{1}} and \meta{didec expr\textsubscript{2}}. +\item For \refCom{didecsub}, if the optional \meta{didec var} is not available, + the difference is stored into \meta{didec expr\textsubscript{1}} which has to be a \meta{didec var} + in this case. +\end{itemize} +\begin{dispExample} +\didecset{A}{123} +\didecset{B}{5,88} +\didecsub{A}{B} +\didecuse{A} + +\didecsub[A]{B}{1000} +\didecuse{A} + +\didecsub{A}{-2750} +\didecuse{A} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + +\clearpage +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = didecmulfp, doc parameter = \oarg{didec var\textsubscript{2}}\marg{didec var}\marg{fp expr} }, + { doc name = didec_gmul_fp:nn, doc parameter = \marg{didec var}\marg{fp expr} }, + { doc name = didec_gmul_fp_check:nn, doc parameter = \marg{didec var}\marg{fp expr} }, + { doc name = didec_gmul_fp_to:nnn, doc parameter = \marg{didec var\textsubscript{2}}\marg{didec var}\marg{fp expr} }, + { doc name = didec_gmul_fp_to_check:nnn, doc parameter = \marg{didec var\textsubscript{2}}\marg{didec var}\marg{fp expr} }, + } +\begin{itemize} +\item Multiplies \meta{didec var} with the result of computing the \meta{fp expr} +\item and sets \meta{didec var} or respectively \meta{didec var\textsubscript{2}} to the result. +\end{itemize} +\begin{dispExample} +\didecset{A}{123} +\didecmulfp{A}{0.9675} +\didecuse{A} + +\didecmulfp[B]{A}{ln(42)} +\didecuse{B} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + + +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = didecdivfp, doc parameter = \oarg{didec var\textsubscript{2}}\marg{didec var}\marg{fp expr} }, + { doc name = didec_gdiv_fp:nn, doc parameter = \marg{didec var}\marg{fp expr} }, + { doc name = didec_gdiv_fp_check:nn, doc parameter = \marg{didec var}\marg{fp expr} }, + { doc name = didec_gdiv_fp_to:nnn, doc parameter = \marg{didec var\textsubscript{2}}\marg{didec var}\marg{fp expr} }, + { doc name = didec_gdiv_fp_to_check:nnn, doc parameter = \marg{didec var\textsubscript{2}}\marg{didec var}\marg{fp expr} }, + } +\begin{itemize} +\item Divides \meta{didec var} by the result of computing the \meta{fp expr} +\item and sets \meta{didec var} or respectively \meta{didec var\textsubscript{2}} to the result. +\end{itemize} +\begin{dispExample} +\didecset{A}{123} +\didecdivfp{A}{0.9675} +\didecuse{A} + +\didecdivfp[B]{A}{ln(42)} +\didecuse{B} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = didecsetsum, doc parameter = \oarg{didec var}\marg{sum of didec exp} }, +} +Sets \meta{didec var} to the result of computing the given \meta{sum of didec exp}.\par +Here, \meta{sum of didec exp} = \meta{didec exp\textsubscript{1}} ++ \meta{didec exp\textsubscript{2}} + \ldots + \meta{didec exp\textsubscript{n}} +\begin{dispExample} +\didecset{A}{123} +\didecset{B}{-32.15} +\didecsetsum{A}{ A + B + -22.5 } +\didecuse{A} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + + +\clearpage +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Using didecs}% + + +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = didectoint, doc parameter = \marg{didec var} }, + { doc name = didec_to_int:n, doc parameter = \marg{didec var} }, + { doc name = didec_to_int_check:n, doc parameter = \marg{didec var} }, +} +Expresses the \meta{didec var} as Cent integer value, i.e. 100 times the +value. +All functions are expandable. +\begin{dispExample} +\didecset{A}{27123.45} +\didectoint{A} + +\didecset{A}{-17} +\didectoint{A} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + + +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = didectofp, doc parameter = \marg{didec var} }, + { doc name = didec_to_fp:n, doc parameter = \marg{didec var} }, + { doc name = didec_to_fp_check:n, doc parameter = \marg{didec var} }, +} +Expresses the \meta{didec var} as floating-point value. +All functions are expandable. +\begin{dispExample} +\didecset{A}{27123.45} +\didectofp{A} + +\didecset{A}{-17} +\didectofp{A} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + + +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = didectofc, doc parameter = \marg{didec var} }, + { doc name = didec_to_fc:n, doc parameter = \marg{didec var} }, + { doc name = didec_to_fc_check:n, doc parameter = \marg{didec var} }, +} +Expresses the \meta{didec var} as floating-comma value. +All functions are expandable. +\begin{dispExample} +\didecset{A}{27123.45} +\didectofc{A} + +\didecset{A}{-17} +\didectofc{A} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + +\clearpage +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = didecuse, doc parameter = \oarg{key list}\marg{didec var} }, + { doc name = didec_use:n, doc parameter = \marg{didec var} }, + { doc name = didec_use_check:n, doc parameter = \marg{didec var} }, +} +Expresses the \meta{didec var} as formatted value. +With \refCom{didecsetup}, the standard format can be set. +This standard format can be overwritten by \meta{key list}. +\begin{dispExample} +\didecset{A}{123456.78} +\didecuse{A} + +\didecuse[ + currency = {\pounds}{}, + decimal-separator = {.}, + grouping-separator = {,}, + ]{A} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + + +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = dideccoluse, doc parameter = \oarg{key list}\marg{didec var} }, + { doc name = didec_color_use:n, doc parameter = \marg{didec var} }, + { doc name = didec_color_use_check:n, doc parameter = \marg{didec var} }, +} +Expresses the \meta{didec var} as colorized formatted value. +With \refCom{didecsetup}, the standard format can be set. +This standard format can be overwritten by \meta{key list}. +\begin{dispExample} +\didecset{A}{123456.78} +\dideccoluse{A} + +\didecset{A}{-125} +\dideccoluse{A} + +\dideccoluse[color-negative=didec-blue]{A} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = dideccolinvuse, doc parameter = \oarg{key list}\marg{didec var} }, + { doc name = didec_color_inverse_use:n, doc parameter = \marg{didec var} }, + { doc name = didec_color_inverse_use_check:n, doc parameter = \marg{didec var} }, +} +Expresses the \meta{didec var} as colorized formatted value. +The coloring is switched between positive and negative. +The standard +coloring and format can be overwritten by \meta{key list}. +\begin{dispExample} +\didecset{A}{123456.78} +\dideccolinvuse{A} + +\didecset{A}{-125} +\dideccolinvuse{A} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + +\clearpage +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = didecformat, doc parameter = \oarg{key list}\marg{didec expr} }, + { doc name = dideccolformat, doc parameter = \oarg{key list}\marg{didec expr} }, + { doc name = dideccolinvformat, doc parameter = \oarg{key list}\marg{didec expr} }, +} +Like \refCom{didecuse}, \refCom{dideccoluse}, \refCom{dideccolinvuse}, +but accepts a \meta{didec expr} instead of a \meta{didec var}. +If the \meta{didec expr} is a \meta{didec var}, +\refCom{didecuse}, \refCom{dideccoluse}, \refCom{dideccolinvuse} are more efficient. +\begin{dispExample} +\didecformat{123456.78}\\ +\didecformat{A}\\ +\didecformat[english]{123456.78}\\ +\dideccolformat{123456.78}\\ +\dideccolinvformat{123456.78} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = didecsetup, doc parameter = \marg{key list} }, +} +Sets all keys of the given \meta{key list}. See the following documentation +for available settings. +\begin{dispExample} +\didecsetup{ + currency = {\pounds}{}, + decimal-separator = {.}, + grouping-separator = {,}, +} +\didecset{A}{123456.78} +\didecuse{A} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + +\clearpage +%------------------------------------------------------------------------------- +\begin{docDidecKeys} +{ + { + doc name = decimal-separator, + doc parameter = {=\marg{separator}}, + doc description = {initially |,|}, + }, +} +Sets some \meta{separator} as decimal separator. +\begin{dispExample} +\didecset{A}{123456.78} +\didecuse[ decimal-separator={\#} ]{A} \par +\end{dispExample} +\end{docDidecKeys} +%------------------------------------------------------------------------------- + + + +%------------------------------------------------------------------------------- +\begin{docDidecKeys} +{ + { + doc name = grouping-separator, + doc parameter = {=\marg{separator}}, + doc description = {initially |.|}, + }, +} +Sets some \meta{separator} as grouping separator. +\begin{dispExample} +\didecset{A}{123456.78} +\didecuse[ grouping-separator={'} ]{A} +\end{dispExample} +\end{docDidecKeys} +%------------------------------------------------------------------------------- + + + +%------------------------------------------------------------------------------- +\begin{docDidecKeys} +{ + { + doc name = currency, + doc parameter = {=\marg{prefix}\marg{postfix}}, + doc description = {initially empty}, + }, +} +Sets some \meta{prefix} and \meta{postfix} to denote the currency of the +didec variable. +This also sets\\ +\refKey{didec/currency-negative}\brackets{\meta{prefix}-}\marg{postfix} +\begin{dispExample} +\didecset{A}{123456.78} +\didecuse[ currency = {\pounds}{} ]{A} \par +\didecuse[ currency = {}{\:Gulden} ]{A} +\end{dispExample} +\end{docDidecKeys} +%------------------------------------------------------------------------------- + + + +%------------------------------------------------------------------------------- +\begin{docDidecKeys} +{ + { + doc name = currency-negative, + doc parameter = {=\marg{prefix}\marg{postfix}}, + doc description = {initially empty}, + }, +} +Sets some \meta{prefix} and \meta{postfix} to denote the currency of the +didec variable, if the resulting value is negative. Otherwise, the settings of +\refKey{didec/currency} are used. +Note that you need to set a minus sign |-| explicitly, if you want to see it. +Also note that setting \refKey{didec/currency} overwrites values given +by \refKey{didec/currency-negative}. +\begin{dispExample} +\didecset{A}{-123456.78} +\didecuse{A}\par +\didecuse[ currency-negative = {$-$}{\;€} ]{A} \par +\didecuse[ currency-negative = {(}{\;€)} ]{A} \par +\didecuse[ currency-negative = {(}{)\;€} ]{A} \par +\didecuse[ currency-negative = {-€}{} ]{A} \par +\end{dispExample} +\end{docDidecKeys} +%------------------------------------------------------------------------------- + + +\clearpage +%------------------------------------------------------------------------------- +\begin{docDidecKeys}[ + doc parameter = , + doc description = style, +] +{ + { doc name = german }, + { doc name = english }, + { doc name = french }, + { doc name = float }, +} +Styles to set some format preferences combined. +Any currency settings are removed and should be applied afterwards, +if needed. +Note that \refCom{didectofp} is more efficient than \refCom{didecuse} with +style \refKey{didec/float}. +\begin{center} +\begin{tabular}{>{\ttfamily}l>{\ttfamily}c>{\ttfamily}c>{\ttfamily}c>{\ttfamily}c}\toprule + & german & english & french & float\\\midrule +decimal-separator & , & . & , & . \\ +grouping-separator & . & , & |\;| & \\\bottomrule +\end{tabular} +\end{center} +\begin{dispExample} +\didecset{A}{12345678.90} +\didecuse[german]{A} \par +\didecuse[english]{A} \par +\didecuse[french]{A} \par +\didecuse[float]{A} \par +\end{dispExample} +\end{docDidecKeys} +%------------------------------------------------------------------------------- + + +%------------------------------------------------------------------------------- +\begin{docDidecKeys} +{ + { + doc name = color-positive, + doc parameter = {=\meta{positive color}}, + doc description = {initially |didec-green|}, + }, + { + doc name = color-negative, + doc parameter = {=\meta{negative color}}, + doc description = {initially |didec-red|}, + }, +} +Sets \meta{positive color} to denote positive (and zero) values +and \meta{negative color} to denote negative values. +Any valid |l3color| \meta{color expression} can be used. +The package defines additional colors +\begin{itemize} +\item\docColorExample{didec-green} +\item\docColorExample{didec-red} +\item\docColorExample{didec-blue} +\end{itemize} +\begin{dispExample} +\didecset{A}{123456.78} +\dideccoluse[ color-positive = magenta ]{A} +\end{dispExample} +\end{docDidecKeys} +%------------------------------------------------------------------------------- + + + + +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = didecwrite, doc parameter = \marg{didec var}\marg{stream} }, + { doc name = didec_write:nn, doc parameter = \marg{didec var}\marg{stream} }, + { doc name = didec_write_check:nn, doc parameter = \marg{didec var}\marg{stream} }, +} +Writes \refCom{didecset}\marg{didec var}\marg{current value} to the given +already opened output \meta{stream}. +\begin{dispListing} +\didecwrite{A}{output} +% writes to output: +% \didecset{A}{VALUE} +\end{dispListing} +\end{docCommands} +%------------------------------------------------------------------------------- + + +\clearpage +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Didec conditionals}% +%------------------------------------------------------------------------------- +\begin{docCommands}[ + doc parameter = \marg{didec var}\marg{true code}\marg{false code}, + ] +{ + { doc name = didecifpositive }, + { doc name = didec_if_positive_p:n, doc parameter = \marg{didec var} }, + { doc name = didec_if_positive:nTF, }, + { doc name = didec_if_positive:nT, doc parameter = \marg{didec var}\marg{true code} }, + { doc name = didec_if_positive:nF, doc parameter = \marg{didec var}\marg{false code} }, + } +Evaluates the \meta{didec var} +and returns |true| or executes the \meta{true code} if the value is positive, +otherwise returns |false| or executes the \meta{false code}. +\begin{dispExample} +\didecset{A}{2799.50} +\didecuse{A} is \didecifpositive{A}{positive}{not positive}. + +\didecset{B}{-584} +\didecuse{B} is \didecifpositive{B}{positive}{not positive}. + +\didecset{A}{0} +\didecuse{A} is \didecifpositive{A}{positive}{not positive}. +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + +%------------------------------------------------------------------------------- +\begin{docCommands}[ + doc parameter = \marg{didec var}\marg{true code}\marg{false code}, + ] +{ + { doc name = didecifnegative }, + { doc name = didec_if_negative_p:n, doc parameter = \marg{didec var} }, + { doc name = didec_if_negative:nTF, }, + { doc name = didec_if_negative:nT, doc parameter = \marg{didec var}\marg{true code} }, + { doc name = didec_if_negative:nF, doc parameter = \marg{didec var}\marg{false code} }, + } +Evaluates the \meta{didec var} +and returns |true| or executes the \meta{true code} if the value is negative, +otherwise returns |false| or executes the \meta{false code}. +\begin{dispExample} +\didecset{A}{2799.50} +\didecuse{A} is \didecifnegative{A}{negative}{not negative}. + +\didecset{B}{-584} +\didecuse{B} is \didecifnegative{B}{negative}{not negative}. + +\didecset{A}{0} +\didecuse{A} is \didecifnegative{A}{negative}{not negative}. +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + +\clearpage +%------------------------------------------------------------------------------- +\begin{docCommands}[ + doc parameter = \marg{didec var}\marg{true code}\marg{false code}, + ] +{ + { doc name = didecifzero }, + { doc name = didec_if_zero_p:n, doc parameter = \marg{didec var} }, + { doc name = didec_if_zero:nTF, }, + { doc name = didec_if_zero:nT, doc parameter = \marg{didec var}\marg{true code} }, + { doc name = didec_if_zero:nF, doc parameter = \marg{didec var}\marg{false code} }, + } +Evaluates the \meta{didec var} +and returns |true| or executes the \meta{true code} if the value is zero, +otherwise returns |false| or executes the \meta{false code}. +\begin{dispExample} +\didecset{A}{2799.50} +\didecuse{A} is \didecifzero{A}{zero}{not zero}. + +\didecset{B}{-584} +\didecuse{B} is \didecifzero{B}{zero}{not zero}. + +\didecset{A}{0} +\didecuse{A} is \didecifzero{A}{zero}{not zero}. +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + + + + + +%------------------------------------------------------------------------------- +\begin{docCommands}[ + doc parameter = \marg{didec expr\textsubscript{1}}\marg{didec expr\textsubscript{2}}\marg{true code}\marg{false code}, + ] +{ + { doc name = dideciflowerthan }, + { doc name = didecifequal }, + { doc name = didecifgreaterthan }, + { doc name = didec_compare_p:nNn, doc parameter = \marg{didec expr\textsubscript{1}}\meta{relation}\marg{didec expr\textsubscript{2}} }, + { doc name = didec_compare:nNnTF, doc parameter = \marg{didec expr\textsubscript{1}}\meta{relation}\marg{didec expr\textsubscript{2}}\marg{true code}\marg{false code} }, + { doc name = didec_compare:nNnT, doc parameter = \marg{didec expr\textsubscript{1}}\meta{relation}\marg{didec expr\textsubscript{2}}\marg{true code} }, + { doc name = didec_compare:nNnF, doc parameter = \marg{didec expr\textsubscript{1}}\meta{relation}\marg{didec expr\textsubscript{2}}\marg{false code} }, + } +Compares the \meta{didec expr\textsubscript{1}} and the \meta{didec expr\textsubscript{2}}, +and returns |true| or executes the \meta{true code} if the \meta{relation} (given by function respectively) +is obeyed, otherwise returns |false| or executes the \meta{false code}. +\begin{dispExample} +\didecset{A}{2799.50} +\didecset{B}{-584} +\didecuse{A} is \dideciflowerthan{A}{B}{lower}{not lower} than \didecuse{B} + +\didecuse{A} is \didecifequal{A}{B}{equal}{not equal} to \didecuse{B} + +\didecuse{A} is \didecifequal{A}{A}{equal}{not equal} to \didecuse{A} + +\didecuse{A} is \didecifgreaterthan{A}{B}{greater}{not greater} than \didecuse{B} +\end{dispExample} +\end{docCommands} +%------------------------------------------------------------------------------- + + +\clearpage +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Viewing didecs}% + +%------------------------------------------------------------------------------- +\begin{docCommands} +{ + { doc name = didec_show:n, doc parameter = \marg{didec var} }, + } +Displays the content of \meta{didec var} in the terminal. +\begin{dispListing} +\didecset{A}{2799.50} +\ExplSyntaxOn +\didec_show:n{A} +\ExplSyntaxOff +\end{dispListing} +\end{docCommands} +%------------------------------------------------------------------------------- + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\clearpage +\phantomsection +\printindex + +\end{document} diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index 1921c11313..e0506e460d 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -15,7 +15,7 @@ %<*class> \NeedsTeXFormat{LaTeX2e}[2021/11/15] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2024/02/25}{2024al} +\ProvidesExplClass{easybook}{2024/02/28}{2024an} {Easily typesetting Chinese theses or books} \bool_new:N \l__eb_compile_draft_bool @@ -297,7 +297,7 @@ %<*package> \NeedsTeXFormat{LaTeX2e}[2021/11/15] \RequirePackage{l3keys2e,etoolbox} -\ProvidesExplPackage{easybase}{2024/02/25}{2024al} +\ProvidesExplPackage{easybase}{2024/02/28}{2024an} {Easily typesetting Chinese theses or books} \cs_generate_variant:Nn \dim_set:Nn { NV } @@ -668,9 +668,9 @@ \cs_set:Npn \markdouble #1 { \markboth{#1}{\ifbool{@twoside}{#1}{}} } \cs_new:Npn \eb@level@markdouble #1#2 - { \markdouble{\use:c { eb@mark@#1@whole } {#2}} } + { \markdouble{\use:c { eb@mark@#1@whole }{#2}} } \cs_new:Npn \eb@level@markright #1#2 - { \markright{\use:c { eb@mark@#1@whole } {#2}} } + { \markright{\use:c { eb@mark@#1@whole }{#2}} } \cs_gset:Npn \chaptermark #1 { \eb@level@markdouble{chapter}{#1} } \cs_gset:Npn \sectionmark #1 { @@ -2390,7 +2390,7 @@ } % %<*tcolorbox> -\ProvidesExplFile{eb-tcolorbox.cfg}{2024/02/25}{2024al} +\ProvidesExplFile{eb-tcolorbox.cfg}{2024/02/28}{2024an} {Customization of tcolorbox for easybook} \cs_set_protected:Npn \addtotcbstyle #1#2 diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf index 707045d46f..3bc9fb4d0e 100644 Binary files a/macros/latex/contrib/easybook/easybook.pdf and b/macros/latex/contrib/easybook/easybook.pdf differ diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex index 061dcd0b08..58886c011f 100644 --- a/macros/latex/contrib/easybook/easybook.tex +++ b/macros/latex/contrib/easybook/easybook.tex @@ -10,7 +10,7 @@ \definecolorscheme{blue} { cs => violet, - option => Green, + option => DarkGreen, cnltx => DarkBlue, link => DeepPink, module => FireBrick, @@ -23,8 +23,8 @@ name = easybook, color-scheme = blue, title = EASYBOOK使用手册, - version = v2024al, - date = 2024/02/25, + version = v2024an, + date = 2024/02/28, authors = 瞿毅, info = 简便地排版中文学位论文或书籍, email = toquyi@163.com, @@ -1401,7 +1401,7 @@ \shortversion{v = 1.638,date = 2022/03/04,changes = 增加目录条目样式选项注册命令 \cs{RegisterTocName}。} \shortversion{v = 1.644,date = 2022/03/10,changes = 增加浮动环境目录声明命令 \cs{DeclareFloatList} 配合 \pkg*{caption} 宏包。} \shortversion{v = 1.682,date = 2022/05/01,changes = 将迷你页判断命令 \cs{notminipage} 改为被保护命令兼容 \pkg*{circledtext} 宏包。} - \begin{version}[v = 2024al,date = 2024/02/25] + \begin{version}[v = 2024an,date = 2024/02/28] \fixed \item 修复图表等浮动环境题注目录中条目标签编号的计数器值显示错误问题。 \item 修复附录命令 \cs{appendix} 的可选参数设置英文目录中条目名字和编号失效的问题。 diff --git a/macros/latex/contrib/mandi/mandi.dtx b/macros/latex/contrib/mandi/mandi.dtx index 3907b21e1b..d1a72ab2b2 100644 --- a/macros/latex/contrib/mandi/mandi.dtx +++ b/macros/latex/contrib/mandi/mandi.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % !TEX program = lualatexmk % -% Copyright (C) 2023 by Paul J. Heafner +% Copyright (C) 2021-2024 by Paul J. Heafner % --------------------------------------------------------------------------- % This work may be distributed and/or modified under the conditions of the % LaTeX Project Public License, either version 1.3c of this license or (at @@ -181,7 +181,7 @@ % \title{The \href{https://ctan.org/pkg/mandi}{\mandi} Bundle} % \author{^^A % Paul J. Heafner\thanks{^^A -% Email: \href{mailto:heafnerj@gmail.com?subject=[Heafner]\%20mandi} +% Email: \href{mailto:heafnerj@gmail.com?subject=from mandi documentation} % {heafnerj@gmail.com}^^A % }^^A % }^^A @@ -259,6 +259,10 @@ % {\linktoplace{sec:mandia}{mandi} \linktoplace{sec:mandib}{mandistudent} % \linktoplace{sec:mandic}{mandiexp} Source updated and bumped version for new % \texttt{CTAN} upload} +% \changes{v3.2.2}{2024-02-27}{\linktoplace{sec:mandia}{mandi} Removed unnecessary +% \cs{ExplSyntaxOn} and \cs{ExplSyntaxOff} pairs} +% \changes{v3.2.2}{2024-02-27}{\linktoplace{sec:mandia}{mandi} Ensured all +% subscripts and superscripts are braced} % % \section{Introduction} % The \mandi \footnote{The bundle name can be pronounced either with two @@ -380,7 +384,7 @@ %<*example> %\fi \begin{dispExample*}{sidebyside = false} - \( \mivector{\slot,\slot,\slot} \) or \( \mivector{p_x,p_y,p_z} \) \\ + \( \mivector{\slot,\slot,\slot} \) or \( \mivector{p_{x},p_{y},p_{z}} \) \\ \( \direction{\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}}} \) or \end{dispExample*} %\iffalse @@ -502,11 +506,11 @@ {% doc new = 2021-02-24,% doc name = momentumvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectormomentum,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% Command for momentum and its vector variants. The default units will depend @@ -548,8 +552,9 @@ % % Commands that include the name of a physical quantity typeset units, so % they shouldn't be used for algebraic or symbolic values of components. -% For example, one shouldn't use |\vectormomentum{mv_x,mv_y,mv_z}| but -% instead the generic |\mivector{mv_x,mv_y,mv_z}| instead. +% Don't use +% |\vectormomentum{mv_{x},mv_{y},mv_{z}}| but +% instead the generic |\mivector{mv_{x},mv_{y},mv_{z}}| instead. % % \subsubsection{Checking Physical Quantities} % @@ -587,11 +592,11 @@ {% doc new = 2021-02-24,% doc name = accelerationvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectoracceleration,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -608,11 +613,11 @@ {% doc new = 2021-02-24,% doc name = angularaccelerationvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorangularacceleration,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -629,11 +634,11 @@ {% doc new = 2021-02-24,% doc name = angularimpulsevector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorangularimpulse,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -647,11 +652,11 @@ {% doc new = 2021-02-24,% doc name = angularmomentumvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorangularmomentum,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -665,11 +670,11 @@ {% doc new = 2021-02-24,% doc name = angularvelocityvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorangularvelocity,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -698,11 +703,11 @@ {% doc new = 2021-02-24,% doc name = cmagneticfieldvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorcmagneticfield,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -728,11 +733,11 @@ {% doc new = 2021-02-24,% doc name = currentdensityvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorcurrentdensity,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -749,11 +754,11 @@ },% {% doc name = directionvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectordirection,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -767,11 +772,11 @@ {% doc new = 2021-02-24,% doc name = displacementvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectordisplacement,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -788,10 +793,10 @@ {% doc new = 2021-02-24,% doc name = electricdipolemomentvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% { doc name = vectorelectricdipolemoment,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -805,11 +810,11 @@ {% doc new = 2021-02-24,% doc name = electricfieldvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorelectricfield,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -853,11 +858,11 @@ {% doc new = 2021-02-24,% doc name = energyfluxvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorenergyflux,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -874,11 +879,11 @@ {% doc new = 2021-02-24,% doc name = forcevector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorforce,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -895,11 +900,11 @@ {% doc new = 2021-02-24,% doc name = gravitationalfieldvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorgravitationalfield,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -919,11 +924,11 @@ {% doc new = 2021-02-24,% doc name = impulsevector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorimpulse,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -958,11 +963,11 @@ {% doc new = 2021-02-24,% doc name = magneticdipolemomentvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectormagneticdipolemoment,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -976,11 +981,11 @@ {% doc new = 2021-02-24,% doc name = magneticfieldvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectormagneticfield,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -1008,12 +1013,12 @@ doc new = 2021-02-24,% doc name = momentumvector,% doc label = momentumvectordemo,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectormomentum,% doc label = vectormomentumdemo,% - doc parameter = \marg{\( c_1,\dots,c_n \)} },% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)} },% }% \end{docCommands} \CheckQuantity{momentum} @@ -1026,11 +1031,11 @@ {% doc new = 2021-02-24,% doc name = momentumfluxvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectormomentumflux,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -1062,11 +1067,11 @@ {% doc new = 2021-02-24,% doc name = poyntingvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorpoynting,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -1116,11 +1121,11 @@ {% doc new = 2021-02-24,% doc name = torquevector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectortorque,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -1134,11 +1139,11 @@ {% doc new = 2021-02-24,% doc name = velocityvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorvelocity,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -1152,11 +1157,11 @@ {% doc new = 2021-02-24,% doc name = velocitycvector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorvelocityc,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -1182,11 +1187,11 @@ {% doc new = 2021-02-24,% doc name = wavenumbervector,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% {% doc name = vectorwavenumber,% - doc parameter = \marg{\( c_1,\dots,c_n \)},% + doc parameter = \marg{\( c_{1},\dots,c_{n} \)},% },% }% \end{docCommands} @@ -1842,7 +1847,7 @@ \begin{dispExample} \( \per \) \\ \( \usk \) \\ - \( \units{3}{\meter\per\second} \) \\ + \( \units{3}{\meter\per\second} \) \\ \( \emptyunit \) \\ \( \ampere \) \\ \( \atomicmassunit \) \\ @@ -1930,7 +1935,7 @@ %<*example> %\fi \begin{docCommand}[doc updated = 2022-01-27]{mivector}{% - \oarg{delimiter}\marg{\( c_1,\dots,c_n \)}\oarg{units} + \oarg{delimiter}\marg{\( c_{1},\dots,c_{n} \)}\oarg{units} }% Typesets a vector as either numeric or symbolic components with an optional unit (for numerical components only). There must be more @@ -1940,12 +1945,12 @@ \emph{Matter \& Interactions}. \end{docCommand} \begin{dispExample*}{lefthand ratio = 0.70} - \( \mivector{p_0,p_1,p_2,p_3} \) \\ - \( \mivector{\gamma mc,\gamma mv_x,\gamma mv_y,\gamma mv_z} \) \\ - \( \mivector{\frac{Q_1Q_2}{x^2},0,0} \) \\ - \( \mivector{-1,0,0} \) \\ - \( \mivector{-1,0,0}[\velocityonlyderivedunits] \) \\ - \( \mivector{-1,0,0}[\meter\per\second] \) \\ + \( \mivector{p_0,p_1,p_2,p_3} \) \\ + \( \mivector{\gamma mc,\gamma mv_{x},\gamma mv_{y},\gamma mv_{z}} \) \\ + \( \mivector{\frac{Q_1Q_2}{x^2},0,0} \) \\ + \( \mivector{-1,0,0} \) \\ + \( \mivector{-1,0,0}[\velocityonlyderivedunits] \) \\ + \( \mivector{-1,0,0}[\meter\per\second] \) \\ \( \velocity{\mivector{-1,0,0}} \) \end{dispExample*} %\iffalse @@ -1966,10 +1971,10 @@ % in the name) that are not for the user to know about. % % \begin{macrocode} -\def\mandi@version{3.2.1} -\def\mandi@date{2023-11-22} +\def\mandi@version{3.2.2} +\def\mandi@date{2024-02-27} \NeedsTeXFormat{LaTeX2e}[2020-02-02] -\DeclareRelease{v3.2.1}{2023-11-22}{mandi.sty} +\DeclareRelease{v3.2.2}{2024-02-27}{mandi.sty} \DeclareCurrentRelease{v\mandi@version}{\mandi@date} \ProvidesPackage{mandi} [\mandi@date\space v\mandi@version\space Macros for physical quantities] @@ -2268,13 +2273,11 @@ { \__mandi_newscalarquantity:nnnn { #1 }{ #2 }{ #3 }{ #4 } } -\ExplSyntaxOff % \end{macrocode} % % Redefining an existing scalar quantity. % % \begin{macrocode} -\ExplSyntaxOn \cs_new:Npn \__mandi_renewscalarquantity:nnnn #1#2#3#4 { \cs_set:cpn {#1} ##1 {\units{##1}{\mandi@selectunits{#2}{#3}{#4}}} @@ -2290,13 +2293,11 @@ { \__mandi_renewscalarquantity:nnnn { #1 }{ #2 }{ #3 }{ #4 } } -\ExplSyntaxOff % \end{macrocode} % % Defining a new vector quantity. Note that a corresponding scalar is also defined. % % \begin{macrocode} -\ExplSyntaxOn \cs_new:Npn \__mandi_newvectorquantity:nnnn #1#2#3#4 { \__mandi_newscalarquantity:nnnn { #1 }{ #2 }{ #3 }{ #4 } @@ -2321,13 +2322,11 @@ { \__mandi_newvectorquantity:nnnn { #1 }{ #2 }{ #3 }{ #4 } } -\ExplSyntaxOff % \end{macrocode} % % Redefining an existing vector quantity. Note that a corresponding scalar is also redefined. % % \begin{macrocode} -\ExplSyntaxOn \cs_new:Npn \__mandi_renewvectorquantity:nnnn #1#2#3#4 { \__mandi_renewscalarquantity:nnnn { #1 }{ #2 }{ #3 }{ #4 } @@ -2352,13 +2351,11 @@ { \__mandi_renewvectorquantity:nnnn { #1 }{ #2 }{ #3 }{ #4 } } -\ExplSyntaxOff % \end{macrocode} % % Defining a new physical constant. % % \begin{macrocode} -\ExplSyntaxOn \cs_new:Npn \__mandi_newphysicalconstant:nnnnnnn #1#2#3#4#5#6#7 { \cs_new:cpn {#1} {\units{\mandi@selectprecision{#3}{#4}}{\mandi@selectunits{#5}{#6}{#7}}} @@ -2379,13 +2376,11 @@ { \__mandi_newphysicalconstant:nnnnnnn { #1 }{ #2 }{ #3 }{ #4 }{ #5 }{ #6 }{ #7 } } -\ExplSyntaxOff % \end{macrocode} % % Redefining an existing physical constant. % % \begin{macrocode} -\ExplSyntaxOn \cs_new:Npn \__mandi_renewphysicalconstant:nnnnnnn #1#2#3#4#5#6#7 { \cs_set:cpn {#1} {\units{\mandi@selectprecision{#3}{#4}}{\mandi@selectunits{#5}{#6}{#7}}} diff --git a/macros/latex/contrib/mandi/mandi.ins b/macros/latex/contrib/mandi/mandi.ins index a479906b68..c5ba38a19b 100644 --- a/macros/latex/contrib/mandi/mandi.ins +++ b/macros/latex/contrib/mandi/mandi.ins @@ -6,7 +6,7 @@ %% %% mandi.dtx (with options: `install') %% -%% Copyright (C) 2023 by Paul J. Heafner +%% Copyright (C) 2021-2024 by Paul J. Heafner %% --------------------------------------------------------------------------- %% This work may be distributed and/or modified under the conditions of the %% LaTeX Project Public License, either version 1.3c of this license or (at @@ -38,7 +38,7 @@ \usedir{tex/latex/mandi} \preamble - Copyright (C) 2023 by Paul J. Heafner + Copyright (C) 2021-2024 by Paul J. Heafner --------------------------------------------------------------------------- This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license or (at diff --git a/macros/latex/contrib/mandi/mandi.pdf b/macros/latex/contrib/mandi/mandi.pdf index 9b3fa83b44..a3d53d4794 100644 Binary files a/macros/latex/contrib/mandi/mandi.pdf and b/macros/latex/contrib/mandi/mandi.pdf differ diff --git a/macros/latex/contrib/mandi/mandiexp.dtx b/macros/latex/contrib/mandi/mandiexp.dtx index bbd1501a73..7ea77c5f84 100644 --- a/macros/latex/contrib/mandi/mandiexp.dtx +++ b/macros/latex/contrib/mandi/mandiexp.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % !TEX program = lualatexmk % -% Copyright (C) 2023 by Paul J. Heafner +% Copyright (C) 2021-2024 by Paul J. Heafner % --------------------------------------------------------------------------- % This work may be distributed and/or modified under the conditions of the % LaTeX Project Public License, either version 1.3c of this license or (at @@ -571,10 +571,10 @@ % \changes{v3.1.0}{2022-01-27} % {\linktoplace{sec:mandic}{mandiexp} Version number works} % \begin{macrocode} -\def\mandiexp@version{3.2.1} -\def\mandiexp@date{2023-11-22} +\def\mandiexp@version{3.2.2} +\def\mandiexp@date{2024-02-27} \NeedsTeXFormat{LaTeX2e}[2020-02-02] -\DeclareRelease{v3.2.1}{2023-11-22}{mandiexp.sty} +\DeclareRelease{v3.2.2}{2024-02-27}{mandiexp.sty} \DeclareCurrentRelease{v\mandiexp@version}{\mandiexp@date} \ProvidesPackage{mandiexp} [\mandiexp@date\space v\mandiexp@version\space Macros for Matter & Interactions] diff --git a/macros/latex/contrib/mandi/mandistudent.dtx b/macros/latex/contrib/mandi/mandistudent.dtx index da277a0baa..0360617b50 100644 --- a/macros/latex/contrib/mandi/mandistudent.dtx +++ b/macros/latex/contrib/mandi/mandistudent.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % !TEX program = lualatexmk % -% Copyright (C) 2023 by Paul J. Heafner +% Copyright (C) 2021-2024 by Paul J. Heafner % --------------------------------------------------------------------------- % This work may be distributed and/or modified under the conditions of the % LaTeX Project Public License, either version 1.3c of this license or (at @@ -722,7 +722,7 @@ while t < 10: %<*example> %\fi \begin{docCommands}[% - doc parameter = \oarg{delimiter}\marg{\( c_1,\dots,c_n \)},% + doc parameter = \oarg{delimiter}\marg{\( c_{1},\dots,c_{n} \)},% ]% {% {% @@ -740,8 +740,8 @@ while t < 10: \begin{dispExample} \[ \colvec{1,2,3} \] \[ \rowvec{1,2,3} \] - \[ \colvec{x^0,x^1,x^2,x^3} \] - \[ \rowvec{x_0,x_1,x_2,x_3} \] + \[ \colvec{x^{0},x^{1},x^{2},x^{3}} \] + \[ \rowvec{x_{0},x_{1},x_{2},x_{3}} \] \end{dispExample} %\iffalse % @@ -1243,10 +1243,10 @@ while t < 10: % \changes{v3.1.0}{2022-01-27} % {\linktoplace{sec:mandib}{mandistudent} Version number works} % \begin{macrocode} -\def\mandistudent@version{3.2.1} -\def\mandistudent@date{2023-11-22} +\def\mandistudent@version{3.2.2} +\def\mandistudent@date{2024-02-27} \NeedsTeXFormat{LaTeX2e}[2020-02-02] -\DeclareRelease{v3.2.1}{2023-11-22}{mandistudent.sty} +\DeclareRelease{v3.2.2}{2024-02-27}{mandistudent.sty} \DeclareCurrentRelease{v\mandistudent@version}{\mandistudent@date} \ProvidesPackage{mandistudent} [\mandistudent@date\space v\mandistudent@version\space Macros for introductory physics] -- cgit v1.2.3