diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/cooking-units/cooking-units.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/cooking-units/cooking-units.dtx | 528 |
1 files changed, 454 insertions, 74 deletions
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] <f> % {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<check>{1}{m} \\ +% \cunum<check>{1}{kg} \\ +% \cunum[ref=check]{1}{C} \\ +% \cusetup { curef-add-forbidden-unit = { m, kg } } @ +% \cunum<check>[m]{1}{m} \\ +% \cunum<check>[m]{1}{kg} \\ +% \cunum[ref=check]{1}{C} \\ +% \cusetup { curef-remove-forbidden-unit = { C } } @ +% \cunum<check>[m]{1}{m} \\ +% \cunum<check>[m]{1}{kg} \\ +% \cunum[ref=check]{1}{C} \\ +% \cusetup { curef-clear-forbidden-units = true } @ +% \cunum<check>[m]{1}{m} \\ +% \cunum<check>[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 % % |