From 5f80d92d8bebc775b30e2b212e33b08089517654 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 28 Mar 2022 03:02:13 +0000 Subject: CTAN sync 202203280302 --- .../latex/contrib/cooking-units/cooking-units.dtx | 318 +++++++++------------ .../latex/contrib/cooking-units/cooking-units.ins | 4 +- .../latex/contrib/cooking-units/cooking-units.pdf | Bin 748443 -> 738814 bytes 3 files changed, 137 insertions(+), 185 deletions(-) (limited to 'macros/latex') diff --git a/macros/latex/contrib/cooking-units/cooking-units.dtx b/macros/latex/contrib/cooking-units/cooking-units.dtx index ee29c982c3..574f2b7fcd 100644 --- a/macros/latex/contrib/cooking-units/cooking-units.dtx +++ b/macros/latex/contrib/cooking-units/cooking-units.dtx @@ -82,7 +82,7 @@ for the details of that license. %\keepsilent \askforoverwritefalse \preamble -Copyright (C) 2016--2021 by Ben Vitecek (current Maintainer) +Copyright (C) 2016--2022 by Ben Vitecek (current Maintainer) This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either @@ -143,9 +143,9 @@ and the derived file cooking-units.sty. \usepackage{nicefrac} \usepackage{cleveref} \usepackage{mathtools} -\usepackage{siunitx} +\usepackage{siunitx}[=v2] \usepackage{totalcount} -\usepackage{microtype} +%\usepackage{microtype} \usepackage{enumitem} @@ -244,7 +244,7 @@ and the derived file cooking-units.sty. \NewDocumentCommand \PrintUnit { o m } { \__cookingunits_culang_let:nnN { name } {#2} \l_tmpa_tl - \tl_if_eq:NNF \l_tmpa_tl \q__cookingunits_no_translation + \tl_if_eq:NNF \l_tmpa_tl \c__cookingunits_no_translation_str { \l_tmpa_tl } \IfNoValueF {#1} {#1} & @@ -307,7 +307,7 @@ and the derived file cooking-units.sty. { \cs_if_eq:NNTF ##1 \\ { \textbackslash\textbackslash \\ } - { \textbackslash \textcolor{blue}{\cs_to_str:N ##1} } + { \textbackslash \textcolor {blue} { \cs_to_str:N ##1 } } }{ \token_if_letter:NTF ##1 {##1} @@ -449,13 +449,13 @@ and the derived file cooking-units.sty. { \l_translation_does_not_exist_tl } { \__cu_use:n { culang_let_for:nnnN } {#1} { unit-symbol } {#2} \l_tmpa_tl - \tl_if_in:NnTF \l_tmpa_tl \q__cookingunits_no_translation + \tl_if_in:NnTF \l_tmpa_tl \c__cookingunits_no_translation_str { \l_translation_does_not_exist_tl } { \l_tmpa_tl } } & \__cu_use:n { culang_let_for:nnnN } {#1} { name } {#2} \l_tmpa_tl - \tl_if_in:NnTF \l_tmpa_tl \q__cookingunits_no_translation + \tl_if_eq:NNTF \l_tmpa_tl \c__cookingunits_no_translation_str { \l_translation_does_not_exist_tl } { \l_tmpa_tl } & @@ -463,13 +463,13 @@ and the derived file cooking-units.sty. \__cu_use:n { culang_let_for:nnnN } {#1} { name-pl } {#2} \l_tmpb_tl \str_if_eq:NNF \l_tmpa_tl \l_tmpb_tl { - \tl_if_in:NnTF \l_tmpb_tl \q__cookingunits_no_translation + \tl_if_eq:NNTF \l_tmpb_tl \c__cookingunits_no_translation_str { \l_translation_does_not_exist_tl } { (\l_tmpb_tl) } } & \__cu_use:n { culang_let_for:nnnN } {#1} { gender } {#2} \l_tmpa_tl - \tl_if_in:NnTF \l_tmpa_tl \q__cookingunits_no_translation + \tl_if_eq:NNTF \l_tmpa_tl \c__cookingunits_no_translation_str { \l_translation_does_not_exist_tl } { \l_tmpa_tl } } @@ -477,14 +477,12 @@ and the derived file cooking-units.sty. \NewDocumentCommand \CreateTableForPhrases { >{\TrimSpaces} m } { \seq_clear:N \l_tmpa_seq - \__cu_use:n { culang_let_for:nnnN } {#1} { phrase } { phrase-prop } \l_tmpa_prop + \__cu_use:n { culang_get_phrase_prop_for:nN } {#1} \l_tmpa_prop \prop_if_exist:NTF \l_tmpa_prop { - \tl_if_eq:NNTF \q__cooking_units_no_translation \l_tmpa_prop + \tl_if_eq:NNTF \c__cookingunits_no_translation_str \l_tmpa_prop { \ERRORCreateTablePhraseII } - { - \prop_get:NnN \l_tmpa_prop { seq } \l_tmpa_seq - } + { \prop_get:NnN \l_tmpa_prop { seq } \l_tmpa_seq } } { \ERRORCreateTablePhraseI } \seq_gput_right:Nn \l_tmpa_seq { THEEND } @@ -553,10 +551,10 @@ and the derived file cooking-units.sty. \endlist } \makeatletter -\newenvironment{mydescription} - {\list{}{\labelwidth\z@ \itemindent-\leftmargin - \let\makelabel\descriptionlabel}} - {\endlist} +%\newenvironment{mydescription} +% {\list{}{\labelwidth\z@ \itemindent-\leftmargin +% \let\makelabel\descriptionlabel}} +% {\endlist} \renewcommand*\descriptionlabel[1]{\hspace\labelsep \normalfont\bfseries #1} \makeatother @@ -804,6 +802,9 @@ and the derived file cooking-units.sty. % \changes {2021/03/21} {2.00} {New commands to define keys: \mycs{cudefinekeychain} and \mycs{cuaddtokeychain}.} % \changes {2021/03/21} {2.00} {Using commands as unit-keys now works.} % +% \changes {2022/03/26} {2.00a} {Bugfix: Fixing property list retrival error (storing property lists via translations did not work too well).} +% \changes {2022/03/26} {2.00a} {Bugfix: |\cuam| prints a unit in case of an error. This also happens with \opt{parse-number=false}.} +% \changes {2022/03/26} {2.00a} {Bugfix: Remove \cs{peek_meaning_ignore_spaces:NTF}.} % % % @@ -849,7 +850,7 @@ and the derived file cooking-units.sty. % not very \LaTeX-like, so I started writing some code to convert % units. I expanded the code, rewrote it in \LaTeX3 (which is much % more pleasant than \LaTeXe) and here it is. -% +% % % % @@ -3207,7 +3208,7 @@ and the derived file cooking-units.sty. % % % -% +% % % % @@ -3367,7 +3368,7 @@ and the derived file cooking-units.sty. % % % -% +% % % % @@ -3385,6 +3386,7 @@ and the derived file cooking-units.sty. % shown. % % \small +% % %\clearpage % \subsection{English} @@ -3449,7 +3451,7 @@ and the derived file cooking-units.sty. % % % -% +% \normalsize % % % \section{US, Imperial and Other units} @@ -3559,108 +3561,6 @@ and the derived file cooking-units.sty. % % % -% -% \begin{comment} -%^^A \section{Notes and other stuff} -%^^A This section contains stuff which might or might not be interesting. -%^^A -%^^A \subsection{More or less FAQ} -%^^A -%^^A \num{624150912.6 +- 3.9 e+10} -%^^A \num{6.241509126 +- 0.000000039 e+18} -%^^A -%^^A \num{8.6173303 +- 00000.0000050 e-5} -%^^A -%^^A \subsection{Calculation} -%^^A This subsection deals with some regarding the conversion to certain units. -%^^A Mostly to (I like to call them) \enquote{electron volt units} (or natural units). -%^^A Let's begin. -%^^A -%^^A We start with the easiest one: conversion of joule into electron volt. -%^^A Easy because Wikipedia and nearly every physics book knows the answer. -%^^A And according to Wikipedia -%^^A \begin{align} -%^^A \SI{1}{\eV} &= \SI{1.6021766208(98)e-19}{\joule} \\ -%^^A \SI{1}{\joule} &= \SI{6.241509126 +- 0.000000039 e+18}{\eV} -%^^A \end{align} -%^^A Adding this is no problem: -%^^A \begin{lstlisting} -%^^A \cuaddtokeys {J} {eV} { 1.6021766208e-19 } -%^^A \end{lstlisting} -%^^A -%^^A -%^^A Great, next Temperature (kelvin) to electron volt. Also no problem at all -%^^A because joule and kelvin are related by the boltzmann constant $k_B$ with -%^^A \begin{equation} -%^^A energy (\si{\joule}) = k_B \cdot temperature (\si{\kelvin}) -%^^A \end{equation} -%^^A as $[k_B]= \sfrac{\si{\joule}}{\si{\kelvin}}$ and -%^^A $k_B= \SI{1.38064852(79)e-23}{\joule\per\kelvin}$. Now using the power -%^^A of (more or less basic, but somehow annoying) mathematics we get: -%^^A \begin{align} -%^^A [k_B] &= \SI{1.38064852(79)e-23}{\joule\per\kelvin} = \\ -%^^A &= \num{1.38064852(79)e-23} \cdot \SI{6.241509126 +- 0.000000039 e+18 }{\eV\per\K} = \\ -%^^A &= \SI{8.6173303 +- 0.0000050 e-5 }{\eV\per\K} -%^^A \end{align} -% -% -%^^A \section{Notes and other stuff} -%^^A \subsection{Some details to electron volts} -%^^A This section explains how I calculated the values for conversion into electron volt -%^^A or the respective derivative. Let's begin with some constants (from Wikipedia), note that -%^^A \begin{equation*} -%^^A \num{1.23456(78)e-9} = \num[separate-uncertainty = true]{1.23456(78)e-9} -%^^A \end{equation*} -%^^A just for info. -%^^A -%^^A \begin{align} -%^^A \SI{1}{\eV} &= \SI{1.6021766208(98)e-19}{\J} \\ -%^^A \hbar &= \SI{1.054571800(13)e-34}{\J\s} \\ -%^^A k_B &= \SI{1.38064852(79)e-23}{\J\per\K} = \SI{8.6173303(50)e-5}{\eV\per\K}\\ -%^^A c &= \SI{299792458}{\m\per\s} -%^^A \end{align} -%^^A -%^^A Note that all those and following values are rounded to the second relevant figure of the -%^^A uncertainty of the value. -%^^A -%^^A Well then, next are temperatures. -%^^A -%^^A Temperatures are fairly easy. Just convert the temperature of your choice to kelvin -%^^A and multiplicate it with $k_B$: -%^^A \begin{align} -%^^A \SI{1}{\K} * k_B &= \SI{8.6173303(50)e-5}{\eV} -%^^A \end{align} -%^^A -%^^A Next is more complicated. To compute the resulting unceartanity I using -%^^A \enquote{Gauß'sches Fehlerfortpflanzungsgesetz} (I don't know if this has -%^^A a translation). Anyway. We know that -%^^A \begin{align*} -%^^A \frac{\SI{1}{\eV}}{c^2} &= \frac{\SI{1.6021766208e-19}{\J}}{(\SI{299792458}{\m\per\s})^2} -%^^A = \frac{\SI{1.6021766208e-19}{\kg\m\squared\per\s\squared}}{\SI{8,98755178736818E16}{\m\squared\per\s\squared}} = \\ -%^^A &\frac{\SI{1.6021766208e-3}{\kg}}{\num{8,98755178736818}} = -%^^A \SI{1782661906,94091624922088}{\kg} -%^^A \end{align*} -%^^A -%^^A Great, now we have to calucalte the unceartinity: -%^^A \begin{align} -%^^A f(\si{\eV},c) &= \frac{\si{\eV}}{c^2} \\ -%^^A df(\si\eV,c) &= \sqrt{ (\frac{\partial f}{\partial \si\eV})^2 * (\Delta \si\eV)^2 + (\frac{\partial f}{\partial c})^2 * (\Delta c)^2 } = \\ -%^^A &= \sqrt{ (\frac{1}{c^2})^2 * (\Delta \si\eV)^2 + (-2\frac{eV}{c^{-3}})^2 * (\Delta c)^2 } -%^^A \end{align} -%^^A -%^^A Now we know that $\Delta c = 0$: -%^^A \begin{align} -%^^A df(\si\eV,c) &= \sqrt{ (\frac{1}{c^2})^2 * (\Delta \si\eV)^2 } = -%^^A \sqrt{ \frac{1}{(\SI{299792458}{\m\per\s} )^2} * (\SI{0.0000000098e-19}{\J})^2 } \\ -%^^A &= -%^^A \end{align} -% \end{comment} -% -% -% -% -% -% %\end{documentation} % % @@ -3703,14 +3603,14 @@ and the derived file cooking-units.sty. % \begin{macrocode} \ProvidesExplPackage {cooking-units} - {2021/05/16} - {2.00} + {2022/03/26} + {2.00a} {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 } { 2021/05/07 } +\@ifpackagelater { expl3 } { 2022/02/24 } { } { \PackageError { cooking-units } { Support~package~expl3~too~old } @@ -3731,7 +3631,7 @@ and the derived file cooking-units.sty. % % Checking if \pkg{translations} is up-to-date, otherwise abort the loading of the package. % \begin{macrocode} -\@ifpackagelater { translations } { 2021/01/17 } +\@ifpackagelater { translations } { 2022/02/05 } { } { \PackageError { cooking-units } { Support~package~translations~too~old } @@ -3761,6 +3661,7 @@ and the derived file cooking-units.sty. % \end{macrocode} % \begin{macrocode} \bool_new:N \g_@@_opt_numeral_bool +%\bool_new:N \g_@@_opt_debug_bool \keys_define:nn { cooking-units } { use-numerals .code:n = @@ -3771,6 +3672,8 @@ and the derived file cooking-units.sty. use-numerals .default:n = { false }, use-fmtcount-numerals .bool_gset:N = \g_@@_opt_numeral_bool , use-fmtcount-numerals .default:n = { false }, +% debug .bool_set:N = \g_@@_opt_debug_bool , +% debug .default:n = { true } , unknown .code:n = { \msg_error:nnxx { cooking-units } { key-unknown } { \l_keys_path_str } { cooking-units } } @@ -3992,6 +3895,8 @@ and the derived file cooking-units.sty. \tl_new:N \l_@@_stored_units_tl \tl_new:N \l_@@_stored_formula_tl \tl_new:N \l_@@_base_tl +\tl_new:N \l_cookingunits_raw_amount_a_tl +\tl_new:N \l_cookingunits_raw_amount_b_tl % \end{macrocode} % \begin{macrocode} \tl_new:N \l_@@_cmd_hook_tl @@ -4062,7 +3967,7 @@ and the derived file cooking-units.sty. % The dimension between the fraction and the mixed fraction part is % stored within this macro. There is no real reason why I have % chosen this distance to be 0.1em, I just thought that it looks -% best. But if someone has some ideas of how large this distance +% best. But if someone has some ideas of how large this distancee % should be I am happy to listen. % \begin{macrocode} \dim_new:N \l_@@_mixed_frac_dim @@ -4303,11 +4208,12 @@ and the derived file cooking-units.sty. % \end{macrocode} %\end{macro} % -% \begin{macro}{ \q_@@_no_translation } +% \begin{macro}{ \q_@@_no_translation_str } % Checking value if a translation is avaiable. % \begin{macrocode} -\quark_new:N \q_@@_no_translation -%\cs_new:Npn \q_@@_no_translation { asdasd\ewhkerhjkwejhk } +\quark_new:N \q_@@_no_translation_str +\str_const:Nn \c_@@_no_translation_str { no-translation-sady-found-@@ } +%\cs_new:Npn \q_@@_no_translation_str { asdasd\ewhkerhjkwejhk } % \end{macrocode} %\end{macro} % @@ -6615,7 +6521,7 @@ and the derived file cooking-units.sty. \prg_new_conditional:Npnn \@@_culang_unitname_let:Nn #1#2 { TF, F , T } { \@@_culang_let:nnN { name } {#2} #1 - \tl_if_eq:NNTF #1 \q_@@_no_translation + \tl_if_eq:NNTF #1 \c_@@_no_translation_str { \prg_return_false: } { \prg_return_true: } } @@ -6671,17 +6577,17 @@ and the derived file cooking-units.sty. % % \begin{macrocode} \@@_culang_def_base:nnn { name } { decimal-mark } { . } -\@@_culang_def_base:nnn { name-pl } { decimal-mark } { \q_@@_no_translation } +\@@_culang_def_base:nnn { name-pl } { decimal-mark } { \c_@@_no_translation_str } \@@_culang_def_for:nnnn { German } { name-pl } { decimal-mark } { , } % \end{macrocode} % Note that the plural versions just exist for completing the set. % \begin{macrocode} -\@@_culang_def_base:nnn { name } { one (m) } { \q_@@_no_translation } -\@@_culang_def_base:nnn { name } { one (f) } { \q_@@_no_translation } -\@@_culang_def_base:nnn { name } { one (n) } { \q_@@_no_translation } -\@@_culang_def_base:nnn { name-pl } { one (m) } { \q_@@_no_translation } -\@@_culang_def_base:nnn { name-pl } { one (f) } { \q_@@_no_translation } -\@@_culang_def_base:nnn { name-pl } { one (n) } { \q_@@_no_translation } +\@@_culang_def_base:nnn { name } { one (m) } { \c_@@_no_translation_str } +\@@_culang_def_base:nnn { name } { one (f) } { \c_@@_no_translation_str } +\@@_culang_def_base:nnn { name } { one (n) } { \c_@@_no_translation_str } +\@@_culang_def_base:nnn { name-pl } { one (m) } { \c_@@_no_translation_str } +\@@_culang_def_base:nnn { name-pl } { one (f) } { \c_@@_no_translation_str } +\@@_culang_def_base:nnn { name-pl } { one (n) } { \c_@@_no_translation_str } % \end{macrocode} % \begin{macrocode} \@@_culang_def_for:nnnn { English } { name } { one (m) } { one } @@ -6696,7 +6602,7 @@ and the derived file cooking-units.sty. % % \begin{macrocode} \@@_culang_def_base:nnn { name } { cutext-range-sign } { -- } -\@@_culang_def_base:nnn { name-pl } { cutext-range-sign } { \q_@@_no_translation } +\@@_culang_def_base:nnn { name-pl } { cutext-range-sign } { \c_@@_no_translation_str } \@@_culang_def_for:nnnn { German } { name } { cutext-range-sign } { ~bis~ } \@@_culang_def_for:nnnn { English } { name } { cutext-range-sign } { ~to~ } % \end{macrocode} @@ -6734,16 +6640,18 @@ and the derived file cooking-units.sty. % \begin{macrocode} \cs_new:Npn \@@_def_new_type_aux:Nnn #1#2#3 { - \cs_new:cpn { @@_set_ #2 _to:n } ##1 + \cs_new_nopar:cpn { @@_set_ #2 _to:n } ##1 { - \tl_if_exist:cF { c_@@_#2_ ##1 _tl } { \tl_show:n { ERROR-set-#2-##1 } } - \tl_set_eq:Nc #1 { c_@@_#2_ ##1 _tl } + \tl_if_exist:cF { c_@@_#2_ ##1 _tl } + { \msg_error:nnn {cooking-units } { internal-error } { Type } { ERROR-set-#2-##1 } } + \tl_set_eq:Nc #1 { c_@@_#2_ ##1 _tl } } \tl_if_empty:nF {#3} { \prg_new_conditional:cpnn { @@_if_ #2 _equal:n } ##1 {#3} { - \tl_if_exist:cF { c_@@_#2_ ##1 _tl } { \tl_show:n { ERROR-check-#2-##1 } } + \tl_if_exist:cF { c_@@_#2_ ##1 _tl } + { \msg_error:nnnn {cooking-units } { internal-error } { Type-2 } { ERROR-set-#2-##1 } } \tl_if_eq:NcTF #1 { c_@@_#2_ ##1 _tl } { \prg_return_true: } { \prg_return_false: } @@ -6798,7 +6706,6 @@ and the derived file cooking-units.sty. % parses options and decides (depending on which command was used) % what to do with the stuff and how to print it. % \begin{macrocode} -\bool_new:N \l_@@_skip_first_part_bool \cs_new:Npn \@@_do_the_stuff:nnnnnn #1#2#3#4#5#6 { % #1 -- label @@ -7217,7 +7124,11 @@ and the derived file cooking-units.sty. \cs_new:Npn \@@_new_print_unit_correctly: { \@@_if_state_equal:nTF { error } - { \@@_print_unit_in_case_of_error: } + { + \tl_case:NnF \l_@@_cmd_type_tl + { \c_@@_cmd_type_cuam_tl { } } + { \@@_print_unit_in_case_of_error: } + } { \tl_case:NnF \l_@@_cmd_type_tl { @@ -7373,12 +7284,12 @@ and the derived file cooking-units.sty. % \begin{macrocode} \cs_new:Npn \@@_create_internal_error:nN #1#2 { - \@@_set_case_to:n { error } + \@@_set_state_to:n { error } \msg_error:nnnV { cooking-units } { internal-error } {#1} #2 } \cs_new:Npn \@@_create_error:n #1 { - \@@_set_case_to:n { error } + \@@_set_state_to:n { error } \msg_error:nnV { cooking-units } {#1} \l_@@_original_amount_tl } \cs_new:Npn \@@_create_error_and_stop:n #1 @@ -7388,7 +7299,7 @@ and the derived file cooking-units.sty. } \cs_new:Npn \@@_create_error:nn #1#2 { - \@@_set_case_to:n { error } + \@@_set_state_to:n { error } \msg_error:nnnV { cooking-units } {#1} {#2} \l_@@_original_amount_tl } % \end{macrocode} @@ -7473,7 +7384,7 @@ and the derived file cooking-units.sty. % \end{macro} % % -% \begin{macro}{ \@@_split_and_parse:} +% \begin{macro}{ \@@_split_and_parse:N} % Splits the input into fractions or ranges (or numbers). % \begin{macrocode} \cs_new:Npn \@@_split_and_parse:N #1 @@ -8247,8 +8158,8 @@ and the derived file cooking-units.sty. % \begin{macrocode} \cs_new:Npn \@@_cuam_post_process_input_phrases:NN #1#2 { - \@@_culang_let:nnN { phrase } { phrase-prop } \l_@@_phrase_prop - \tl_if_eq:NNT \q_@@_no_translation \l_@@_phrase_prop + \@@_culang_get_phrase_prop:N \l_@@_phrase_prop + \tl_if_eq:NNT \c_@@_no_translation_str \l_@@_phrase_prop { \use_none_delimit_by_q_stop:w } \prop_get:NnN \l_@@_phrase_prop { seq } \l_@@_phrase_numbers_seq % @@ -9119,8 +9030,8 @@ and the derived file cooking-units.sty. % \begin{macrocode} \cs_new:Npn \@@_set_cooking_unit_base_translation:n #1 { - \@@_culang_def_base:nnn { name } {#1} \q_@@_no_translation - \@@_culang_def_base:nnn { name-pl } {#1} \q_@@_no_translation + \@@_culang_def_base:nnn { name } {#1} \c_@@_no_translation_str + \@@_culang_def_base:nnn { name-pl } {#1} \c_@@_no_translation_str \@@_culang_def_base:nnn { gender } {#1} { m } } % \end{macrocode} @@ -9222,11 +9133,11 @@ and the derived file cooking-units.sty. { \seq_pop:NN \g_@@_stored_derived_formula_seq \l_@@_tmpb_tl \prop_put:NnV \l_@@_derived_units_prop {##1} \l_@@_tmpb_tl - \seq_pop:NN \g_@@_stored_derived_unit_print_seq \l_@@_tmpa_tl % \end{macrocode} % First create the unit, \emph{then} set the reference to the base unit. % (Else it is not yet defined) % \begin{macrocode} + \seq_pop:NN \g_@@_stored_derived_unit_print_seq \l_@@_tmpa_tl \exp_args:NNx \declarecookingunit [ {symbol={\l_@@_tmpa_tl}} ] {##1} \tl_set_eq:cN { l_@@_base_key_unit_ ##1 _tl } \l_@@_curr_unit_tl } @@ -9494,9 +9405,12 @@ and the derived file cooking-units.sty. \@@_error_if_unit_not_defined:nNT {#1} \l_@@_curr_unit_tl { \@@_set_state_to:n { error } } } - \peek_meaning_ignore_spaces:NTF [ - { \@@_parse_definename_optional_unitsymbol:w } - { \@@_parse_definename_singular:n } + \peek_remove_spaces:n + { + \peek_meaning:NTF [ + { \@@_parse_definename_optional_unitsymbol:w } + { \@@_parse_definename_singular:n } + } } % \end{macrocode} % \end{macro} @@ -9531,9 +9445,12 @@ and the derived file cooking-units.sty. \quark_if_recursion_tail_stop_do:nn {#1} { \msg_error:nn { cooking-units } { missing-argument } } \prop_put:Nnn \l_@@_tmpa_prop { name } {#1} - \peek_meaning_ignore_spaces:NTF [ - { \@@_parse_definename_optional_plural:w } - { \@@_parse_definename_optional_plural:w [#1] } + \peek_remove_spaces:n + { + \peek_meaning:NTF [ + { \@@_parse_definename_optional_plural:w } + { \@@_parse_definename_optional_plural:w [#1] } + } } % \end{macrocode} % \end{macro} @@ -9545,9 +9462,12 @@ and the derived file cooking-units.sty. \cs_new:Npn \@@_parse_definename_optional_plural:w [#1] { \prop_put:Nnn \l_@@_tmpa_prop { name-pl } {#1} - \peek_meaning_ignore_spaces:NTF < - { \@@_parse_definename_optional_gender:w } - { \@@_parse_definename_optional_gender:w } + \peek_remove_spaces:n + { + \peek_meaning:NTF < + { \@@_parse_definename_optional_gender:w } + { \@@_parse_definename_optional_gender:w } + } } % \end{macrocode} % \end{macro} @@ -9635,14 +9555,35 @@ and the derived file cooking-units.sty. % % % -% \begin{macro}{ \@@_cuprint_define_printed_unit:nn } +% \begin{macro}{ } % Defining phrases. Phrases (sadly) depend on the language. % The idea is going to be: Each language has its own property list % which is going to be stored for each language. Later, the property % list is recoverd for the language currently used. If no phrase is defined -% the fallback |\q_@@_no_translation| is returned. +% the fallback |\c_@@_no_translation_str| is returned. % \begin{macrocode} -\@@_culang_def_base:nnn { phrase } { phrase-prop } { \q_@@_no_translation } +\@@_culang_def_base:nnn { phrase } { phrase-prop } { \c_@@_no_translation_str } +\@@_culang_def_base:nnn { phrase } { phrase-lang } { Humphry-Drumphy } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{ } +% \begin{macrocode} +\cs_new:Npn \@@_culang_get_phrase_prop:N #1 + { + \@@_culang_let:nnN { phrase } { phrase-lang } \l_@@_language_tl + \prop_if_exist:cTF { l_@@_ \l_@@_language_tl _phrase_prop } + { + \prop_set_eq:Nc #1 { l_@@_ \l_@@_language_tl _phrase_prop } + } + { \tl_set_eq:NN #1 \c_@@_no_translation_str } + } +\cs_new:Npn \@@_culang_get_phrase_prop_for:nN #1#2 + { + \prop_set_eq:Nc #2 { l_@@_ #1 _phrase_prop } +% \prop_if_exist:cT { l_@@_ #1 _phrase_prop } +% { \prop_set_eq:Nc \l_@@_phrase_prop { l_@@_ #1 _phrase_prop } } + } % \end{macrocode} % \end{macro} % @@ -9684,21 +9625,26 @@ and the derived file cooking-units.sty. { \tl_set:Nn \l_@@_language_tl {#1} \@@_culang_if_translation_exists_for:VnnTF \l_@@_language_tl - { phrase } { phrase-prop } + { phrase } { phrase-lang } { - \@@_culang_let_for:VnnN \l_@@_language_tl { phrase } { phrase-prop } - \l_@@_phrase_prop +% \@@_culang_let_for:VnnN \l_@@_language_tl { phrase } { phrase-prop } +% \l_@@_phrase_prop + \prop_set_eq:Nc \l_@@_phrase_prop { l_@@_ \l_@@_language_tl _phrase_prop } \prop_get:NnN \l_@@_phrase_prop { seq } \l_@@_phrase_numbers_seq }{ + \prop_new:c { l_@@_ \l_@@_language_tl _phrase_prop } \prop_clear:N \l_@@_phrase_prop \seq_clear:N \l_@@_phrase_numbers_seq } - \@@_sanitize_arrows:n {#2} - \@@_parse_phrase:V \l_@@_sanitise_tl - \@@_new_cuphrase_sort_sequence:N \l_@@_phrase_numbers_seq - \prop_put:NnV \l_@@_phrase_prop { seq } \l_@@_phrase_numbers_seq - \@@_culang_def_for:VnnV - \l_@@_language_tl { phrase } { phrase-prop } \l_@@_phrase_prop + \@@_sanitize_arrows:n {#2} + \@@_parse_phrase:V \l_@@_sanitise_tl + \@@_new_cuphrase_sort_sequence:N \l_@@_phrase_numbers_seq + \prop_put:NnV \l_@@_phrase_prop { seq } \l_@@_phrase_numbers_seq + \prop_set_eq:cN { l_@@_ \l_@@_language_tl _phrase_prop } \l_@@_phrase_prop +% \@@_culang_def_for:VnnV +% \l_@@_language_tl { phrase } { phrase-prop } \l_@@_phrase_prop + \@@_culang_def_for:VnnV + \l_@@_language_tl { phrase } { phrase-lang } \l_@@_language_tl } % \end{macrocode} % \end{macro} @@ -9780,9 +9726,12 @@ and the derived file cooking-units.sty. % \begin{macrocode} \cs_new:Npn \@@_parse_phrase_optionals:n #1 { - \peek_meaning_ignore_spaces:NTF [ - { \@@_parse_stuff_plural:w } - { \@@_parse_stuff_plural:w [#1] } + \peek_remove_spaces:n + { + \peek_meaning:NTF [ + { \@@_parse_stuff_plural:w } + { \@@_parse_stuff_plural:w [#1] } + } } % \end{macrocode} % \end{macro} @@ -9795,9 +9744,12 @@ and the derived file cooking-units.sty. \cs_new:Npn \@@_parse_stuff_plural:w [#1] { \prop_put:Nnn \l_@@_tmpa_prop { -pl } {#1} - \peek_meaning_ignore_spaces:NTF < - { \@@_parse_stuff_gender:w } - { \@@_parse_stuff_gender:w } + \peek_remove_spaces:n + { + \peek_meaning:NTF < + { \@@_parse_stuff_gender:w } + { \@@_parse_stuff_gender:w } + } } % \end{macrocode} % \end{macro} diff --git a/macros/latex/contrib/cooking-units/cooking-units.ins b/macros/latex/contrib/cooking-units/cooking-units.ins index 7298eb0e53..1d58ebb3ae 100644 --- a/macros/latex/contrib/cooking-units/cooking-units.ins +++ b/macros/latex/contrib/cooking-units/cooking-units.ins @@ -5,7 +5,7 @@ %% The original source files were: %% %% cooking-units.dtx (with options: `install') -%% Copyright (C) 2016--2021 by Ben Vitecek (current Maintainer) +%% Copyright (C) 2016--2022 by Ben Vitecek (current Maintainer) %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -25,7 +25,7 @@ \input l3docstrip.tex \askforoverwritefalse \preamble -Copyright (C) 2016--2021 by Ben Vitecek (current Maintainer) +Copyright (C) 2016--2022 by Ben Vitecek (current Maintainer) This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either diff --git a/macros/latex/contrib/cooking-units/cooking-units.pdf b/macros/latex/contrib/cooking-units/cooking-units.pdf index e65da308d7..d4b06cbb01 100644 Binary files a/macros/latex/contrib/cooking-units/cooking-units.pdf and b/macros/latex/contrib/cooking-units/cooking-units.pdf differ -- cgit v1.2.3