From 68966bb4bfd52e8d9d91b9fd5e6ff36d3d74a57e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 24 Sep 2018 20:21:13 +0000 Subject: cooking-units (24sep18) git-svn-id: svn://tug.org/texlive/trunk@48748 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/cooking-units/cooking-units.pdf | Bin 617911 -> 658095 bytes .../source/latex/cooking-units/cooking-units.dtx | 528 ++++- .../tex/latex/cooking-units/cooking-units.sty | 2350 ++++++++++---------- 3 files changed, 1656 insertions(+), 1222 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/cooking-units/cooking-units.pdf b/Master/texmf-dist/doc/latex/cooking-units/cooking-units.pdf index 80fd68d708d..948ebcfe7f3 100644 Binary files a/Master/texmf-dist/doc/latex/cooking-units/cooking-units.pdf and b/Master/texmf-dist/doc/latex/cooking-units/cooking-units.pdf differ diff --git a/Master/texmf-dist/source/latex/cooking-units/cooking-units.dtx b/Master/texmf-dist/source/latex/cooking-units/cooking-units.dtx index 52b05783e36..74cd835484b 100644 --- a/Master/texmf-dist/source/latex/cooking-units/cooking-units.dtx +++ b/Master/texmf-dist/source/latex/cooking-units/cooking-units.dtx @@ -179,8 +179,8 @@ and the derived file cooking-units.sty. -\clist_new:N \l_cooking_units_list_of_defined_befehlen_clist -\clist_set:Nn \l_cooking_units_list_of_defined_befehlen_clist +\clist_new:N \l_cookingunits_list_of_defined_befehlen_clist +\clist_set:Nn \l_cookingunits_list_of_defined_befehlen_clist { cunum, cutext, @@ -204,7 +204,7 @@ and the derived file cooking-units.sty. \NewDocumentCommand \mycs { m } { - \clist_if_in:NnTF \l_cooking_units_list_of_defined_befehlen_clist {#1} + \clist_if_in:NnTF \l_cookingunits_list_of_defined_befehlen_clist {#1} { \cs{\textcolor{blue}{#1}} } { \ERROR } } @@ -219,26 +219,29 @@ and the derived file cooking-units.sty. \NewDocumentCommand \PrintUnit { o m } { \SaveTranslation \l_tmpa_tl { #2 (cu-unitname) } - \tl_if_eq:NNF \l_tmpa_tl \q__cooking_units_no_translation + \tl_if_eq:NNF \l_tmpa_tl \q__cookingunits_no_translation { \l_tmpa_tl } \IfNoValueF {#1} {#1} & \texttt {#2} & - \tl_use:c { l__cooking_units_default_unit_ #2 _tl } + \tl_use:c { l__cookingunits_default_unit_ #2 _tl } } \NewDocumentCommand \PrintUnitSymbol { m } { \texttt {#1} & - \tl_use:c { l__cooking_units_default_unit_ #1 _tl } + \tl_use:c { l__cookingunits_default_unit_ #1 _tl } } \NewDocumentCommand \PrintGroup { m } { \mygroup {#1} & - \seq_use:cn { l__cooking_units_group_ #1 _seq } { ,~ } + \seq_use:cn { l__cookingunits_group_ #1 _seq } { ,~ } } - +\NewDocumentCommand \DeactivateForbiddenUnitError { } + { + \msg_redirect_name:nnn { cooking-units } { curef-forbidden-unit } { warning } + } %% Allyourwhitespacearebelongtous (too long) @@ -391,7 +394,7 @@ and the derived file cooking-units.sty. \cs_new_eq:NN \__table_default_midrule: \__table_midrule: \cs_new:Npn \_cook_use:n #1 - { \cs_if_exist_use:cF { __cooking_units_#1 } {\ERROR} } + { \cs_if_exist_use:cF { __cookingunits_#1 } {\ERRORcommandNOTexist} } \NewDocumentCommand \CreateTableForLanguages { s >{\TrimSpaces} m } { @@ -423,28 +426,28 @@ and the derived file cooking-units.sty. \clist_if_in:NnTF \l_list_of_textunits_clist {##1} { \l_translation_does_not_exist_tl } { - \_cook_use:n { translate_let:nNxx } {#1} \l_tmpa_tl {##1} \c__cooking_units_postfix_unit_tl - \tl_if_in:NnTF \l_tmpa_tl \q__cooking_units_no_translation + \_cook_use:n { translate_let:nNnV } {#1} \l_tmpa_tl {##1} \c__cookingunits_postfix_unit_tl + \tl_if_in:NnTF \l_tmpa_tl \q__cookingunits_no_translation { \l_translation_does_not_exist_tl } { \l_tmpa_tl } } & - \_cook_use:n { translate_let:nNxx } {#1} \l_tmpa_tl {##1} \c__cooking_units_postfix_unitname_tl - \tl_if_in:NnTF \l_tmpa_tl \q__cooking_units_no_translation + \_cook_use:n { translate_let:nNnV } {#1} \l_tmpa_tl {##1} \c__cookingunits_postfix_unitname_tl + \tl_if_in:NnTF \l_tmpa_tl \q__cookingunits_no_translation { \l_translation_does_not_exist_tl } { \l_tmpa_tl } & - \_cook_use:n { translate_let:nNxx } {#1} \l_tmpa_tl {##1} \c__cooking_units_postfix_unitname_tl - \_cook_use:n { translate_let:nNxx } {#1} \l_tmpb_tl {##1} \c__cooking_units_postfix_unitname_pl_tl + \_cook_use:n { translate_let:nNnV } {#1} \l_tmpa_tl {##1} \c__cookingunits_postfix_unitname_tl + \_cook_use:n { translate_let:nNnV } {#1} \l_tmpb_tl {##1} \c__cookingunits_postfix_unitname_pl_tl \tl_if_eq:NNF \l_tmpa_tl \l_tmpb_tl { - \tl_if_in:NnTF \l_tmpb_tl \q__cooking_units_no_translation + \tl_if_in:NnTF \l_tmpb_tl \q__cookingunits_no_translation { \l_translation_does_not_exist_tl } { (\l_tmpb_tl) } } & - \_cook_use:n { translate_let:nNxx } {#1} \l_tmpa_tl {##1} \c__cooking_units_postfix_gender_tl - \tl_if_in:NnTF \l_tmpa_tl \q__cooking_units_no_translation + \_cook_use:n { translate_let:nNnV } {#1} \l_tmpa_tl {##1} \c__cookingunits_postfix_gender_tl + \tl_if_in:NnTF \l_tmpa_tl \q__cookingunits_no_translation { \l_translation_does_not_exist_tl } { \l_tmpa_tl } } @@ -454,13 +457,13 @@ and the derived file cooking-units.sty. \NewDocumentCommand \CreateTableForPhrases { >{\TrimSpaces} m } { \tl_set:Nn \l_tmpa_tl {#1} - \__cooking_units_phrase_list_get_for:NNTF \l_tmpa_prop \l_tmpa_tl + \__cookingunits_phrase_list_get_for:NNTF \l_tmpa_prop \l_tmpa_tl { - \__cooking_units_translate_let:VNxx \l_tmpa_tl \l_tmpa_seq - { phrase-clist } \c__cooking_units_postfix_phrase_tl + \__cookingunits_translate_let:VNnV \l_tmpa_tl \l_tmpa_seq + { phrase-clist } \c__cookingunits_postfix_phrase_tl } - { \ERROR } - \clist_gput_right:Nn \l_tmpa_seq { THEEND } + { \ERRORCreateTable } + \seq_gput_right:Nn \l_tmpa_seq { THEEND } \cs_gset_eq:NN \__table_midrule: \__table_default_midrule: \begin{tabular}{ l l l l l } \toprule @@ -481,21 +484,59 @@ and the derived file cooking-units.sty. \__table_midrule: ##1 & - \prop_get:NnN \l__cooking_units_phrase_prop {##1} \l_tmpa_tl + \prop_get:NnN \l__cookingunits_phrase_prop {##1} \l_tmpa_tl \tl_gset:NV \l_tmpa_tl \l_tmpa_tl %% Damit global \l_tmpa_tl & - \prop_get:NnN \l__cooking_units_phrase_prop {##1-pl} \l_tmpb_tl + \prop_get:NnN \l__cookingunits_phrase_prop {##1-pl} \l_tmpb_tl \tl_if_eq:NNF \l_tmpa_tl \l_tmpb_tl { \l_tmpb_tl } & - \__cooking_units_translate_let:nNxx {#1} - \l_tmpa_tl { ##1 -phrase-gender } \c__cooking_units_postfix_gender_tl + \__cookingunits_translate_let:nNnV {#1} + \l_tmpa_tl { ##1 -phrase-gender } \c__cookingunits_postfix_gender_tl \l_tmpa_tl } } } + + + +\newcommand\txtupde{\textsuperscript{de}} +\newcommand\txtupsic{\textsuperscript{sicilian}} +\newcommand\txtupen{\textsuperscript{en}} +\NewDocumentCommand\unititem { m d** O{} O{} } + { + \item + [{ + #1 + \IfNoValueF {#2} { \use:c { txtup #2 } } + \tl_if_empty:nF {#3} {\ (#3) } + \tl_if_empty:nF {#4} {\ [#4] } + }] + } + +\NewDocumentEnvironment { myquote } { o o } + { + \list{}{% + \topsep 0pt + \leftmargin 0pt + } + \item\relax + \itshape + }{ + \normalfont + \IfNoValueF{#1}{(see\ \cite{#1} \IfNoValueF{#2}{\ page \ #2} )} + \endlist + } +\makeatletter +\newenvironment{mydescription} + {\list{}{\labelwidth\z@ \itemindent-\leftmargin + \let\makelabel\descriptionlabel}} + {\endlist} +\renewcommand*\descriptionlabel[1]{\hspace\labelsep + \normalfont\bfseries #1} +\makeatother \ExplSyntaxOff \newcommand\cCutext{\mycs{cutext} and \mycs{Cutext}} @@ -533,12 +574,13 @@ and the derived file cooking-units.sty. \newcookingunit {st} \newcookingunit [\ensuremath{ {} ^ { \circ } }\kern-\scriptspace R{\text{\o}}] {Ro} - +\newcookingunit {ft} \cuaddkeys {lb} { {st} { 1/14 } %% 1 lb are 1/14 st } +\cuaddtokeys {m} {ft} {0.3048} \cuaddsinglekeys {C} { {Ro} { #1*21/40 + 7.5 } @@ -701,6 +743,13 @@ and the derived file cooking-units.sty. % \changes {2018/06/05} {1.40} {Bugfix (\texttt{phrases}): Use the phrase from the first amount to check % the second (and don't parse through the second amount).} % +% \changes {2018/09/24} {1.45} {Changes prefix from \texttt{cooking\_units} to \texttt{cookingunits}.} +% \changes {2018/09/24} {1.45} {New language symbols: \opt{cutext-range-sign}} +% \changes {2018/09/24} {1.45} {Improved french (not in general, only for this package)} +% \changes {2018/09/24} {1.45} {New section in documentation.} +% \changes {2018/09/24} {1.45} {Remove exhaustive expansion from internals (shouldn't change anything for users).} +% +% % % % @@ -713,6 +762,7 @@ and the derived file cooking-units.sty. %\author{Ben Vitecek \\ b.vitecek@gmx.at}% %\date{\filedate}% % +% % \maketitle % % \begin{documentation} @@ -1534,11 +1584,17 @@ and the derived file cooking-units.sty. % name depending on the language you can use \lstinline|\cudefinename| % and to only change symbols use \lstinline|\cudefinesymbol|. % -% \begin{function}{decimal-mark, one(m),one(f),one(n)} +% \begin{function}{decimal-mark,cutext-range-sign, one(m),one(f),one(n)} % Those are special keys (as they cannot be used as units). Not only % are printed units language depending, but as is the decimal mark -% (\enquote{.} or \enquote{,}). To set the decimal mark use -% \opt{decimal-mark} (see examples below). +% (\enquote{.} or \enquote{,}) and the text which substitutes the range-sign. +% To set the decimal mark use +% \opt{decimal-mark} (see examples below), to set the range-sign for \cCutext\ +% use \opt{cutext-range-sign}. +% +% Note that \opt{cutext-range-sign} is \enquote{overwritten} by the \emph{option} +% \opt{cutext-range-sign}. If the \emph{option} is set, then the language symbol +% will be ignored. % % Furthermore if you are using the package-option \opt{use-numerals} % you may also use the keys \opt{one(m)}, \opt{one(f)} and @@ -1585,6 +1641,7 @@ and the derived file cooking-units.sty. % {h} {hour} [hours] % {C} {degree\space Celsius} [degrees\space Celsius] % {decimal-marker} {.} +% {cutext-range-sign} {~to~} % {one(m)} {one} % {one(f)} {one} % {one(n)} {one} @@ -1599,6 +1656,7 @@ and the derived file cooking-units.sty. % {h} {Stunde} [Stunden] % {C} {Grad\space Celsius} % {decimal-marker} {,} +% {cutext-range-sign} {~bis~} % {one(m)} {ein} % {one(f)} {eine} % {one(n)} {ein} @@ -1630,6 +1688,7 @@ and the derived file cooking-units.sty. % \cudefinesymbol {English} % { % {decimal-mark} {.} +% {cutext-range-sign} {~to~} % {one(m)} {one} % {one(f)} {one} % {one(n)} {one} @@ -1637,6 +1696,7 @@ and the derived file cooking-units.sty. % \cudefinesymbol {German} % { % {decimal-mark} {,} +% {cutext-range-sign} {~bis~} % {one(m)} {ein} % {one(f)} {eine} % {one(n)} {ein} @@ -2289,6 +2349,16 @@ and the derived file cooking-units.sty. % The default for \meta{string} is \texttt{-{}-} (for both). % \end{function} % +% Since version 1.45 there also exits the language symbol \opt{cutext-range-sign} +% (see \cref{sec:language}). If the \emph{option} \opt{cutext-range-sign} is set +% the language symbol will be ignored. +% +% \begin{cuexamplecode} +% \cunum{1--2}{kg} \\ +% \cuam{1--2} \\ +% \cutext{1--2}{kg} \\ +% \Cutext{1--2}{kg} +% \end{cuexamplecode} % \begin{cuexamplecode} % \cusetup{cunum-range-sign={~to~}} @ % \cunum{1--2}{kg} \\ @@ -2297,14 +2367,14 @@ and the derived file cooking-units.sty. % \Cutext{1--2}{kg} % \end{cuexamplecode} % \begin{cuexamplecode} -% \cusetup{cutext-range-sign={~to~}} @ +% \cusetup{cutext-range-sign={--}} @ % \cunum{1--2}{kg} \\ % \cuam{1--2} \\ % \cutext{1--2}{kg} \\ % \Cutext{1--2}{kg} % \end{cuexamplecode} % \begin{cuexamplecode} -% \cusetup{range-sign={~to~}} @ +% \cusetup{range-sign={-to-}} @ % \cunum{1--2}{kg} \\ % \cuam{1--2} \\ % \cutext{1--2}{kg} \\ @@ -2712,6 +2782,67 @@ and the derived file cooking-units.sty. % \cunum[ref=Kaese,m=dm]{1}{m} % \end{cuexamplecode} % +% +% +% \begin{function}{curef-add-forbidden-unit, curef-remove-forbidden-unit,curef-clear-forbidden-units} +% \begin{syntax} +% curef-add-forbidden-unit = \marg{unit list} +% curef-remove-forbidden-unit = \marg{unit list} +% curef-clear-forbidden-units = \meta{true/false} +% \end{syntax} +%^^A How much of a specify ingredient is used generally depends on the number of folks the meal +%^^A is for. Change the number of folks and the needed weight of an ingredient will most probably +%^^A change, \emph{but} there are units which do not change automatically if you have $2$ instead +%^^A of $4$ guests. Units which measure the temperature are for example one of them. So changing +%^^A them using the label \& ref system would be accidental and should in the best case create an error. +%^^A Use the given options to define units which will throw an error if they are about to be changed +%^^A by the label \& ref system. Of course, you can also remove units or clear the whole list. +% +% There are units which do not depend on the number of folks you are cooking for, units measuring +% the temperature are for example some of them. Changing those units with the label \& ref +% system would be accidental and in the best case throw an error. With the following options +% you can add units to the \enquote{forbidden unit list}, remove them and clear the whole list +% entirely. +% +% By default the list contains \texttt{C}, \texttt{F}, \texttt{K} and \texttt{Re}. +% \end{function} +% \begingroup +% \DeactivateForbiddenUnitError +% \begin{cuexamplecode} +% \culabel{check}{2} @ +% \cusetup{ recalculate-amount=true } @ +% \cunum{1}{m} \\ +% \cunum{1}{kg} \\ +% \cunum[ref=check]{1}{C} \\ +% \cusetup { curef-add-forbidden-unit = { m, kg } } @ +% \cunum[m]{1}{m} \\ +% \cunum[m]{1}{kg} \\ +% \cunum[ref=check]{1}{C} \\ +% \cusetup { curef-remove-forbidden-unit = { C } } @ +% \cunum[m]{1}{m} \\ +% \cunum[m]{1}{kg} \\ +% \cunum[ref=check]{1}{C} \\ +% \cusetup { curef-clear-forbidden-units = true } @ +% \cunum[m]{1}{m} \\ +% \cunum[m]{1}{kg} \\ +% \cunum[ref=check]{1}{C} +% \end{cuexamplecode} +% \endgroup +% +% +% +% +% +% +% +% +% +% +% +% +% +% +% % \subsection{Weird options} % % \begin{function}{check-temperature} @@ -2873,6 +3004,152 @@ and the derived file cooking-units.sty. % % % +% \clearpage +% +% \section{Bens Einheitensammelsurium (Bens unit Almanac)} +% +% Units are a fascinating mess. There are so many different ones which are different and +% the few ones which are the same (in name at least) are \emph{also} different, depending on +% geographical position, time period and probably pure spite. We can be glad that SI-units exist. +% +% +%^^A Units are a fascinating mess. There are so many different ones that one can be glad +%^^A that SI-units exist in this world. This section offers some units which didn't manage +%^^A to appear in \cref{tab:def-units} and \cref{tab:some-more-units}.^^A\footnote{This somehow +%^^A ^^A reminds me of the story of \enquote{Tower of Babel} in the bible. This tower is -- according to the +%^^A ^^A story -- the reason (or the symptom) of why people speak different languages. +%^^A ^^A I suppose what didn't make it into the story was that as even more severe punishment, +%^^A ^^A different units were created. Just my take at lest.}. +% +% So for those units which didn't make it into \cref{tab:def-units} and \cref{tab:some-more-units}, +% this section exists. Please note that this list is intended to be a just-for-fun list and not a +% compilation of every unit in existence with its exact value ordered by geographical and chronological +% position. I am sadly neither a historian nor very good in regards to languages. It would sound like +% fun, but ultimately, I wouldn't have the time. +% Therefore I am only taking units into account which I either found in literature (stone, canna, etc.), +% are well known (foot) or have some other experience with them (ell) (exception: Batman). The reason I +% am not including units which I found in the internet is that I would like to +% see those units in their \enquote{natural environment}. +% +% \begin{comment} +% \begin{tabular}{lllllll} +% \toprule +% unit & original & abréviation & type & source \\ \midrule +% +% Batman & & & weight\\ +%^^A Rottel\txtupde & Sicilian: \emph{rotolo} && length & \cite{Gattopardo}\\ +%^^A Rute\txtupde & Sicilian: \emph{canna} & & weight & \cite{Gattopardo}\\ +% rotolo\txtupsic & Rottel\txtupde && length & \cite{Gattopardo}\\ +% canna\txtupsic & rod\txtupen, Rute\txtupde & & weight & \cite{Gattopardo}\\ +% \bottomrule +% \end{tabular} +% +% {\footnotesize \txtupde German } +% \end{comment} +% +% \begin{description} +% +% \unititem{unit}*in given language*[translation][abbreviation] Description, containing a +% quote or not. \emph{Please note that most of the units are country dependent! +% So the translation may not have the same amount as the word it is translated to.} +% +% \unititem{Batman} +% So \dots\ You wanna be Batman? Be like Bruce Wayne? Having a secret identity? +% Then congratulations! You \emph{are} Batman! How much Batman depends on the location, +% but Wikipedia is your friend in this matter. +% +% +% \unititem{Rotolo}*sic*[Rottel\txtupde] Around \SI{0.850}{\kg} +% \begin{myquote}[Gattopardo][51] +% Auf den Fußboden lagen vier ungereifte Käse zu je \emph{zwölf Rottel}, +% jeder ungefähr zehn Kilo schwer. +% \end{myquote} +% +% \unititem{Canna}*sic*[Rute\txtupde, rod\txtupen] About \SI{2}{\m} bzw.\ about $6$ foot. +% \begin{myquote}[Gattopardo][25] +% \enquote{Unsinn, Stella, Unsinn; was soll mir zustoßen? Sie kennen mich alle: +% Männer, die \emph{eine Rute} lange sind, gibt es wenige in Palermo.} +% \end{myquote} +% +% \unititem{Stone}[][st] \cunum[st=kg]{1}{st}. According to a fellow student +% this unit is still used in +% Great Britain. I've also recently found it in a video game; in the german translation +% of said video game to be precise. Why is the german translation using stone +% and not kilogram (at least in braces)? +% +% \begin{myquote}[Sh:3][988] +% As we had expected, the telegramm was soon followed by its sender, and the card of Mr.\ Cyril Overton, Trinity College, Cambridge, announced the arrival of an enormous young man, \emph{sixteen stone} \emph{[\cunum[st=kg]{16}{st}]} of solid bone and muscle, who spanned the doorway with his broad shoulders \emph{[\dots\!]} +% \end{myquote} (Story \enquote{The missing Three Quarters}) +% +% \unititem{Foot}[][ft] Equals exactly \cunum[ft=m,round-precision=10]{1}{ft} +% or \cunum[ft=in]{1}{ft}. +% +% A bit of a strange unit (for me at least). Where I am from, people +% tend to have different feet sizes. Also present in the german translation of the +% video game that uses \enquote{Stone}. +% +% \unititem{degree Rèamur}[][\ensuremath{{}^{\circ}}\kern-\scriptspace R\'{e}] Like degree Celsius, but instead of having the +% water boiling at \SI{100}{\degree} (Celsius), water boils at \SI{80}{\degree}. +% Water thankfully still freezes at \SI{0}{\degree}. Don't think that this unit +% is used anymore. I think I learned about in physics. +% +% \unititem{Ell} Just read the Wikipedia article. +% +% Fun Fact: At the Stephansdom +% in Vienna left of the main entrance are two metal bars. One is the +% \enquote{Tuchelle} (drapery ell, circa \SI{78}{\cm}), the other the +% \enquote{Leinenelle} (linen ell, around \SI{89.6}{\cm}). +% +% \unititem{cup} I think the idea of having a \enquote{cup} and it not being +% equal to \cunum{250}{ml} is a bit strange, for me at least. What other sizes can a +% cup have? I can imagine \cunum{500}{ml}, but are there other sizes? +% ^^A Any person who writes \enquote{cup} and +% ^^A \emph{doesn't} mean +% ^^A a cup equal to \SI{250}{\ml} should be +%^^A^^A -- in my humble opinion\footnote{Which, now that I admitted +%^^A^^A my humbleness, is automatically +%^^A^^A more important than yours.} -- +%^^A excommunicated by default (or incommunicated, +%^^A if you are an atheist). +% +% \unititem{stick} A unit I've made fun of because it is quite regional and doesn't make +% any sense for foreigners. Then I realized that I am using the unit \enquote{Packerl} +% in my cookery book which is also quite locally\footnote{And maybe doesn't even exist +% outside my family} and -- even worse -- the weight changes depending +% the content (See \emph{Packerl}). +% +% \unititem{Packerl}*de*[small bag] I'm a bit split on this unit as I don't actually +% know if it exists. The reason I have the unit \emph{Packerl} for my cookery +% book is that in Austria you can buy baking powder, (dry) Germ, Natrium, etc. +% in small bags (similar to \emph{stick}). The problem: Depending on the content, +% the weight of \emph{Packerl} differs. Not only that, but it can also differ +% between different producers (but not more than \SI{2}{\g} bzw.\ \cunum[g=oz]{2}{g}). +% Here is a table: +% +% \begin{tabular}{l @{\space} l @{\space} l r l} +% +% 1 Packerl & Backpulver & (baking powder) & \cunum{16}{g} & (\cunum[g=oz]{16}{g}) \\ +% & Natrium & & \cunum{14}{g} & (\cunum[g=oz]{14}{g}) \\ +% & Vanillin(-zucker) & (vanillin(-sugar)) & \cunum{8}{g} & (\cunum[g=oz]{8}{g}) \\ +% & Germ* & & \cunum{7}{g} & (\cunum[g=oz]{7}{g}) \\ +% \end{tabular} +% +% {\footnotesize *Tockengerm (dry Germ) to be precise} +% +% For what kind of thing do I need \emph{Natrium} for? +% \end{description} +% +% +% \begin{comment} +% Fun Wikipedia articles: +% \begin{itemize} +% \item Old Austrian units: https://en.wikipedia.org/wiki/Obsolete_Austrian_units_of_measurement +% \end{itemize} +% \end{comment} +% +% +% +% % % % \clearpage @@ -2942,6 +3219,11 @@ and the derived file cooking-units.sty. % \CreateTableForLanguages{ French } % \end{tabular} % +% If the spoons should be extra full: +% \begin{itemize} +% \item cuill\`{e}re \`{a} soupe rase +% \item cuill\`{e}re \`{a} caf\'{e} rase +% \end{itemize} % % \clearpage % @@ -3064,7 +3346,7 @@ and the derived file cooking-units.sty. % \subsection{Beginning} % % \begin{macrocode} -%<@@=cooking_units> +%<@@=cookingunits> % \end{macrocode} % % \begin{macrocode} @@ -3088,14 +3370,14 @@ and the derived file cooking-units.sty. % \begin{macrocode} \ProvidesExplPackage {cooking-units} - {2018/06/05} - {1.40} + {2018/09/24} + {1.45} {Ein Paket fuer Kocheinheiten} % \end{macrocode} % % Checking if \pkg{expl3} is up-to-date, otherwise abort the loading of the package. % \begin{macrocode} -\@ifpackagelater { expl3 } { 2018/06/01 } +\@ifpackagelater { expl3 } { 2018/08/23 } { } { \PackageError { cooking-units } { Support~package~expl3~too~old } @@ -3318,7 +3600,7 @@ and the derived file cooking-units.sty. % \end{macrocode} % \begin{macrocode} \tl_set:Nn \l_@@_cunum_range_sign_tl { -- } -\tl_set:Nn \l_@@_cutext_range_sign_tl { -- } +\tl_set:Nn \l_@@_cutext_range_sign_tl {} \tl_set:Nn \l_@@_value_unit_space_tl { \thinspace } \tl_set:Nn \l_@@_cutext_space_tl { \space } \tl_set:Nn \l_@@_cuphrase_space_tl { \space } @@ -4067,7 +4349,9 @@ and the derived file cooking-units.sty. % % \begin{macro}{ 42 } % \begin{macrocode} - 42 .bool_set:N = \l_@@_fourty_two_bool , + 42 .choice: , + 42 / true .code:n = { \bool_set_true:N \l_@@_fourty_two_bool } , + 42 / false .code:n = { \msg_fatal:nnn { cooking-units } { 42-is-...-wrong? } } , 42 .default:n = { true } , % \end{macrocode} % \end{macro} @@ -4129,13 +4413,48 @@ and the derived file cooking-units.sty. % % % -% \begin{macro}{} +% +% +% +% +% +% +% +% +% +% +% +% +% \begin{macro}{curef-add-forbidden-unit, curef-remove-forbidden-unit, curef-clear-forbidden-units} % \begin{macrocode} - curef-do-not-change .code:n = + curef-add-forbidden-unit .code:n = + { + \seq_set_from_clist:Nn \l_@@_tmpa_seq {#1} + \seq_map_inline:Nn \l_@@_tmpa_seq + { + \seq_if_in:NnF \l_@@_curef_do_not_change_seq {##1} + { \seq_put_right:Nn \l_@@_curef_do_not_change_seq {##1} } + } + } , + curef-add-forbidden-unit .default:n = { } , + curef-remove-forbidden-unit .code:n = { - \seq_if_in:NnF \l_@@_curef_do_not_change_seq {#1} - {\seq_put_right:Nn \l_@@_curef_do_not_change_seq {#1} } + \seq_set_from_clist:Nn \l_@@_tmpa_seq {#1} + \seq_map_inline:Nn \l_@@_tmpa_seq + { + \seq_if_in:NnTF \l_@@_curef_do_not_change_seq {##1} + { \seq_remove_all:Nn \l_@@_curef_do_not_change_seq {##1} } + { + \msg_warning:nnn { cooking-units } { curef-not-inside-list } {##1} + { \seq_use:Nnnn \l_@@_curef_do_not_change_seq { ',~ ' } { ',~ ' } { ' ~ and ~ ' } } + } + } } , + curef-remove-forbidden-unit .default:n = { } , + curef-clear-forbidden-units .choice: , + curef-clear-forbidden-units/true .code:n = { \seq_clear:N \l_@@_curef_do_not_change_seq } , + curef-clear-forbidden-units/false .code:n = { } , + curef-clear-forbidden-units .value_required:n = true, % \end{macrocode} % \end{macro} % @@ -4549,13 +4868,51 @@ and the derived file cooking-units.sty. \msg_new:nnnn { cooking-units } { unknown-gender } { '#1' \ is \ not \ allowed \ to \ be \ used \ as \ a \ gender-specification. - Only \ 'm', \ 'f' \ or \ 'n' \ are \ allowed + Only \ 'm', \ 'f' \ or \ 'n' \ are \ allowed. }{ Please \ remove \ spaces \ if \ there \ are \ some. \msg_see_documentation_text:n { cooking-units } } % \end{macrocode} % +% +% \begin{macrocode} +\msg_new:nnnn { cooking-units } { curef-not-inside-list } + { + '#1' \ cannot \ be \ removed \ from \ the \ 'forbidden \ unit' \ list \ because + \ it \ is \ not \ inside \ the \ list. + }{ + Currently \ the \ list\ contains \ '#2'. + \msg_see_documentation_text:n { cooking-units } + } +% \end{macrocode} +% +% +% \begin{macrocode} +\msg_new:nnnn { cooking-units } { curef-forbidden-unit } + { + The \ amount \ of \ '#1' \ cannot \ be \ changed \ using \ cooking-units` \ label \ \& \ ref \ feature. + }{ + You \ can \ remove \ the \ unit \ using \ 'curef-remove-forbidden-unit'. + \msg_see_documentation_text:n { cooking-units } + } +% \end{macrocode} +% +% \begin{macrocode} +\msg_new:nnnn { cooking-units } { 42-is-...-wrong? } + { + You \ requested \ to \ set \ 42 \ to \ 'false'. \ This \ doesn't \ make + \ any \ sense! \ It \ cannot \ be \ 'false', \ it \ is \ the \ answer \ to \ the + \ question \ of \ life, \ universe \ and \ everything. \ For \ the \ sake \ of \ + the \ world \ I \ cannot \ allow \ you \ to \ set \ it \ to \ 'false', \ the \ universe + \ might \ explode \ otherwise. \\ + The \ run \ will \ be \ aborted. + }{ + Phew ... \ this \ might \ have \ ended \ disastrous. + \msg_see_documentation_text:n { cooking-units } + } +% \end{macrocode} +% % \begin{macrocode} \msg_new:nnnn { cooking-units } { internal-error } { @@ -5075,8 +5432,9 @@ and the derived file cooking-units.sty. % \end{macro} % % -% \begin{macro}{\@@_translate:nn , \@@_translate:xx } -% \begin{macro}{\@@_translate_let:Nxx , \@@_translate_let:Nxx } +% \begin{macro}{\@@_translate:nn , \@@_translate:xV } +% \begin{macro}{\@@_translate_let:Nnn , \@@_translate_let:NnV } +% \begin{macro}{\@@_translate_let:nNnn , \@@_translate_let:VNnV } % \begin{macrocode} \cs_new:Npn \@@_translate:nn #1#2 { @@ -5090,18 +5448,19 @@ and the derived file cooking-units.sty. { \SaveTranslationFor {#2} {#1} { #3 #4 } } -\cs_generate_variant:Nn \@@_translate:nn { xx , VV } -\cs_generate_variant:Nn \@@_translate_let:Nnn { Nxx } -\cs_generate_variant:Nn \@@_translate_let:nNnn { VNxx, nNxx } +\cs_generate_variant:Nn \@@_translate:nn { VV, nV } +\cs_generate_variant:Nn \@@_translate_let:Nnn { NnV } +\cs_generate_variant:Nn \@@_translate_let:nNnn { VNnV, nNnV } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}[TF]{\@@_unitname_get:Nn,\@@_unitname_get:Nx } % \begin{macrocode} \prg_new_conditional:Npnn \@@_unitname_get:Nn #1#2 { F } { - \@@_translate_let:Nxx #1 {#2} \c_@@_postfix_unitname_tl + \@@_translate_let:NnV #1 {#2} \c_@@_postfix_unitname_tl \tl_if_eq:NNTF #1 \q_@@_no_translation { \prg_return_false: } { \prg_return_true: } @@ -5111,13 +5470,14 @@ and the derived file cooking-units.sty. % \end{macro} % % \begin{macro}{\@@_translate_one_and_check_existance:Nx } +% As |#2| is already going to be expanded, using |\@@_translate_let:NnV| is safe. % \begin{macrocode} \cs_new:Npn \@@_translate_one_and_check_existance:Nn #1#2 { - \@@_translate_let:Nxx #1 {#2} \c_@@_postfix_gender_tl + \@@_translate_let:NnV #1 {#2} \c_@@_postfix_gender_tl \@@_unitname_get:NxF #1 { one (#1) } { - \@@_translate_let:Nxx #1 {#2} \c_@@_postfix_gender_tl + \@@_translate_let:NnV #1 {#2} \c_@@_postfix_gender_tl \msg_error:nnn { cooking-units } { Translation-not-available } { one (#1) } } } @@ -5166,10 +5526,10 @@ and the derived file cooking-units.sty. % \end{macrocode} % % \begin{macrocode} -\@@_newtranslation_base:nVn { range-sign } \c_@@_postfix_unitname_tl { -- } -\@@_newtranslation_base:nVn { range-sign } \c_@@_postfix_unitname_pl_tl { \q_@@_no_translation } -\@@_newtranslation_to:nnVn { German } { range-sign } \c_@@_postfix_unitname_tl { ~bis~ } -\@@_newtranslation_to:nnVn { English } { range-sign } \c_@@_postfix_unitname_tl { ~to~ } +\@@_newtranslation_base:nVn { cutext-range-sign } \c_@@_postfix_unitname_tl { -- } +\@@_newtranslation_base:nVn { cutext-range-sign } \c_@@_postfix_unitname_pl_tl { \q_@@_no_translation } +\@@_newtranslation_to:nnVn { German } { cutext-range-sign } \c_@@_postfix_unitname_tl { ~bis~ } +\@@_newtranslation_to:nnVn { English } { cutext-range-sign } \c_@@_postfix_unitname_tl { ~to~ } % \end{macrocode} % % @@ -5299,7 +5659,7 @@ and the derived file cooking-units.sty. { \tl_if_in:NnT #1 { . } { - \@@_translate_let:Nxx \l_@@_translation_tmpa_tl + \@@_translate_let:NnV \l_@@_translation_tmpa_tl { decimal-mark } \c_@@_postfix_unitname_tl \tl_replace_once:Nnn #1 { . } { \l_@@_translation_tmpa_tl } } @@ -5338,8 +5698,10 @@ and the derived file cooking-units.sty. \@@_print_input:N #1 \bool_if:NTF \l_@@_using_cutext_bool { - \tl_use:N \l_@@_cutext_range_sign_tl -% \@@_translate:VV { range-sign } \c_@@_postfix_unitname_tl +% \tl_use:N \l_@@_cutext_range_sign_tl + \tl_if_empty:NTF \l_@@_cutext_range_sign_tl + { \@@_translate:nV { cutext-range-sign } \c_@@_postfix_unitname_tl } + { \tl_use:N \l_@@_cutext_range_sign_tl } \bool_set_false:N \l_@@_cutext_uppercase_word_bool } { \tl_use:N \l_@@_cunum_range_sign_tl } @@ -5808,10 +6170,12 @@ and the derived file cooking-units.sty. = { \l_@@_local_number_of_persons_int } { - \@@_change_unit:TF - { \tl_set_eq:NN \l_@@_tmpb_tl \l_@@_option_unit_tl } - { \tl_set_eq:NN \l_@@_tmpb_tl \l_@@_given_unit_tl } - \seq_if_in:NVF \l_@@_curef_do_not_change_seq \l_@@_tmpb_tl +% \@@_change_unit:TF +% { \tl_set_eq:NN \l_@@_tmpb_tl \l_@@_option_unit_tl } +% { \tl_set_eq:NN \l_@@_tmpb_tl \l_@@_given_unit_tl } + \tl_set_eq:NN \l_@@_tmpb_tl \l_@@_given_unit_tl + \seq_if_in:NVTF \l_@@_curef_do_not_change_seq \l_@@_tmpb_tl + { \msg_error:nnV { cooking-units } { curef-forbidden-unit } \l_@@_tmpb_tl } { \@@_calc_references_aux:NN #1 #2 } } } @@ -6039,8 +6403,8 @@ and the derived file cooking-units.sty. \tl_if_empty:NF \l_@@_phantom_tl { \phantom { \l_@@_phantom_tl } } \tl_use:N \l_@@_value_unit_space_tl \@@_change_unit:TF - { \@@_translate:xx \l_@@_option_unit_tl \c_@@_postfix_unit_tl } - { \@@_translate:xx \l_@@_given_unit_tl \c_@@_postfix_unit_tl } + { \@@_translate:VV \l_@@_option_unit_tl \c_@@_postfix_unit_tl } + { \@@_translate:VV \l_@@_given_unit_tl \c_@@_postfix_unit_tl } } % \end{macrocode} % \end{macro} @@ -6162,10 +6526,10 @@ and the derived file cooking-units.sty. \@@_change_unit:TF { \@@_fp_if_equal_one:nTF { \l_@@_cutext_last_value_tl } - { \@@_translate:xx \l_@@_option_unit_tl \c_@@_postfix_unitname_tl } - { \@@_translate:xx \l_@@_option_unit_tl \c_@@_postfix_unitname_pl_tl } + { \@@_translate:VV \l_@@_option_unit_tl \c_@@_postfix_unitname_tl } + { \@@_translate:VV \l_@@_option_unit_tl \c_@@_postfix_unitname_pl_tl } } - { \@@_translate:xx \l_@@_given_unit_tl \c_@@_postfix_unitname_pl_tl } + { \@@_translate:VV \l_@@_given_unit_tl \c_@@_postfix_unitname_pl_tl } } % \end{macrocode} % @@ -7099,18 +7463,18 @@ and the derived file cooking-units.sty. % \begin{macrocode} \prg_new_conditional:Npnn \@@_phrase_list_get_for:NN #1#2 { TF } { - \@@_translate_let:VNxx #2 #1 { phrase-prop } \c_@@_postfix_phrase_tl + \@@_translate_let:VNnV #2 #1 { phrase-prop } \c_@@_postfix_phrase_tl \tl_if_eq:NNTF #1 \q_@@_no_translation { \prg_return_false: } { \prg_return_true: } } \prg_new_conditional:Npnn \@@_get_phrase_for_current_langauge:NN #1#2 { T } { - \@@_translate_let:Nxx #1 { phrase-prop } \c_@@_postfix_phrase_tl + \@@_translate_let:NnV #1 { phrase-prop } \c_@@_postfix_phrase_tl \tl_if_eq:NNTF #1 \q_@@_no_translation { \prg_return_false: } { - \@@_translate_let:Nxx #2 { phrase-clist } \c_@@_postfix_phrase_tl + \@@_translate_let:NnV #2 { phrase-clist } \c_@@_postfix_phrase_tl \prg_return_true: } } @@ -7127,7 +7491,7 @@ and the derived file cooking-units.sty. % \begin{macrocode} \@@_phrase_list_get_for:NNTF \l_@@_phrase_prop \l_@@_language_tl { - \@@_translate_let:VNxx \l_@@_language_tl \l_@@_phrase_numbers_seq + \@@_translate_let:VNnV \l_@@_language_tl \l_@@_phrase_numbers_seq { phrase-clist } \c_@@_postfix_phrase_tl }{ \prop_clear:N \l_@@_phrase_prop @@ -7709,8 +8073,8 @@ and the derived file cooking-units.sty. % \end{macrocode} % \begin{macrocode} { pn } { pinc\'{e}e } < f > - { EL } { cuill\'{e}re \space \`{a} \space soupe } < f > - { TL } { cuill\'{e}re \space \`{a} \space caf\'{e} } < f > + { EL } [c.\`{a}.s.] { cuill\`{e}re \space \`{a} \space soupe } < f > + { TL } [c.\`{a}.c.] { cuill\`{e}re \space \`{a} \space caf\'{e} } < f > % \end{macrocode} % \begin{macrocode} { decimal-mark } { . } @@ -7828,6 +8192,7 @@ and the derived file cooking-units.sty. set-option-for-C = { round-to-int = true } , set-option-for-K = { round-to-int = true } , set-option-for-Re = { round-to-int = true } , + curef-add-forbidden-unit = { F , C , K , Re } , add-temperature-to-check = { K = 0, @@ -7855,6 +8220,21 @@ and the derived file cooking-units.sty. % \end{implementation} % % +% +% \begin{thebibliography}{} +% \bibitem{Gattopardo} +% Guiseppe Tomasi di Lampedusa, \enquote{Der Gattopardo}, +% Piper, Volume~8 (2018), ISBN~978-3-492-24586-9 +% +% \bibitem{Sh:3} +% Sir Arthur Conan Doyle, \enquote{Sherlock Holmes The Complete Novels and Stories Volume~II}, +% Bantam Books +% +% +% \end{thebibliography} +% +% +% % \endinput % % diff --git a/Master/texmf-dist/tex/latex/cooking-units/cooking-units.sty b/Master/texmf-dist/tex/latex/cooking-units/cooking-units.sty index e22bc6dd37d..5b8bb0d6a80 100644 --- a/Master/texmf-dist/tex/latex/cooking-units/cooking-units.sty +++ b/Master/texmf-dist/tex/latex/cooking-units/cooking-units.sty @@ -30,10 +30,10 @@ { \RequirePackage {expl3} } \ProvidesExplPackage {cooking-units} - {2018/06/05} - {1.40} + {2018/09/24} + {1.45} {Ein Paket fuer Kocheinheiten} -\@ifpackagelater { expl3 } { 2018/06/01 } +\@ifpackagelater { expl3 } { 2018/08/23 } { } { \PackageError { cooking-units } { Support~package~expl3~too~old } @@ -57,14 +57,14 @@ } \tex_endinput:D } -\bool_new:N \g__cooking_units_opt_numeral_bool +\bool_new:N \g__cookingunits_opt_numeral_bool \keys_define:nn { cooking-units } { - use-numerals .bool_gset:N = \g__cooking_units_opt_numeral_bool , + use-numerals .bool_gset:N = \g__cookingunits_opt_numeral_bool , use-numerals .default:n = { false }, } \ProcessKeysOptions { cooking-units } -\bool_if:NT \g__cooking_units_opt_numeral_bool +\bool_if:NT \g__cookingunits_opt_numeral_bool { \@ifpackageloaded { fmtcount } { } { \RequirePackage { fmtcount } } } @@ -83,64 +83,64 @@ \cs_generate_variant:Nn \msg_error:nnnn { nnnV } \cs_generate_variant:Nn \msg_error:nnn { nnV } \cs_generate_variant:Nn \msg_warning:nnn { nnV } -\cs_new:Npn \__cooking_units_dim_horizontal:N #1 { \tex_kern:D #1 } -\cs_new_eq:NN \__cooking_units_frac:nn \sfrac -\cs_new_eq:NN \__cooking_units_set_amount:Nn \tl_set:Nn -\cs_new_eq:NN \__cooking_units_set_unit:Nn \tl_set:Nn -\cs_new:Npn \__cooking_units_print_numeral:n #1 { } -\cs_new:Npn \__cooking_units_print_Numeral:n #1 { } -\bool_if:NT \g__cooking_units_opt_numeral_bool - { - \cs_set_eq:NN \__cooking_units_print_numeral:n \numberstringnum - \cs_set_eq:NN \__cooking_units_print_Numeral:n \Numberstringnum - } -\prop_new:N \l__cooking_units_change_unit_prop -\tl_new:N \l__cooking_units_number_tmpa_tl -\tl_new:N \l__cooking_units_number_tmpb_tl -\tl_new:N \l__cooking_units_tmpa_tl -\tl_new:N \l__cooking_units_tmpb_tl -\tl_new:N \l__cooking_units_mixed_fraction_tl -\tl_new:N \l__cooking_units_given_amount_tl -\tl_new:N \l__cooking_units_given_unit_tl -\tl_new:N \l__cooking_units_option_unit_tl -\tl_new:N \l__cooking_units_language_tl -\tl_new:N \l__cooking_units_cunum_range_sign_tl -\tl_new:N \l__cooking_units_cutext_range_sign_tl -\tl_new:N \l__cooking_units_value_unit_space_tl -\tl_new:N \l__cooking_units_input_digits_tl -\tl_new:N \l__cooking_units_input_decimal_mark_tl -\tl_new:N \l__cooking_units_input_value_signs_tl -\tl_new:N \l__cooking_units_input_allowed_special_signs_tl -\tl_new:N \c__cooking_units_input_str_hash_one_tl -\tl_new:N \l__cooking_units_input_range_sign_tl -\tl_new:N \l__cooking_units_cutext_space_tl -\tl_new:N \l__cooking_units_cuphrase_space_tl -\tl_new:N \l__cooking_units_translation_tmpa_tl -\tl_new:N \l__cooking_units_cutext_last_value_tl -\tl_new:N \l__cooking_units_phantom_tl -\tl_new:N \l__cooking_units_phrase_phrase_tl -\tl_new:N \l__cooking_units_unit_letter_not_allowed_tl -\tl_new:N \l__cooking_units_input_fraction_sign_tl -\tl_new:N \l__cooking_units_input_mixed_fraction_sign_tl -\tl_new:N \l__cooking_units_cunum_hook_tl -\tl_new:N \l__cooking_units_cutext_hook_tl -\tl_new:N \l__cooking_units_Cutext_hook_tl -\tl_new:N \l__cooking_units_cuam_hook_tl -\tl_set:Nn \l__cooking_units_input_digits_tl { 0123456789 } -\tl_set:Nn \l__cooking_units_input_range_sign_tl { -- } -\tl_set:Nn \l__cooking_units_input_fraction_sign_tl { / } -\tl_set:Nn \l__cooking_units_input_mixed_fraction_sign_tl { _ } -\tl_set:Nn \l__cooking_units_input_decimal_mark_tl { . , } -\tl_set:Nn \l__cooking_units_input_value_signs_tl { + - } -\tl_set:Nn \l__cooking_units_input_allowed_special_signs_tl { ? } -\tl_set_rescan:Nnn \c__cooking_units_input_str_hash_one_tl +\cs_new:Npn \__cookingunits_dim_horizontal:N #1 { \tex_kern:D #1 } +\cs_new_eq:NN \__cookingunits_frac:nn \sfrac +\cs_new_eq:NN \__cookingunits_set_amount:Nn \tl_set:Nn +\cs_new_eq:NN \__cookingunits_set_unit:Nn \tl_set:Nn +\cs_new:Npn \__cookingunits_print_numeral:n #1 { } +\cs_new:Npn \__cookingunits_print_Numeral:n #1 { } +\bool_if:NT \g__cookingunits_opt_numeral_bool + { + \cs_set_eq:NN \__cookingunits_print_numeral:n \numberstringnum + \cs_set_eq:NN \__cookingunits_print_Numeral:n \Numberstringnum + } +\prop_new:N \l__cookingunits_change_unit_prop +\tl_new:N \l__cookingunits_number_tmpa_tl +\tl_new:N \l__cookingunits_number_tmpb_tl +\tl_new:N \l__cookingunits_tmpa_tl +\tl_new:N \l__cookingunits_tmpb_tl +\tl_new:N \l__cookingunits_mixed_fraction_tl +\tl_new:N \l__cookingunits_given_amount_tl +\tl_new:N \l__cookingunits_given_unit_tl +\tl_new:N \l__cookingunits_option_unit_tl +\tl_new:N \l__cookingunits_language_tl +\tl_new:N \l__cookingunits_cunum_range_sign_tl +\tl_new:N \l__cookingunits_cutext_range_sign_tl +\tl_new:N \l__cookingunits_value_unit_space_tl +\tl_new:N \l__cookingunits_input_digits_tl +\tl_new:N \l__cookingunits_input_decimal_mark_tl +\tl_new:N \l__cookingunits_input_value_signs_tl +\tl_new:N \l__cookingunits_input_allowed_special_signs_tl +\tl_new:N \c__cookingunits_input_str_hash_one_tl +\tl_new:N \l__cookingunits_input_range_sign_tl +\tl_new:N \l__cookingunits_cutext_space_tl +\tl_new:N \l__cookingunits_cuphrase_space_tl +\tl_new:N \l__cookingunits_translation_tmpa_tl +\tl_new:N \l__cookingunits_cutext_last_value_tl +\tl_new:N \l__cookingunits_phantom_tl +\tl_new:N \l__cookingunits_phrase_phrase_tl +\tl_new:N \l__cookingunits_unit_letter_not_allowed_tl +\tl_new:N \l__cookingunits_input_fraction_sign_tl +\tl_new:N \l__cookingunits_input_mixed_fraction_sign_tl +\tl_new:N \l__cookingunits_cunum_hook_tl +\tl_new:N \l__cookingunits_cutext_hook_tl +\tl_new:N \l__cookingunits_Cutext_hook_tl +\tl_new:N \l__cookingunits_cuam_hook_tl +\tl_set:Nn \l__cookingunits_input_digits_tl { 0123456789 } +\tl_set:Nn \l__cookingunits_input_range_sign_tl { -- } +\tl_set:Nn \l__cookingunits_input_fraction_sign_tl { / } +\tl_set:Nn \l__cookingunits_input_mixed_fraction_sign_tl { _ } +\tl_set:Nn \l__cookingunits_input_decimal_mark_tl { . , } +\tl_set:Nn \l__cookingunits_input_value_signs_tl { + - } +\tl_set:Nn \l__cookingunits_input_allowed_special_signs_tl { ? } +\tl_set_rescan:Nnn \c__cookingunits_input_str_hash_one_tl { \char_set_catcode_letter:N \# } {#1} -\tl_set:Nn \l__cooking_units_cunum_range_sign_tl { -- } -\tl_set:Nn \l__cooking_units_cutext_range_sign_tl { -- } -\tl_set:Nn \l__cooking_units_value_unit_space_tl { \thinspace } -\tl_set:Nn \l__cooking_units_cutext_space_tl { \space } -\tl_set:Nn \l__cooking_units_cuphrase_space_tl { \space } -\tl_set:Nn \l__cooking_units_unit_letter_not_allowed_tl { , / } +\tl_set:Nn \l__cookingunits_cunum_range_sign_tl { -- } +\tl_set:Nn \l__cookingunits_cutext_range_sign_tl {} +\tl_set:Nn \l__cookingunits_value_unit_space_tl { \thinspace } +\tl_set:Nn \l__cookingunits_cutext_space_tl { \space } +\tl_set:Nn \l__cookingunits_cuphrase_space_tl { \space } +\tl_set:Nn \l__cookingunits_unit_letter_not_allowed_tl { , / } \AtBeginDocument { \cs_if_free:cT { T@TS1 } { @@ -148,129 +148,129 @@ \DeclareFontSubstitution { TS1 } { cmr } { m } { n } } } -\DeclareTextSymbolDefault \c__cooking_units_minus_tl { TS1 } -\DeclareTextSymbol \c__cooking_units_minus_tl { TS1 } { 61 } +\DeclareTextSymbolDefault \c__cookingunits_minus_tl { TS1 } +\DeclareTextSymbol \c__cookingunits_minus_tl { TS1 } { 61 } \AtBeginDocument { \@ifpackageloaded { fontspec } { \@ifpackageloaded { eulervm } { } { - \int_const:Nn \c__cooking_units_minus_int { 8722 } - \tl_set:Nn \c__cooking_units_minus_tl - { \tex_char:D \c__cooking_units_minus_int } + \int_const:Nn \c__cookingunits_minus_int { 8722 } + \tl_set:Nn \c__cookingunits_minus_tl + { \tex_char:D \c__cookingunits_minus_int } } } { } } -\dim_new:N \l__cooking_units_mixed_frac_dim -\dim_set:Nn \l__cooking_units_mixed_frac_dim { 0.1 em } -\int_new:N \l__cooking_units_round_precision_int -\int_set:Nn \l__cooking_units_round_precision_int { 2 } -\int_new:N \l__cooking_units_print_numerals_below_int -\int_set:Nn \l__cooking_units_print_numerals_below_int { 13 } -\int_new:N \l__cooking_units_local_number_of_persons_int -\int_new:N \l__cooking_units_wanted_number_of_persons_int -\int_set:Nn \l__cooking_units_wanted_number_of_persons_int { 4 } -\int_new:N \l__cooking_units_phrase_number_tl -\seq_new:N \l__cooking_units_list_of_defined_keys_seq -\seq_new:N \g__cooking_units_list_of_defined_units_seq -\seq_new:N \g__cooking_units_allowed_special_keys_seq -\seq_new:N \l__cooking_units_phrase_numbers_seq -\seq_new:N \l__cooking_units_temperatures_to_check_seq -\seq_new:N \l__cooking_units_curef_do_not_change_seq -\prop_new:N \l__cooking_units_phrase_prop -\bool_new:N \l__cooking_units_minus_bool -\bool_new:N \l__cooking_units_round_number_bool -\bool_new:N \l__cooking_units_error_bool -\bool_new:N \l__cooking_units_eval_fractions_bool -\bool_new:N \l__cooking_units_draft_bool -\bool_new:N \l__cooking_units_round_to_int_bool -\bool_new:N \l__cooking_units_special_sign_bool -\bool_new:N \l__cooking_units_single_key_bool -\bool_new:N \l__cooking_units_check_temperature_bool -\bool_new:N \l__cooking_units_convert_to_eV_bool -\bool_new:N \l__cooking_units_cutext_uppercase_word_bool -\bool_new:N \l__cooking_units_error_for_unknown_value_bool -\bool_new:N \l__cooking_units_using_cutext_bool -\bool_new:N \l__cooking_units_cuam_old_bool -\bool_new:N \l__cooking_units_change_number_of_persons_bool -\bool_new:N \l__cooking_units_calc_because_ref_was_given_bool -\bool_new:N \l__cooking_units_lokal_persons_bool -\bool_new:N \l__cooking_units_cutext_to_cunum_bool -\bool_new:N \l__cooking_units_cutext_old_bool -\bool_new:N \l__cooking_units_cutext_keep_unit_bool -\bool_new:N \l__cooking_units_round_commercial_bool -\bool_new:N \l__cooking_units_use_phrases_bool -\bool_new:N \l__cooking_units_lokal_phrase_bool -\bool_new:N \l__cooking_units_print_numeral_bool -\bool_new:N \l__cooking_units_lokal_numeral_bool -\bool_new:N \l__cooking_units_round_precision_positive_bool -\bool_new:N \l__cooking_units_fourty_two_bool -\bool_new:N \l__cooking_units_phrase_negative_bool -\bool_new:N \l__cooking_units_range_in_input_bool -\bool_new:N \l__cooking_units_lokal_fraction_bool -\bool_new:N \l__cooking_units_print_fraction_bool -\bool_new:N \l__cooking_units_lokal_mixed_fraction_bool -\bool_new:N \l__cooking_units_check_decimal_bool -\bool_set_false:N \l__cooking_units_cutext_keep_unit_bool -\bool_set_eq:NN \l__cooking_units_print_numeral_bool \g__cooking_units_opt_numeral_bool -\quark_new:N \q__cooking_units_range -\quark_new:N \q__cooking_units_no_translation -\quark_new:N \q__cooking_units_decimal -\quark_new:N \q__cooking_units_fraction -\quark_new:N \q__cooking_units_mixed_fraction -\fp_new:N \l__cooking_units_tmpa_fp -\clist_new:N \l__cooking_units_tmpa_clist -\prop_new:N \l__cooking_units_tmpa_prop -\prop_new:N \l__cooking_units_tmpb_prop -\seq_new:N \l__cooking_units_tmpa_seq -\int_new:N \l__cooking_units_tmpa_int -\int_new:N \l__cooking_units_tmpb_int +\dim_new:N \l__cookingunits_mixed_frac_dim +\dim_set:Nn \l__cookingunits_mixed_frac_dim { 0.1 em } +\int_new:N \l__cookingunits_round_precision_int +\int_set:Nn \l__cookingunits_round_precision_int { 2 } +\int_new:N \l__cookingunits_print_numerals_below_int +\int_set:Nn \l__cookingunits_print_numerals_below_int { 13 } +\int_new:N \l__cookingunits_local_number_of_persons_int +\int_new:N \l__cookingunits_wanted_number_of_persons_int +\int_set:Nn \l__cookingunits_wanted_number_of_persons_int { 4 } +\int_new:N \l__cookingunits_phrase_number_tl +\seq_new:N \l__cookingunits_list_of_defined_keys_seq +\seq_new:N \g__cookingunits_list_of_defined_units_seq +\seq_new:N \g__cookingunits_allowed_special_keys_seq +\seq_new:N \l__cookingunits_phrase_numbers_seq +\seq_new:N \l__cookingunits_temperatures_to_check_seq +\seq_new:N \l__cookingunits_curef_do_not_change_seq +\prop_new:N \l__cookingunits_phrase_prop +\bool_new:N \l__cookingunits_minus_bool +\bool_new:N \l__cookingunits_round_number_bool +\bool_new:N \l__cookingunits_error_bool +\bool_new:N \l__cookingunits_eval_fractions_bool +\bool_new:N \l__cookingunits_draft_bool +\bool_new:N \l__cookingunits_round_to_int_bool +\bool_new:N \l__cookingunits_special_sign_bool +\bool_new:N \l__cookingunits_single_key_bool +\bool_new:N \l__cookingunits_check_temperature_bool +\bool_new:N \l__cookingunits_convert_to_eV_bool +\bool_new:N \l__cookingunits_cutext_uppercase_word_bool +\bool_new:N \l__cookingunits_error_for_unknown_value_bool +\bool_new:N \l__cookingunits_using_cutext_bool +\bool_new:N \l__cookingunits_cuam_old_bool +\bool_new:N \l__cookingunits_change_number_of_persons_bool +\bool_new:N \l__cookingunits_calc_because_ref_was_given_bool +\bool_new:N \l__cookingunits_lokal_persons_bool +\bool_new:N \l__cookingunits_cutext_to_cunum_bool +\bool_new:N \l__cookingunits_cutext_old_bool +\bool_new:N \l__cookingunits_cutext_keep_unit_bool +\bool_new:N \l__cookingunits_round_commercial_bool +\bool_new:N \l__cookingunits_use_phrases_bool +\bool_new:N \l__cookingunits_lokal_phrase_bool +\bool_new:N \l__cookingunits_print_numeral_bool +\bool_new:N \l__cookingunits_lokal_numeral_bool +\bool_new:N \l__cookingunits_round_precision_positive_bool +\bool_new:N \l__cookingunits_fourty_two_bool +\bool_new:N \l__cookingunits_phrase_negative_bool +\bool_new:N \l__cookingunits_range_in_input_bool +\bool_new:N \l__cookingunits_lokal_fraction_bool +\bool_new:N \l__cookingunits_print_fraction_bool +\bool_new:N \l__cookingunits_lokal_mixed_fraction_bool +\bool_new:N \l__cookingunits_check_decimal_bool +\bool_set_false:N \l__cookingunits_cutext_keep_unit_bool +\bool_set_eq:NN \l__cookingunits_print_numeral_bool \g__cookingunits_opt_numeral_bool +\quark_new:N \q__cookingunits_range +\quark_new:N \q__cookingunits_no_translation +\quark_new:N \q__cookingunits_decimal +\quark_new:N \q__cookingunits_fraction +\quark_new:N \q__cookingunits_mixed_fraction +\fp_new:N \l__cookingunits_tmpa_fp +\clist_new:N \l__cookingunits_tmpa_clist +\prop_new:N \l__cookingunits_tmpa_prop +\prop_new:N \l__cookingunits_tmpb_prop +\seq_new:N \l__cookingunits_tmpa_seq +\int_new:N \l__cookingunits_tmpa_int +\int_new:N \l__cookingunits_tmpb_int \keys_define:nn { cooking-units } { add-unit-to-group .code:n = { \keyval_parse:NNn - \__cooking_units_unit_group_add_unit_error:n - \__cooking_units_unit_group_add_unit:nn + \__cookingunits_unit_group_add_unit_error:n + \__cookingunits_unit_group_add_unit:nn {#1} } , add-unit-to-group .default:n = {} , set-option-for .code:n = { \keyval_parse:NNn - \__cooking_units_set_options_for_error:n - \__cooking_units_set_options_for:nn + \__cookingunits_set_options_for_error:n + \__cookingunits_set_options_for:nn {#1} }, add-option-for .code:n = { \keyval_parse:NNn - \__cooking_units_add_options_for_error:n - \__cooking_units_add_options_for:nn + \__cookingunits_add_options_for_error:n + \__cookingunits_add_options_for:nn {#1} }, erase-all-options .code:n = { - \seq_map_inline:Nn \g__cooking_units_list_of_defined_units_seq + \seq_map_inline:Nn \g__cookingunits_list_of_defined_units_seq { - \clist_clear:c { l__cooking_units_predefined_option_ ##1 _clist } + \clist_clear:c { l__cookingunits_predefined_option_ ##1 _clist } } }, erase-all-options .value_forbidden:n = { true } , erase-all-options-for .code:n = { \keyval_parse:NNn - \__cooking_units_erase_options_for:n - \__cooking_units_erase_options_for_error:nn + \__cookingunits_erase_options_for:n + \__cookingunits_erase_options_for_error:nn {#1} }, erase-all-options-for .value_required:n = { true } , - cutext-to-cunum .bool_set:N = \l__cooking_units_cutext_to_cunum_bool , + cutext-to-cunum .bool_set:N = \l__cookingunits_cutext_to_cunum_bool , cutext-to-cunum .default:n = { false } , cutext-to-cunum .groups:n = { change-command } , - cutext-change-unit .bool_set_inverse:N = \l__cooking_units_cutext_keep_unit_bool , + cutext-change-unit .bool_set_inverse:N = \l__cookingunits_cutext_keep_unit_bool , cutext-change-unit .default:n = { true } , cutext-change-unit .groups:n = { change-unit } , cuam-version .choices:nn = @@ -278,8 +278,8 @@ { \int_case:nn { \l_keys_choice_int } { - { 1 } { \bool_set_false:N \l__cooking_units_cuam_old_bool } - { 2 } { \bool_set_true:N \l__cooking_units_cuam_old_bool } + { 1 } { \bool_set_false:N \l__cookingunits_cuam_old_bool } + { 2 } { \bool_set_true:N \l__cookingunits_cuam_old_bool } } } , cuam-version .default:n = { new } , @@ -288,28 +288,28 @@ { \int_case:nn { \l_keys_choice_int } { - { 1 } { \bool_set_false:N \l__cooking_units_cutext_old_bool } - { 2 } { \bool_set_true:N \l__cooking_units_cutext_old_bool } + { 1 } { \bool_set_false:N \l__cookingunits_cutext_old_bool } + { 2 } { \bool_set_true:N \l__cookingunits_cutext_old_bool } } } , cutext-version .default:n = { new } , expand-both .choices:nn = { n , o , f , x } { - \cs_set_eq:Nc \__cooking_units_set_unit:Nn { tl_set:N \l_keys_choice_tl } - \cs_set_eq:Nc \__cooking_units_set_amount:Nn { tl_set:N \l_keys_choice_tl } + \cs_set_eq:Nc \__cookingunits_set_unit:Nn { tl_set:N \l_keys_choice_tl } + \cs_set_eq:Nc \__cookingunits_set_amount:Nn { tl_set:N \l_keys_choice_tl } } , expand-both .default:n = { n } , expand-amount .choices:nn = { n , o , f , x } { - \cs_set_eq:Nc \__cooking_units_set_amount:Nn { tl_set:N \l_keys_choice_tl } + \cs_set_eq:Nc \__cookingunits_set_amount:Nn { tl_set:N \l_keys_choice_tl } } , expand-amount .default:n = { n } , expand-unit .choices:nn = { n , o , f , x } { - \cs_set_eq:Nc \__cooking_units_set_unit:Nn { tl_set:N \l_keys_choice_tl } + \cs_set_eq:Nc \__cookingunits_set_unit:Nn { tl_set:N \l_keys_choice_tl } } , expand-unit .default:n = { n } , set-special-sign .code:n = @@ -322,7 +322,7 @@ \tl_map_break:n { \use_none:nn } } } - \use:n { \tl_set:Nn \l__cooking_units_input_allowed_special_signs_tl {#1} } + \use:n { \tl_set:Nn \l__cookingunits_input_allowed_special_signs_tl {#1} } } , add-special-sign .code:n = { @@ -332,7 +332,7 @@ { \msg_error:nn { cooking-units } { <-not-allowed-as-special-sign } }{ - \tl_put_right:Nn \l__cooking_units_input_allowed_special_signs_tl {##1} + \tl_put_right:Nn \l__cookingunits_input_allowed_special_signs_tl {##1} } } } , @@ -351,11 +351,11 @@ { \l_keys_choice_tl } } , set-cutext-translation-message .default:n = { warning } , - print-numerals .bool_set:N = \l__cooking_units_print_numeral_bool , + print-numerals .bool_set:N = \l__cookingunits_print_numeral_bool , print-numerals .default:n = { true } , - use-numerals-below .int_set:N = \l__cooking_units_print_numerals_below_int , + use-numerals-below .int_set:N = \l__cookingunits_print_numerals_below_int , use-numerals-below .default:n = { 13 } , - parse-number .bool_set_inverse:N = \l__cooking_units_draft_bool , + parse-number .bool_set_inverse:N = \l__cookingunits_draft_bool , parse-number .default:n= { true } , range-sign .meta:n = { @@ -363,83 +363,85 @@ cutext-range-sign = {#1} } , range-sign .default:n = { -- } , - cunum-range-sign .tl_set:N = \l__cooking_units_cunum_range_sign_tl , + cunum-range-sign .tl_set:N = \l__cookingunits_cunum_range_sign_tl , cunum-range-sign .default:n = { -- } , - cutext-range-sign .tl_set:N = \l__cooking_units_cutext_range_sign_tl , + cutext-range-sign .tl_set:N = \l__cookingunits_cutext_range_sign_tl , cutext-range-sign .default:n = { -- } , - use-phrases .bool_set:N = \l__cooking_units_use_phrases_bool , + use-phrases .bool_set:N = \l__cookingunits_use_phrases_bool , use-phrases .default:n = { true } , round-precision .code:n = { - \int_set:Nn \l__cooking_units_round_precision_int {#1} + \int_set:Nn \l__cookingunits_round_precision_int {#1} \int_compare:nNnTF {#1} < { 0 } - { \bool_set_false:N \l__cooking_units_round_precision_positive_bool } - { \bool_set_true:N \l__cooking_units_round_precision_positive_bool } + { \bool_set_false:N \l__cookingunits_round_precision_positive_bool } + { \bool_set_true:N \l__cookingunits_round_precision_positive_bool } } , round-precision .default:n = { 2 } , - round-to-int .bool_set:N = \l__cooking_units_round_to_int_bool , + round-to-int .bool_set:N = \l__cookingunits_round_to_int_bool , round-to-int .default:n = { false } , round-half .choices:nn = { default , commercial } { \int_case:nn { \l_keys_choice_int } { - { 1 } { \bool_set_false:N \l__cooking_units_round_commercial_bool } - { 2 } { \bool_set_true:N \l__cooking_units_round_commercial_bool } + { 1 } { \bool_set_false:N \l__cookingunits_round_commercial_bool } + { 2 } { \bool_set_true:N \l__cookingunits_round_commercial_bool } } }, round-half .default:n = { default }, - eval-fraction .bool_set:N = \l__cooking_units_eval_fractions_bool , + eval-fraction .bool_set:N = \l__cookingunits_eval_fractions_bool , eval-fraction .default:n = { false } , - fraction-command .code:n = { \cs_set_eq:NN \__cooking_units_frac:nn #1 } , + fraction-command .code:n = { \cs_set_eq:NN \__cookingunits_frac:nn #1 } , fraction-command .default:n = { \sfrac } , - fraction-inline .code:n = { \cs_set:Npn \__cooking_units_frac:nn ##1##2 {#1} } , + fraction-inline .code:n = { \cs_set:Npn \__cookingunits_frac:nn ##1##2 {#1} } , fraction-inline .default:n = { \sfrac {#1} {#2} } , - mixed-fraction-space .dim_set:N = \l__cooking_units_mixed_frac_dim , + mixed-fraction-space .dim_set:N = \l__cookingunits_mixed_frac_dim , mixed-fraction-space .default:n = { 0.1 em } , - cutext-space .tl_set:N = \l__cooking_units_cutext_space_tl , + cutext-space .tl_set:N = \l__cookingunits_cutext_space_tl , cutext-space .default:n = { \space } , - phrase-space .tl_set:N = \l__cooking_units_cuphrase_space_tl , + phrase-space .tl_set:N = \l__cookingunits_cuphrase_space_tl , phrase-space .default:n = { \space } , - amount-unit-space .tl_set:N = \l__cooking_units_value_unit_space_tl , + amount-unit-space .tl_set:N = \l__cookingunits_value_unit_space_tl , amount-unit-space .default:n = { \thinspace } , - recalculate-amount .bool_set:N = \l__cooking_units_change_number_of_persons_bool , + recalculate-amount .bool_set:N = \l__cookingunits_change_number_of_persons_bool , recalculate-amount .default:n = { false } , - set-number-of-persons .int_set:N = \l__cooking_units_wanted_number_of_persons_int , + set-number-of-persons .int_set:N = \l__cookingunits_wanted_number_of_persons_int , set-number-of-persons .default:n = { 4 } , - label .code:n = \__cooking_units_label_and_persons:n {#1} , + label .code:n = \__cookingunits_label_and_persons:n {#1} , label .value_required:n = { true } , - get-label .code:n = \__cooking_units_curef:n {#1} , + get-label .code:n = \__cookingunits_curef:n {#1} , label .value_required:n = { true } , - ref .code:n = \__cooking_units_reference_label_and_persons:n {#1} , + ref .code:n = \__cookingunits_reference_label_and_persons:n {#1} , ref .value_required:n = { true } , - check-temperature .bool_set:N = \l__cooking_units_check_temperature_bool , + check-temperature .bool_set:N = \l__cookingunits_check_temperature_bool , check-temperature .default:n = { true } , add-temperature-to-check .code:n = { \keyval_parse:NNn - \__cooking_units_temperature_to_check_print_error:n - \__cooking_units_temperatures_to_check_define:nn + \__cookingunits_temperature_to_check_print_error:n + \__cookingunits_temperatures_to_check_define:nn {#1} } , temperature-to-check .value_required:n = { true } , - convert-to-eV .bool_set:N = \l__cooking_units_convert_to_eV_bool , + convert-to-eV .bool_set:N = \l__cookingunits_convert_to_eV_bool , convert-to-eV .default:n = { true } , convert-to-eV .groups:n = { change-unit } , add-natural-unit .code:n = { - \__cooking_units_error_if_unit_not_defined:n {#1} - \seq_set_from_clist:Nn \l__cooking_units_tmpa_seq {#1} - \seq_concat:NNN \g__cooking_units_natural_units_seq \g__cooking_units_natural_units_seq \l__cooking_units_tmpa_seq - \seq_remove_duplicates:N \g__cooking_units_natural_units_seq + \__cookingunits_error_if_unit_not_defined:n {#1} + \seq_set_from_clist:Nn \l__cookingunits_tmpa_seq {#1} + \seq_concat:NNN \g__cookingunits_natural_units_seq \g__cookingunits_natural_units_seq \l__cookingunits_tmpa_seq + \seq_remove_duplicates:N \g__cookingunits_natural_units_seq } , add-natural-unit .value_required:n = { true } , - 42 .bool_set:N = \l__cooking_units_fourty_two_bool , + 42 .choice: , + 42 / true .code:n = { \bool_set_true:N \l__cookingunits_fourty_two_bool } , + 42 / false .code:n = { \msg_fatal:nnn { cooking-units } { 42-is-...-wrong? } } , 42 .default:n = { true } , - input-range-sign .tl_set:N = \l__cooking_units_input_range_sign_tl , + input-range-sign .tl_set:N = \l__cookingunits_input_range_sign_tl , input-range-sign .default:n = { -- } , - numeral-function .code:n = { \cs_set_eq:NN \__cooking_units_print_numeral:n #1 } , - Numeral-function .code:n = { \cs_set_eq:NN \__cooking_units_print_Numeral:n #1 } , + numeral-function .code:n = { \cs_set_eq:NN \__cookingunits_print_numeral:n #1 } , + Numeral-function .code:n = { \cs_set_eq:NN \__cookingunits_print_Numeral:n #1 } , commands-add-hook .meta:n = { cunum-add-hook = {#1} , @@ -447,20 +449,43 @@ Cutext-add-hook = {#1} , cuam-add-hook = {#1} , } , - cunum-add-hook .code:n = { \tl_put_right:Nn \l__cooking_units_cunum_hook_tl {#1} } , - cutext-add-hook .code:n = { \tl_put_right:Nn \l__cooking_units_cutext_hook_tl {#1} } , - Cutext-add-hook .code:n = { \tl_put_right:Nn \l__cooking_units_Cutext_hook_tl {#1} } , - cuam-add-hook .code:n = { \tl_put_right:Nn \l__cooking_units_cuam_hook_tl {#1} } , - curef-do-not-change .code:n = + cunum-add-hook .code:n = { \tl_put_right:Nn \l__cookingunits_cunum_hook_tl {#1} } , + cutext-add-hook .code:n = { \tl_put_right:Nn \l__cookingunits_cutext_hook_tl {#1} } , + Cutext-add-hook .code:n = { \tl_put_right:Nn \l__cookingunits_Cutext_hook_tl {#1} } , + cuam-add-hook .code:n = { \tl_put_right:Nn \l__cookingunits_cuam_hook_tl {#1} } , + curef-add-forbidden-unit .code:n = { - \seq_if_in:NnF \l__cooking_units_curef_do_not_change_seq {#1} - {\seq_put_right:Nn \l__cooking_units_curef_do_not_change_seq {#1} } + \seq_set_from_clist:Nn \l__cookingunits_tmpa_seq {#1} + \seq_map_inline:Nn \l__cookingunits_tmpa_seq + { + \seq_if_in:NnF \l__cookingunits_curef_do_not_change_seq {##1} + { \seq_put_right:Nn \l__cookingunits_curef_do_not_change_seq {##1} } + } + } , + curef-add-forbidden-unit .default:n = { } , + curef-remove-forbidden-unit .code:n = + { + \seq_set_from_clist:Nn \l__cookingunits_tmpa_seq {#1} + \seq_map_inline:Nn \l__cookingunits_tmpa_seq + { + \seq_if_in:NnTF \l__cookingunits_curef_do_not_change_seq {##1} + { \seq_remove_all:Nn \l__cookingunits_curef_do_not_change_seq {##1} } + { + \msg_warning:nnn { cooking-units } { curef-not-inside-list } {##1} + { \seq_use:Nnnn \l__cookingunits_curef_do_not_change_seq { ',~ ' } { ',~ ' } { ' ~ and ~ ' } } + } + } } , + curef-remove-forbidden-unit .default:n = { } , + curef-clear-forbidden-units .choice: , + curef-clear-forbidden-units/true .code:n = { \seq_clear:N \l__cookingunits_curef_do_not_change_seq } , + curef-clear-forbidden-units/false .code:n = { } , + curef-clear-forbidden-units .value_required:n = true, } \msg_new:nnnn { cooking-units } { fraction-not-allowed-with-range } { You \ cannot \ use \ '/' \ ( and \ '_' )\ in \ combination \ - with \ '\l__cooking_units_input_range_sign_tl' \ in \ '#1'. + with \ '\l__cookingunits_input_range_sign_tl' \ in \ '#1'. }{ You \ cannot \ use \ fractions \ with \ a \ range. \msg_see_documentation_text:n { cooking-units } @@ -554,7 +579,7 @@ The \ temperature \ '#1' \ is \ too \ low.\ It \ cannot \ be \ below \ the \ absolute \ zero - point \ of \ '#2'. \ Note \ that \ the \ temperatures \ - '\seq_use:Nnnn \l__cooking_units_temperatures_to_check_seq + '\seq_use:Nnnn \l__cookingunits_temperatures_to_check_seq { ', ~ ' } { ', ~ ' } { ' ~ and ~ ' }' \ are \ rounded \ to \ integers \ by \ default. \\\\ @@ -722,11 +747,38 @@ \msg_new:nnnn { cooking-units } { unknown-gender } { '#1' \ is \ not \ allowed \ to \ be \ used \ as \ a \ gender-specification. - Only \ 'm', \ 'f' \ or \ 'n' \ are \ allowed + Only \ 'm', \ 'f' \ or \ 'n' \ are \ allowed. }{ Please \ remove \ spaces \ if \ there \ are \ some. \msg_see_documentation_text:n { cooking-units } } +\msg_new:nnnn { cooking-units } { curef-not-inside-list } + { + '#1' \ cannot \ be \ removed \ from \ the \ 'forbidden \ unit' \ list \ because + \ it \ is \ not \ inside \ the \ list. + }{ + Currently \ the \ list\ contains \ '#2'. + \msg_see_documentation_text:n { cooking-units } + } +\msg_new:nnnn { cooking-units } { curef-forbidden-unit } + { + The \ amount \ of \ '#1' \ cannot \ be \ changed \ using \ cooking-units` \ label \ \& \ ref \ feature. + }{ + You \ can \ remove \ the \ unit \ using \ 'curef-remove-forbidden-unit'. + \msg_see_documentation_text:n { cooking-units } + } +\msg_new:nnnn { cooking-units } { 42-is-...-wrong? } + { + You \ requested \ to \ set \ 42 \ to \ 'false'. \ This \ doesn't \ make + \ any \ sense! \ It \ cannot \ be \ 'false', \ it \ is \ the \ answer \ to \ the + \ question \ of \ life, \ universe \ and \ everything. \ For \ the \ sake \ of \ + the \ world \ I \ cannot \ allow \ you \ to \ set \ it \ to \ 'false', \ the \ universe + \ might \ explode \ otherwise. \\ + The \ run \ will \ be \ aborted. + }{ + Phew ... \ this \ might \ have \ ended \ disastrous. + \msg_see_documentation_text:n { cooking-units } + } \msg_new:nnnn { cooking-units } { internal-error } { This \ error \ shouldn't \ show. \ This \ means \ I @@ -736,57 +788,57 @@ Please \ send \ me \ a \ bug \ report. \msg_see_documentation_text:n { cooking-units } } -\cs_new:Npn \__cooking_units_error_if_unit_not_defined:n #1 +\cs_new:Npn \__cookingunits_error_if_unit_not_defined:n #1 { - \seq_if_in:NnF \g__cooking_units_list_of_defined_units_seq {#1} + \seq_if_in:NnF \g__cookingunits_list_of_defined_units_seq {#1} { \msg_error:nnn { cooking-units } { unknown-unit } {#1} } } -\cs_generate_variant:Nn \__cooking_units_error_if_unit_not_defined:n { V } -\prg_new_protected_conditional:Npnn \__cooking_units_if_integer:n #1 { TF , F } +\cs_generate_variant:Nn \__cookingunits_error_if_unit_not_defined:n { V } +\prg_new_protected_conditional:Npnn \__cookingunits_if_integer:n #1 { TF , F } { \tl_map_inline:nn {#1} { - \tl_if_in:NnF \l__cooking_units_input_digits_tl {##1} + \tl_if_in:NnF \l__cookingunits_input_digits_tl {##1} { \tl_map_break:n { \use_iii:nnn } } } \use_i:nn \prg_return_true: \prg_return_false: } -\cs_generate_variant:Nn \__cooking_units_if_integer:nTF { V } -\cs_generate_variant:Nn \__cooking_units_if_integer:nF { V } -\cs_new:Npn \__cooking_units_bool_set_if_integers:NNN #1#2#3 +\cs_generate_variant:Nn \__cookingunits_if_integer:nTF { V } +\cs_generate_variant:Nn \__cookingunits_if_integer:nF { V } +\cs_new:Npn \__cookingunits_bool_set_if_integers:NNN #1#2#3 { - \__cooking_units_if_integer:VTF #2 + \__cookingunits_if_integer:VTF #2 { \bool_set_true:N #1 } { \bool_set_false:N #1 } \bool_lazy_and:nnT - { \l__cooking_units_range_in_input_bool } {#1} + { \l__cookingunits_range_in_input_bool } {#1} { - \__cooking_units_if_integer:VF #3 + \__cookingunits_if_integer:VF #3 { \bool_set_false:N #1 } } } -\prg_new_conditional:Npnn \__cooking_units_fp_if_equal_one:n #1 { TF } +\prg_new_conditional:Npnn \__cookingunits_fp_if_equal_one:n #1 { TF } { \fp_compare:nNnTF {#1} = { 1.0 } { \prg_return_true: } { \prg_return_false: } } -\prg_new_conditional:Npnn \__cooking_units_int_if_equal_one:n #1 { TF } +\prg_new_conditional:Npnn \__cookingunits_int_if_equal_one:n #1 { TF } { \int_compare:nNnTF {#1} = { 1 } { \prg_return_true: } { \prg_return_false: } } -\prg_new_conditional:Npnn \__cooking_units_change_cutext_to_cunum:n #1 { TF } +\prg_new_conditional:Npnn \__cookingunits_change_cutext_to_cunum:n #1 { TF } { \keys_set_groups:nnn { cooking-units } { change-command } {#1} - \bool_if:NTF \l__cooking_units_cutext_to_cunum_bool + \bool_if:NTF \l__cookingunits_cutext_to_cunum_bool { \prg_return_true: } { \prg_return_false: } } -\cs_new:Npn \__cooking_units_check_if_correct_gender_input:n #1 +\cs_new:Npn \__cookingunits_check_if_correct_gender_input:n #1 { \str_case:nnF {#1} { @@ -795,61 +847,61 @@ { n } { } } { \msg_error:nnn { cooking-units } { unknown-gender } {#1} } } -\cs_new:Npn \__cooking_units_define_unit_group:nn #1#2 +\cs_new:Npn \__cookingunits_define_unit_group:nn #1#2 { - \seq_new:c { l__cooking_units_group_ #1 _seq } - \seq_set_from_clist:cn { l__cooking_units_group_ #1 _seq } {#2} + \seq_new:c { l__cookingunits_group_ #1 _seq } + \seq_set_from_clist:cn { l__cookingunits_group_ #1 _seq } {#2} \keys_define:nn { cooking-units } { - #1 .code:n = { \__cooking_units_unit_group_convert_units:nn {#1} {##1} } , + #1 .code:n = { \__cookingunits_unit_group_convert_units:nn {#1} {##1} } , #1 .groups:n = { change-unit } , } } -\cs_new:Npn \__cooking_units_error_if_group_not_defined:n #1 +\cs_new:Npn \__cookingunits_error_if_group_not_defined:n #1 { - \seq_if_exist:cF { l__cooking_units_group_ #1 _seq } + \seq_if_exist:cF { l__cookingunits_group_ #1 _seq } { \msg_error:nn { cooking-units} { group-key-unknown } } } -\cs_new:Npn \__cooking_units_unit_group_convert_units:nn #1#2 +\cs_new:Npn \__cookingunits_unit_group_convert_units:nn #1#2 { - \__cooking_units_error_if_group_not_defined:n {#1} - \__cooking_units_error_if_unit_not_defined:n {#2} - \seq_if_in:cnTF { l__cooking_units_group_ #1 _seq } {#2} + \__cookingunits_error_if_group_not_defined:n {#1} + \__cookingunits_error_if_unit_not_defined:n {#2} + \seq_if_in:cnTF { l__cookingunits_group_ #1 _seq } {#2} { - \seq_map_inline:cn { l__cooking_units_group_ #1 _seq } - { \__cooking_units_keys_set:nnn { cooking-units } {##1} {#2} } + \seq_map_inline:cn { l__cookingunits_group_ #1 _seq } + { \__cookingunits_keys_set:nnn { cooking-units } {##1} {#2} } }{ \msg_error:nnxxx { cooking-units } { group-choice-not-allowed } {#1} {#2} - { \seq_use:cnnn { l__cooking_units_group_ #1 _seq } { ',~ ' } { ',~ ' } { ' ~ and ~ ' } } + { \seq_use:cnnn { l__cookingunits_group_ #1 _seq } { ',~ ' } { ',~ ' } { ' ~ and ~ ' } } } } -\__cooking_units_define_unit_group:nn { weight } { kg , dag, g, oz, lb, stick } -\__cooking_units_define_unit_group:nn { length } { m , dm , cm , mm , in } -\__cooking_units_define_unit_group:nn { volume } { l , dl , cl , ml } -\__cooking_units_define_unit_group:nn { temperature } { C , F , K , Re } -\__cooking_units_define_unit_group:nn { energy } { cal, kcal , J , kJ , eV } -\__cooking_units_define_unit_group:nn { time } { d , h , min , s } -\cs_new:Npn \__cooking_units_unit_group_add_unit_error:n #1 +\__cookingunits_define_unit_group:nn { weight } { kg , dag, g, oz, lb, stick } +\__cookingunits_define_unit_group:nn { length } { m , dm , cm , mm , in } +\__cookingunits_define_unit_group:nn { volume } { l , dl , cl , ml } +\__cookingunits_define_unit_group:nn { temperature } { C , F , K , Re } +\__cookingunits_define_unit_group:nn { energy } { cal, kcal , J , kJ , eV } +\__cookingunits_define_unit_group:nn { time } { d , h , min , s } +\cs_new:Npn \__cookingunits_unit_group_add_unit_error:n #1 { \msg_error:nnn { cooking-units } { No-Value-given } { add-unit-to-group } } -\cs_new:Npn \__cooking_units_unit_group_add_unit:nn #1#2 +\cs_new:Npn \__cookingunits_unit_group_add_unit:nn #1#2 { - \__cooking_units_error_if_group_not_defined:n {#1} + \__cookingunits_error_if_group_not_defined:n {#1} \clist_map_inline:nn {#2} { - \__cooking_units_error_if_unit_not_defined:n {##1} - \seq_if_in:cnF { l__cooking_units_group_ #1 _seq } {##1} - { \seq_put_right:cn { l__cooking_units_group_ #1 _seq } {##1} } + \__cookingunits_error_if_unit_not_defined:n {##1} + \seq_if_in:cnF { l__cookingunits_group_ #1 _seq } {##1} + { \seq_put_right:cn { l__cookingunits_group_ #1 _seq } {##1} } } } -\seq_new:N \g__cooking_units_natural_units_seq -\prop_new:N \g__cooking_units_convert_to_eV_remember_prop -\seq_set_from_clist:Nn \g__cooking_units_natural_units_seq +\seq_new:N \g__cookingunits_natural_units_seq +\prop_new:N \g__cookingunits_convert_to_eV_remember_prop +\seq_set_from_clist:Nn \g__cookingunits_natural_units_seq { eV , eVc-2 , @@ -857,29 +909,29 @@ chbareV-1 , (chbareV-1)3 , } -\cs_new:Npn \__cooking_units_keys_set:nnn #1#2#3 +\cs_new:Npn \__cookingunits_keys_set:nnn #1#2#3 { \keys_set:nn {#1} { #2 = #3 } } -\cs_generate_variant:Nn \__cooking_units_keys_set:nnn { nVV , nVn } -\cs_new:Npn \__cooking_units_convert_to_eV: +\cs_generate_variant:Nn \__cookingunits_keys_set:nnn { nVV , nVn } +\cs_new:Npn \__cookingunits_convert_to_eV: { - \prop_if_exist:cT { l__cooking_units_cukeys_ \l__cooking_units_given_unit_tl _prop } + \prop_if_exist:cT { l__cookingunits_cukeys_ \l__cookingunits_given_unit_tl _prop } { - \prop_get:NVNTF \g__cooking_units_convert_to_eV_remember_prop - \l__cooking_units_given_unit_tl \l__cooking_units_tmpa_tl + \prop_get:NVNTF \g__cookingunits_convert_to_eV_remember_prop + \l__cookingunits_given_unit_tl \l__cookingunits_tmpa_tl { - \__cooking_units_keys_set:nVV { cooking-units } \l__cooking_units_given_unit_tl \l__cooking_units_tmpa_tl + \__cookingunits_keys_set:nVV { cooking-units } \l__cookingunits_given_unit_tl \l__cookingunits_tmpa_tl }{ - \prop_get:cnNT { l__cooking_units_cukeys_ \l__cooking_units_given_unit_tl _prop } { Liste } \l__cooking_units_tmpa_seq + \prop_get:cnNT { l__cookingunits_cukeys_ \l__cookingunits_given_unit_tl _prop } { Liste } \l__cookingunits_tmpa_seq { - \seq_map_inline:Nn \g__cooking_units_natural_units_seq + \seq_map_inline:Nn \g__cookingunits_natural_units_seq { - \seq_if_in:NnT \l__cooking_units_tmpa_seq {##1} + \seq_if_in:NnT \l__cookingunits_tmpa_seq {##1} { - \prop_gput:NVn \g__cooking_units_convert_to_eV_remember_prop - \l__cooking_units_given_unit_tl {##1} - \__cooking_units_keys_set:nVn { cooking-units } \l__cooking_units_given_unit_tl {##1} + \prop_gput:NVn \g__cookingunits_convert_to_eV_remember_prop + \l__cookingunits_given_unit_tl {##1} + \__cookingunits_keys_set:nVn { cooking-units } \l__cookingunits_given_unit_tl {##1} \seq_map_break: } } @@ -887,122 +939,122 @@ } } } -\cs_new:Npn \__cooking_units_tl_eval:Nn #1#2 { \tl_set:Nf #1 { \fp_eval:n {#2} } } -\cs_generate_variant:Nn \__cooking_units_tl_eval:Nn { Nv } -\prg_new_conditional:Npnn \__cooking_units_change_unit: { TF } +\cs_new:Npn \__cookingunits_tl_eval:Nn #1#2 { \tl_set:Nf #1 { \fp_eval:n {#2} } } +\cs_generate_variant:Nn \__cookingunits_tl_eval:Nn { Nv } +\prg_new_conditional:Npnn \__cookingunits_change_unit: { TF } { \bool_lazy_any:nTF { - { \l__cooking_units_lokal_fraction_bool } - { \l__cooking_units_special_sign_bool } - { \l__cooking_units_draft_bool } + { \l__cookingunits_lokal_fraction_bool } + { \l__cookingunits_special_sign_bool } + { \l__cookingunits_draft_bool } } { \prg_return_false: } { \prg_return_true: } } -\cs_new:Npn \__cooking_units_temperature_to_check_print_error:n #1 +\cs_new:Npn \__cookingunits_temperature_to_check_print_error:n #1 { - \__cooking_units_error_if_unit_not_defined:n {#1} + \__cookingunits_error_if_unit_not_defined:n {#1} \msg_error:nnn { cooking-units } { No-Value-given } { add-temperature-to-check } } -\cs_new:Npn \__cooking_units_temperatures_to_check_define:nn #1#2 +\cs_new:Npn \__cookingunits_temperatures_to_check_define:nn #1#2 { - \__cooking_units_error_if_unit_not_defined:n {#1} - \fp_if_exist:cTF { c__cooking_units_ #1 _min_fp } + \__cookingunits_error_if_unit_not_defined:n {#1} + \fp_if_exist:cTF { c__cookingunits_ #1 _min_fp } { \msg_warning:nnn { cooking-units } { Minimum-already-defined } {#1} } { - \seq_put_right:Nn \l__cooking_units_temperatures_to_check_seq {#1} - \fp_const:cn { c__cooking_units_ #1 _min_fp } {#2} + \seq_put_right:Nn \l__cookingunits_temperatures_to_check_seq {#1} + \fp_const:cn { c__cookingunits_ #1 _min_fp } {#2} } } -\cs_new:Npn \__cooking_units_erase_options_for:n #1 +\cs_new:Npn \__cookingunits_erase_options_for:n #1 { - \__cooking_units_error_if_unit_not_defined:n {#1} - \clist_clear:c { l__cooking_units_predefined_option_ ##1 _clist } + \__cookingunits_error_if_unit_not_defined:n {#1} + \clist_clear:c { l__cookingunits_predefined_option_ ##1 _clist } } -\cs_new:Npn \__cooking_units_erase_options_for_error:nn #1#2 +\cs_new:Npn \__cookingunits_erase_options_for_error:nn #1#2 { - \__cooking_units_error_if_unit_not_defined:n {#1} + \__cookingunits_error_if_unit_not_defined:n {#1} \msg_error:nnn { cooking-units } { Value-not-allowed } { erase-all-options-for } } -\cs_new:Npn \__cooking_units_set_options_for_error:n #1 +\cs_new:Npn \__cookingunits_set_options_for_error:n #1 { - \__cooking_units_error_if_unit_not_defined:n {#1} + \__cookingunits_error_if_unit_not_defined:n {#1} \msg_error:nnn { cooking-units } { No-Value-given } { set-option-for } } -\cs_new:Npn \__cooking_units_set_options_for:nn #1#2 +\cs_new:Npn \__cookingunits_set_options_for:nn #1#2 { - \__cooking_units_error_if_unit_not_defined:n {#1} - \clist_set:cn { l__cooking_units_predefined_option_#1_clist } {#2} + \__cookingunits_error_if_unit_not_defined:n {#1} + \clist_set:cn { l__cookingunits_predefined_option_#1_clist } {#2} } -\cs_new:Npn \__cooking_units_add_options_for_error:n #1 +\cs_new:Npn \__cookingunits_add_options_for_error:n #1 { - \__cooking_units_error_if_unit_not_defined:n {#1} + \__cookingunits_error_if_unit_not_defined:n {#1} \msg_error:nnn { cooking-units } { No-Value-given } { add-option-for } } -\cs_new:Npn \__cooking_units_add_options_for:nn #1#2 +\cs_new:Npn \__cookingunits_add_options_for:nn #1#2 { - \__cooking_units_error_if_unit_not_defined:n {#1} - \clist_put_right:cn { l__cooking_units_predefined_option_ #1 _clist } {#2} + \__cookingunits_error_if_unit_not_defined:n {#1} + \clist_put_right:cn { l__cookingunits_predefined_option_ #1 _clist } {#2} } -\cs_new:Npn \__cooking_units_rounding_function:n #1 +\cs_new:Npn \__cookingunits_rounding_function:n #1 { #1 - \bool_if:NTF \l__cooking_units_round_to_int_bool + \bool_if:NTF \l__cookingunits_round_to_int_bool { , 0 } - { , \l__cooking_units_round_precision_int } - \bool_if:NT \l__cooking_units_round_commercial_bool + { , \l__cookingunits_round_precision_int } + \bool_if:NT \l__cookingunits_round_commercial_bool { , #1 } } -\cs_new:Npn \__cooking_units_label_and_persons:n #1 +\cs_new:Npn \__cookingunits_label_and_persons:n #1 { \tl_if_in:nnTF {#1} { * } { - \__cooking_units_label_and_persons_times_persons:ww #1 \q_stop + \__cookingunits_label_and_persons_times_persons:ww #1 \q_stop }{ \msg_error:nnn { cooking-units} { Number-of-persons-missing } {#1} } } -\cs_new:Npn \__cooking_units_label_and_persons_times_persons:ww #1 * #2 \q_stop +\cs_new:Npn \__cookingunits_label_and_persons_times_persons:ww #1 * #2 \q_stop { - \__cooking_units_culabel:nn {#1} {#2} + \__cookingunits_culabel:nn {#1} {#2} } -\cs_new:Npn \__cooking_units_culabel:nn #1#2 +\cs_new:Npn \__cookingunits_culabel:nn #1#2 { - \int_if_exist:cTF { g__cooking_units_number_of_persons_ #1 _int } + \int_if_exist:cTF { g__cookingunits_number_of_persons_ #1 _int } { \msg_error:nnn { cooking-units } { label-already-defined } {#1} }{ - \__cooking_units_if_integer:nTF {#2} + \__cookingunits_if_integer:nTF {#2} { - \int_new:c { g__cooking_units_number_of_persons_ #1 _int } - \int_gset:cn { g__cooking_units_number_of_persons_ #1 _int } {#2} + \int_new:c { g__cookingunits_number_of_persons_ #1 _int } + \int_gset:cn { g__cookingunits_number_of_persons_ #1 _int } {#2} } { \msg_error:nnn { cooking-units } { Number-of-persons-is-not-an-integer } {#2} } } } -\cs_new:Npn \__cooking_units_reference_label_and_persons:n #1 +\cs_new:Npn \__cookingunits_reference_label_and_persons:n #1 { - \int_if_exist:cTF { g__cooking_units_number_of_persons_ #1 _int } + \int_if_exist:cTF { g__cookingunits_number_of_persons_ #1 _int } { - \bool_set_true:N \l__cooking_units_calc_because_ref_was_given_bool - \int_set_eq:Nc \l__cooking_units_local_number_of_persons_int - { g__cooking_units_number_of_persons_ #1 _int } + \bool_set_true:N \l__cookingunits_calc_because_ref_was_given_bool + \int_set_eq:Nc \l__cookingunits_local_number_of_persons_int + { g__cookingunits_number_of_persons_ #1 _int } } { \msg_error:nnn { cooking-units } { label-not-defined } {#1} } } -\cs_new:Npn \__cooking_units_curef:n #1 +\cs_new:Npn \__cookingunits_curef:n #1 { - \int_if_exist:cTF { g__cooking_units_number_of_persons_ #1 _int } + \int_if_exist:cTF { g__cookingunits_number_of_persons_ #1 _int } { - \bool_if:NTF \l__cooking_units_change_number_of_persons_bool - { \int_use:N \l__cooking_units_wanted_number_of_persons_int } - { \int_use:c { g__cooking_units_number_of_persons_ #1 _int } } + \bool_if:NTF \l__cookingunits_change_number_of_persons_bool + { \int_use:N \l__cookingunits_wanted_number_of_persons_int } + { \int_use:c { g__cookingunits_number_of_persons_ #1 _int } } }{ \msg_error:nnn { cooking-units } { label-not-defined } {#1} } } -\NewDocumentCommand \culabel { m m } { \__cooking_units_culabel:nn {#1} {#2} } -\NewExpandableDocumentCommand \curef { m } { \__cooking_units_curef:n {#1} } -\cs_new:Npn \__cooking_units_tl_if_in_remove_and_set_bool:NnN #1#2#3 +\NewDocumentCommand \culabel { m m } { \__cookingunits_culabel:nn {#1} {#2} } +\NewExpandableDocumentCommand \curef { m } { \__cookingunits_curef:n {#1} } +\cs_new:Npn \__cookingunits_tl_if_in_remove_and_set_bool:NnN #1#2#3 { \tl_if_in:NnTF #1 {#2} { @@ -1011,7 +1063,7 @@ } { \bool_set_false:N #3 } } -\cs_new:Npn \__cooking_units_tl_if_in_remove_and_reverse_bool:NnN #1#2#3 +\cs_new:Npn \__cookingunits_tl_if_in_remove_and_reverse_bool:NnN #1#2#3 { \tl_if_in:NnT #1 {#2} { @@ -1021,830 +1073,831 @@ \tl_remove_once:Nn #1 {#2} } } -\tl_const:Nn \c__cooking_units_postfix_unit_tl { ( cu-unit ) } -\tl_const:Nn \c__cooking_units_postfix_unit_pl_tl { ( cu-unit-pl ) } -\tl_const:Nn \c__cooking_units_postfix_unitname_tl { ( cu-unitname ) } -\tl_const:Nn \c__cooking_units_postfix_unitname_pl_tl { ( cu-unitname-pl ) } -\tl_const:Nn \c__cooking_units_postfix_gender_tl { ( cu-unitgender ) } -\tl_const:Nn \c__cooking_units_postfix_phrase_tl { ( cu-unitphrase ) } -\cs_new:Npn \__cooking_units_deftranslation_base:nnn #1#2#3 +\tl_const:Nn \c__cookingunits_postfix_unit_tl { ( cu-unit ) } +\tl_const:Nn \c__cookingunits_postfix_unit_pl_tl { ( cu-unit-pl ) } +\tl_const:Nn \c__cookingunits_postfix_unitname_tl { ( cu-unitname ) } +\tl_const:Nn \c__cookingunits_postfix_unitname_pl_tl { ( cu-unitname-pl ) } +\tl_const:Nn \c__cookingunits_postfix_gender_tl { ( cu-unitgender ) } +\tl_const:Nn \c__cookingunits_postfix_phrase_tl { ( cu-unitphrase ) } +\cs_new:Npn \__cookingunits_deftranslation_base:nnn #1#2#3 { \declaretranslationfallback { #1 #2 } {#3} } -\cs_new:Npn \__cooking_units_deftranslation_to:nnnn #1#2#3#4 +\cs_new:Npn \__cookingunits_deftranslation_to:nnnn #1#2#3#4 { \declaretranslation {#1} { #2 #3 } {#4} } -\cs_generate_variant:Nn \__cooking_units_deftranslation_base:nnn { xx , xxV } -\cs_generate_variant:Nn \__cooking_units_deftranslation_to:nnnn { Vxxv, VxxV , Vxxn, Vxxx,Vxxo,Vxxf } -\cs_new:Npn \__cooking_units_newtranslation_base:nnn #1#2#3 +\cs_generate_variant:Nn \__cookingunits_deftranslation_base:nnn { xx , xxV } +\cs_generate_variant:Nn \__cookingunits_deftranslation_to:nnnn { Vxxv, VxxV , Vxxn, Vxxx,Vxxo,Vxxf } +\cs_new:Npn \__cookingunits_newtranslation_base:nnn #1#2#3 { \definetranslationfallback { #1 #2 } {#3} } -\cs_new:Npn \__cooking_units_newtranslation_to:nnnn #1#2#3#4 +\cs_new:Npn \__cookingunits_newtranslation_to:nnnn #1#2#3#4 { \definetranslation {#1} { #2 #3 } {#4} } -\cs_generate_variant:Nn \__cooking_units_newtranslation_base:nnn { nVn } -\cs_generate_variant:Nn \__cooking_units_newtranslation_to:nnnn { nnVn } -\cs_new:Npn \__cooking_units_translate:nn #1#2 +\cs_generate_variant:Nn \__cookingunits_newtranslation_base:nnn { nVn } +\cs_generate_variant:Nn \__cookingunits_newtranslation_to:nnnn { nnVn } +\cs_new:Npn \__cookingunits_translate:nn #1#2 { \GetTranslation { #1 #2 } } -\cs_new:Npn \__cooking_units_translate_let:Nnn #1#2#3 +\cs_new:Npn \__cookingunits_translate_let:Nnn #1#2#3 { \SaveTranslation {#1} { #2 #3 } } -\cs_new:Npn \__cooking_units_translate_let:nNnn #1#2#3#4 +\cs_new:Npn \__cookingunits_translate_let:nNnn #1#2#3#4 { \SaveTranslationFor {#2} {#1} { #3 #4 } } -\cs_generate_variant:Nn \__cooking_units_translate:nn { xx , VV } -\cs_generate_variant:Nn \__cooking_units_translate_let:Nnn { Nxx } -\cs_generate_variant:Nn \__cooking_units_translate_let:nNnn { VNxx, nNxx } -\prg_new_conditional:Npnn \__cooking_units_unitname_get:Nn #1#2 { F } +\cs_generate_variant:Nn \__cookingunits_translate:nn { VV, nV } +\cs_generate_variant:Nn \__cookingunits_translate_let:Nnn { NnV } +\cs_generate_variant:Nn \__cookingunits_translate_let:nNnn { VNnV, nNnV } +\prg_new_conditional:Npnn \__cookingunits_unitname_get:Nn #1#2 { F } { - \__cooking_units_translate_let:Nxx #1 {#2} \c__cooking_units_postfix_unitname_tl - \tl_if_eq:NNTF #1 \q__cooking_units_no_translation + \__cookingunits_translate_let:NnV #1 {#2} \c__cookingunits_postfix_unitname_tl + \tl_if_eq:NNTF #1 \q__cookingunits_no_translation { \prg_return_false: } { \prg_return_true: } } -\cs_generate_variant:Nn \__cooking_units_unitname_get:NnF { Nx } -\cs_new:Npn \__cooking_units_translate_one_and_check_existance:Nn #1#2 +\cs_generate_variant:Nn \__cookingunits_unitname_get:NnF { Nx } +\cs_new:Npn \__cookingunits_translate_one_and_check_existance:Nn #1#2 { - \__cooking_units_translate_let:Nxx #1 {#2} \c__cooking_units_postfix_gender_tl - \__cooking_units_unitname_get:NxF #1 { one (#1) } + \__cookingunits_translate_let:NnV #1 {#2} \c__cookingunits_postfix_gender_tl + \__cookingunits_unitname_get:NxF #1 { one (#1) } { - \__cooking_units_translate_let:Nxx #1 {#2} \c__cooking_units_postfix_gender_tl + \__cookingunits_translate_let:NnV #1 {#2} \c__cookingunits_postfix_gender_tl \msg_error:nnn { cooking-units } { Translation-not-available } { one (#1) } } } -\cs_generate_variant:Nn \__cooking_units_translate_one_and_check_existance:Nn { Nx } -\seq_gset_from_clist:Nn \g__cooking_units_allowed_special_keys_seq +\cs_generate_variant:Nn \__cookingunits_translate_one_and_check_existance:Nn { Nx } +\seq_gset_from_clist:Nn \g__cookingunits_allowed_special_keys_seq { decimal-mark , one (m) , one (f) , one (n) } -\__cooking_units_newtranslation_base:nVn { decimal-mark } \c__cooking_units_postfix_unitname_tl { . } -\__cooking_units_newtranslation_base:nVn { decimal-mark } \c__cooking_units_postfix_unitname_pl_tl { \q__cooking_units_no_translation } -\__cooking_units_newtranslation_to:nnVn { German } { decimal-mark } \c__cooking_units_postfix_unitname_tl { , } -\__cooking_units_newtranslation_base:nVn { one (m) } \c__cooking_units_postfix_unitname_tl { \q__cooking_units_no_translation } -\__cooking_units_newtranslation_base:nVn { one (f) } \c__cooking_units_postfix_unitname_tl { \q__cooking_units_no_translation } -\__cooking_units_newtranslation_base:nVn { one (n) } \c__cooking_units_postfix_unitname_tl { \q__cooking_units_no_translation } -\__cooking_units_newtranslation_base:nVn { one (m) } \c__cooking_units_postfix_unitname_pl_tl { \q__cooking_units_no_translation } -\__cooking_units_newtranslation_base:nVn { one (f) } \c__cooking_units_postfix_unitname_pl_tl { \q__cooking_units_no_translation } -\__cooking_units_newtranslation_base:nVn { one (n) } \c__cooking_units_postfix_unitname_pl_tl { \q__cooking_units_no_translation } -\__cooking_units_newtranslation_to:nnVn { English } { one (m) } \c__cooking_units_postfix_unitname_tl { one } -\__cooking_units_newtranslation_to:nnVn { English } { one (f) } \c__cooking_units_postfix_unitname_tl { one } -\__cooking_units_newtranslation_to:nnVn { English } { one (n) } \c__cooking_units_postfix_unitname_tl { one } -\__cooking_units_newtranslation_to:nnVn { German } { one (m) } \c__cooking_units_postfix_unitname_tl { ein } -\__cooking_units_newtranslation_to:nnVn { German } { one (f) } \c__cooking_units_postfix_unitname_tl { eine } -\__cooking_units_newtranslation_to:nnVn { German } { one (n) } \c__cooking_units_postfix_unitname_tl { ein } -\__cooking_units_newtranslation_base:nVn { range-sign } \c__cooking_units_postfix_unitname_tl { -- } -\__cooking_units_newtranslation_base:nVn { range-sign } \c__cooking_units_postfix_unitname_pl_tl { \q__cooking_units_no_translation } -\__cooking_units_newtranslation_to:nnVn { German } { range-sign } \c__cooking_units_postfix_unitname_tl { ~bis~ } -\__cooking_units_newtranslation_to:nnVn { English } { range-sign } \c__cooking_units_postfix_unitname_tl { ~to~ } -\cs_new_protected:Npn \__cooking_units_initialise_default:n #1 - { - \__cooking_units_set_unit:Nn \l__cooking_units_given_unit_tl {#1} - \__cooking_units_error_if_unit_not_defined:V \l__cooking_units_given_unit_tl - \bool_set_false:N \l__cooking_units_special_sign_bool - \bool_set_false:N \l__cooking_units_error_bool - \bool_set_false:N \l__cooking_units_range_in_input_bool - \bool_set_false:N \l__cooking_units_lokal_fraction_bool - \bool_set_false:N \l__cooking_units_lokal_mixed_fraction_bool - } -\cs_new_protected:Npn \__cooking_units_initialise_unit_change:n #1 +\__cookingunits_newtranslation_base:nVn { decimal-mark } \c__cookingunits_postfix_unitname_tl { . } +\__cookingunits_newtranslation_base:nVn { decimal-mark } \c__cookingunits_postfix_unitname_pl_tl { \q__cookingunits_no_translation } +\__cookingunits_newtranslation_to:nnVn { German } { decimal-mark } \c__cookingunits_postfix_unitname_tl { , } +\__cookingunits_newtranslation_base:nVn { one (m) } \c__cookingunits_postfix_unitname_tl { \q__cookingunits_no_translation } +\__cookingunits_newtranslation_base:nVn { one (f) } \c__cookingunits_postfix_unitname_tl { \q__cookingunits_no_translation } +\__cookingunits_newtranslation_base:nVn { one (n) } \c__cookingunits_postfix_unitname_tl { \q__cookingunits_no_translation } +\__cookingunits_newtranslation_base:nVn { one (m) } \c__cookingunits_postfix_unitname_pl_tl { \q__cookingunits_no_translation } +\__cookingunits_newtranslation_base:nVn { one (f) } \c__cookingunits_postfix_unitname_pl_tl { \q__cookingunits_no_translation } +\__cookingunits_newtranslation_base:nVn { one (n) } \c__cookingunits_postfix_unitname_pl_tl { \q__cookingunits_no_translation } +\__cookingunits_newtranslation_to:nnVn { English } { one (m) } \c__cookingunits_postfix_unitname_tl { one } +\__cookingunits_newtranslation_to:nnVn { English } { one (f) } \c__cookingunits_postfix_unitname_tl { one } +\__cookingunits_newtranslation_to:nnVn { English } { one (n) } \c__cookingunits_postfix_unitname_tl { one } +\__cookingunits_newtranslation_to:nnVn { German } { one (m) } \c__cookingunits_postfix_unitname_tl { ein } +\__cookingunits_newtranslation_to:nnVn { German } { one (f) } \c__cookingunits_postfix_unitname_tl { eine } +\__cookingunits_newtranslation_to:nnVn { German } { one (n) } \c__cookingunits_postfix_unitname_tl { ein } +\__cookingunits_newtranslation_base:nVn { cutext-range-sign } \c__cookingunits_postfix_unitname_tl { -- } +\__cookingunits_newtranslation_base:nVn { cutext-range-sign } \c__cookingunits_postfix_unitname_pl_tl { \q__cookingunits_no_translation } +\__cookingunits_newtranslation_to:nnVn { German } { cutext-range-sign } \c__cookingunits_postfix_unitname_tl { ~bis~ } +\__cookingunits_newtranslation_to:nnVn { English } { cutext-range-sign } \c__cookingunits_postfix_unitname_tl { ~to~ } +\cs_new_protected:Npn \__cookingunits_initialise_default:n #1 + { + \__cookingunits_set_unit:Nn \l__cookingunits_given_unit_tl {#1} + \__cookingunits_error_if_unit_not_defined:V \l__cookingunits_given_unit_tl + \bool_set_false:N \l__cookingunits_special_sign_bool + \bool_set_false:N \l__cookingunits_error_bool + \bool_set_false:N \l__cookingunits_range_in_input_bool + \bool_set_false:N \l__cookingunits_lokal_fraction_bool + \bool_set_false:N \l__cookingunits_lokal_mixed_fraction_bool + } +\cs_new_protected:Npn \__cookingunits_initialise_unit_change:n #1 { \tl_if_empty:nF {#1} { \keys_set_groups:nnn { cooking-units } { change-unit } {#1} } - \bool_if:NT \l__cooking_units_convert_to_eV_bool - { \__cooking_units_convert_to_eV: } - \prop_get:NVNF \l__cooking_units_change_unit_prop \l__cooking_units_given_unit_tl \l__cooking_units_option_unit_tl - { \tl_set_eq:NN \l__cooking_units_option_unit_tl \l__cooking_units_given_unit_tl } + \bool_if:NT \l__cookingunits_convert_to_eV_bool + { \__cookingunits_convert_to_eV: } + \prop_get:NVNF \l__cookingunits_change_unit_prop \l__cookingunits_given_unit_tl \l__cookingunits_option_unit_tl + { \tl_set_eq:NN \l__cookingunits_option_unit_tl \l__cookingunits_given_unit_tl } } -\cs_new_protected:Npn \__cooking_units_initialise_after_unit_change:nn #1#2 +\cs_new_protected:Npn \__cookingunits_initialise_after_unit_change:nn #1#2 { \IfNoValueF {#1} - { \__cooking_units_reference_label_and_persons:n {#1} } - \clist_if_empty:cF { l__cooking_units_predefined_option_ \l__cooking_units_option_unit_tl _clist } + { \__cookingunits_reference_label_and_persons:n {#1} } + \clist_if_empty:cF { l__cookingunits_predefined_option_ \l__cookingunits_option_unit_tl _clist } { \keys_set_filter:nnv { cooking-units } { change-unit } - { l__cooking_units_predefined_option_ \l__cooking_units_option_unit_tl _clist } + { l__cookingunits_predefined_option_ \l__cookingunits_option_unit_tl _clist } } \tl_if_empty:nF {#2} { \keys_set_filter:nnn { cooking-units } { change-unit } {#2} } \bool_lazy_and:nnTF - { \l__cooking_units_calc_because_ref_was_given_bool } { \l__cooking_units_change_number_of_persons_bool } - { \bool_set_true:N \l__cooking_units_lokal_persons_bool } - { \bool_set_false:N \l__cooking_units_lokal_persons_bool } + { \l__cookingunits_calc_because_ref_was_given_bool } { \l__cookingunits_change_number_of_persons_bool } + { \bool_set_true:N \l__cookingunits_lokal_persons_bool } + { \bool_set_false:N \l__cookingunits_lokal_persons_bool } \bool_lazy_and:nnTF - { \g__cooking_units_opt_numeral_bool } { \l__cooking_units_print_numeral_bool } - { \bool_set_true:N \l__cooking_units_lokal_numeral_bool } - { \bool_set_false:N \l__cooking_units_lokal_numeral_bool } + { \g__cookingunits_opt_numeral_bool } { \l__cookingunits_print_numeral_bool } + { \bool_set_true:N \l__cookingunits_lokal_numeral_bool } + { \bool_set_false:N \l__cookingunits_lokal_numeral_bool } } -\cs_new_protected:Npn \__cooking_units_print_input:N #1 { } -\cs_new_protected:Npn \__cooking_units_print_correct_unit: { } -\cs_new_protected:Npn \__cooking_units_do_not_process_input:NN #1#2 { } -\cs_new_eq:NN \__cooking_units_pre_process_input:NN \__cooking_units_do_not_process_input:NN -\cs_new_eq:NN \__cooking_units_post_process_input:NN \__cooking_units_do_not_process_input:NN -\cs_new_protected:Npn \__cooking_units_set_process_and_print_for_cunum: +\cs_new_protected:Npn \__cookingunits_print_input:N #1 { } +\cs_new_protected:Npn \__cookingunits_print_correct_unit: { } +\cs_new_protected:Npn \__cookingunits_do_not_process_input:NN #1#2 { } +\cs_new_eq:NN \__cookingunits_pre_process_input:NN \__cookingunits_do_not_process_input:NN +\cs_new_eq:NN \__cookingunits_post_process_input:NN \__cookingunits_do_not_process_input:NN +\cs_new_protected:Npn \__cookingunits_set_process_and_print_for_cunum: { - \cs_set_eq:NN \__cooking_units_print_input:N \__cooking_units_print_numerical_input:N - \cs_set_eq:NN \__cooking_units_print_correct_unit: \__cooking_units_cunum_print_correct_unit: - \cs_set_eq:NN \__cooking_units_pre_process_input:NN \__cooking_units_do_not_process_input:NN - \cs_set_eq:NN \__cooking_units_post_process_input:NN \__cooking_units_do_not_process_input:NN + \cs_set_eq:NN \__cookingunits_print_input:N \__cookingunits_print_numerical_input:N + \cs_set_eq:NN \__cookingunits_print_correct_unit: \__cookingunits_cunum_print_correct_unit: + \cs_set_eq:NN \__cookingunits_pre_process_input:NN \__cookingunits_do_not_process_input:NN + \cs_set_eq:NN \__cookingunits_post_process_input:NN \__cookingunits_do_not_process_input:NN } -\cs_new_protected:Npn \__cooking_units_set_process_and_print_for_cutext: +\cs_new_protected:Npn \__cookingunits_set_process_and_print_for_cutext: { - \cs_set_eq:NN \__cooking_units_print_input:N \__cooking_units_cutext_print_input:N - \cs_set_eq:NN \__cooking_units_print_correct_unit: \__cooking_units_cutext_print_correct_unitname: - \cs_set_eq:NN \__cooking_units_pre_process_input:NN \__cooking_units_cutext_pre_process_input:NN - \cs_set_eq:NN \__cooking_units_post_process_input:NN \__cooking_units_cutext_post_process_input:NN + \cs_set_eq:NN \__cookingunits_print_input:N \__cookingunits_cutext_print_input:N + \cs_set_eq:NN \__cookingunits_print_correct_unit: \__cookingunits_cutext_print_correct_unitname: + \cs_set_eq:NN \__cookingunits_pre_process_input:NN \__cookingunits_cutext_pre_process_input:NN + \cs_set_eq:NN \__cookingunits_post_process_input:NN \__cookingunits_cutext_post_process_input:NN } -\cs_new_protected:Npn \__cooking_units_set_process_and_print_for_cuam: +\cs_new_protected:Npn \__cookingunits_set_process_and_print_for_cuam: { - \cs_set_eq:NN \__cooking_units_print_input:N \__cooking_units_cuam_print_numerical_input:N - \cs_set_eq:NN \__cooking_units_print_correct_unit: \__cooking_units_cuam_print_correct_unitphrase: - \cs_set_eq:NN \__cooking_units_pre_process_input:NN \__cooking_units_do_not_process_input:NN - \cs_set_eq:NN \__cooking_units_post_process_input:NN \__cooking_units_cuam_post_process_input:NN + \cs_set_eq:NN \__cookingunits_print_input:N \__cookingunits_cuam_print_numerical_input:N + \cs_set_eq:NN \__cookingunits_print_correct_unit: \__cookingunits_cuam_print_correct_unitphrase: + \cs_set_eq:NN \__cookingunits_pre_process_input:NN \__cookingunits_do_not_process_input:NN + \cs_set_eq:NN \__cookingunits_post_process_input:NN \__cookingunits_cuam_post_process_input:NN } -\cs_new_protected:Npn \__cooking_units_print_numerical_input:N #1 +\cs_new_protected:Npn \__cookingunits_print_numerical_input:N #1 { \tl_if_in:NnT #1 { . } { - \__cooking_units_translate_let:Nxx \l__cooking_units_translation_tmpa_tl - { decimal-mark } \c__cooking_units_postfix_unitname_tl - \tl_replace_once:Nnn #1 { . } { \l__cooking_units_translation_tmpa_tl } + \__cookingunits_translate_let:NnV \l__cookingunits_translation_tmpa_tl + { decimal-mark } \c__cookingunits_postfix_unitname_tl + \tl_replace_once:Nnn #1 { . } { \l__cookingunits_translation_tmpa_tl } } - \tl_replace_once:Nnn #1 { - } \c__cooking_units_minus_tl + \tl_replace_once:Nnn #1 { - } \c__cookingunits_minus_tl #1 } -\cs_new:Npn \__cooking_units_print_fractions:nnn #1#2#3 +\cs_new:Npn \__cookingunits_print_fractions:nnn #1#2#3 { - \bool_if:NT \l__cooking_units_minus_bool { \c__cooking_units_minus_tl } + \bool_if:NT \l__cookingunits_minus_bool { \c__cookingunits_minus_tl } \tl_if_empty:nF {#1} { #1 - \__cooking_units_dim_horizontal:N \l__cooking_units_mixed_frac_dim + \__cookingunits_dim_horizontal:N \l__cookingunits_mixed_frac_dim } - \__cooking_units_frac:nn {#2} {#3} + \__cookingunits_frac:nn {#2} {#3} } -\cs_new:Npn \__cooking_units_print_ranges:NN #1#2 +\cs_new:Npn \__cookingunits_print_ranges:NN #1#2 { - \__cooking_units_print_input:N #1 - \bool_if:NTF \l__cooking_units_using_cutext_bool + \__cookingunits_print_input:N #1 + \bool_if:NTF \l__cookingunits_using_cutext_bool { - \tl_use:N \l__cooking_units_cutext_range_sign_tl - \bool_set_false:N \l__cooking_units_cutext_uppercase_word_bool + \tl_if_empty:NTF \l__cookingunits_cutext_range_sign_tl + { \__cookingunits_translate:nV { cutext-range-sign } \c__cookingunits_postfix_unitname_tl } + { \tl_use:N \l__cookingunits_cutext_range_sign_tl } + \bool_set_false:N \l__cookingunits_cutext_uppercase_word_bool } - { \tl_use:N \l__cooking_units_cunum_range_sign_tl } - \__cooking_units_print_input:N #2 + { \tl_use:N \l__cookingunits_cunum_range_sign_tl } + \__cookingunits_print_input:N #2 } -\cs_new:Npn \__cooking_units_create_error:n #1 +\cs_new:Npn \__cookingunits_create_error:n #1 { - \bool_set_true:N \l__cooking_units_error_bool - \msg_error:nnV { cooking-units } {#1} \l__cooking_units_given_amount_tl + \bool_set_true:N \l__cookingunits_error_bool + \msg_error:nnV { cooking-units } {#1} \l__cookingunits_given_amount_tl } -\cs_new:Npn \__cooking_units_create_error_and_stop:n #1 +\cs_new:Npn \__cookingunits_create_error_and_stop:n #1 { - \bool_set_true:N \l__cooking_units_error_bool - \msg_error:nnV { cooking-units } {#1} \l__cooking_units_given_amount_tl + \bool_set_true:N \l__cookingunits_error_bool + \msg_error:nnV { cooking-units } {#1} \l__cookingunits_given_amount_tl \use_none_delimit_by_q_nil:w } -\cs_new:Npn \__cooking_units_create_error:nn #1#2 +\cs_new:Npn \__cookingunits_create_error:nn #1#2 { - \bool_set_true:N \l__cooking_units_error_bool - \msg_error:nnnV { cooking-units } {#1} {#2} \l__cooking_units_given_amount_tl + \bool_set_true:N \l__cookingunits_error_bool + \msg_error:nnnV { cooking-units } {#1} {#2} \l__cookingunits_given_amount_tl } -\cs_new:Npn \__cooking_units_parse_input:n #1 +\cs_new:Npn \__cookingunits_parse_input:n #1 { - \bool_if:NTF \l__cooking_units_fourty_two_bool - { \tl_clear:N \l__cooking_units_given_amount_tl } - { \__cooking_units_set_amount:Nn \l__cooking_units_given_amount_tl {#1} } - \tl_set_rescan:NnV \l__cooking_units_given_amount_tl + \bool_if:NTF \l__cookingunits_fourty_two_bool + { \tl_clear:N \l__cookingunits_given_amount_tl } + { \__cookingunits_set_amount:Nn \l__cookingunits_given_amount_tl {#1} } + \tl_set_rescan:NnV \l__cookingunits_given_amount_tl { \char_set_catcode_letter:N \_ % \char_set_catcode_ignore:N \ % \char_set_catcode_other:N ? % - } \l__cooking_units_given_amount_tl + } \l__cookingunits_given_amount_tl \bool_lazy_or:nnTF - { \l__cooking_units_draft_bool } - { \tl_if_empty_p:N \l__cooking_units_given_amount_tl } + { \l__cookingunits_draft_bool } + { \tl_if_empty_p:N \l__cookingunits_given_amount_tl } { - \bool_if:NTF \l__cooking_units_fourty_two_bool + \bool_if:NTF \l__cookingunits_fourty_two_bool { 42 } - { \l__cooking_units_given_amount_tl } + { \l__cookingunits_given_amount_tl } }{ - \tl_set_eq:NN \l__cooking_units_tmpa_tl \l__cooking_units_given_amount_tl - \__cooking_units_split_input:N \l__cooking_units_tmpa_tl - \__cooking_units_process_and_print_input: + \tl_set_eq:NN \l__cookingunits_tmpa_tl \l__cookingunits_given_amount_tl + \__cookingunits_split_input:N \l__cookingunits_tmpa_tl + \__cookingunits_process_and_print_input: } } -\cs_new:Npn \__cooking_units_split_input:N #1 +\cs_new:Npn \__cookingunits_split_input:N #1 { - \tl_if_in:NVT #1 \l__cooking_units_input_range_sign_tl + \tl_if_in:NVT #1 \l__cookingunits_input_range_sign_tl { - \tl_replace_once:NVn #1 \l__cooking_units_input_range_sign_tl { \q__cooking_units_range } - \bool_set_true:N \l__cooking_units_range_in_input_bool + \tl_replace_once:NVn #1 \l__cookingunits_input_range_sign_tl { \q__cookingunits_range } + \bool_set_true:N \l__cookingunits_range_in_input_bool } \tl_if_in:NnT #1 { / } { - \bool_set_true:N \l__cooking_units_lokal_fraction_bool - \bool_if:NT \l__cooking_units_range_in_input_bool - { \__cooking_units_create_error_and_stop:n { fraction-not-allowed-with-range } } + \bool_set_true:N \l__cookingunits_lokal_fraction_bool + \bool_if:NT \l__cookingunits_range_in_input_bool + { \__cookingunits_create_error_and_stop:n { fraction-not-allowed-with-range } } } \tl_if_in:NnT #1 { _ } { - \bool_set_true:N \l__cooking_units_lokal_mixed_fraction_bool - \bool_if:NF \l__cooking_units_lokal_fraction_bool - { \__cooking_units_create_error_and_stop:n { missing-slash } } + \bool_set_true:N \l__cookingunits_lokal_mixed_fraction_bool + \bool_if:NF \l__cookingunits_lokal_fraction_bool + { \__cookingunits_create_error_and_stop:n { missing-slash } } } - \__cooking_units_split:N #1 + \__cookingunits_split:N #1 \use_none_delimit_by_q_nil:w \q_nil } -\cs_new:Npn \__cooking_units_process_tmp: { } -\cs_new:Npn \__cooking_units_process_and_print_input: +\cs_new:Npn \__cookingunits_process_tmp: { } +\cs_new:Npn \__cookingunits_process_and_print_input: { - \bool_if:NTF \l__cooking_units_error_bool - { \l__cooking_units_given_amount_tl } - { \__cooking_units_process_tmp: } + \bool_if:NTF \l__cookingunits_error_bool + { \l__cookingunits_given_amount_tl } + { \__cookingunits_process_tmp: } } -\cs_new:Npn \__cooking_units_split:N #1 +\cs_new:Npn \__cookingunits_split:N #1 { - \bool_if:NTF \l__cooking_units_lokal_fraction_bool - { \__cooking_units_split_fraction:V } + \bool_if:NTF \l__cookingunits_lokal_fraction_bool + { \__cookingunits_split_fraction:V } { - \bool_if:NTF \l__cooking_units_range_in_input_bool - { \__cooking_units_split_range:V } - { \__cooking_units_split_number:V } + \bool_if:NTF \l__cookingunits_range_in_input_bool + { \__cookingunits_split_range:V } + { \__cookingunits_split_number:V } } #1 } -\cs_new:Npn \__cooking_units_split_number:n #1 +\cs_new:Npn \__cookingunits_split_number:n #1 { - \cs_set_eq:NN \__cooking_units_process_tmp: \__cooking_units_process_number_in_input: - \__cooking_units_parse_input_and_safe_in:nN {#1} \l__cooking_units_number_tmpa_tl + \cs_set_eq:NN \__cookingunits_process_tmp: \__cookingunits_process_number_in_input: + \__cookingunits_parse_input_and_safe_in:nN {#1} \l__cookingunits_number_tmpa_tl } -\cs_new:Npn \__cooking_units_split_range:n #1 +\cs_new:Npn \__cookingunits_split_range:n #1 { - \cs_set_eq:NN \__cooking_units_process_tmp: \__cooking_units_process_range_in_input: - \__cooking_units_split_range_aux:ww #1 \q_stop + \cs_set_eq:NN \__cookingunits_process_tmp: \__cookingunits_process_range_in_input: + \__cookingunits_split_range_aux:ww #1 \q_stop } -\cs_new:Npn \__cooking_units_split_range_aux:ww #1 \q__cooking_units_range #2 \q_stop +\cs_new:Npn \__cookingunits_split_range_aux:ww #1 \q__cookingunits_range #2 \q_stop { - \__cooking_units_parse_input_and_safe_in:nN {#1} \l__cooking_units_number_tmpa_tl - \__cooking_units_parse_input_and_safe_in:nN {#2} \l__cooking_units_number_tmpb_tl + \__cookingunits_parse_input_and_safe_in:nN {#1} \l__cookingunits_number_tmpa_tl + \__cookingunits_parse_input_and_safe_in:nN {#2} \l__cookingunits_number_tmpb_tl } -\cs_new:Npn \__cooking_units_split_fraction:n #1 +\cs_new:Npn \__cookingunits_split_fraction:n #1 { - \bool_if:NTF \l__cooking_units_lokal_mixed_fraction_bool + \bool_if:NTF \l__cookingunits_lokal_mixed_fraction_bool { - \cs_set_eq:NN \__cooking_units_process_tmp: \__cooking_units_process_mixed_fraction_in_input: - \__cooking_units_split_fraction_mixed:ww + \cs_set_eq:NN \__cookingunits_process_tmp: \__cookingunits_process_mixed_fraction_in_input: + \__cookingunits_split_fraction_mixed:ww }{ - \cs_set_eq:NN \__cooking_units_process_tmp: \__cooking_units_process_fraction_in_input: - \__cooking_units_split_fraction_frac:ww + \cs_set_eq:NN \__cookingunits_process_tmp: \__cookingunits_process_fraction_in_input: + \__cookingunits_split_fraction_frac:ww } #1 \q_stop / \q_recursion_tail \q_stop \q_recursion_stop \bool_lazy_or:nnT - { \l__cooking_units_lokal_persons_bool }{ \l__cooking_units_eval_fractions_bool } - { \bool_set_false:N \l__cooking_units_lokal_fraction_bool } + { \l__cookingunits_lokal_persons_bool }{ \l__cookingunits_eval_fractions_bool } + { \bool_set_false:N \l__cookingunits_lokal_fraction_bool } } -\cs_new:Npn \__cooking_units_split_fraction_frac:ww #1 / #2 \q_stop +\cs_new:Npn \__cookingunits_split_fraction_frac:ww #1 / #2 \q_stop { \quark_if_recursion_tail_stop_do:nn {#2} - { \__cooking_units_create_error:n { fraction-wrong-order } } - \__cooking_units_parse_input_and_safe_in:nN {#1} \l__cooking_units_number_tmpa_tl - \__cooking_units_parse_input_and_safe_in:nN {#2} \l__cooking_units_number_tmpb_tl + { \__cookingunits_create_error:n { fraction-wrong-order } } + \__cookingunits_parse_input_and_safe_in:nN {#1} \l__cookingunits_number_tmpa_tl + \__cookingunits_parse_input_and_safe_in:nN {#2} \l__cookingunits_number_tmpb_tl \use_none_delimit_by_q_recursion_stop:w } -\cs_new:Npn \__cooking_units_split_fraction_mixed:ww #1 _ #2 \q_stop +\cs_new:Npn \__cookingunits_split_fraction_mixed:ww #1 _ #2 \q_stop { - \__cooking_units_parse_input_and_safe_in:nN {#1} \l__cooking_units_mixed_fraction_tl - \__cooking_units_split_fraction_frac:ww #2 \q_stop + \__cookingunits_parse_input_and_safe_in:nN {#1} \l__cookingunits_mixed_fraction_tl + \__cookingunits_split_fraction_frac:ww #2 \q_stop } -\cs_generate_variant:Nn \__cooking_units_split_number:n { V } -\cs_generate_variant:Nn \__cooking_units_split_range:n { V } -\cs_generate_variant:Nn \__cooking_units_split_fraction:n { V } -\cs_new:Npn \__cooking_units_parse_input_and_safe_in:nN #1 #2 +\cs_generate_variant:Nn \__cookingunits_split_number:n { V } +\cs_generate_variant:Nn \__cookingunits_split_range:n { V } +\cs_generate_variant:Nn \__cookingunits_split_fraction:n { V } +\cs_new:Npn \__cookingunits_parse_input_and_safe_in:nN #1 #2 { - \tl_clear:N \l__cooking_units_tmpa_tl - \bool_set_false:N \l__cooking_units_check_decimal_bool - \cs_set_eq:NN \__cooking_units_parse:N \__cooking_units_start_loop:N - \tl_map_function:nN {#1} \__cooking_units_parse:N - \bool_if:NTF \l__cooking_units_error_bool + \tl_clear:N \l__cookingunits_tmpa_tl + \bool_set_false:N \l__cookingunits_check_decimal_bool + \cs_set_eq:NN \__cookingunits_parse:N \__cookingunits_start_loop:N + \tl_map_function:nN {#1} \__cookingunits_parse:N + \bool_if:NTF \l__cookingunits_error_bool { \use_none_delimit_by_q_nil:w } - { \tl_set_eq:NN #2 \l__cooking_units_tmpa_tl } + { \tl_set_eq:NN #2 \l__cookingunits_tmpa_tl } } -\cs_new:Npn \__cooking_units_start_loop:N #1 +\cs_new:Npn \__cookingunits_start_loop:N #1 { - \cs_set_eq:NN \__cooking_units_parse:N \__cooking_units_parse_input_loop_aux:N - \tl_if_in:NnTF \l__cooking_units_input_value_signs_tl {#1} - { \tl_put_right:Nn \l__cooking_units_tmpa_tl {#1} } + \cs_set_eq:NN \__cookingunits_parse:N \__cookingunits_parse_input_loop_aux:N + \tl_if_in:NnTF \l__cookingunits_input_value_signs_tl {#1} + { \tl_put_right:Nn \l__cookingunits_tmpa_tl {#1} } { - \tl_map_function:nN {#1} \__cooking_units_parse:N + \tl_map_function:nN {#1} \__cookingunits_parse:N } } -\cs_new:Npn \__cooking_units_parse_input_loop_aux:N #1 +\cs_new:Npn \__cookingunits_parse_input_loop_aux:N #1 { - \tl_if_in:NnTF \l__cooking_units_input_digits_tl {#1} - { \tl_put_right:Nn \l__cooking_units_tmpa_tl {#1} } + \tl_if_in:NnTF \l__cookingunits_input_digits_tl {#1} + { \tl_put_right:Nn \l__cookingunits_tmpa_tl {#1} } { - \tl_if_in:NnTF \l__cooking_units_input_decimal_mark_tl {#1} + \tl_if_in:NnTF \l__cookingunits_input_decimal_mark_tl {#1} { - \__cooking_units_check_repitition:N \l__cooking_units_check_decimal_bool - \tl_put_right:Nn \l__cooking_units_tmpa_tl { . } + \__cookingunits_check_repitition:N \l__cookingunits_check_decimal_bool + \tl_put_right:Nn \l__cookingunits_tmpa_tl { . } }{ - \tl_if_in:NnTF \l__cooking_units_input_allowed_special_signs_tl {#1} + \tl_if_in:NnTF \l__cookingunits_input_allowed_special_signs_tl {#1} { - \bool_set_true:N \l__cooking_units_special_sign_bool - \tl_put_right:Nn \l__cooking_units_tmpa_tl {#1} + \bool_set_true:N \l__cookingunits_special_sign_bool + \tl_put_right:Nn \l__cookingunits_tmpa_tl {#1} }{ - \bool_set_true:N \l__cooking_units_error_bool - \__cooking_units_check_error:n {#1} + \bool_set_true:N \l__cookingunits_error_bool + \__cookingunits_check_error:n {#1} } } } } -\cs_new:Npn \__cooking_units_check_error:n #1 +\cs_new:Npn \__cookingunits_check_error:n #1 { - \tl_if_in:NnTF \l__cooking_units_input_fraction_sign_tl {#1} - { \__cooking_units_create_error:n { Second-fraction-sign-not-allowed } } + \tl_if_in:NnTF \l__cookingunits_input_fraction_sign_tl {#1} + { \__cookingunits_create_error:n { Second-fraction-sign-not-allowed } } { - \tl_if_in:NnTF \l__cooking_units_input_mixed_fraction_sign_tl {#1} - { \__cooking_units_create_error:n { Second-mixed-fraction-sign-not-allowed } } - { \__cooking_units_create_error:nn { Token-not-allowed } {#1} } + \tl_if_in:NnTF \l__cookingunits_input_mixed_fraction_sign_tl {#1} + { \__cookingunits_create_error:n { Second-mixed-fraction-sign-not-allowed } } + { \__cookingunits_create_error:nn { Token-not-allowed } {#1} } } } -\cs_new:Npn \__cooking_units_check_repitition:N #1 +\cs_new:Npn \__cookingunits_check_repitition:N #1 { \bool_if:NTF #1 - { \__cooking_units_create_error:n { Second-decimal-sign-not-allowed } } + { \__cookingunits_create_error:n { Second-decimal-sign-not-allowed } } { \bool_set_true:N #1 } } -\cs_new:Npn \__cooking_units_process_number_in_input: +\cs_new:Npn \__cookingunits_process_number_in_input: { - \__cooking_units_process_and_print_number_in_input:N \l__cooking_units_number_tmpa_tl + \__cookingunits_process_and_print_number_in_input:N \l__cookingunits_number_tmpa_tl } -\cs_new:Npn \__cooking_units_process_and_print_number_in_input:N #1 +\cs_new:Npn \__cookingunits_process_and_print_number_in_input:N #1 { - \__cooking_units_pre_process_input:NN #1 \q_no_value - \__cooking_units_calculate_and_store_in:N #1 - \__cooking_units_post_process_input:NN #1 \q_no_value - \__cooking_units_print_input:N #1 + \__cookingunits_pre_process_input:NN #1 \q_no_value + \__cookingunits_calculate_and_store_in:N #1 + \__cookingunits_post_process_input:NN #1 \q_no_value + \__cookingunits_print_input:N #1 } -\cs_new:Npn \__cooking_units_process_range_in_input: +\cs_new:Npn \__cookingunits_process_range_in_input: { - \__cooking_units_pre_process_input:NN \l__cooking_units_number_tmpa_tl \l__cooking_units_number_tmpb_tl - \__cooking_units_calculate_and_store_in:N \l__cooking_units_number_tmpa_tl - \__cooking_units_calculate_and_store_in:N \l__cooking_units_number_tmpb_tl - \__cooking_units_post_process_input:NN \l__cooking_units_number_tmpa_tl \l__cooking_units_number_tmpb_tl - \__cooking_units_print_ranges:NN \l__cooking_units_number_tmpa_tl \l__cooking_units_number_tmpb_tl + \__cookingunits_pre_process_input:NN \l__cookingunits_number_tmpa_tl \l__cookingunits_number_tmpb_tl + \__cookingunits_calculate_and_store_in:N \l__cookingunits_number_tmpa_tl + \__cookingunits_calculate_and_store_in:N \l__cookingunits_number_tmpb_tl + \__cookingunits_post_process_input:NN \l__cookingunits_number_tmpa_tl \l__cookingunits_number_tmpb_tl + \__cookingunits_print_ranges:NN \l__cookingunits_number_tmpa_tl \l__cookingunits_number_tmpb_tl } -\cs_new:Npn \__cooking_units_process_fraction_in_input: +\cs_new:Npn \__cookingunits_process_fraction_in_input: { \bool_lazy_or:nnTF - { \l__cooking_units_lokal_fraction_bool } - { \l__cooking_units_special_sign_bool } + { \l__cookingunits_lokal_fraction_bool } + { \l__cookingunits_special_sign_bool } { - \__cooking_units_tl_if_in_remove_and_set_bool:NnN \l__cooking_units_number_tmpa_tl { - } \l__cooking_units_minus_bool - \__cooking_units_tl_if_in_remove_and_reverse_bool:NnN \l__cooking_units_number_tmpb_tl { - } \l__cooking_units_minus_bool - \__cooking_units_print_fractions:nnn + \__cookingunits_tl_if_in_remove_and_set_bool:NnN \l__cookingunits_number_tmpa_tl { - } \l__cookingunits_minus_bool + \__cookingunits_tl_if_in_remove_and_reverse_bool:NnN \l__cookingunits_number_tmpb_tl { - } \l__cookingunits_minus_bool + \__cookingunits_print_fractions:nnn { } - { \l__cooking_units_number_tmpa_tl } - { \l__cooking_units_number_tmpb_tl } + { \l__cookingunits_number_tmpa_tl } + { \l__cookingunits_number_tmpb_tl } }{ - \fp_compare:nNnT { \l__cooking_units_number_tmpb_tl } = { 0 } - { \msg_error:nnV { cooking-units } { Division-by-zero } \l__cooking_units_given_amount_tl } - \__cooking_units_tl_eval:Nn \l__cooking_units_number_tmpa_tl - { \l__cooking_units_number_tmpa_tl / \l__cooking_units_number_tmpb_tl } - \__cooking_units_process_and_print_number_in_input:N \l__cooking_units_number_tmpa_tl + \fp_compare:nNnT { \l__cookingunits_number_tmpb_tl } = { 0 } + { \msg_error:nnV { cooking-units } { Division-by-zero } \l__cookingunits_given_amount_tl } + \__cookingunits_tl_eval:Nn \l__cookingunits_number_tmpa_tl + { \l__cookingunits_number_tmpa_tl / \l__cookingunits_number_tmpb_tl } + \__cookingunits_process_and_print_number_in_input:N \l__cookingunits_number_tmpa_tl } } -\cs_new:Npn \__cooking_units_process_mixed_fraction_in_input: +\cs_new:Npn \__cookingunits_process_mixed_fraction_in_input: { - \__cooking_units_tl_if_in_remove_and_set_bool:NnN \l__cooking_units_mixed_fraction_tl { - } \l__cooking_units_minus_bool - \__cooking_units_tl_if_in_remove_and_reverse_bool:NnN \l__cooking_units_number_tmpa_tl { - } \l__cooking_units_minus_bool - \__cooking_units_tl_if_in_remove_and_reverse_bool:NnN \l__cooking_units_number_tmpb_tl { - } \l__cooking_units_minus_bool + \__cookingunits_tl_if_in_remove_and_set_bool:NnN \l__cookingunits_mixed_fraction_tl { - } \l__cookingunits_minus_bool + \__cookingunits_tl_if_in_remove_and_reverse_bool:NnN \l__cookingunits_number_tmpa_tl { - } \l__cookingunits_minus_bool + \__cookingunits_tl_if_in_remove_and_reverse_bool:NnN \l__cookingunits_number_tmpb_tl { - } \l__cookingunits_minus_bool \bool_lazy_or:nnTF - { \l__cooking_units_lokal_fraction_bool } - { \l__cooking_units_special_sign_bool } + { \l__cookingunits_lokal_fraction_bool } + { \l__cookingunits_special_sign_bool } { - \__cooking_units_print_fractions:nnn - { \l__cooking_units_mixed_fraction_tl } - { \l__cooking_units_number_tmpa_tl } - { \l__cooking_units_number_tmpb_tl } + \__cookingunits_print_fractions:nnn + { \l__cookingunits_mixed_fraction_tl } + { \l__cookingunits_number_tmpa_tl } + { \l__cookingunits_number_tmpb_tl } }{ - \fp_compare:nNnT { \l__cooking_units_number_tmpb_tl } = { 0 } - { \msg_error:nnV { cooking-units } { Division-by-zero } \l__cooking_units_given_amount_tl } - \__cooking_units_tl_eval:Nn \l__cooking_units_number_tmpa_tl + \fp_compare:nNnT { \l__cookingunits_number_tmpb_tl } = { 0 } + { \msg_error:nnV { cooking-units } { Division-by-zero } \l__cookingunits_given_amount_tl } + \__cookingunits_tl_eval:Nn \l__cookingunits_number_tmpa_tl { - \bool_if:NTF \l__cooking_units_minus_bool - { - \l__cooking_units_mixed_fraction_tl - } - { \l__cooking_units_mixed_fraction_tl + } - \l__cooking_units_number_tmpa_tl / \l__cooking_units_number_tmpb_tl + \bool_if:NTF \l__cookingunits_minus_bool + { - \l__cookingunits_mixed_fraction_tl - } + { \l__cookingunits_mixed_fraction_tl + } + \l__cookingunits_number_tmpa_tl / \l__cookingunits_number_tmpb_tl } - \__cooking_units_process_and_print_number_in_input:N \l__cooking_units_number_tmpa_tl + \__cookingunits_process_and_print_number_in_input:N \l__cookingunits_number_tmpa_tl } } -\cs_new:Npn \__cooking_units_calculate_and_store_in:N #1 +\cs_new:Npn \__cookingunits_calculate_and_store_in:N #1 { - \bool_if:NTF \l__cooking_units_special_sign_bool + \bool_if:NTF \l__cookingunits_special_sign_bool { \msg_warning:nnV { cooking-units } { amount-not-known } #1 }{ \bool_lazy_and:nnTF - { \l__cooking_units_using_cutext_bool } { \l__cooking_units_cutext_keep_unit_bool } - { \tl_set_eq:NN \l__cooking_units_tmpa_tl #1 } - { \__cooking_units_calculate_input_and_store_in:nN {#1} \l__cooking_units_tmpa_tl } - \__cooking_units_calc_references:NN \l__cooking_units_tmpa_tl \l__cooking_units_tmpa_tl - \__cooking_units_round_calculated_input:NV \l__cooking_units_tmpa_tl \l__cooking_units_tmpa_tl - \__cooking_units_check_temperature_limit:N \l__cooking_units_tmpa_tl - \tl_set_eq:NN #1 \l__cooking_units_tmpa_tl + { \l__cookingunits_using_cutext_bool } { \l__cookingunits_cutext_keep_unit_bool } + { \tl_set_eq:NN \l__cookingunits_tmpa_tl #1 } + { \__cookingunits_calculate_input_and_store_in:nN {#1} \l__cookingunits_tmpa_tl } + \__cookingunits_calc_references:NN \l__cookingunits_tmpa_tl \l__cookingunits_tmpa_tl + \__cookingunits_round_calculated_input:NV \l__cookingunits_tmpa_tl \l__cookingunits_tmpa_tl + \__cookingunits_check_temperature_limit:N \l__cookingunits_tmpa_tl + \tl_set_eq:NN #1 \l__cookingunits_tmpa_tl } } -\cs_new:Npn \__cooking_units_calculate_input_and_store_in:nN #1#2 +\cs_new:Npn \__cookingunits_calculate_input_and_store_in:nN #1#2 { - \fp_set:Nn \l__cooking_units_tmpa_fp {#1} - \tl_if_in:cnTF { l__cooking_units_unit_change_ \l__cooking_units_given_unit_tl _tl } { \l__cooking_units_tmpa_fp } + \fp_set:Nn \l__cookingunits_tmpa_fp {#1} + \tl_if_in:cnTF { l__cookingunits_unit_change_ \l__cookingunits_given_unit_tl _tl } { \l__cookingunits_tmpa_fp } { - \__cooking_units_tl_eval:Nv #2 { l__cooking_units_unit_change_ \l__cooking_units_given_unit_tl _tl } + \__cookingunits_tl_eval:Nv #2 { l__cookingunits_unit_change_ \l__cookingunits_given_unit_tl _tl } }{ - \__cooking_units_tl_eval:Nn #2 - { \l__cooking_units_tmpa_fp * \tl_use:c { l__cooking_units_unit_change_ \l__cooking_units_given_unit_tl _tl } } + \__cookingunits_tl_eval:Nn #2 + { \l__cookingunits_tmpa_fp * \tl_use:c { l__cookingunits_unit_change_ \l__cookingunits_given_unit_tl _tl } } } } -\cs_new:Npn \__cooking_units_calc_references:NN #1#2 +\cs_new:Npn \__cookingunits_calc_references:NN #1#2 { - \bool_if:NT \l__cooking_units_lokal_persons_bool + \bool_if:NT \l__cookingunits_lokal_persons_bool { \int_compare:nNnF - { \l__cooking_units_wanted_number_of_persons_int } + { \l__cookingunits_wanted_number_of_persons_int } = - { \l__cooking_units_local_number_of_persons_int } + { \l__cookingunits_local_number_of_persons_int } { - \__cooking_units_change_unit:TF - { \tl_set_eq:NN \l__cooking_units_tmpb_tl \l__cooking_units_option_unit_tl } - { \tl_set_eq:NN \l__cooking_units_tmpb_tl \l__cooking_units_given_unit_tl } - \seq_if_in:NVF \l__cooking_units_curef_do_not_change_seq \l__cooking_units_tmpb_tl - { \__cooking_units_calc_references_aux:NN #1 #2 } + \tl_set_eq:NN \l__cookingunits_tmpb_tl \l__cookingunits_given_unit_tl + \seq_if_in:NVTF \l__cookingunits_curef_do_not_change_seq \l__cookingunits_tmpb_tl + { \msg_error:nnV { cooking-units } { curef-forbidden-unit } \l__cookingunits_tmpb_tl } + { \__cookingunits_calc_references_aux:NN #1 #2 } } } } -\cs_new:Npn \__cooking_units_calc_references_aux:NN #1#2 +\cs_new:Npn \__cookingunits_calc_references_aux:NN #1#2 { - \__cooking_units_tl_eval:Nn #1 + \__cookingunits_tl_eval:Nn #1 { #2 * - \l__cooking_units_wanted_number_of_persons_int / - \l__cooking_units_local_number_of_persons_int + \l__cookingunits_wanted_number_of_persons_int / + \l__cookingunits_local_number_of_persons_int } } -\cs_new:Npn \__cooking_units_check_number_for_rounding:n #1 +\cs_new:Npn \__cookingunits_check_number_for_rounding:n #1 { - \bool_set_false:N \l__cooking_units_round_number_bool - \__cooking_units_check_number_after_dot_aux:ww #1 . \q_recursion_tail . + \bool_set_false:N \l__cookingunits_round_number_bool + \__cookingunits_check_number_after_dot_aux:ww #1 . \q_recursion_tail . \q_recursion_stop } -\cs_new:Npn \__cooking_units_check_number_after_dot_aux:ww #1 . #2 . +\cs_new:Npn \__cookingunits_check_number_after_dot_aux:ww #1 . #2 . { \quark_if_recursion_tail_stop_do:nn {#2} { \bool_lazy_or:nnF - { \l__cooking_units_round_precision_positive_bool } - { \l__cooking_units_round_to_int_bool } - { \bool_set_true:N \l__cooking_units_round_number_bool } + { \l__cookingunits_round_precision_positive_bool } + { \l__cookingunits_round_to_int_bool } + { \bool_set_true:N \l__cookingunits_round_number_bool } } \int_compare:nNnT { \tl_count:n {#2} } > { - \bool_if:NTF \l__cooking_units_round_to_int_bool + \bool_if:NTF \l__cookingunits_round_to_int_bool { 0 } - { \l__cooking_units_round_precision_int } + { \l__cookingunits_round_precision_int } } - { \bool_set_true:N \l__cooking_units_round_number_bool } + { \bool_set_true:N \l__cookingunits_round_number_bool } \use_none_delimit_by_q_recursion_stop:w } -\cs_new:Npn \__cooking_units_round_calculated_input:Nn #1#2 +\cs_new:Npn \__cookingunits_round_calculated_input:Nn #1#2 { - \__cooking_units_check_number_for_rounding:n {#2} - \bool_if:NTF \l__cooking_units_round_number_bool - { \__cooking_units_tl_eval:Nn #1 { round ( \__cooking_units_rounding_function:n {#2} ) } } + \__cookingunits_check_number_for_rounding:n {#2} + \bool_if:NTF \l__cookingunits_round_number_bool + { \__cookingunits_tl_eval:Nn #1 { round ( \__cookingunits_rounding_function:n {#2} ) } } { \tl_set:Nn #1 {#2} } } -\cs_generate_variant:Nn \__cooking_units_round_calculated_input:Nn { NV } -\cs_new:Npn \__cooking_units_check_temperature_limit:N #1 +\cs_generate_variant:Nn \__cookingunits_round_calculated_input:Nn { NV } +\cs_new:Npn \__cookingunits_check_temperature_limit:N #1 { - \bool_if:NT \l__cooking_units_check_temperature_bool + \bool_if:NT \l__cookingunits_check_temperature_bool { - \seq_if_in:NVT \l__cooking_units_temperatures_to_check_seq \l__cooking_units_option_unit_tl + \seq_if_in:NVT \l__cookingunits_temperatures_to_check_seq \l__cookingunits_option_unit_tl { \fp_compare:vNnT - { c__cooking_units_ \l__cooking_units_option_unit_tl _min_fp } > {#1} + { c__cookingunits_ \l__cookingunits_option_unit_tl _min_fp } > {#1} { \msg_error:nnxx { cooking-units } { Temperature-too-low } - { #1 \space \l__cooking_units_option_unit_tl } + { #1 \space \l__cookingunits_option_unit_tl } { - \fp_use:c { c__cooking_units_ \l__cooking_units_option_unit_tl _min_fp } - \space \l__cooking_units_option_unit_tl + \fp_use:c { c__cookingunits_ \l__cookingunits_option_unit_tl _min_fp } + \space \l__cookingunits_option_unit_tl } } } } } -\cs_new_nopar:Npn \__cooking_units_grab_arrows_for_safety_do_afterwards:nN #1#2 +\cs_new_nopar:Npn \__cookingunits_grab_arrows_for_safety_do_afterwards:nN #1#2 { \str_if_eq:nnTF {#2} { > } { - \tl_put_right:Nx \l__cooking_units_tmpa_tl { \tl_to_str:N > } - \exp_last_unbraced:NV #1 \l__cooking_units_tmpa_tl + \tl_put_right:Nx \l__cookingunits_tmpa_tl { \tl_to_str:N > } + \exp_last_unbraced:NV #1 \l__cookingunits_tmpa_tl }{ - \tl_put_right:Nn \l__cooking_units_tmpa_tl {#2} - \__cooking_units_grab_arrows_for_safety_do_afterwards:nN {#1} + \tl_put_right:Nn \l__cookingunits_tmpa_tl {#2} + \__cookingunits_grab_arrows_for_safety_do_afterwards:nN {#1} } } -\cs_new_nopar:Npn \__cooking_units_if_arrow_grab_until_close_do:nnTF #1#2#3#4 +\cs_new_nopar:Npn \__cookingunits_if_arrow_grab_until_close_do:nnTF #1#2#3#4 { \str_if_eq:nnTF {#1} { < } { - \tl_if_in:NoT \l__cooking_units_input_allowed_special_signs_tl { < } + \tl_if_in:NoT \l__cookingunits_input_allowed_special_signs_tl { < } { \msg_error:nn { cooking-units } { <-not-allowed-as-special-sign } } - \tl_clear:N \l__cooking_units_tmpa_tl - \tl_put_right:Nx \l__cooking_units_tmpa_tl { \tl_to_str:N < } - \__cooking_units_grab_arrows_for_safety_do_afterwards:nN + \tl_clear:N \l__cookingunits_tmpa_tl + \tl_put_right:Nx \l__cookingunits_tmpa_tl { \tl_to_str:N < } + \__cookingunits_grab_arrows_for_safety_do_afterwards:nN {#3} #2 } {#4} } \NewDocumentCommand \cunum { d<> O{} m O{} m } { - \__cooking_units_if_arrow_grab_until_close_do:nnTF {#3} {#5} + \__cookingunits_if_arrow_grab_until_close_do:nnTF {#3} {#5} { \cunum } { \group_begin: - \__cooking_units_cunum:nnnnn {#1} {#2} {#3} {#4} {#5} + \__cookingunits_cunum:nnnnn {#1} {#2} {#3} {#4} {#5} \group_end: } } -\cs_new:Npn \__cooking_units_cunum:nnnnn #1#2#3#4#5 +\cs_new:Npn \__cookingunits_cunum:nnnnn #1#2#3#4#5 { - \__cooking_units_cunum_initialise:nnnnn {#1} {#2} {#3} {#4} {#5} - \l__cooking_units_cunum_hook_tl - \__cooking_units_parse_input:n {#3} - \__cooking_units_print_correct_unit: + \__cookingunits_cunum_initialise:nnnnn {#1} {#2} {#3} {#4} {#5} + \l__cookingunits_cunum_hook_tl + \__cookingunits_parse_input:n {#3} + \__cookingunits_print_correct_unit: } -\cs_new_protected:Npn \__cooking_units_cunum_initialise:nnnnn #1#2#3#4#5 +\cs_new_protected:Npn \__cookingunits_cunum_initialise:nnnnn #1#2#3#4#5 { - \__cooking_units_set_process_and_print_for_cunum: - \tl_set:Nn \l__cooking_units_phantom_tl {#4} - \__cooking_units_initialise_default:n {#5} - \__cooking_units_initialise_unit_change:n {#2} - \__cooking_units_initialise_after_unit_change:nn {#1} {#2} + \__cookingunits_set_process_and_print_for_cunum: + \tl_set:Nn \l__cookingunits_phantom_tl {#4} + \__cookingunits_initialise_default:n {#5} + \__cookingunits_initialise_unit_change:n {#2} + \__cookingunits_initialise_after_unit_change:nn {#1} {#2} } -\cs_new:Npn \__cooking_units_cunum_print_correct_unit: +\cs_new:Npn \__cookingunits_cunum_print_correct_unit: { - \tl_if_empty:NF \l__cooking_units_phantom_tl { \phantom { \l__cooking_units_phantom_tl } } - \tl_use:N \l__cooking_units_value_unit_space_tl - \__cooking_units_change_unit:TF - { \__cooking_units_translate:xx \l__cooking_units_option_unit_tl \c__cooking_units_postfix_unit_tl } - { \__cooking_units_translate:xx \l__cooking_units_given_unit_tl \c__cooking_units_postfix_unit_tl } + \tl_if_empty:NF \l__cookingunits_phantom_tl { \phantom { \l__cookingunits_phantom_tl } } + \tl_use:N \l__cookingunits_value_unit_space_tl + \__cookingunits_change_unit:TF + { \__cookingunits_translate:VV \l__cookingunits_option_unit_tl \c__cookingunits_postfix_unit_tl } + { \__cookingunits_translate:VV \l__cookingunits_given_unit_tl \c__cookingunits_postfix_unit_tl } } \NewDocumentCommand \cutext { d<> O{} m m } { - \__cooking_units_if_arrow_grab_until_close_do:nnTF {#3} {#4} + \__cookingunits_if_arrow_grab_until_close_do:nnTF {#3} {#4} { \cutext } { \group_begin: - \__cooking_units_change_cutext_to_cunum:nTF {#2} - { \__cooking_units_cunum:nnnnn {#1} {#2} {#3} { } {#4} } + \__cookingunits_change_cutext_to_cunum:nTF {#2} + { \__cookingunits_cunum:nnnnn {#1} {#2} {#3} { } {#4} } { - \bool_set_false:N \l__cooking_units_cutext_uppercase_word_bool - \__cooking_units_cutext:nnnn {#1} {#2} {#3} {#4} + \bool_set_false:N \l__cookingunits_cutext_uppercase_word_bool + \__cookingunits_cutext:nnnn {#1} {#2} {#3} {#4} } \group_end: } } \NewDocumentCommand \Cutext { d<> O{} m m } { - \__cooking_units_if_arrow_grab_until_close_do:nnTF {#3} {#4} + \__cookingunits_if_arrow_grab_until_close_do:nnTF {#3} {#4} { \Cutext } { \group_begin: - \__cooking_units_change_cutext_to_cunum:nTF {#2} - { \__cooking_units_cunum:nnnnn {#1} {#2} {#3} { } {#4} } + \__cookingunits_change_cutext_to_cunum:nTF {#2} + { \__cookingunits_cunum:nnnnn {#1} {#2} {#3} { } {#4} } { - \bool_set_true:N \l__cooking_units_cutext_uppercase_word_bool - \__cooking_units_cutext:nnnn {#1} {#2} {#3} {#4} + \bool_set_true:N \l__cookingunits_cutext_uppercase_word_bool + \__cookingunits_cutext:nnnn {#1} {#2} {#3} {#4} } \group_end: } } -\cs_new_protected:Npn \__cooking_units_cutext_initialise:nnn #1#2#3 +\cs_new_protected:Npn \__cookingunits_cutext_initialise:nnn #1#2#3 { - \bool_set_true:N \l__cooking_units_using_cutext_bool - \__cooking_units_set_process_and_print_for_cutext: - \__cooking_units_initialise_default:n {#3} - \__cooking_units_initialise_unit_change:n {#2} - \bool_if:NT \l__cooking_units_cutext_keep_unit_bool - { \tl_set_eq:NN \l__cooking_units_option_unit_tl \l__cooking_units_given_unit_tl } - \__cooking_units_initialise_after_unit_change:nn {#1} {#2} - \bool_if:NT \l__cooking_units_fourty_two_bool - { \tl_set:Nn \l__cooking_units_cutext_last_value_tl { 42 } } + \bool_set_true:N \l__cookingunits_using_cutext_bool + \__cookingunits_set_process_and_print_for_cutext: + \__cookingunits_initialise_default:n {#3} + \__cookingunits_initialise_unit_change:n {#2} + \bool_if:NT \l__cookingunits_cutext_keep_unit_bool + { \tl_set_eq:NN \l__cookingunits_option_unit_tl \l__cookingunits_given_unit_tl } + \__cookingunits_initialise_after_unit_change:nn {#1} {#2} + \bool_if:NT \l__cookingunits_fourty_two_bool + { \tl_set:Nn \l__cookingunits_cutext_last_value_tl { 42 } } } -\cs_new:Npn \__cooking_units_cutext:nnnn #1#2#3#4 +\cs_new:Npn \__cookingunits_cutext:nnnn #1#2#3#4 { - \__cooking_units_cutext_initialise:nnn {#1} {#2} {#4} - \bool_if:NTF \l__cooking_units_cutext_uppercase_word_bool - { \l__cooking_units_Cutext_hook_tl } - { \l__cooking_units_cutext_hook_tl } - \bool_if:NTF \l__cooking_units_cutext_old_bool - { \__cooking_units_old_cutext:nnn {#2} {#3} {#4} } - { \__cooking_units_parse_input:n {#3} } - \__cooking_units_print_correct_unit: + \__cookingunits_cutext_initialise:nnn {#1} {#2} {#4} + \bool_if:NTF \l__cookingunits_cutext_uppercase_word_bool + { \l__cookingunits_Cutext_hook_tl } + { \l__cookingunits_cutext_hook_tl } + \bool_if:NTF \l__cookingunits_cutext_old_bool + { \__cookingunits_old_cutext:nnn {#2} {#3} {#4} } + { \__cookingunits_parse_input:n {#3} } + \__cookingunits_print_correct_unit: } -\cs_new_protected:Npn \__cooking_units_cutext_print_input:Nn #1#2 +\cs_new_protected:Npn \__cookingunits_cutext_print_input:Nn #1#2 { - \bool_if:NTF \l__cooking_units_lokal_numeral_bool + \bool_if:NTF \l__cookingunits_lokal_numeral_bool { - \__cooking_units_int_if_equal_one:nTF {#1} + \__cookingunits_int_if_equal_one:nTF {#1} { - \__cooking_units_translate_one_and_check_existance:Nx \l__cooking_units_translation_tmpa_tl {#2} - \bool_if:NTF \l__cooking_units_cutext_uppercase_word_bool + \__cookingunits_translate_one_and_check_existance:Nx \l__cookingunits_translation_tmpa_tl {#2} + \bool_if:NTF \l__cookingunits_cutext_uppercase_word_bool { - \exp_args:Nx \tl_upper_case:n { \tl_head:V \l__cooking_units_translation_tmpa_tl } - \tl_tail:V \l__cooking_units_translation_tmpa_tl + \exp_args:Nx \tl_upper_case:n { \tl_head:V \l__cookingunits_translation_tmpa_tl } + \tl_tail:V \l__cookingunits_translation_tmpa_tl } - { \l__cooking_units_translation_tmpa_tl } + { \l__cookingunits_translation_tmpa_tl } }{ - \bool_if:NTF \l__cooking_units_cutext_uppercase_word_bool - { \__cooking_units_print_Numeral:n {#1} } - { \__cooking_units_print_numeral:n {#1} } + \bool_if:NTF \l__cookingunits_cutext_uppercase_word_bool + { \__cookingunits_print_Numeral:n {#1} } + { \__cookingunits_print_numeral:n {#1} } } } - { \__cooking_units_print_numerical_input:N #1 } + { \__cookingunits_print_numerical_input:N #1 } } -\cs_generate_variant:Nn \__cooking_units_cutext_print_input:Nn { NV } -\cs_new_protected:Npn \__cooking_units_cutext_print_input:N #1 +\cs_generate_variant:Nn \__cookingunits_cutext_print_input:Nn { NV } +\cs_new_protected:Npn \__cookingunits_cutext_print_input:N #1 { - \__cooking_units_change_unit:TF - { \__cooking_units_cutext_print_input:NV #1 \l__cooking_units_option_unit_tl } - { \__cooking_units_cutext_print_input:NV #1 \l__cooking_units_given_unit_tl } + \__cookingunits_change_unit:TF + { \__cookingunits_cutext_print_input:NV #1 \l__cookingunits_option_unit_tl } + { \__cookingunits_cutext_print_input:NV #1 \l__cookingunits_given_unit_tl } } -\cs_new:Npn \__cooking_units_cutext_print_correct_unitname: +\cs_new:Npn \__cookingunits_cutext_print_correct_unitname: { - \l__cooking_units_cutext_space_tl - \__cooking_units_change_unit:TF + \l__cookingunits_cutext_space_tl + \__cookingunits_change_unit:TF { - \__cooking_units_fp_if_equal_one:nTF { \l__cooking_units_cutext_last_value_tl } - { \__cooking_units_translate:xx \l__cooking_units_option_unit_tl \c__cooking_units_postfix_unitname_tl } - { \__cooking_units_translate:xx \l__cooking_units_option_unit_tl \c__cooking_units_postfix_unitname_pl_tl } + \__cookingunits_fp_if_equal_one:nTF { \l__cookingunits_cutext_last_value_tl } + { \__cookingunits_translate:VV \l__cookingunits_option_unit_tl \c__cookingunits_postfix_unitname_tl } + { \__cookingunits_translate:VV \l__cookingunits_option_unit_tl \c__cookingunits_postfix_unitname_pl_tl } } - { \__cooking_units_translate:xx \l__cooking_units_given_unit_tl \c__cooking_units_postfix_unitname_pl_tl } + { \__cookingunits_translate:VV \l__cookingunits_given_unit_tl \c__cookingunits_postfix_unitname_pl_tl } } -\cs_new:Npn \__cooking_units_cutext_pre_process_input:NN #1#2 +\cs_new:Npn \__cookingunits_cutext_pre_process_input:NN #1#2 { - \__cooking_units_change_unit:TF - { \tl_set_eq:NN \l__cooking_units_tmpb_tl \l__cooking_units_option_unit_tl } - { \tl_set_eq:NN \l__cooking_units_tmpb_tl \l__cooking_units_given_unit_tl } - \__cooking_units_unitname_get:NxF \l__cooking_units_tmpa_tl \l__cooking_units_tmpb_tl + \__cookingunits_change_unit:TF + { \tl_set_eq:NN \l__cookingunits_tmpb_tl \l__cookingunits_option_unit_tl } + { \tl_set_eq:NN \l__cookingunits_tmpb_tl \l__cookingunits_given_unit_tl } + \__cookingunits_unitname_get:NxF \l__cookingunits_tmpa_tl \l__cookingunits_tmpb_tl { \msg_warning:nnx { cooking-units } { cutext-no-translation-available } - \l__cooking_units_tmpb_tl - \bool_set_false:N \l__cooking_units_using_cutext_bool - \__cooking_units_set_process_and_print_for_cunum: + \l__cookingunits_tmpb_tl + \bool_set_false:N \l__cookingunits_using_cutext_bool + \__cookingunits_set_process_and_print_for_cunum: } } -\cs_new:Npn \__cooking_units_cutext_post_process_input:NN #1#2 +\cs_new:Npn \__cookingunits_cutext_post_process_input:NN #1#2 { - \bool_if:NF \l__cooking_units_special_sign_bool + \bool_if:NF \l__cookingunits_special_sign_bool { - \__cooking_units_cutext_post_process_input_aux:NN #1#2 + \__cookingunits_cutext_post_process_input_aux:NN #1#2 } } -\cs_new:Npn \__cooking_units_cutext_post_process_input_aux:NN #1#2 +\cs_new:Npn \__cookingunits_cutext_post_process_input_aux:NN #1#2 { - \bool_if:NTF \l__cooking_units_range_in_input_bool - { \tl_set_eq:NN \l__cooking_units_cutext_last_value_tl #2 } - { \tl_set_eq:NN \l__cooking_units_cutext_last_value_tl #1 } - \bool_if:NT \l__cooking_units_lokal_numeral_bool - { \__cooking_units_cutext_post_process_input_numerals:NN #1#2 } + \bool_if:NTF \l__cookingunits_range_in_input_bool + { \tl_set_eq:NN \l__cookingunits_cutext_last_value_tl #2 } + { \tl_set_eq:NN \l__cookingunits_cutext_last_value_tl #1 } + \bool_if:NT \l__cookingunits_lokal_numeral_bool + { \__cookingunits_cutext_post_process_input_numerals:NN #1#2 } } -\cs_new:Npn \__cooking_units_cutext_post_process_input_numerals:NN #1#2 +\cs_new:Npn \__cookingunits_cutext_post_process_input_numerals:NN #1#2 { - \__cooking_units_bool_set_if_integers:NNN \l__cooking_units_tmpa_bool #1 #2 - \bool_if:NTF \l__cooking_units_tmpa_bool + \__cookingunits_bool_set_if_integers:NNN \l__cookingunits_tmpa_bool #1 #2 + \bool_if:NTF \l__cookingunits_tmpa_bool { - \bool_if:NTF \l__cooking_units_range_in_input_bool + \bool_if:NTF \l__cookingunits_range_in_input_bool { \bool_lazy_and:nnF - { \int_compare_p:nNn {#1} < { \l__cooking_units_print_numerals_below_int } } - { \int_compare_p:nNn {#2} < { \l__cooking_units_print_numerals_below_int } } - { \bool_set_false:N \l__cooking_units_lokal_numeral_bool } + { \int_compare_p:nNn {#1} < { \l__cookingunits_print_numerals_below_int } } + { \int_compare_p:nNn {#2} < { \l__cookingunits_print_numerals_below_int } } + { \bool_set_false:N \l__cookingunits_lokal_numeral_bool } }{ - \int_compare:nNnF {#1} < { \l__cooking_units_print_numerals_below_int } - { \bool_set_false:N \l__cooking_units_lokal_numeral_bool } + \int_compare:nNnF {#1} < { \l__cookingunits_print_numerals_below_int } + { \bool_set_false:N \l__cookingunits_lokal_numeral_bool } } } - { \bool_set_false:N \l__cooking_units_lokal_numeral_bool } + { \bool_set_false:N \l__cookingunits_lokal_numeral_bool } } -\tl_const:Nn \c__cooking_units_cuam_marker_tl { __cooking_units_cunum } -\tl_new:c { l__cooking_units_unit_change_ \c__cooking_units_cuam_marker_tl _tl } -\tl_set:cn { l__cooking_units_unit_change_ \c__cooking_units_cuam_marker_tl _tl } { 1.0 } -\clist_new:c { l__cooking_units_predefined_option_ \c__cooking_units_cuam_marker_tl _clist } +\tl_const:Nn \c__cookingunits_cuam_marker_tl { __cookingunits_cunum } +\tl_new:c { l__cookingunits_unit_change_ \c__cookingunits_cuam_marker_tl _tl } +\tl_set:cn { l__cookingunits_unit_change_ \c__cookingunits_cuam_marker_tl _tl } { 1.0 } +\clist_new:c { l__cookingunits_predefined_option_ \c__cookingunits_cuam_marker_tl _clist } \NewDocumentCommand \cuam { d<> O{} m } { - \__cooking_units_if_arrow_grab_until_close_do:nnTF {#3} { } + \__cookingunits_if_arrow_grab_until_close_do:nnTF {#3} { } { \cuam } { \group_begin: - \__cooking_units_cuam:nnn {#1} {#2} {#3} + \__cookingunits_cuam:nnn {#1} {#2} {#3} \group_end: } } -\cs_new:Npn \__cooking_units_cuam:nnn #1#2#3 +\cs_new:Npn \__cookingunits_cuam:nnn #1#2#3 { - \__cooking_units_cuam_initialise:nn {#1} {#2} - \l__cooking_units_cuam_hook_tl - \bool_if:NTF \l__cooking_units_cuam_old_bool - { \__cooking_units_cuam_old:n {#3} } + \__cookingunits_cuam_initialise:nn {#1} {#2} + \l__cookingunits_cuam_hook_tl + \bool_if:NTF \l__cookingunits_cuam_old_bool + { \__cookingunits_cuam_old:n {#3} } { - \__cooking_units_parse_input:n {#3} - \__cooking_units_print_correct_unit: + \__cookingunits_parse_input:n {#3} + \__cookingunits_print_correct_unit: } } -\cs_new_protected:Npn \__cooking_units_cuam_initialise:nn #1#2 +\cs_new_protected:Npn \__cookingunits_cuam_initialise:nn #1#2 { - \__cooking_units_set_process_and_print_for_cuam: - \tl_set_eq:NN \l__cooking_units_given_unit_tl \c__cooking_units_cuam_marker_tl - \tl_set_eq:NN \l__cooking_units_option_unit_tl \c__cooking_units_cuam_marker_tl - \bool_set_false:N \l__cooking_units_lokal_phrase_bool - \__cooking_units_initialise_after_unit_change:nn {#1} {#2} + \__cookingunits_set_process_and_print_for_cuam: + \tl_set_eq:NN \l__cookingunits_given_unit_tl \c__cookingunits_cuam_marker_tl + \tl_set_eq:NN \l__cookingunits_option_unit_tl \c__cookingunits_cuam_marker_tl + \bool_set_false:N \l__cookingunits_lokal_phrase_bool + \__cookingunits_initialise_after_unit_change:nn {#1} {#2} } -\cs_new_protected:Npn \__cooking_units_cuam_post_process_input:NN #1#2 +\cs_new_protected:Npn \__cookingunits_cuam_post_process_input:NN #1#2 { - \bool_if:NF \l__cooking_units_special_sign_bool - { \__cooking_units_cuam_post_process_input_aux:NN #1 #2 } + \bool_if:NF \l__cookingunits_special_sign_bool + { \__cookingunits_cuam_post_process_input_aux:NN #1 #2 } } -\cs_new:Npn \__cooking_units_cuam_post_process_input_aux:NN #1#2 +\cs_new:Npn \__cookingunits_cuam_post_process_input_aux:NN #1#2 { - \__cooking_units_bool_set_if_integers:NNN \l__cooking_units_tmpa_bool #1 #2 + \__cookingunits_bool_set_if_integers:NNN \l__cookingunits_tmpa_bool #1 #2 \bool_lazy_and:nnT - { \l__cooking_units_use_phrases_bool } { \l__cooking_units_tmpa_bool } - { \__cooking_units_cuam_post_process_input_phrases:NN #1#2 } - \bool_if:NT \l__cooking_units_lokal_numeral_bool - { \__cooking_units_cuam_post_process_input_numerals:NN #1#2 } + { \l__cookingunits_use_phrases_bool } { \l__cookingunits_tmpa_bool } + { \__cookingunits_cuam_post_process_input_phrases:NN #1#2 } + \bool_if:NT \l__cookingunits_lokal_numeral_bool + { \__cookingunits_cuam_post_process_input_numerals:NN #1#2 } } -\cs_new:Npn \__cooking_units_cuam_post_process_input_phrases:NN #1#2 +\cs_new:Npn \__cookingunits_cuam_post_process_input_phrases:NN #1#2 { - \__cooking_units_get_phrase_for_current_langauge:NNT - \l__cooking_units_phrase_prop - \l__cooking_units_phrase_numbers_seq + \__cookingunits_get_phrase_for_current_langauge:NNT + \l__cookingunits_phrase_prop + \l__cookingunits_phrase_numbers_seq { - \__cooking_units_cuam_post_process_input_phrases_aux:NNN - #1 \l__cooking_units_tmpa_int \l__cooking_units_phrase_number_tl - \bool_if:NT \l__cooking_units_lokal_phrase_bool + \__cookingunits_cuam_post_process_input_phrases_aux:NNN + #1 \l__cookingunits_tmpa_int \l__cookingunits_phrase_number_tl + \bool_if:NT \l__cookingunits_lokal_phrase_bool { - \bool_if:NTF \l__cooking_units_range_in_input_bool + \bool_if:NTF \l__cookingunits_range_in_input_bool { - \bool_if:NF \l__cooking_units_phrase_negative_bool + \bool_if:NF \l__cookingunits_phrase_negative_bool { - \__cooking_units_cuam_post_process_input_phrases_range:NN - #2 \l__cooking_units_tmpb_int - \bool_if:NT \l__cooking_units_lokal_phrase_bool + \__cookingunits_cuam_post_process_input_phrases_range:NN + #2 \l__cookingunits_tmpb_int + \bool_if:NT \l__cookingunits_lokal_phrase_bool { - \tl_set:NV #1 \l__cooking_units_tmpa_int - \tl_set:NV #2 \l__cooking_units_tmpb_int - \__cooking_units_cuam_get_phrase_name:NVN - \l__cooking_units_phrase_phrase_tl \l__cooking_units_phrase_number_tl \l__cooking_units_tmpb_int + \tl_set:NV #1 \l__cookingunits_tmpa_int + \tl_set:NV #2 \l__cookingunits_tmpb_int + \__cookingunits_cuam_get_phrase_name:NVN + \l__cookingunits_phrase_phrase_tl \l__cookingunits_phrase_number_tl \l__cookingunits_tmpb_int } } }{ - \tl_set:NV #1 \l__cooking_units_tmpa_int - \__cooking_units_cuam_get_phrase_name:NVN - \l__cooking_units_phrase_phrase_tl \l__cooking_units_phrase_number_tl \l__cooking_units_tmpa_int + \tl_set:NV #1 \l__cookingunits_tmpa_int + \__cookingunits_cuam_get_phrase_name:NVN + \l__cookingunits_phrase_phrase_tl \l__cookingunits_phrase_number_tl \l__cookingunits_tmpa_int } } } } -\cs_new:Npn \__cooking_units_cuam_post_process_input_phrases_aux:NNN #1#2#3 +\cs_new:Npn \__cookingunits_cuam_post_process_input_phrases_aux:NNN #1#2#3 { - \bool_set_false:N \l__cooking_units_lokal_phrase_bool - \seq_map_inline:Nn \l__cooking_units_phrase_numbers_seq + \bool_set_false:N \l__cookingunits_lokal_phrase_bool + \seq_map_inline:Nn \l__cookingunits_phrase_numbers_seq { \int_compare:nNnF { \int_abs:n {##1} } > {#1} { \int_compare:nNnTF {##1} < { 0 } { - \bool_set_true:N \l__cooking_units_phrase_negative_bool + \bool_set_true:N \l__cookingunits_phrase_negative_bool \int_set:Nn \l_tmpa_int { 1 } } { \int_set:Nn \l_tmpa_int { \int_div_truncate:nn {#1} {##1} } } @@ -1852,155 +1905,155 @@ { \int_set_eq:NN #2 \l_tmpa_int \tl_set:Nn #3 {##1} - \bool_set_true:N \l__cooking_units_lokal_phrase_bool + \bool_set_true:N \l__cookingunits_lokal_phrase_bool \seq_map_break: } } } } -\cs_new:Npn \__cooking_units_cuam_post_process_input_phrases_range:NN #1#2 +\cs_new:Npn \__cookingunits_cuam_post_process_input_phrases_range:NN #1#2 { - \int_set:Nn \l_tmpa_int { \int_div_truncate:nn {#1} { \l__cooking_units_phrase_number_tl } } - \int_compare:nNnTF { \l__cooking_units_phrase_number_tl * \l_tmpa_int } = {#1} + \int_set:Nn \l_tmpa_int { \int_div_truncate:nn {#1} { \l__cookingunits_phrase_number_tl } } + \int_compare:nNnTF { \l__cookingunits_phrase_number_tl * \l_tmpa_int } = {#1} { \int_set_eq:NN #2 \l_tmpa_int - \bool_set_true:N \l__cooking_units_lokal_phrase_bool + \bool_set_true:N \l__cookingunits_lokal_phrase_bool }{ - \bool_set_false:N \l__cooking_units_lokal_phrase_bool + \bool_set_false:N \l__cookingunits_lokal_phrase_bool } } -\cs_new:Npn \__cooking_units_cuam_get_phrase_name:NnN #1#2#3 +\cs_new:Npn \__cookingunits_cuam_get_phrase_name:NnN #1#2#3 { - \__cooking_units_int_if_equal_one:nTF {#3} - { \prop_get:NnN \l__cooking_units_phrase_prop {#2} #1 } - { \prop_get:NnN \l__cooking_units_phrase_prop { #2-pl } #1 } + \__cookingunits_int_if_equal_one:nTF {#3} + { \prop_get:NnN \l__cookingunits_phrase_prop {#2} #1 } + { \prop_get:NnN \l__cookingunits_phrase_prop { #2-pl } #1 } } -\cs_generate_variant:Nn \__cooking_units_cuam_get_phrase_name:NnN { NVN } -\cs_new:Npn \__cooking_units_cuam_post_process_input_numerals:NN #1#2 +\cs_generate_variant:Nn \__cookingunits_cuam_get_phrase_name:NnN { NVN } +\cs_new:Npn \__cookingunits_cuam_post_process_input_numerals:NN #1#2 { - \bool_if:NTF \l__cooking_units_tmpa_bool + \bool_if:NTF \l__cookingunits_tmpa_bool { - \bool_if:NTF \l__cooking_units_range_in_input_bool + \bool_if:NTF \l__cookingunits_range_in_input_bool { \bool_lazy_and:nnF - { \int_compare_p:nNn {#1} < { \l__cooking_units_print_numerals_below_int } } - { \int_compare_p:nNn {#2} < { \l__cooking_units_print_numerals_below_int } } - { \bool_set_false:N \l__cooking_units_lokal_numeral_bool } + { \int_compare_p:nNn {#1} < { \l__cookingunits_print_numerals_below_int } } + { \int_compare_p:nNn {#2} < { \l__cookingunits_print_numerals_below_int } } + { \bool_set_false:N \l__cookingunits_lokal_numeral_bool } }{ - \int_compare:nNnF {#1} < { \l__cooking_units_print_numerals_below_int } - { \bool_set_false:N \l__cooking_units_lokal_numeral_bool } + \int_compare:nNnF {#1} < { \l__cookingunits_print_numerals_below_int } + { \bool_set_false:N \l__cookingunits_lokal_numeral_bool } } } - { \bool_set_false:N \l__cooking_units_lokal_numeral_bool } + { \bool_set_false:N \l__cookingunits_lokal_numeral_bool } } -\cs_new_protected:Npn \__cooking_units_cuam_print_numerical_input:N #1 +\cs_new_protected:Npn \__cookingunits_cuam_print_numerical_input:N #1 { \bool_lazy_and:nnTF - { \l__cooking_units_lokal_phrase_bool } - { \l__cooking_units_lokal_numeral_bool } + { \l__cookingunits_lokal_phrase_bool } + { \l__cookingunits_lokal_numeral_bool } { - \__cooking_units_int_if_equal_one:nTF {#1} + \__cookingunits_int_if_equal_one:nTF {#1} { - \__cooking_units_translate_one_and_check_existance:Nx - \l__cooking_units_translation_tmpa_tl - { \l__cooking_units_phrase_number_tl -phrase-gender } - \l__cooking_units_translation_tmpa_tl + \__cookingunits_translate_one_and_check_existance:Nx + \l__cookingunits_translation_tmpa_tl + { \l__cookingunits_phrase_number_tl -phrase-gender } + \l__cookingunits_translation_tmpa_tl } - { \exp_args:NV \__cooking_units_print_numeral:n #1 } - }{ \__cooking_units_print_numerical_input:N #1 } + { \exp_args:NV \__cookingunits_print_numeral:n #1 } + }{ \__cookingunits_print_numerical_input:N #1 } } -\cs_new:Npn \__cooking_units_cuam_print_correct_unitphrase: +\cs_new:Npn \__cookingunits_cuam_print_correct_unitphrase: { - \bool_if:NT \l__cooking_units_lokal_phrase_bool + \bool_if:NT \l__cookingunits_lokal_phrase_bool { - \l__cooking_units_cuphrase_space_tl - \l__cooking_units_phrase_phrase_tl + \l__cookingunits_cuphrase_space_tl + \l__cookingunits_phrase_phrase_tl } } \NewDocumentCommand \cudefinekeys { m m } { - \bool_set_false:N \l__cooking_units_single_key_bool - \__cooking_units_cukeys_define_keys_and_single_keys:nn {#1} {#2} + \bool_set_false:N \l__cookingunits_single_key_bool + \__cookingunits_cukeys_define_keys_and_single_keys:nn {#1} {#2} } \NewDocumentCommand \cudefinesinglekey { m m } { - \bool_set_true:N \l__cooking_units_single_key_bool - \__cooking_units_cukeys_define_keys_and_single_keys:nn {#1} {#2} + \bool_set_true:N \l__cookingunits_single_key_bool + \__cookingunits_cukeys_define_keys_and_single_keys:nn {#1} {#2} } -\cs_new:Npn \__cooking_units_cukeys_define_keys_and_single_keys:nn #1#2 +\cs_new:Npn \__cookingunits_cukeys_define_keys_and_single_keys:nn #1#2 { - \__cooking_units_error_if_unit_not_defined:n {#1} + \__cookingunits_error_if_unit_not_defined:n {#1} \tl_if_blank:nF {#2} { - \seq_clear:N \l__cooking_units_tmpa_seq - \prop_clear:N \l__cooking_units_tmpa_prop - \bool_if:NTF \l__cooking_units_single_key_bool + \seq_clear:N \l__cookingunits_tmpa_seq + \prop_clear:N \l__cookingunits_tmpa_prop + \bool_if:NTF \l__cookingunits_single_key_bool { - \__cooking_units_cukeys_parse_and_create_single_key:nn {#1} {#2} + \__cookingunits_cukeys_parse_and_create_single_key:nn {#1} {#2} }{ - \fp_set:Nn \l__cooking_units_tmpa_fp { 1.0 } - \tl_set:Nn \l__cooking_units_given_unit_tl {#1} - \__cooking_units_cukeys_parse_and_create_keys:nn {#1} + \fp_set:Nn \l__cookingunits_tmpa_fp { 1.0 } + \tl_set:Nn \l__cookingunits_given_unit_tl {#1} + \__cookingunits_cukeys_parse_and_create_keys:nn {#1} { {#1} { 1.0 } #2 } } } } -\cs_new:Npn \__cooking_units_cukeys_parse_and_create_keys:nn #1#2 +\cs_new:Npn \__cookingunits_cukeys_parse_and_create_keys:nn #1#2 { - \__cooking_units_cukeys_parse_input:nn #2 + \__cookingunits_cukeys_parse_input:nn #2 \q_recursion_tail \q_recursion_tail \q_recursion_stop - \__cooking_units_cukeys_create_key_prop:n {#1} - \clist_set_from_seq:NN \l__cooking_units_tmpa_clist \l__cooking_units_tmpa_seq - \__cooking_units_cukeys_define_keys:V \l__cooking_units_tmpa_clist + \__cookingunits_cukeys_create_key_prop:n {#1} + \clist_set_from_seq:NN \l__cookingunits_tmpa_clist \l__cookingunits_tmpa_seq + \__cookingunits_cukeys_define_keys:V \l__cookingunits_tmpa_clist } -\cs_new:Npn \__cooking_units_cukeys_parse_input:nn #1#2 +\cs_new:Npn \__cookingunits_cukeys_parse_input:nn #1#2 { \quark_if_recursion_tail_stop:n {#1} \quark_if_recursion_tail_stop_do:nn {#2} { \msg_error:nn { cooking-units } { missing-argument } } - \__cooking_units_error_if_unit_not_defined:n {#1} - \seq_put_right:Nn \l__cooking_units_tmpa_seq {#1} - \prop_put:Nnx \l__cooking_units_tmpa_prop {#1} { \fp_eval:n { (#2) / \l__cooking_units_tmpa_fp } } - \__cooking_units_cukeys_parse_input:nn - } -\cs_new:Npn \__cooking_units_cukeys_create_key_prop:n #1 - { - \prop_clear:N \l__cooking_units_tmpb_prop - \prop_put:NnV \l__cooking_units_tmpb_prop { Liste } \l__cooking_units_tmpa_seq - \prop_put:NnV \l__cooking_units_tmpb_prop { prop } \l__cooking_units_tmpa_prop - \prop_put:NnV \l__cooking_units_tmpb_prop { Erstes Ding } \l__cooking_units_given_unit_tl - \seq_map_inline:Nn \l__cooking_units_tmpa_seq - { - \prop_set_eq:cN { l__cooking_units_cukeys_ ##1 _prop } \l__cooking_units_tmpb_prop - \tl_set:cn { l__cooking_units_unit_change_ ##1 _tl } { 1.0 } - \seq_map_inline:Nn \l__cooking_units_tmpa_seq + \__cookingunits_error_if_unit_not_defined:n {#1} + \seq_put_right:Nn \l__cookingunits_tmpa_seq {#1} + \prop_put:Nnx \l__cookingunits_tmpa_prop {#1} { \fp_eval:n { (#2) / \l__cookingunits_tmpa_fp } } + \__cookingunits_cukeys_parse_input:nn + } +\cs_new:Npn \__cookingunits_cukeys_create_key_prop:n #1 + { + \prop_clear:N \l__cookingunits_tmpb_prop + \prop_put:NnV \l__cookingunits_tmpb_prop { Liste } \l__cookingunits_tmpa_seq + \prop_put:NnV \l__cookingunits_tmpb_prop { prop } \l__cookingunits_tmpa_prop + \prop_put:NnV \l__cookingunits_tmpb_prop { Erstes Ding } \l__cookingunits_given_unit_tl + \seq_map_inline:Nn \l__cookingunits_tmpa_seq + { + \prop_set_eq:cN { l__cookingunits_cukeys_ ##1 _prop } \l__cookingunits_tmpb_prop + \tl_set:cn { l__cookingunits_unit_change_ ##1 _tl } { 1.0 } + \seq_map_inline:Nn \l__cookingunits_tmpa_seq { - \prop_put:cnx { l__cooking_units_cukeys_ ##1 _prop } + \prop_put:cnx { l__cookingunits_cukeys_ ##1 _prop } {####1} { \fp_eval:n { - ( \prop_item:Nn \l__cooking_units_tmpa_prop {####1} ) / - ( \prop_item:Nn \l__cooking_units_tmpa_prop {##1} ) + ( \prop_item:Nn \l__cookingunits_tmpa_prop {####1} ) / + ( \prop_item:Nn \l__cookingunits_tmpa_prop {##1} ) } } } } } -\cs_new:Npn \__cooking_units_cukeys_define_keys:n #1 +\cs_new:Npn \__cookingunits_cukeys_define_keys:n #1 { - \seq_map_inline:Nn \l__cooking_units_tmpa_seq + \seq_map_inline:Nn \l__cookingunits_tmpa_seq { - \seq_if_in:NnF \l__cooking_units_list_of_defined_keys_seq {##1} - { \seq_put_right:Nn \l__cooking_units_list_of_defined_keys_seq {##1} } + \seq_if_in:NnF \l__cookingunits_list_of_defined_keys_seq {##1} + { \seq_put_right:Nn \l__cookingunits_list_of_defined_keys_seq {##1} } \keys_define:nn { cooking-units } { ##1 .choices:Vn = - \l__cooking_units_tmpa_clist + \l__cookingunits_tmpa_clist { - \__cooking_units_cukeys_define_keys_and_single_key_aux:n {##1} + \__cookingunits_cukeys_define_keys_and_single_key_aux:n {##1} } , ##1 / unknown .code:n= { @@ -2017,63 +2070,63 @@ } } } -\cs_generate_variant:Nn \__cooking_units_cukeys_define_keys:n { V } -\cs_new:Npn \__cooking_units_cukeys_define_keys_and_single_key_aux:n #1 +\cs_generate_variant:Nn \__cookingunits_cukeys_define_keys:n { V } +\cs_new:Npn \__cookingunits_cukeys_define_keys_and_single_key_aux:n #1 { \prop_get:cVc - { l__cooking_units_cukeys_#1_prop } + { l__cookingunits_cukeys_#1_prop } \l_keys_choice_tl - { l__cooking_units_unit_change_ #1_tl } - \prop_put:NnV \l__cooking_units_change_unit_prop {#1} \l_keys_choice_tl + { l__cookingunits_unit_change_ #1_tl } + \prop_put:NnV \l__cookingunits_change_unit_prop {#1} \l_keys_choice_tl } -\cs_new:Npn \__cooking_units_cukeys_parse_and_create_single_key:nn #1#2 +\cs_new:Npn \__cookingunits_cukeys_parse_and_create_single_key:nn #1#2 { - \tl_set_rescan:Nnn \l__cooking_units_tmpa_tl + \tl_set_rescan:Nnn \l__cookingunits_tmpa_tl { \char_set_catcode_letter:N \# % \char_set_catcode_ignore:N\ % } { {#1} { 1.0 } #2 } - \__cooking_units_cusinglekeys_parse_input:V \l__cooking_units_tmpa_tl - \__cooking_units_cusinglekeys_create_key_prop:n {#1} - \clist_set_from_seq:NN \l__cooking_units_tmpa_clist \l__cooking_units_tmpa_seq - \__cooking_units_cukeys_define_singlekey:nV {#1} \l__cooking_units_tmpa_clist + \__cookingunits_cusinglekeys_parse_input:V \l__cookingunits_tmpa_tl + \__cookingunits_cusinglekeys_create_key_prop:n {#1} + \clist_set_from_seq:NN \l__cookingunits_tmpa_clist \l__cookingunits_tmpa_seq + \__cookingunits_cukeys_define_singlekey:nV {#1} \l__cookingunits_tmpa_clist } -\cs_new:Npn \__cooking_units_cusinglekeys_parse_input:n #1 +\cs_new:Npn \__cookingunits_cusinglekeys_parse_input:n #1 { - \__cooking_units_cusinglekeys_parse_input_aux:nn #1 + \__cookingunits_cusinglekeys_parse_input_aux:nn #1 \q_recursion_tail \q_recursion_tail \q_recursion_stop } -\cs_generate_variant:Nn \__cooking_units_cusinglekeys_parse_input:n { V } -\cs_new:Npn \__cooking_units_cusinglekeys_parse_input_aux:nn #1#2 +\cs_generate_variant:Nn \__cookingunits_cusinglekeys_parse_input:n { V } +\cs_new:Npn \__cookingunits_cusinglekeys_parse_input_aux:nn #1#2 { \quark_if_recursion_tail_stop:n {#1} \quark_if_recursion_tail_stop_do:nn {#2} { \msg_error:nn { cooking-units } { missing-argument } } - \__cooking_units_error_if_unit_not_defined:n {#1} - \seq_put_right:Nn \l__cooking_units_tmpa_seq {#1} - \tl_set:Nn \l__cooking_units_tmpa_tl {#2} - \tl_replace_all:NVn \l__cooking_units_tmpa_tl \c__cooking_units_input_str_hash_one_tl { \l__cooking_units_tmpa_fp } - \prop_put:NnV \l__cooking_units_tmpa_prop {#1} \l__cooking_units_tmpa_tl - \__cooking_units_cusinglekeys_parse_input_aux:nn + \__cookingunits_error_if_unit_not_defined:n {#1} + \seq_put_right:Nn \l__cookingunits_tmpa_seq {#1} + \tl_set:Nn \l__cookingunits_tmpa_tl {#2} + \tl_replace_all:NVn \l__cookingunits_tmpa_tl \c__cookingunits_input_str_hash_one_tl { \l__cookingunits_tmpa_fp } + \prop_put:NnV \l__cookingunits_tmpa_prop {#1} \l__cookingunits_tmpa_tl + \__cookingunits_cusinglekeys_parse_input_aux:nn } -\cs_new:Npn \__cooking_units_cusinglekeys_create_key_prop:n #1 +\cs_new:Npn \__cookingunits_cusinglekeys_create_key_prop:n #1 { - \tl_set:cn { l__cooking_units_unit_change_ #1 _tl } { 1.0 } - \prop_set_eq:cN { l__cooking_units_cukeys_ #1 _prop } \l__cooking_units_tmpa_prop - \prop_put:cnn { l__cooking_units_cukeys_ #1 _prop } { Erstes Ding } {#1} - \prop_put:cnV { l__cooking_units_cukeys_ #1 _prop } { Liste } \l__cooking_units_tmpa_seq - \prop_put:cnV { l__cooking_units_cukeys_ #1 _prop } { prop } \l__cooking_units_tmpa_prop + \tl_set:cn { l__cookingunits_unit_change_ #1 _tl } { 1.0 } + \prop_set_eq:cN { l__cookingunits_cukeys_ #1 _prop } \l__cookingunits_tmpa_prop + \prop_put:cnn { l__cookingunits_cukeys_ #1 _prop } { Erstes Ding } {#1} + \prop_put:cnV { l__cookingunits_cukeys_ #1 _prop } { Liste } \l__cookingunits_tmpa_seq + \prop_put:cnV { l__cookingunits_cukeys_ #1 _prop } { prop } \l__cookingunits_tmpa_prop } -\cs_new:Npn \__cooking_units_cukeys_define_singlekey:nn #1#2 +\cs_new:Npn \__cookingunits_cukeys_define_singlekey:nn #1#2 { - \seq_if_in:NnF \l__cooking_units_list_of_defined_keys_seq {#1} - { \seq_put_right:Nn \l__cooking_units_list_of_defined_keys_seq {#1} } + \seq_if_in:NnF \l__cookingunits_list_of_defined_keys_seq {#1} + { \seq_put_right:Nn \l__cookingunits_list_of_defined_keys_seq {#1} } \keys_define:nn { cooking-units } { #1 .choices:Vn = - \l__cooking_units_tmpa_clist + \l__cookingunits_tmpa_clist { - \__cooking_units_cukeys_define_keys_and_single_key_aux:n {#1} + \__cookingunits_cukeys_define_keys_and_single_key_aux:n {#1} } , #1 / unknown .code:n= { @@ -2089,295 +2142,295 @@ #1 .groups:n = { change-unit } , } } -\cs_generate_variant:Nn \__cooking_units_cukeys_define_singlekey:nn { nV } +\cs_generate_variant:Nn \__cookingunits_cukeys_define_singlekey:nn { nV } \NewDocumentCommand \cuaddkeys { m m } { - \bool_set_false:N \l__cooking_units_single_key_bool - \__cooking_units_cukeys_add_keys_or_single_keys:nn {#1} {#2} + \bool_set_false:N \l__cookingunits_single_key_bool + \__cookingunits_cukeys_add_keys_or_single_keys:nn {#1} {#2} } \NewDocumentCommand \cuaddsinglekeys { m m } { - \bool_set_true:N \l__cooking_units_single_key_bool - \__cooking_units_cukeys_add_keys_or_single_keys:nn {#1} {#2} + \bool_set_true:N \l__cookingunits_single_key_bool + \__cookingunits_cukeys_add_keys_or_single_keys:nn {#1} {#2} } \NewDocumentCommand \cuaddtokeys { m m m } { - \bool_set_false:N \l__cooking_units_single_key_bool - \tl_set:Nn \l__cooking_units_tmpb_tl { {#2} { \fp_eval:n { 1.0 / (#3) } } } - \__cooking_units_cukeys_add_keys_or_single_keys:nV {#1} \l__cooking_units_tmpb_tl + \bool_set_false:N \l__cookingunits_single_key_bool + \tl_set:Nn \l__cookingunits_tmpb_tl { {#2} { \fp_eval:n { 1.0 / (#3) } } } + \__cookingunits_cukeys_add_keys_or_single_keys:nV {#1} \l__cookingunits_tmpb_tl } -\cs_new:Npn \__cooking_units_cukeys_add_keys_or_single_keys:nn #1#2 +\cs_new:Npn \__cookingunits_cukeys_add_keys_or_single_keys:nn #1#2 { - \__cooking_units_error_if_unit_not_defined:n {#1} - \seq_if_in:NnF \l__cooking_units_list_of_defined_keys_seq {#1} + \__cookingunits_error_if_unit_not_defined:n {#1} + \seq_if_in:NnF \l__cookingunits_list_of_defined_keys_seq {#1} { \msg_error:nnn { cooking-units } { Key-not-defined } {#1} } \tl_if_blank:nF {#2} { - \__cooking_units_cukeys_add_keys_and_single_key_aux:n {#1} - \bool_if:NTF \l__cooking_units_single_key_bool - { \__cooking_units_cukeys_parse_and_create_single_key:nn {#1} {#2} } - { \__cooking_units_cukeys_parse_and_create_keys:nn {#1} {#2} } + \__cookingunits_cukeys_add_keys_and_single_key_aux:n {#1} + \bool_if:NTF \l__cookingunits_single_key_bool + { \__cookingunits_cukeys_parse_and_create_single_key:nn {#1} {#2} } + { \__cookingunits_cukeys_parse_and_create_keys:nn {#1} {#2} } } } -\cs_generate_variant:Nn \__cooking_units_cukeys_add_keys_or_single_keys:nn { nV } -\cs_new:Npn \__cooking_units_cukeys_add_keys_and_single_key_aux:n #1 +\cs_generate_variant:Nn \__cookingunits_cukeys_add_keys_or_single_keys:nn { nV } +\cs_new:Npn \__cookingunits_cukeys_add_keys_and_single_key_aux:n #1 { - \prop_get:cnN { l__cooking_units_cukeys_ #1 _prop } { Liste } \l__cooking_units_tmpa_seq - \prop_get:cnN { l__cooking_units_cukeys_ #1 _prop } { prop } \l__cooking_units_tmpa_prop - \prop_get:cnN { l__cooking_units_cukeys_ #1 _prop } { Erstes Ding } \l__cooking_units_given_unit_tl - \prop_get:cVN { l__cooking_units_cukeys_ #1 _prop } \l__cooking_units_given_unit_tl \l__cooking_units_tmpa_fp + \prop_get:cnN { l__cookingunits_cukeys_ #1 _prop } { Liste } \l__cookingunits_tmpa_seq + \prop_get:cnN { l__cookingunits_cukeys_ #1 _prop } { prop } \l__cookingunits_tmpa_prop + \prop_get:cnN { l__cookingunits_cukeys_ #1 _prop } { Erstes Ding } \l__cookingunits_given_unit_tl + \prop_get:cVN { l__cookingunits_cukeys_ #1 _prop } \l__cookingunits_given_unit_tl \l__cookingunits_tmpa_fp } \NewDocumentCommand \declarecookingunit { o m } { - \seq_if_in:NnTF \g__cooking_units_list_of_defined_units_seq {#2} + \seq_if_in:NnTF \g__cookingunits_list_of_defined_units_seq {#2} { \msg_info:nnn { cooking-units } { redefine-unit } {#2} } - { \__cooking_units_new_cooking_unit:nn {#1} {#2} } - \__cooking_units_set_cooking_unit:nn {#1} {#2} + { \__cookingunits_new_cooking_unit:nn {#1} {#2} } + \__cookingunits_set_cooking_unit:nn {#1} {#2} } \NewDocumentCommand \newcookingunit { o m } { - \__cooking_units_new_cooking_unit:nn {#1} {#2} - \__cooking_units_set_cooking_unit:nn {#1} {#2} + \__cookingunits_new_cooking_unit:nn {#1} {#2} + \__cookingunits_set_cooking_unit:nn {#1} {#2} } \NewDocumentCommand \providecookingunit { o m } { - \seq_if_in:NnF \g__cooking_units_list_of_defined_units_seq {#2} + \seq_if_in:NnF \g__cookingunits_list_of_defined_units_seq {#2} { - \__cooking_units_new_cooking_unit:nn {#1} {#2} - \__cooking_units_set_cooking_unit:nn {#1} {#2} + \__cookingunits_new_cooking_unit:nn {#1} {#2} + \__cookingunits_set_cooking_unit:nn {#1} {#2} } } -\cs_new:Npn \__cooking_units_new_cooking_unit:nn #1#2 +\cs_new:Npn \__cookingunits_new_cooking_unit:nn #1#2 { - \seq_if_in:NnTF \g__cooking_units_list_of_defined_units_seq {#2} + \seq_if_in:NnTF \g__cookingunits_list_of_defined_units_seq {#2} { \msg_error:nnn { cooking-units } { unit-already-defined } {#2} } { \tl_map_inline:nn {#2} { - \tl_if_in:NnT \l__cooking_units_unit_letter_not_allowed_tl {##1} + \tl_if_in:NnT \l__cookingunits_unit_letter_not_allowed_tl {##1} { \msg_error:nnn { cooking-units } { character-not-allowed } {#2} } } - \seq_put_right:Nn \g__cooking_units_list_of_defined_units_seq {#2} - \tl_new:c { l__cooking_units_unit_change_ #2 _tl } - \tl_set:cn { l__cooking_units_unit_change_ #2 _tl } { 1.0 } - \clist_new:c { l__cooking_units_predefined_option_#2_clist } + \seq_put_right:Nn \g__cookingunits_list_of_defined_units_seq {#2} + \tl_new:c { l__cookingunits_unit_change_ #2 _tl } + \tl_set:cn { l__cookingunits_unit_change_ #2 _tl } { 1.0 } + \clist_new:c { l__cookingunits_predefined_option_#2_clist } \keys_define:nn { cooking-units } { - set-option-for-#2 .clist_set:c = { l__cooking_units_predefined_option_#2_clist } , + set-option-for-#2 .clist_set:c = { l__cookingunits_predefined_option_#2_clist } , add-option-for-#2 .code:n = - { \clist_put_right:cn { l__cooking_units_predefined_option_#2_clist } {##1} }, + { \clist_put_right:cn { l__cookingunits_predefined_option_#2_clist } {##1} }, } - \prop_new:c { l__cooking_units_cukeys_ #2 _prop } - \tl_new:c { l__cooking_units_default_unit_ #2 _tl } + \prop_new:c { l__cookingunits_cukeys_ #2 _prop } + \tl_new:c { l__cookingunits_default_unit_ #2 _tl } } } -\cs_new:Npn \__cooking_units_set_cooking_unit:nn #1#2 +\cs_new:Npn \__cookingunits_set_cooking_unit:nn #1#2 { \IfNoValueTF {#1} { - \tl_set:cn { l__cooking_units_default_unit_ #2 _tl } {#2} - \__cooking_units_deftranslation_base:xxn {#2} \c__cooking_units_postfix_unit_tl {#2} + \tl_set:cn { l__cookingunits_default_unit_ #2 _tl } {#2} + \__cookingunits_deftranslation_base:xxn {#2} \c__cookingunits_postfix_unit_tl {#2} }{ - \tl_set:cn { l__cooking_units_default_unit_ #2 _tl } {#1} - \__cooking_units_deftranslation_base:xxn {#2} \c__cooking_units_postfix_unit_tl {#1} + \tl_set:cn { l__cookingunits_default_unit_ #2 _tl } {#1} + \__cookingunits_deftranslation_base:xxn {#2} \c__cookingunits_postfix_unit_tl {#1} } - \__cooking_units_deftranslation_base:xxn {#2} \c__cooking_units_postfix_unitname_tl { \q__cooking_units_no_translation } - \__cooking_units_deftranslation_base:xxn {#2} \c__cooking_units_postfix_unitname_pl_tl { \q__cooking_units_no_translation } - \__cooking_units_deftranslation_base:xxn {#2} \c__cooking_units_postfix_gender_tl { m } + \__cookingunits_deftranslation_base:xxn {#2} \c__cookingunits_postfix_unitname_tl { \q__cookingunits_no_translation } + \__cookingunits_deftranslation_base:xxn {#2} \c__cookingunits_postfix_unitname_pl_tl { \q__cookingunits_no_translation } + \__cookingunits_deftranslation_base:xxn {#2} \c__cookingunits_postfix_gender_tl { m } } -\tl_new:N \l__cooking_units_sanitise_tl -\cs_new_protected:Npn \__cooking_units_sanitise_aux:w #1 \q_mark - { \tl_set:Nn \l__cooking_units_sanitise_tl {#1} } +\tl_new:N \l__cookingunits_sanitise_tl +\cs_new_protected:Npn \__cookingunits_sanitise_aux:w #1 \q_mark + { \tl_set:Nn \l__cookingunits_sanitise_tl {#1} } \group_begin: \char_set_catcode_active:n { `\< } \char_set_catcode_active:n { `\> } - \cs_new:Npn \__cooking_units_sanitize_open_arrow: + \cs_new:Npn \__cookingunits_sanitize_open_arrow: { - \exp_after:wN \__cooking_units_sanitize_open_arrow_auxi:w \l__cooking_units_sanitise_tl + \exp_after:wN \__cookingunits_sanitize_open_arrow_auxi:w \l__cookingunits_sanitise_tl \q_mark < \q_nil < - \exp_after:wN \__cooking_units_sanitise_aux:w \l__cooking_units_sanitise_tl + \exp_after:wN \__cookingunits_sanitise_aux:w \l__cookingunits_sanitise_tl } - \cs_new_protected:Npn \__cooking_units_sanitize_open_arrow_auxi:w #1 < + \cs_new_protected:Npn \__cookingunits_sanitize_open_arrow_auxi:w #1 < { - \tl_set:Nn \l__cooking_units_sanitise_tl {#1} - \__cooking_units_sanitize_open_arrow_auxii:w + \tl_set:Nn \l__cookingunits_sanitise_tl {#1} + \__cookingunits_sanitize_open_arrow_auxii:w } - \cs_new_protected:Npn \__cooking_units_sanitize_open_arrow_auxii:w #1 < + \cs_new_protected:Npn \__cookingunits_sanitize_open_arrow_auxii:w #1 < { \quark_if_nil:nF {#1} { - \tl_set:Nx \l__cooking_units_sanitise_tl + \tl_set:Nx \l__cookingunits_sanitise_tl { - \exp_not:V \l__cooking_units_sanitise_tl + \exp_not:V \l__cookingunits_sanitise_tl \token_to_str:N < \exp_not:n {#1} } - \exp_after:wN \__cooking_units_sanitize_open_arrow_auxii:w + \exp_after:wN \__cookingunits_sanitize_open_arrow_auxii:w } } - \cs_new:Npn \__cooking_units_sanitize_close_arrow: + \cs_new:Npn \__cookingunits_sanitize_close_arrow: { - \exp_after:wN \__cooking_units_sanitize_close_arrow_auxi:w \l__cooking_units_sanitise_tl + \exp_after:wN \__cookingunits_sanitize_close_arrow_auxi:w \l__cookingunits_sanitise_tl \q_mark > \q_nil > - \exp_after:wN \__cooking_units_sanitise_aux:w \l__cooking_units_sanitise_tl + \exp_after:wN \__cookingunits_sanitise_aux:w \l__cookingunits_sanitise_tl } - \cs_new_protected:Npn \__cooking_units_sanitize_close_arrow_auxi:w #1 > + \cs_new_protected:Npn \__cookingunits_sanitize_close_arrow_auxi:w #1 > { - \tl_set:Nn \l__cooking_units_sanitise_tl {#1} - \__cooking_units_sanitize_close_arrow_auxii:w + \tl_set:Nn \l__cookingunits_sanitise_tl {#1} + \__cookingunits_sanitize_close_arrow_auxii:w } - \cs_new_protected:Npn \__cooking_units_sanitize_close_arrow_auxii:w #1 > + \cs_new_protected:Npn \__cookingunits_sanitize_close_arrow_auxii:w #1 > { \quark_if_nil:nF {#1} { - \tl_set:Nx \l__cooking_units_sanitise_tl + \tl_set:Nx \l__cookingunits_sanitise_tl { - \exp_not:V \l__cooking_units_sanitise_tl + \exp_not:V \l__cookingunits_sanitise_tl \token_to_str:N > \exp_not:n {#1} } - \exp_after:wN \__cooking_units_sanitize_close_arrow_auxii:w + \exp_after:wN \__cookingunits_sanitize_close_arrow_auxii:w } } \group_end: -\cs_new_protected:Npn \__cooking_units_sanitize_arrows:n #1 +\cs_new_protected:Npn \__cookingunits_sanitize_arrows:n #1 { - \tl_set:Nn \l__cooking_units_sanitise_tl {#1} - \__cooking_units_sanitize_open_arrow: - \__cooking_units_sanitize_close_arrow: + \tl_set:Nn \l__cookingunits_sanitise_tl {#1} + \__cookingunits_sanitize_open_arrow: + \__cookingunits_sanitize_close_arrow: } \NewDocumentCommand \cudefinename { m m } { - \tl_set:Nn \l__cooking_units_language_tl {#1} - \__cooking_units_sanitize_arrows:n {#2} + \tl_set:Nn \l__cookingunits_language_tl {#1} + \__cookingunits_sanitize_arrows:n {#2} \exp_last_unbraced:NV - \__cooking_units_cuname_parse_input:n \l__cooking_units_sanitise_tl + \__cookingunits_cuname_parse_input:n \l__cookingunits_sanitise_tl \q_recursion_tail \q_recursion_tail \q_recursion_stop } -\cs_new:Npn \__cooking_units_cuname_parse_input:n #1 +\cs_new:Npn \__cookingunits_cuname_parse_input:n #1 { \peek_meaning_ignore_spaces:NTF [ { - \__cooking_units_cuname_parse_unit_symbol:nw {#1} + \__cookingunits_cuname_parse_unit_symbol:nw {#1} }{ - \seq_if_in:NnTF \g__cooking_units_allowed_special_keys_seq {#1} - { \__cooking_units_cuname_parse_input_aux:nn {#1} } - { \__cooking_units_cuname_parse_unit_symbol:nw {#1} [ \q_no_value ] } + \seq_if_in:NnTF \g__cookingunits_allowed_special_keys_seq {#1} + { \__cookingunits_cuname_parse_input_aux:nn {#1} } + { \__cookingunits_cuname_parse_unit_symbol:nw {#1} [ \q_no_value ] } } } -\cs_new:Npn \__cooking_units_cuname_parse_unit_symbol:nw #1 [#2] +\cs_new:Npn \__cookingunits_cuname_parse_unit_symbol:nw #1 [#2] { \quark_if_recursion_tail_stop:n {#1} \quark_if_recursion_tail_stop_do:nn {#2} { \msg_error:nn { cooking-units } { missing-argument } } - \__cooking_units_error_if_unit_not_defined:n {#1} + \__cookingunits_error_if_unit_not_defined:n {#1} \quark_if_no_value:nTF {#2} { - \__cooking_units_deftranslation_to:Vxxv - \l__cooking_units_language_tl {#1} - \c__cooking_units_postfix_unit_tl - { l__cooking_units_default_unit_ #1 _tl } + \__cookingunits_deftranslation_to:Vxxv + \l__cookingunits_language_tl {#1} + \c__cookingunits_postfix_unit_tl + { l__cookingunits_default_unit_ #1 _tl } }{ - \__cooking_units_deftranslation_to:Vxxn - \l__cooking_units_language_tl {#1} - \c__cooking_units_postfix_unit_tl {#2} + \__cookingunits_deftranslation_to:Vxxn + \l__cookingunits_language_tl {#1} + \c__cookingunits_postfix_unit_tl {#2} } - \__cooking_units_cuname_parse_input_aux:nn {#1} + \__cookingunits_cuname_parse_input_aux:nn {#1} } -\cs_new:Npn \__cooking_units_cuname_parse_input_aux:nn #1#2 +\cs_new:Npn \__cookingunits_cuname_parse_input_aux:nn #1#2 { \quark_if_recursion_tail_stop:n {#1} \quark_if_recursion_tail_stop_do:nn {#2} { \msg_error:nn { cooking-units } { missing-argument } } - \seq_if_in:NnF \g__cooking_units_allowed_special_keys_seq {#1} - { \__cooking_units_error_if_unit_not_defined:n {#1} } - \__cooking_units_deftranslation_to:Vxxn - \l__cooking_units_language_tl {#1} - \c__cooking_units_postfix_unitname_tl {#2} + \seq_if_in:NnF \g__cookingunits_allowed_special_keys_seq {#1} + { \__cookingunits_error_if_unit_not_defined:n {#1} } + \__cookingunits_deftranslation_to:Vxxn + \l__cookingunits_language_tl {#1} + \c__cookingunits_postfix_unitname_tl {#2} \peek_meaning_ignore_spaces:NTF [ - { \__cooking_units_cuname_parse_bracket:nw {#1} } - { \__cooking_units_cuname_parse_bracket:nw {#1} [#2] } + { \__cookingunits_cuname_parse_bracket:nw {#1} } + { \__cookingunits_cuname_parse_bracket:nw {#1} [#2] } } -\cs_new:Npn \__cooking_units_cuname_parse_bracket:nw #1 [#2] +\cs_new:Npn \__cookingunits_cuname_parse_bracket:nw #1 [#2] { - \seq_if_in:NnF \g__cooking_units_allowed_special_keys_seq {#1} + \seq_if_in:NnF \g__cookingunits_allowed_special_keys_seq {#1} { - \__cooking_units_deftranslation_to:Vxxn \l__cooking_units_language_tl {#1} - \c__cooking_units_postfix_unitname_pl_tl {#2} + \__cookingunits_deftranslation_to:Vxxn \l__cookingunits_language_tl {#1} + \c__cookingunits_postfix_unitname_pl_tl {#2} } \peek_meaning_ignore_spaces:NTF < - { \__cooking_units_cuname_parse_gender:nw {#1} } - { \__cooking_units_cuname_parse_gender:nw {#1} } + { \__cookingunits_cuname_parse_gender:nw {#1} } + { \__cookingunits_cuname_parse_gender:nw {#1} } } -\cs_new:Npn \__cooking_units_cuname_parse_gender:nw #1 <#2> +\cs_new:Npn \__cookingunits_cuname_parse_gender:nw #1 <#2> { - \__cooking_units_check_if_correct_gender_input:n {#2} - \__cooking_units_deftranslation_to:Vxxn - \l__cooking_units_language_tl {#1} - \c__cooking_units_postfix_gender_tl {#2} - \__cooking_units_cuname_parse_input:n + \__cookingunits_check_if_correct_gender_input:n {#2} + \__cookingunits_deftranslation_to:Vxxn + \l__cookingunits_language_tl {#1} + \c__cookingunits_postfix_gender_tl {#2} + \__cookingunits_cuname_parse_input:n } \NewDocumentCommand \cudefinesymbol { m m } { - \tl_set:Nn \l__cooking_units_language_tl {#1} - \__cooking_units_cuprint_define_printed_unit:nn #2 + \tl_set:Nn \l__cookingunits_language_tl {#1} + \__cookingunits_cuprint_define_printed_unit:nn #2 \q_recursion_tail \q_recursion_tail \q_recursion_stop } -\cs_new:Npn \__cooking_units_cuprint_define_printed_unit:nn #1#2 +\cs_new:Npn \__cookingunits_cuprint_define_printed_unit:nn #1#2 { \quark_if_recursion_tail_stop:n {#1} \quark_if_recursion_tail_stop_do:nn {#2} { \msg_error:nn { cooking-units } { missing-argument } } - \seq_if_in:NnTF \g__cooking_units_allowed_special_keys_seq {#1} + \seq_if_in:NnTF \g__cookingunits_allowed_special_keys_seq {#1} { - \__cooking_units_deftranslation_to:Vxxn \l__cooking_units_language_tl {#1} - \c__cooking_units_postfix_unitname_tl {#2} + \__cookingunits_deftranslation_to:Vxxn \l__cookingunits_language_tl {#1} + \c__cookingunits_postfix_unitname_tl {#2} }{ - \__cooking_units_error_if_unit_not_defined:n {#1} - \__cooking_units_deftranslation_to:Vxxn - \l__cooking_units_language_tl {#1} - \c__cooking_units_postfix_unit_tl {#2} + \__cookingunits_error_if_unit_not_defined:n {#1} + \__cookingunits_deftranslation_to:Vxxn + \l__cookingunits_language_tl {#1} + \c__cookingunits_postfix_unit_tl {#2} } - \__cooking_units_cuprint_define_printed_unit:nn + \__cookingunits_cuprint_define_printed_unit:nn } -\__cooking_units_newtranslation_base:nVn { phrase-prop } \c__cooking_units_postfix_phrase_tl { \q__cooking_units_no_translation } -\prg_new_conditional:Npnn \__cooking_units_phrase_list_get_for:NN #1#2 { TF } +\__cookingunits_newtranslation_base:nVn { phrase-prop } \c__cookingunits_postfix_phrase_tl { \q__cookingunits_no_translation } +\prg_new_conditional:Npnn \__cookingunits_phrase_list_get_for:NN #1#2 { TF } { - \__cooking_units_translate_let:VNxx #2 #1 { phrase-prop } \c__cooking_units_postfix_phrase_tl - \tl_if_eq:NNTF #1 \q__cooking_units_no_translation + \__cookingunits_translate_let:VNnV #2 #1 { phrase-prop } \c__cookingunits_postfix_phrase_tl + \tl_if_eq:NNTF #1 \q__cookingunits_no_translation { \prg_return_false: } { \prg_return_true: } } -\prg_new_conditional:Npnn \__cooking_units_get_phrase_for_current_langauge:NN #1#2 { T } +\prg_new_conditional:Npnn \__cookingunits_get_phrase_for_current_langauge:NN #1#2 { T } { - \__cooking_units_translate_let:Nxx #1 { phrase-prop } \c__cooking_units_postfix_phrase_tl - \tl_if_eq:NNTF #1 \q__cooking_units_no_translation + \__cookingunits_translate_let:NnV #1 { phrase-prop } \c__cookingunits_postfix_phrase_tl + \tl_if_eq:NNTF #1 \q__cookingunits_no_translation { \prg_return_false: } { - \__cooking_units_translate_let:Nxx #2 { phrase-clist } \c__cooking_units_postfix_phrase_tl + \__cookingunits_translate_let:NnV #2 { phrase-clist } \c__cookingunits_postfix_phrase_tl \prg_return_true: } } \NewDocumentCommand \cudefinephrase { m m } { - \__cooking_units_cuphrase:nn {#1} {#2} + \__cookingunits_cuphrase:nn {#1} {#2} } -\cs_new:Npn \__cooking_units_cuphrase:nn #1#2 +\cs_new:Npn \__cookingunits_cuphrase:nn #1#2 { - \tl_set:Nn \l__cooking_units_language_tl {#1} - \__cooking_units_phrase_list_get_for:NNTF \l__cooking_units_phrase_prop \l__cooking_units_language_tl + \tl_set:Nn \l__cookingunits_language_tl {#1} + \__cookingunits_phrase_list_get_for:NNTF \l__cookingunits_phrase_prop \l__cookingunits_language_tl { - \__cooking_units_translate_let:VNxx \l__cooking_units_language_tl \l__cooking_units_phrase_numbers_seq - { phrase-clist } \c__cooking_units_postfix_phrase_tl + \__cookingunits_translate_let:VNnV \l__cookingunits_language_tl \l__cookingunits_phrase_numbers_seq + { phrase-clist } \c__cookingunits_postfix_phrase_tl }{ - \prop_clear:N \l__cooking_units_phrase_prop - \seq_clear:N \l__cooking_units_phrase_numbers_seq + \prop_clear:N \l__cookingunits_phrase_prop + \seq_clear:N \l__cookingunits_phrase_numbers_seq } - \__cooking_units_sanitize_arrows:n {#2} + \__cookingunits_sanitize_arrows:n {#2} \exp_last_unbraced:NV - \__cooking_units_cuphrase_parse:n \l__cooking_units_sanitise_tl + \__cookingunits_cuphrase_parse:n \l__cookingunits_sanitise_tl \q_recursion_tail \q_recursion_tail \q_recursion_stop - \seq_sort:Nn \l__cooking_units_phrase_numbers_seq + \seq_sort:Nn \l__cookingunits_phrase_numbers_seq { \int_compare:nNnTF { \int_abs:n {##1} } < { \int_abs:n {##2} } { \sort_return_swapped: } @@ -2390,177 +2443,177 @@ }{ \sort_return_same: } } } - \__cooking_units_deftranslation_to:VxxV - \l__cooking_units_language_tl { phrase-prop } - \c__cooking_units_postfix_phrase_tl - \l__cooking_units_phrase_prop - \__cooking_units_deftranslation_to:VxxV - \l__cooking_units_language_tl { phrase-clist } - \c__cooking_units_postfix_phrase_tl \l__cooking_units_phrase_numbers_seq + \__cookingunits_deftranslation_to:VxxV + \l__cookingunits_language_tl { phrase-prop } + \c__cookingunits_postfix_phrase_tl + \l__cookingunits_phrase_prop + \__cookingunits_deftranslation_to:VxxV + \l__cookingunits_language_tl { phrase-clist } + \c__cookingunits_postfix_phrase_tl \l__cookingunits_phrase_numbers_seq } -\cs_new:Npn \__cooking_units_cuphrase_parse:n #1 +\cs_new:Npn \__cookingunits_cuphrase_parse:n #1 { \quark_if_recursion_tail_stop:n {#1} - \__cooking_units_if_integer:nF {#1} + \__cookingunits_if_integer:nF {#1} { \msg_error:nnn { cooking-units} { phrase-unit-not-an-integer } {#1} } \peek_meaning_remove_ignore_spaces:NTF * { - \int_set:Nn \l__cooking_units_tmpa_int {-#1} - \__cooking_units_cuphrase_parse_normal:Vn \l__cooking_units_tmpa_int + \int_set:Nn \l__cookingunits_tmpa_int {-#1} + \__cookingunits_cuphrase_parse_normal:Vn \l__cookingunits_tmpa_int }{ - \int_set:Nn \l__cooking_units_tmpa_int {#1} - \__cooking_units_cuphrase_parse_normal:Vn \l__cooking_units_tmpa_int + \int_set:Nn \l__cookingunits_tmpa_int {#1} + \__cookingunits_cuphrase_parse_normal:Vn \l__cookingunits_tmpa_int } } -\cs_new:Npn \__cooking_units_cuphrase_parse_normal:nn #1#2 +\cs_new:Npn \__cookingunits_cuphrase_parse_normal:nn #1#2 { \quark_if_recursion_tail_stop_do:nn {#2} { \msg_error:nn { cooking-units } { missing-argument } } - \prop_put:Nnn \l__cooking_units_phrase_prop {#1} {#2} - \seq_if_in:NnF \l__cooking_units_phrase_numbers_seq {#1} - { \seq_push:Nn \l__cooking_units_phrase_numbers_seq {#1} } + \prop_put:Nnn \l__cookingunits_phrase_prop {#1} {#2} + \seq_if_in:NnF \l__cookingunits_phrase_numbers_seq {#1} + { \seq_push:Nn \l__cookingunits_phrase_numbers_seq {#1} } \peek_meaning_ignore_spaces:NTF [ { - \__cooking_units_chuphrase_parse_plural:nw {#1} + \__cookingunits_chuphrase_parse_plural:nw {#1} }{ - \__cooking_units_chuphrase_parse_plural:nw {#1} [#2] + \__cookingunits_chuphrase_parse_plural:nw {#1} [#2] } } -\cs_generate_variant:Nn \__cooking_units_cuphrase_parse_normal:nn { V } -\cs_new:Npn \__cooking_units_chuphrase_parse_plural:nw #1 [#2] +\cs_generate_variant:Nn \__cookingunits_cuphrase_parse_normal:nn { V } +\cs_new:Npn \__cookingunits_chuphrase_parse_plural:nw #1 [#2] { - \prop_put:Nnn \l__cooking_units_phrase_prop { #1-pl } {#2} + \prop_put:Nnn \l__cookingunits_phrase_prop { #1-pl } {#2} \peek_meaning_ignore_spaces:NTF < { - \__cooking_units_chuphrase_parse_gender:nw {#1} + \__cookingunits_chuphrase_parse_gender:nw {#1} }{ - \__cooking_units_chuphrase_parse_gender:nw {#1} < m > + \__cookingunits_chuphrase_parse_gender:nw {#1} < m > } } -\cs_new:Npn \__cooking_units_chuphrase_parse_gender:nw #1 <#2> +\cs_new:Npn \__cookingunits_chuphrase_parse_gender:nw #1 <#2> { - \__cooking_units_check_if_correct_gender_input:n {#2} - \__cooking_units_deftranslation_to:Vxxn - \l__cooking_units_language_tl { #1-phrase-gender } - \c__cooking_units_postfix_gender_tl {#2} - \__cooking_units_cuphrase_parse:n + \__cookingunits_check_if_correct_gender_input:n {#2} + \__cookingunits_deftranslation_to:Vxxn + \l__cookingunits_language_tl { #1-phrase-gender } + \c__cookingunits_postfix_gender_tl {#2} + \__cookingunits_cuphrase_parse:n } -\cs_new:Npn \__cooking_units_old_cutext:nnn #1#2#3 +\cs_new:Npn \__cookingunits_old_cutext:nnn #1#2#3 { - \tl_set_eq:NN \l__cooking_units_option_unit_tl \l__cooking_units_given_unit_tl - \__cooking_units_old_cutext_default:nnn {#1} {#2} {#3} + \tl_set_eq:NN \l__cookingunits_option_unit_tl \l__cookingunits_given_unit_tl + \__cookingunits_old_cutext_default:nnn {#1} {#2} {#3} } -\cs_new:Npn \__cooking_units_old_cutext_default:nnn #1#2#3 +\cs_new:Npn \__cookingunits_old_cutext_default:nnn #1#2#3 { - \bool_if:NTF \l__cooking_units_draft_bool + \bool_if:NTF \l__cookingunits_draft_bool {#2} { - \tl_set:Nn \l__cooking_units_cutext_last_value_tl {#2} - \tl_if_in:NVTF \l__cooking_units_cutext_last_value_tl \l__cooking_units_input_range_sign_tl + \tl_set:Nn \l__cookingunits_cutext_last_value_tl {#2} + \tl_if_in:NVTF \l__cookingunits_cutext_last_value_tl \l__cookingunits_input_range_sign_tl { - \tl_replace_once:NVn \l__cooking_units_cutext_last_value_tl - \l__cooking_units_input_range_sign_tl { \q__cooking_units_range } - \__cooking_units_old_cutext_parse_range:Vn \l__cooking_units_cutext_last_value_tl {#3} + \tl_replace_once:NVn \l__cookingunits_cutext_last_value_tl + \l__cookingunits_input_range_sign_tl { \q__cookingunits_range } + \__cookingunits_old_cutext_parse_range:Vn \l__cookingunits_cutext_last_value_tl {#3} }{ - \__cooking_units_old_cutext_print_input:Nn \l__cooking_units_cutext_last_value_tl {#3} + \__cookingunits_old_cutext_print_input:Nn \l__cookingunits_cutext_last_value_tl {#3} } } } -\cs_new_protected:Npn \__cooking_units_old_cutext_print_input:Nn #1#2 +\cs_new_protected:Npn \__cookingunits_old_cutext_print_input:Nn #1#2 { - \__cooking_units_old_cutext_if_numeral_is_int_and_parse_and_smaller_then_print_numerals:NTF #1 + \__cookingunits_old_cutext_if_numeral_is_int_and_parse_and_smaller_then_print_numerals:NTF #1 { - \__cooking_units_int_if_equal_one:nTF {#1} + \__cookingunits_int_if_equal_one:nTF {#1} { - \__cooking_units_translate_one_and_check_existance:Nx \l__cooking_units_translation_tmpa_tl {#2} - \bool_if:NTF \l__cooking_units_cutext_uppercase_word_bool + \__cookingunits_translate_one_and_check_existance:Nx \l__cookingunits_translation_tmpa_tl {#2} + \bool_if:NTF \l__cookingunits_cutext_uppercase_word_bool { - \exp_args:Nx \tl_upper_case:n { \tl_head:V \l__cooking_units_translation_tmpa_tl } - \tl_tail:V \l__cooking_units_translation_tmpa_tl + \exp_args:Nx \tl_upper_case:n { \tl_head:V \l__cookingunits_translation_tmpa_tl } + \tl_tail:V \l__cookingunits_translation_tmpa_tl } - { \l__cooking_units_translation_tmpa_tl } + { \l__cookingunits_translation_tmpa_tl } }{ - \bool_if:NTF \l__cooking_units_cutext_uppercase_word_bool - { \__cooking_units_print_Numeral:n {#1} } - { \__cooking_units_print_numeral:n {#1} } + \bool_if:NTF \l__cookingunits_cutext_uppercase_word_bool + { \__cookingunits_print_Numeral:n {#1} } + { \__cookingunits_print_numeral:n {#1} } } } - { \__cooking_units_print_numerical_input:N #1 } + { \__cookingunits_print_numerical_input:N #1 } } -\prg_new_conditional:Npnn \__cooking_units_old_cutext_if_numeral_is_int_and_parse_and_smaller_then_print_numerals:N #1 { TF } +\prg_new_conditional:Npnn \__cookingunits_old_cutext_if_numeral_is_int_and_parse_and_smaller_then_print_numerals:N #1 { TF } { - \bool_if:NTF \l__cooking_units_lokal_numeral_bool + \bool_if:NTF \l__cookingunits_lokal_numeral_bool { - \__cooking_units_if_integer:VTF #1 + \__cookingunits_if_integer:VTF #1 { - \int_compare:nNnTF {#1} < { \l__cooking_units_print_numerals_below_int } + \int_compare:nNnTF {#1} < { \l__cookingunits_print_numerals_below_int } { \prg_return_true: } { \prg_return_false: } }{ \prg_return_false: } }{ \prg_return_false: } } -\cs_new:Npn \__cooking_units_old_cutext_parse_range:nn #1 #2 +\cs_new:Npn \__cookingunits_old_cutext_parse_range:nn #1 #2 { - \__cooking_units_old_cutext_parse_range_aux:nww {#2} #1 \q_stop + \__cookingunits_old_cutext_parse_range_aux:nww {#2} #1 \q_stop } -\cs_generate_variant:Nn \__cooking_units_old_cutext_parse_range:nn { V } -\cs_new:Npn \__cooking_units_old_cutext_parse_range_aux:nww #1 #2 \q__cooking_units_range #3 \q_stop +\cs_generate_variant:Nn \__cookingunits_old_cutext_parse_range:nn { V } +\cs_new:Npn \__cookingunits_old_cutext_parse_range_aux:nww #1 #2 \q__cookingunits_range #3 \q_stop { - \tl_set:Nn \l__cooking_units_tmpa_tl {#2} - \tl_set:Nn \l__cooking_units_cutext_last_value_tl {#3} - \__cooking_units_old_cutext_print_input:Nn \l__cooking_units_tmpa_tl {#1} - \tl_use:N \l__cooking_units_cutext_range_sign_tl - \__cooking_units_old_cutext_print_input:Nn \l__cooking_units_cutext_last_value_tl {#1} + \tl_set:Nn \l__cookingunits_tmpa_tl {#2} + \tl_set:Nn \l__cookingunits_cutext_last_value_tl {#3} + \__cookingunits_old_cutext_print_input:Nn \l__cookingunits_tmpa_tl {#1} + \tl_use:N \l__cookingunits_cutext_range_sign_tl + \__cookingunits_old_cutext_print_input:Nn \l__cookingunits_cutext_last_value_tl {#1} } -\cs_new:Npn \__cooking_units_cuam_old:n #1 +\cs_new:Npn \__cookingunits_cuam_old:n #1 { - \tl_set_rescan:Nnn \l__cooking_units_tmpa_tl + \tl_set_rescan:Nnn \l__cookingunits_tmpa_tl { \char_set_catcode_letter:N \_ % \char_set_catcode_ignore:N\ % } {#1} - \bool_if:NTF \l__cooking_units_draft_bool - { \l__cooking_units_tmpa_tl } - { \__cooking_units_cuam_old_parse:V \l__cooking_units_tmpa_tl } + \bool_if:NTF \l__cookingunits_draft_bool + { \l__cookingunits_tmpa_tl } + { \__cookingunits_cuam_old_parse:V \l__cookingunits_tmpa_tl } } -\cs_new_protected:Npn \__cooking_units_cuam_old_parse:n #1 +\cs_new_protected:Npn \__cookingunits_cuam_old_parse:n #1 { - \tl_if_in:nVTF {#1} \l__cooking_units_input_range_sign_tl + \tl_if_in:nVTF {#1} \l__cookingunits_input_range_sign_tl { - \tl_set:Nn \l__cooking_units_tmpa_tl {#1} - \tl_replace_once:NVn \l__cooking_units_tmpa_tl \l__cooking_units_input_range_sign_tl { \q__cooking_units_range } - \__cooking_units_cuam_old_parse_range:V \l__cooking_units_tmpa_tl + \tl_set:Nn \l__cookingunits_tmpa_tl {#1} + \tl_replace_once:NVn \l__cookingunits_tmpa_tl \l__cookingunits_input_range_sign_tl { \q__cookingunits_range } + \__cookingunits_cuam_old_parse_range:V \l__cookingunits_tmpa_tl }{ \tl_if_in:nnTF {#1} { / } { \tl_if_in:nnTF {#1} { _ } - { \__cooking_units_cuam_old_parse_mixed_frac:www #1 \q_stop } - { \__cooking_units_cuam_old_parse_frac:ww #1 \q_stop } + { \__cookingunits_cuam_old_parse_mixed_frac:www #1 \q_stop } + { \__cookingunits_cuam_old_parse_frac:ww #1 \q_stop } }{ \tl_if_in:nnTF {#1} { _ } { \msg_error:nnn { cooking-units } { missing-slash } {#1} } - { \__cooking_units_cuam_old_parse_scale:n {#1} } + { \__cookingunits_cuam_old_parse_scale:n {#1} } } } } -\cs_generate_variant:Nn \__cooking_units_cuam_old_parse:n { V } -\cs_new:Npn \__cooking_units_cuam_old_parse_range:n #1 +\cs_generate_variant:Nn \__cookingunits_cuam_old_parse:n { V } +\cs_new:Npn \__cookingunits_cuam_old_parse_range:n #1 { - \__cooking_units_cuam_old_parse_range_aux:ww #1 \q_nil + \__cookingunits_cuam_old_parse_range_aux:ww #1 \q_nil } -\cs_generate_variant:Nn \__cooking_units_cuam_old_parse_range:n { V } -\cs_new:Npn \__cooking_units_cuam_old_parse_range_aux:ww #1 \q__cooking_units_range #2 \q_nil +\cs_generate_variant:Nn \__cookingunits_cuam_old_parse_range:n { V } +\cs_new:Npn \__cookingunits_cuam_old_parse_range_aux:ww #1 \q__cookingunits_range #2 \q_nil { - #1 \l__cooking_units_cunum_range_sign_tl #2 + #1 \l__cookingunits_cunum_range_sign_tl #2 } -\cs_new:Npn \__cooking_units_cuam_old_parse_scale:n #1 {#1} -\cs_new:Npn \__cooking_units_cuam_old_parse_frac:ww #1/#2 \q_stop - { \__cooking_units_frac:nn {#1} {#2} } -\cs_new:Npn \__cooking_units_cuam_old_parse_mixed_frac:www #1_#2/#3 \q_stop +\cs_new:Npn \__cookingunits_cuam_old_parse_scale:n #1 {#1} +\cs_new:Npn \__cookingunits_cuam_old_parse_frac:ww #1/#2 \q_stop + { \__cookingunits_frac:nn {#1} {#2} } +\cs_new:Npn \__cookingunits_cuam_old_parse_mixed_frac:www #1_#2/#3 \q_stop { #1 - \__cooking_units_dim_horizontal:N \l__cooking_units_mixed_frac_dim - \__cooking_units_frac:nn {#2} {#3} + \__cookingunits_dim_horizontal:N \l__cookingunits_mixed_frac_dim + \__cookingunits_frac:nn {#2} {#3} } \NewDocumentCommand \cufrac { O{} m } { @@ -2568,40 +2621,40 @@ \group_begin: \tl_if_empty:nF {#1} { \keys_set:nn { cooking-units } {#1} } - \__cooking_units_cufrac:n {#2} + \__cookingunits_cufrac:n {#2} \group_end: } -\cs_new:Npn \__cooking_units_cufrac:n #1 +\cs_new:Npn \__cookingunits_cufrac:n #1 { - \tl_set_rescan:Nnn \l__cooking_units_tmpa_tl + \tl_set_rescan:Nnn \l__cookingunits_tmpa_tl { \char_set_catcode_letter:N \_ % \char_set_catcode_ignore:N\ % } {#1} - \__cooking_units_cufrac_parse:V \l__cooking_units_tmpa_tl + \__cookingunits_cufrac_parse:V \l__cookingunits_tmpa_tl } -\cs_new:Npn \__cooking_units_cufrac_parse:n #1 +\cs_new:Npn \__cookingunits_cufrac_parse:n #1 { \tl_if_in:nnTF {#1} { / } { \tl_if_in:nnTF {#1} { _ } - { \__cooking_units_cufrac_parse_mixed_frac:www #1 \q_stop } - { \__cooking_units_cufrac_parse_frac:ww #1 \q_stop } + { \__cookingunits_cufrac_parse_mixed_frac:www #1 \q_stop } + { \__cookingunits_cufrac_parse_frac:ww #1 \q_stop } }{ \tl_if_in:nnTF {#1} { _ } { \msg_error:nnn { cooking-units } { missing-slash } {#1} } - { \__cooking_units_cufrac_parse_scale:n {#1} } + { \__cookingunits_cufrac_parse_scale:n {#1} } } } -\cs_generate_variant:Nn \__cooking_units_cufrac_parse:n { V } -\cs_new:Npn \__cooking_units_cufrac_parse_scale:n #1 {#1} -\cs_new:Npn \__cooking_units_cufrac_parse_frac:ww #1/#2 \q_stop - { \__cooking_units_frac:nn {#1} {#2} } -\cs_new:Npn \__cooking_units_cufrac_parse_mixed_frac:www #1_#2/#3 \q_stop +\cs_generate_variant:Nn \__cookingunits_cufrac_parse:n { V } +\cs_new:Npn \__cookingunits_cufrac_parse_scale:n #1 {#1} +\cs_new:Npn \__cookingunits_cufrac_parse_frac:ww #1/#2 \q_stop + { \__cookingunits_frac:nn {#1} {#2} } +\cs_new:Npn \__cookingunits_cufrac_parse_mixed_frac:www #1_#2/#3 \q_stop { #1 - \__cooking_units_dim_horizontal:N \l__cooking_units_mixed_frac_dim - \__cooking_units_frac:nn {#2} {#3} + \__cookingunits_dim_horizontal:N \l__cookingunits_mixed_frac_dim + \__cookingunits_frac:nn {#2} {#3} } \NewDocumentCommand \cusetup { m } { @@ -2613,7 +2666,7 @@ \newcookingunit { oz } \newcookingunit { lb } \newcookingunit { stick } -\newcookingunit [ \ensuremath{ \__cooking_units_frac:nn { eV } { c^2 } } ] { eVc-2 } +\newcookingunit [ \ensuremath{ \__cookingunits_frac:nn { eV } { c^2 } } ] { eVc-2 } \newcookingunit { K } \newcookingunit [ \ensuremath{ {} ^ { \circ } } \kern-\scriptspace C ] { C } \newcookingunit [ \ensuremath{ {} ^ { \circ } } \kern-\scriptspace F ] { F } @@ -2622,18 +2675,18 @@ \newcookingunit { h } \newcookingunit { min } \newcookingunit { s } -\newcookingunit [ \ensuremath{ \__cooking_units_frac:nn { \hbar } { eV } } ] { hbareV-1 } +\newcookingunit [ \ensuremath{ \__cookingunits_frac:nn { \hbar } { eV } } ] { hbareV-1 } \newcookingunit { m } \newcookingunit { cm } \newcookingunit { dm } \newcookingunit { mm } \newcookingunit { in } -\newcookingunit [ \ensuremath{ \__cooking_units_frac:nn { c\hbar } { eV } } ] { chbareV-1 } +\newcookingunit [ \ensuremath{ \__cookingunits_frac:nn { c\hbar } { eV } } ] { chbareV-1 } \newcookingunit { l } \newcookingunit { dl } \newcookingunit { cl } \newcookingunit { ml } -\newcookingunit [ \ensuremath { \__cooking_units_frac:nn { c^3 \hbar^3 } { eV^3 } } ] { (chbareV-1)3 } +\newcookingunit [ \ensuremath { \__cookingunits_frac:nn { c^3 \hbar^3 } { eV^3 } } ] { (chbareV-1)3 } \newcookingunit { cal } \newcookingunit { kcal } \newcookingunit { J } @@ -2774,8 +2827,8 @@ { kJ } { kilojoule } [ kilojoules ] { eV } { \'{e}lectron-volt } [ \'{e}lectron-volts ] { pn } { pinc\'{e}e } < f > - { EL } { cuill\'{e}re \space \`{a} \space soupe } < f > - { TL } { cuill\'{e}re \space \`{a} \space caf\'{e} } < f > + { EL } [c.\`{a}.s.] { cuill\`{e}re \space \`{a} \space soupe } < f > + { TL } [c.\`{a}.c.] { cuill\`{e}re \space \`{a} \space caf\'{e} } < f > { decimal-mark } { . } { one (m) } { un } { one (f) } { une } @@ -2819,34 +2872,34 @@ { kcal }{ 0.2388459e-3 } { eV }{ 624150912.6e+10 } %% 624150912.6 +- 3.9 e+10 } -\fp_const:Nn \c__cooking_units_kb_eV_fp { 8.617 330 3 e-5 } +\fp_const:Nn \c__cookingunits_kb_eV_fp { 8.617 330 3 e-5 } \cudefinesinglekey { C } { { K } { #1 + 273.15 } { F } { #1 * 1.8 + 32 } { Re } { #1 * 0.8 } - { eV } { ( #1 + 273.15 ) * \c__cooking_units_kb_eV_fp } + { eV } { ( #1 + 273.15 ) * \c__cookingunits_kb_eV_fp } } \cudefinesinglekey { F } { { C } { ( #1 - 32 ) * 5/9 } { K } { ( #1 + 459.67 ) * 5/9 } { Re } { ( #1 - 32 ) * 4/9 } - { eV } {( #1 + 459.67 ) * 5/9 * \c__cooking_units_kb_eV_fp } + { eV } {( #1 + 459.67 ) * 5/9 * \c__cookingunits_kb_eV_fp } } \cudefinesinglekey { K } { { C } { #1 - 273.15 } { F } { #1 * 1.8 - 459.67 } { Re } { ( #1 - 273.15 ) * 0.8 } - { eV } { #1 * \c__cooking_units_kb_eV_fp } + { eV } { #1 * \c__cookingunits_kb_eV_fp } } \cudefinesinglekey { Re } { { K } { #1 * 1.25 + 273.15 } { C } { #1 * 1.25 } { F } { #1 * 2.25 + 32 } - { eV } { ( #1 * 1.25 + 273.15 ) * \c__cooking_units_kb_eV_fp } + { eV } { ( #1 * 1.25 + 273.15 ) * \c__cookingunits_kb_eV_fp } } \cudefinephrase { German } { @@ -2858,6 +2911,7 @@ set-option-for-C = { round-to-int = true } , set-option-for-K = { round-to-int = true } , set-option-for-Re = { round-to-int = true } , + curef-add-forbidden-unit = { F , C , K , Re } , add-temperature-to-check = { K = 0, -- cgit v1.2.3