summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/non-decimal-units
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-09-28 03:01:12 +0000
committerNorbert Preining <norbert@preining.info>2023-09-28 03:01:12 +0000
commit30430eda38d883489e7ec7119ef3589d7f96e17d (patch)
tree03f569686df3c011dd21060461b232f8c460998b /macros/latex/contrib/non-decimal-units
parentddf6d4e181f87c112f2d86ecbb7c3af314ce548a (diff)
CTAN sync 202309280301
Diffstat (limited to 'macros/latex/contrib/non-decimal-units')
-rw-r--r--macros/latex/contrib/non-decimal-units/README.md2
-rw-r--r--macros/latex/contrib/non-decimal-units/docs/non-decimal-units.pdfbin161903 -> 163176 bytes
-rw-r--r--macros/latex/contrib/non-decimal-units/docs/non-decimal-units.tex28
-rw-r--r--macros/latex/contrib/non-decimal-units/docs/test.pdfbin20459 -> 0 bytes
-rw-r--r--macros/latex/contrib/non-decimal-units/docs/test.tex232
-rw-r--r--macros/latex/contrib/non-decimal-units/latex/non-decimal-units.sty2
6 files changed, 24 insertions, 240 deletions
diff --git a/macros/latex/contrib/non-decimal-units/README.md b/macros/latex/contrib/non-decimal-units/README.md
index 16bb099f73..fb4f75a2c0 100644
--- a/macros/latex/contrib/non-decimal-units/README.md
+++ b/macros/latex/contrib/non-decimal-units/README.md
@@ -5,7 +5,7 @@ Macros for displaying and manipulating historical non-decimal units.
See [non-decimal-units.pdf](docs/non-decimal-units.pdf) for the documentation.
-Contents last updated 2023-09-26.
+Contents last updated 2023-09-27.
<!-- Package available via CTAN at https://www.ctan.org/pkg/non-decimal-units -->
diff --git a/macros/latex/contrib/non-decimal-units/docs/non-decimal-units.pdf b/macros/latex/contrib/non-decimal-units/docs/non-decimal-units.pdf
index 309a4651d8..60e5b7acd8 100644
--- a/macros/latex/contrib/non-decimal-units/docs/non-decimal-units.pdf
+++ b/macros/latex/contrib/non-decimal-units/docs/non-decimal-units.pdf
Binary files differ
diff --git a/macros/latex/contrib/non-decimal-units/docs/non-decimal-units.tex b/macros/latex/contrib/non-decimal-units/docs/non-decimal-units.tex
index 06a83532fb..d5490aa021 100644
--- a/macros/latex/contrib/non-decimal-units/docs/non-decimal-units.tex
+++ b/macros/latex/contrib/non-decimal-units/docs/non-decimal-units.tex
@@ -18,7 +18,7 @@
\section{Preface} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-Many historical unit systems were non-decimal. For example, the Danish rigsdaler\footnote{\url{https://en.wikipedia.org/wiki/Danish_rigsdaler}} --- where 1 \nduName{danish rigsdaler}{0} consists of \nduFactor{danish rigsdaler}{0} \nduName{danish rigsdaler}{1}, each again consisting of \nduFactor{danish rigsdaler}{1} \nduName{danish rigsdaler}{2} for a total of 96 \nduName{danish rigsdaler}{2} or per \nduName{danish rigsdaler}{0} --- was used from 1625 to 1875, when currency was decimalised to the current system of 1 krone = 100 øre.
+Many historical unit systems were non-decimal. For example, the Danish rigsdaler\footnote{\url{https://en.wikipedia.org/wiki/Danish_rigsdaler}} --- where 1 \nduName{danish rigsdaler}{0} consists of \nduFactor{danish rigsdaler}{1}~\nduName{danish rigsdaler}{1}, each again consisting of \nduFactor{danish rigsdaler}{2}~\nduName{danish rigsdaler}{2} for a total of 96 \nduName{danish rigsdaler}{2} per \nduName{danish rigsdaler}{0} --- was used from 1625 to 1875, when currency was decimalised to the current system of 1 krone = 100 øre.
% https://en.wikipedia.org/wiki/Non-decimal_currency
@@ -191,13 +191,13 @@ All segments will be included in the headers and cells, whether they contain a v
},
{
doc name = set aligned for environment,
- doc description = {initially not set},
+ doc description = {initially set for \texttt{tabular}},
},
}
Setting \docAuxKey*{aligned} will format the presently displayed header in aligned boxes, desirable in tabular contexts.
- In this document, the \docAuxKey*{set aligned for environment} key has been set for \texttt{tabular}, which means that all values in the tables are automatically aligned. It can be set multiple times, once for each required environment.
+ Additionally, the \docAuxKey*{set aligned for environment} key can be set to an environment name, causing \docAuxKey*{aligned} to automatically be set aligned for those enviroments, using \docAuxCommand*{AtBeginEnvironment}. It can be set multiple times, once for each required environment.
\begin{dispExample*}{
title=Example usage: \docAuxCommand*{nduHeader} and \docAuxCommand*{nduValue} macros with \docAuxKey*{aligned} key.
@@ -249,7 +249,7 @@ Changes the width of each segment.
Basic arithmetic functions can be used to build a result for display. Internally, this is done by converting the value to a representation, which is the total number of the smallest usable unit, eg. \nduValue{danish rigsdaler}{1.2.3} is 131 \nduName{danish rigsdaler}{2}.
-Results can be gathered in two ways, either manually via the \docAuxCommand*{nduMath} macro, or automatically via the \docAuxKey*{add to variable} and \docAuxKey*{subtract from variable} keys, the latter being especially suitable in tabular contexts.
+Results can be gathered in two ways, either manually via the \docAuxCommand*{nduMath} macro, or automatically via the \docAuxKey{add to variable} and \docAuxKey{subtract from variable} keys, the latter being especially suitable in tabular contexts.
\begin{docCommands}[]{
{
@@ -262,7 +262,7 @@ Results can be gathered in two ways, either manually via the \docAuxCommand*{ndu
}
}
-The first arguments of \docAuxCommand*{nduMath} are identical to those of the \refCom{nduValue} macro. In addition, it has \meta{operator} (one of \texttt{+ - * /}) and \meta{variable} arguments. The first time a variable is used, it is assumed that the value is 0. The given value is then converted to its internal representation and stored in the variable. The command does not expand to any output.
+The first arguments of \docAuxCommand*{nduMath} are identical to those of the \refCom{nduValue} macro. In addition, it has \meta{variable} and \meta{operator} (one of \texttt{+ - * /}) arguments. The first time a variable is used, it is assumed that the value is 0. The given value is then converted to its internal representation and stored in the variable. The command does not expand to any output.
Note that mixing units in the same variable is not currently supported, and will likely give incorrect results.
@@ -339,7 +339,23 @@ Adding an additional 15 \nduName{danish rigsdaler}{2} to the existing result giv
\end{dispExample}
\end{docKeys}
-\subsection{Accessing Information About Units} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{docKey}
+ {normalize}
+ {}
+ {initially not set}
+
+Reformats an amount, which is useful for quick conversions.
+
+\begin{dispExample*}{
+ title=Example usage: \docAuxKey*{normalize} key
+}
+100 \nduName{danish rigsdaler}{2} equal
+\nduValue{danish rigsdaler}[normalize]{..100} % 1.0.4
+\end{dispExample*}
+\end{docKey}
+
+
+\section{Accessing Information About Units} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{docCommand}
{nduName}
diff --git a/macros/latex/contrib/non-decimal-units/docs/test.pdf b/macros/latex/contrib/non-decimal-units/docs/test.pdf
deleted file mode 100644
index 6cb11b3f93..0000000000
--- a/macros/latex/contrib/non-decimal-units/docs/test.pdf
+++ /dev/null
Binary files differ
diff --git a/macros/latex/contrib/non-decimal-units/docs/test.tex b/macros/latex/contrib/non-decimal-units/docs/test.tex
deleted file mode 100644
index 69b5d73a9b..0000000000
--- a/macros/latex/contrib/non-decimal-units/docs/test.tex
+++ /dev/null
@@ -1,232 +0,0 @@
-% !TEX TS-program = LuaLaTeX-shell-escape
-\documentclass{article}
-\usepackage{trace}
-
-\usepackage{non-decimal-units.preamble}
-
-%\nduset{logging}
-
-\makeatletter
-
-\begin{document}
-
-
-\nduNewMacro{rigsdaler.mark.skilling}
- [unit groups/rigsdaler.mark.skilling,segment 0/symbol={R\textsuperscript{dl}}]
- {myRdl}
-\myRdl{1.2.3}
-
-\end{document}
-
-\nduValue{sletdaler.mark}{1.2}%
-
-
-%\traceon
-\nduValue{sletdaler.mark}[restrict segment depth=2]{1.2}%
-%\traceoff
-
-%\end{document}
-
-
-\nduValue{danish rigsbankdaler}{.120}
-
-
-normalize 120 skilling = \nduValue{danish rigsdaler}[
- normalize,
- treat zero as nil,
-]{..120} = 1.1.8
-
-
-\nduValue{danish rigsbankdaler}{.100}
-
-\nduValue{sletdaler.mark}{1.2}%
-
-\rbd{1.2} = 1.2
-
-\rbd{.100} = 1.4
-
-\rdl{..120} = 1.1.8
-
-
-
-%\end{document}
-
-\nduAliasOrGroup{danish rigsbankdaler} == \nduAliasOrGroup{rigsbankdaler.skilling}
-
-\nduValue{danish rigsbankdaler}{50.10} == \nduValue{rigsbankdaler.skilling}{50.10}
-
-\begingroup
-\nduset{
- aliases/danish sletdaler,
- restrict segment depth=2,
-}
-
-\nduset{
- unit groups/sletdaler.mark.skilling.penning/restrict segment depth=2,
-}
-\endgroup
-
-\nduValue{danish rigsdaler}[
- restrict segment depth=2,
- segment separator=!,
-]{1..3} = 1!3
-
-\nduValue{sletdaler.mark.skilling}[
- restrict segment depth=2,
- segment separator=!,
-]{1..2} = 1!2
-
-
-factor: \pgfkeysvalueof{/ndu/base units/rigsdaler/factors/ort}
-
-factor: \pgfkeysvalueof{/ndu/base units/rigsdaler/factors/mark}
-
-factor: \pgfkeysvalueof{/ndu/base units/tønde/factors/skæppe}
-
-
-%\nduFactor{danish rigsdaler}{0}
-
-\nduFactor{danish rigsdaler}{1} \nduSymbol{danish rigsdaler}{1} per \nduSymbol{danish rigsdaler}{0}
-
-\nduFactor{danish rigsdaler}{2} \nduSymbol{danish rigsdaler}{2} per \nduSymbol{danish rigsdaler}{1}
-
-\nduFactor{danish rigsdaler}{3} \nduSymbol{danish rigsdaler}{3} per \nduSymbol{danish rigsdaler}{2}
-
-%\nduFactor{danish rigsdaler}{4} \nduSymbol{danish rigsdaler}{4} per \nduSymbol{danish rigsdaler}{3}
-
-%\end{document}
-
-
-\section{Aligned math test}
-
- testing with 1.2.3.4 = 1*6*16*12 + 2*16*12 + 3*12 + 4 = 1576
-
- \csdef{ndu@repr@TEST}{0}
- init as 0: \csuse{ndu@repr@TEST}
-
- \nduConvertToRepr@helper{danish rigsdaler}{TEST}{0}{1}
- no conv, add rdl: 0 + 1 = 1 --- is \csuse{ndu@repr@TEST}
-
- \nduConvertToRepr@helper{danish rigsdaler}{TEST}{1}{2}
- conv to mk, add mk: 1*6 + 2 = 8 --- is \csuse{ndu@repr@TEST}
-
- \nduConvertToRepr@helper{danish rigsdaler}{TEST}{2}{3}
- conv to sk, add sk: 8*16 + 3 = 131 --- is \csuse{ndu@repr@TEST}
-
- \nduConvertToRepr@helper{danish rigsdaler}{TEST}{3}{4}
- conv to pg, add pg: 131*12 + 4 = 1576 --- is \csuse{ndu@repr@TEST}
-
- \nduConvertToRepr@helper{danish rigsdaler}{TEST}{4}{0}
- no conv, no add: --- is \csuse{ndu@repr@TEST}
-
-\nduResult{danish rigsdaler}{TEST}
-
-
-\nduValue{danish rigsdaler}[replace nil with=---]{1..3} = 1.---.3.---
-
-\nduValue{danish rigsdaler}{1..3} = 1..3
-
-\nduValue{danish rigsdaler}{1.2.3} = 1.2.3
-
-\nduConvertToRepr{danish rigsdaler}{baz}{1.2.3.4} 1.2.3.4 =
-baz: \nduResult{danish rigsdaler}{baz}
-
-\nduConvertToRepr{danish rigsdaler}{foo}{1.2.3} 1.2.3 =
-foo: \nduResult{danish rigsdaler}{foo}
-
-foo with local zero as nil: \nduResult{danish rigsdaler}[treat zero as nil]{foo}
-
-Setting depth to 2
-
-\traceon
-\nduset{
-% unit groups/rigsdaler.mark.skilling.penning/restrict segment depth=2,
- aliases/danish rigsdaler,
- restrict segment depth=2,
-}
-\traceoff
-
-\nduConvertToRepr{danish rigsdaler}{zap}{1.2.3.4} 1.2.3.4 =
-zap: \nduResult{danish rigsdaler}{zap}
-
-\nduConvertToRepr{danish rigsdaler}{bar}{1.2.3} 1.2.3 =
-bar: \nduResult{danish rigsdaler}{bar}
-
-
-\section{Zero test}
-
-should be 1.0.1: \nduValue{danish rigsdaler}{1.0.1}
-
-should be 1..1: \nduValue{danish rigsdaler}[treat zero as nil]{1.0.1}
-
-
-\section{Math test}
-
-\nduMath{danish rigsdaler}{math}{+}{..8}
-\nduResult{danish rigsdaler}{math}
-
-\nduMath{danish rigsdaler}{math}{+}{..8}
-\nduResult{danish rigsdaler}{math}
-
-\nduMath{danish rigsdaler}{math}{+}{..9}
-\nduResult{danish rigsdaler}{math}
-
-\nduMath{danish rigsdaler}{math}{-}{..8}
-\nduResult{danish rigsdaler}{math} = 0.1.1
-
-\nduMath{danish rigsdaler}{math}{+}{..8}
-\nduResult{danish rigsdaler}{math} = 0.1.9
-
-\nduMath{danish rigsdaler}{math}{*}{2}
-\nduResult{danish rigsdaler}{math} = 0.3.2
-
-\section{Aligned math test}
-
-\begingroup
-\nduset{
- aligned,
- cell width=3em,
- replace nil with=---,
- treat zero as nil,
- add to variable=example 2
-}
-\begin{tabular}{r r}
- \toprule
- & \nduHeader{danish rigsdaler} \\
- \midrule
- a & \nduValue{danish rigsdaler}{1.2.3} \\
- b & \nduValue{danish rigsdaler}{100.1.} \\
- c & \nduValue{danish rigsdaler}{0..15} \\
- \bottomrule
- total & \nduResult{danish rigsdaler}{example 2} \\
-\end{tabular} = 101.4.2
-\endgroup
-
-\end{document}
-
-Does not work because 1 ort = 1.5 mark
-
-\section{All coins test}
-
-\nduMath{danish rigsdaler all coins}{all coins}{+}{..10}
-\nduResult{danish rigsdaler all coins}{all coins}
-
-\nduMath{danish rigsdaler all coins}{all coins}{+}{...100}
-\nduResult{danish rigsdaler all coins}{all coins}
-
-\nduMath{danish rigsdaler all coins}{all coins}{+}{.5}
-\nduResult{danish rigsdaler all coins}{all coins}
-
-\nduMath{danish rigsdaler all coins}{all coins}{+}{....10}
-\nduResult{danish rigsdaler all coins}{all coins} = XXXX
-
-\end{document}
-
-segment depth: \pgfkeysvalueof{/ndu/aliases/danish rigsdaler/segment depth}
-
-restrict segment depth: \pgfkeysvalueof{/ndu/aliases/danish rigsdaler/restrict segment depth}
-
-segment depth: \pgfkeysvalueof{/ndu/unit groups/sletdaler.mark.skilling/segment depth}
-
-restrict segment depth: \pgfkeysvalueof{/ndu/unit groups/sletdaler.mark.skilling/restrict segment depth}
-
diff --git a/macros/latex/contrib/non-decimal-units/latex/non-decimal-units.sty b/macros/latex/contrib/non-decimal-units/latex/non-decimal-units.sty
index 92459759cc..0444991aee 100644
--- a/macros/latex/contrib/non-decimal-units/latex/non-decimal-units.sty
+++ b/macros/latex/contrib/non-decimal-units/latex/non-decimal-units.sty
@@ -1,4 +1,4 @@
-\ProvidesPackage{non-decimal-units}[2023/09/26 Macros for displaying and manipulating historical non-decimal units]
+\ProvidesPackage{non-decimal-units}[2023/09/27 Macros for displaying and manipulating historical non-decimal units]
% License: CC-BY-SA 4.0
% Author: Mikkel Eide Eriksen <mikkel.eriksen@gmail.com>