diff options
author | Karl Berry <karl@freefriends.org> | 2016-09-06 21:31:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-09-06 21:31:08 +0000 |
commit | d2a1e931d98897f867978375a73d2a97050fc37a (patch) | |
tree | 2e62e6c6d83210684943dcd4c1106516f89188e0 /Master | |
parent | 22b1546e4e62d89b1361ec2c9f26221e22d9a428 (diff) |
cooking-units (6sep16)
git-svn-id: svn://tug.org/texlive/trunk@42002 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/cooking-units/README.md | 21 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/cooking-units/cooking-units.pdf | bin | 495535 -> 517854 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/cooking-units/cooking-units.dtx | 371 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/cooking-units/cooking-units.sty | 117 |
4 files changed, 434 insertions, 75 deletions
diff --git a/Master/texmf-dist/doc/latex/cooking-units/README.md b/Master/texmf-dist/doc/latex/cooking-units/README.md index 9660bdd6c02..bf7bdbafd48 100644 --- a/Master/texmf-dist/doc/latex/cooking-units/README.md +++ b/Master/texmf-dist/doc/latex/cooking-units/README.md @@ -31,7 +31,7 @@ Requirements * l3keys2e * fmtcount (optional) - This file contains +This file contains ------------------ * README @@ -39,7 +39,24 @@ Requirements * cooking-units.dtx * cooking-units.ins - License +Changes +------- + + * v1.00a Converting 'Re' to 'eV' should be correct now. + * v1.01 Added units 'ssp', 'csp' and 'dsp' (salt-, coffee-, dessertspoonful) + English: litre (and only litre) now uses curly l + British English: 'pinch' is written in full. + * v1.02 Replaced \cufrac by \cuam + New message: 'obsolete-command'. + +Supported Languages +------------------- + +* German +* English +* French (suboptimal) + +License ------- This material is subject to the LaTeX Project Public License. See diff --git a/Master/texmf-dist/doc/latex/cooking-units/cooking-units.pdf b/Master/texmf-dist/doc/latex/cooking-units/cooking-units.pdf Binary files differindex 2a9027ef4a5..1c42da2768c 100644 --- a/Master/texmf-dist/doc/latex/cooking-units/cooking-units.pdf +++ b/Master/texmf-dist/doc/latex/cooking-units/cooking-units.pdf 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 7977c41cc57..27c7c2628ee 100644 --- a/Master/texmf-dist/source/latex/cooking-units/cooking-units.dtx +++ b/Master/texmf-dist/source/latex/cooking-units/cooking-units.dtx @@ -43,15 +43,32 @@ Requirements * fmtcount (optional) - This file contains +This file contains ------------------ * README * cooking-units.pdf * cooking-units.dtx * cooking-units.ins - - License + +Changes +------- + + * v1.00a Converting 'Re' to 'eV' should be correct now. + * v1.01 Added units 'ssp', 'csp' and 'dsp' (salt-, coffee-, dessertspoonful) + English: litre (and only litre) now uses curly l + British English: 'pinch' is written in full. + * v1.02 Replaced \cufrac by \cuam + New message: 'obsolete-command'. + +Supported Languages +------------------- + +* German +* English +* French (suboptimal) + +License ------- This material is subject to the LaTeX Project Public License. See @@ -130,6 +147,7 @@ and the derived file cooking-units.sty. \usepackage{environ} \usepackage{nicefrac} \usepackage{varioref} +\usepackage{mathtools} \usepackage{siunitx} \DeclareSIUnit{\ounce}{oz} @@ -253,7 +271,7 @@ and the derived file cooking-units.sty. cunum, cutext, Cutext, - cufrac, + cuam, newcookingunit, cudefinename, cudefinesymbol, @@ -327,6 +345,19 @@ and the derived file cooking-units.sty. % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % +% +% \iffalse +%: changes +% \fi +% \changes {2016/06/11} {0.99} {Added the package option to load 'fmtcount'.} +% \changes {2016/08/31} {1.00} {Initial version} +% \changes {2016/08/31} {1.00a} {Fixed calculation: degree Reamur to eV} +% \changes {2016/09/03} {1.01} {Added units 'ssp', 'csp', 'dsp'} +% \changes {2016/09/03} {1.01} {English unit: litre (and only litre) uses the curly l \protect\ensuremath{\protect\ell} now } +% \changes {2016/09/03} {1.01} {British English: 'pinch' is written in full} +% \changes {2016/09/03} {1.01} {Separated Messerpsitze and pinch} +% \changes {2016/09/05} {1.02} {Replaced \cs{cufrac} by \cs{cuam}} +% \changes {2016/09/05} {1.02} {New message: 'obsolete-command'} % % \GetFileInfo{\jobname.sty} % @@ -355,7 +386,7 @@ and the derived file cooking-units.sty. % % While writing on a cookery book I used -- for reasons whatsoever -- % three different units for weight: kilogram (kg), gram (g) and -% decagram (dag). Later my mother told me that she doesn't like it if a +% decagram (dag, or older: dkg). Later my mother told me that she doesn't like it if a % cookery book uses more than two different units (for weight in this case). Happily % I hardly used Decagram and therefore didn't have many problems % changing the units. But, well \dots\ I am using \LaTeX\ and changing @@ -398,15 +429,25 @@ and the derived file cooking-units.sty. % At least I hope that this works, dealing with languages is a pain in % the ass\footnote{If you excuse me being blunt about this}. % +% \subsection{Supported languages} +% +% \begin{itemize} +% \item German +% \item English +% \item French (currently suboptimal\footnote{You can only get limited information from the internet.}) +% \end{itemize} +% Have another language to add or a correction of an existing one? +% See \vref{sec:bug-feed} for more details. +% % \section {The Commands} % % This package offers the following commands for unit printing (and converting): % % \begin{itemize} -% \item \mycs{cunum} \oarg{options}\marg{amount}\oarg{space}\marg{unit-key} +% \item \mycs{cunum}\oarg{options}\marg{amount}\oarg{space}\marg{unit-key} % \item \mycs{cutext}\oarg{options}\marg{amount}\marg{unit-key} % \item \mycs{Cutext}\oarg{options}\marg{amount}\marg{unit-key} -% \item \mycs{cufrac}\marg{input} +% \item \mycs{cuam}\oarg{options} \marg{amount} % \end{itemize} % % Numbers and units are printed using \mycs{cunum}. The numerical part @@ -481,32 +522,45 @@ and the derived file cooking-units.sty. % \cusetup{use-numerals-below=0} % % -% \lstinline|\cufrac| can be used to print fractions. Like in \lstinline|\cunum| -% \texttt{\_} and \texttt{/} are used to imply a (mixed) fraction: +% \lstinline|\cuam| works like a more primitive version \mycs{cunum} +% which doesn't need a unit, but doesn't check the input like \mycs{cunum}. +% Like in \lstinline|\cunum| \texttt{\_} and \texttt{/} are used to imply a (mixed) fraction and \texttt{-{}-} +% used to print ranges\footnote{Note that since v1.02 \mycs{myfrac} is obsolete.}: % % \begin{cuexamplecode} -% \cufrac{3} \\ -% \cufrac{2/3} \\ -% \cufrac{1_2/3} +% \cuam{3} \\ +% \cuam{2--3} \\ +% \cuam{2/3} \\ +% \cuam{1_2/3} % \end{cuexamplecode} % % % \section{Predefined units \& some notes} % \label{sec:pred-units} % -% In \vref{tab:def-units} you can find all predefined units. +% In \vref{tab:def-units} and \vref{tab:some-more-units} you can find all predefined units. % -% I did not include a separate key for \enquote{Prise} (pinch), but you can use -% \texttt{Msp} (Messerspitze) and modify it to fit your -% purpose\footnote{See \vref{sec:language}.}. -% In other languages the nearest equivalent of \enquote{Messerspitze} is -% \enquote{pinch} which I used. +% I now \emph{did} include a separate key for \enquote{Messerspitze} (Msp.) +% and therefore separated \enquote{Pinch} (pn) and \enquote{Messerspitze} (Msp.). +% My biggest problems with the units given in \vref{tab:some-more-units} is +% that they may only exist in one language (or country) +% and therefore do not exist in another language (I think for example that +% knife point \enquote{Messerspitze} doesn't exist in english) so translating +% them would be difficult. Therefore use units known to you and if there are +% unsupported units or languages feel free to write (see \vref{sec:bug-feed} +% for more details). +%^^A I did not include a separate key for \enquote{Prise} (pinch), but you can use +%^^A \texttt{Msp} (Messerspitze) and modify it to fit your +%^^A purpose\footnote{See \vref{sec:language}.}. +%^^A In other languages the nearest equivalent of \enquote{Messerspitze} is +%^^A \enquote{pinch} which I used. % -%^^A Please note that this package uses \texttt{translator} for defining translations, -%^^A so you may put % % \begin{table}[htbp] % \centering +% \caption{List of predefined unit-keys. +% The \enquote{symbol} column is language dependent. Note that \enquote{electron +% volt} exists just for fun.} % \begin{tabular}{ lll } % \toprule % unit name & unit-key & symbol \\ \midrule @@ -543,18 +597,36 @@ and the derived file cooking-units.sty. % \PrintUnit {kJ} \\ % \PrintUnit {eV} \\ \addlinespace % -% \PrintUnit {Msp} \\ +% \bottomrule +% \end{tabular} +% \label{tab:def-units} +% \end{table} +% +% \begin{table}[htbp] +% \centering +% \caption{A (not only) spoonful of (more or less) country and language dependent units. +% Please note that sometimes a translation is nearly impossible as a unit +% (e.g. \enquote{saltspoonful}) may not exist in another language +% (like german; at least I never heard of it). So please only use units known to you.} +% \begin{tabular}{ lll } +% \toprule +% unit name & unit-key & symbol \\ \midrule +% \PrintUnit {pn} \\ \addlinespace % \PrintUnit {EL} \\ % \PrintUnit {TL} \\ +% \PrintUnit {dsp} \\ +% \PrintUnit {csp} \\ +% \PrintUnit {ssp} \\ \addlinespace +% \PrintUnit {Msp} \\ % \bottomrule % \end{tabular} -% \caption{List of predefined unit-keys. Note that \enquote{electron -% volt} exists just for fun.} -% \label{tab:def-units} +% \label{tab:some-more-units} % \end{table} % % \begin{table}[htbp] % \centering +% \caption{List of nonsense units (exist just for fun, there will +% be no support for those units). } % \begin{tabular}{ ll } % \toprule % unit-key & symbol \\ \midrule @@ -564,8 +636,6 @@ and the derived file cooking-units.sty. % \PrintUnitSymbol {(chbareV-1)3} \\ % \bottomrule % \end{tabular} -% \caption{List of nonsense units (exist just for fun, there will -% be no support for those units). } % \label{tab:def-units} % \end{table} % @@ -997,7 +1067,7 @@ and the derived file cooking-units.sty. % printed as numbers. Please note the keys \opt{one(m)}, \opt{one(f)} % and \opt{one(n)} to change the printed \enquote{one} (as % \enquote{one} is in many languages dependent on the gender of the -% following word. E.g in German: Maskulin: ein Baum, +% following word. E.g in German: Masculine: ein Baum, % Feminin: eine Pflanze, Neutrum: ein Auto). % \end{function} % @@ -1139,14 +1209,15 @@ and the derived file cooking-units.sty. % cutext-range-sign = \meta{string} % \end{syntax} %^^A Sets the \emph{printed} range-sign equal to \meta{string}. -% The second sets the \emph{printed} range-sign used in \mycs{cunum} to +% The second sets the \emph{printed} range-sign used in \mycs{cunum} +% (and \mycs{cuam}) to % \meta{string}, the third sets the printed range-sign used in % \mycs{cutext}/\mycs{Cutext} to \meta{string}. % %^^A If you want to change to the same range-sign for all commands %^^A use the first option. % Use the \opt{range-sign} to set the printed range-signs for both -% \mycs{cunum} and \mycs{cutext}/\mycs{Cutext} to \meta{string}. +% \mycs{cunum} (and \mycs{cuam}) and \mycs{cutext}/\mycs{Cutext} to \meta{string}. % % The default for \meta{string} is \texttt{-{}-} (for both). % \end{function} @@ -1154,18 +1225,21 @@ and the derived file cooking-units.sty. % \begin{cuexamplecode} % \cusetup{cunum-range-sign={~to~}} @ % \cunum{1--2}{kg} \\ +% \cuam{1--2}{kg} \\ % \cutext{1--2}{kg} \\ % \Cutext{1--2}{kg} \\ % \end{cuexamplecode} % \begin{cuexamplecode} % \cusetup{cutext-range-sign={~to~}} @ % \cunum{1--2}{kg} \\ +% \cuam{1--2}{kg} \\ % \cutext{1--2}{kg} \\ % \Cutext{1--2}{kg} \\ % \end{cuexamplecode} % \begin{cuexamplecode} % \cusetup{range-sign={~to~}} @ % \cunum{1--2}{kg} \\ +% \cuam{1--2}{kg} \\ % \cutext{1--2}{kg} \\ % \Cutext{1--2}{kg} \\ % \end{cuexamplecode} @@ -1187,10 +1261,12 @@ and the derived file cooking-units.sty. % \begin{cuexamplecode} % \newcommand\myfrac[2]{#1/#2} @ % \cusetup{fraction-command=\myfrac} @ +% \cuam{1/8} \\ % \cunum{1/2}{kg} \\ % \cunum{4/5}{C} \\ % \cunum{1_2/3}{kg} \\ % \cusetup{fraction-command=\nicefrac} @ +% \cuam{1/8} \\ % \cunum{1/2}{kg} \\ % \cunum{4/5}{C} \\ % \cunum{1_2/3}{kg} @@ -1206,10 +1282,12 @@ and the derived file cooking-units.sty. % % \begin{cuexamplecode} % \cusetup{fraction-inline={#1/#2} } @ +% \cuam{1/8} \\ % \cunum{1/2}{kg} \\ % \cunum{4/5}{C} \\ % \cunum{1_2/3}{kg} \\ % \cusetup{fraction-inline={\nicefrac{#2}{#1}} } @ +% \cuam{1/8} \\ % \cunum{1/2}{kg} \\ % \cunum{4/5}{C} \\ % \cunum{1_2/3}{kg} @@ -1225,12 +1303,15 @@ and the derived file cooking-units.sty. % \end{function} % % \begin{cuexamplecode} +% \cuam{1_2/3}{kg} \\ % \cunum{1_2/3}{kg} \\ % \cunum{10_2/3}{kg} \\ % \cusetup{mixed-fraction-space=1em } @ +% \cuam{1_2/3}{kg} \\ % \cunum{1_2/3}{kg} \\ % \cunum{10_2/3}{kg} \\ % \cusetup{mixed-fraction-space=0em } @ +% \cuam{1_2/3}{kg} \\ % \cunum{1_2/3}{kg} \\ % \cunum{10_2/3}{kg} \\ % \end{cuexamplecode} @@ -1360,7 +1441,8 @@ and the derived file cooking-units.sty. % to electron volt or the respective derivative. Note that this % option is: % a) experimental and probably will forever be and b) just a joke, you are not -% supposed to use this units in a cookery book. +% supposed to use this units in a cookery book (and as you see this package +% doesn't support the arrangement of such huge numbers). % % \end{function} % @@ -1378,6 +1460,7 @@ and the derived file cooking-units.sty. % % % \section{Bugs \& Feedback} +% \label{sec:bug-feed} % % Bug reports are always welcome. If you are sending a bug report % please include a minimal working example showing the bug and a short @@ -1386,7 +1469,8 @@ and the derived file cooking-units.sty. % spam account and adding \enquote{cooking-units} to the header makes % it easier to recognize those e-mails. % -% Feedback and requests are most welcome. Please also add (if possible) an example of the +% Feedback and requests (commands, units) are most welcome. +% Please also add (if possible) an example of the % desired output into the minimal example (and also add \enquote{cooking-units} % to the header). % @@ -1394,7 +1478,7 @@ and the derived file cooking-units.sty. % english to be precise; I managed to add french with the help of the internet, % which is not optimal) so if you are able to speak a language not yet implemented % and would like to help you can send me a list of the translations of the units given in -% \vref{tab:def-units}. I would need +% \vref{sec:pred-units}. I would need % \begin{itemize} % \item their singular (and plural) form, % \item the gender, @@ -1404,6 +1488,51 @@ and the derived file cooking-units.sty. % % Oh yeah, if someone has a better idea of how to deal with languages I am happy to know. % +% +% +%^^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} +% +% % \end{documentation} % % \begin{implementation} @@ -1431,12 +1560,13 @@ and the derived file cooking-units.sty. { } { \RequirePackage {expl3} } % \end{macrocode} -% \changes {2016/08/31} {1.00} {Initial version} +% +%: Package % \begin{macrocode} \ProvidesExplPackage {cooking-units} - {2016/08/31} - {1.00} + {2016/09/05} + {1.02} {Ein Paket fuer Kocheinheiten} % \end{macrocode} % Chekcing if \pkg{expl3} is uptodate, otherwise abort the loading of the package. @@ -1460,8 +1590,6 @@ and the derived file cooking-units.sty. \@ifpackageloaded { l3keys2e } { } { \RequirePackage { l3keys2e } } % \end{macrocode} % -% \changes {2016/06/11} {0.99} {Added the package option to load -% 'fmtcount'.} % Define the only load-time option for this package. If it is set, % load package \pkg{fmtcount} and redefine the option so that it % displays an error message if used. @@ -1492,7 +1620,7 @@ and the derived file cooking-units.sty. % \tl_replace_all:NVn, % \tl_replace_once:NnV , % \tl_replace_once:NVn , -% \tl_if_in:nVT , +% \tl_if_in:nVTF , % \tl_if_in:NVT , % \fp_compare:cNnT , % \fp_eval:c, @@ -1501,7 +1629,7 @@ and the derived file cooking-units.sty. % \begin{macrocode} \cs_generate_variant:Nn \tl_replace_all:Nnn { NVn } \cs_generate_variant:Nn \tl_replace_once:Nnn { NnV, NVn } -\cs_generate_variant:Nn \tl_if_in:nnT { nVT } +\cs_generate_variant:Nn \tl_if_in:nnTF { nVTF } \cs_generate_variant:Nn \tl_if_in:NnT { NVT } \cs_generate_variant:Nn \fp_compare:nNnT { cNnT } \cs_generate_variant:Nn \fp_eval:n { c } @@ -2089,6 +2217,19 @@ and the derived file cooking-units.sty. \msg_see_documentation_text:n { cooking-units } } % \end{macrocode} +% +% If a load time option not used as a package option, but later, this +% message is shown. +% \begin{macrocode} +\msg_new:nnnn { cooking - units } { obsolete-command } + { + Command \ #1 is \ obsolete. \ Please \ use \ #2 instead. + } + { + Don't \ use \ the \ old \ command \ ... + \msg_see_documentation_text:n { cooking-units } + } +% \end{macrocode} % \end{macro} % % \section {Helper Macros} @@ -2194,6 +2335,16 @@ and the derived file cooking-units.sty. % \end{macrocode} %\end{macro} % +% \begin{macro}{\@@_deftranslation:Nnn} +% \begin{macrocode} +\cs_new:Npn \@@_deftranslation:Nnn #1#2#3 + { + \deftranslation [ to=#1 ] { #2 } {#3} + } +\cs_generate_variant:Nn \@@_deftranslation:Nnn { Vnn } +% \end{macrocode} +% \end{macro} +% % \subsection {Parsing and cheking numbers} % % This section contains macros helping an checking the input. @@ -2287,8 +2438,8 @@ and the derived file cooking-units.sty. % part is positive or negative. % % \begin{align} -% \cufrac{1_2/3} &= 1 + 2/3 \\ -% \cufrac{-1_2/3} &= -1 - 2/3 +% \cuam{1_2/3} &= 1 + 2/3 \\ +% \cuam{-1_2/3} &= -1 - 2/3 % \end{align} % % \begin{macrocode} @@ -2690,6 +2841,7 @@ and the derived file cooking-units.sty. } {#1} \tl_if_empty:VF \l_tmpa_tl { +%% besser mit boolean arbeiten als nochmals ueberpruefen lassen? \tl_if_in:NVT \l_tmpa_tl \l_@@_input_range_sign_tl { \tl_replace_once:NVn \l_tmpa_tl \l_@@_input_range_sign_tl { \q_@@_range } } \@@_cunum_parse_input:V \l_tmpa_tl @@ -3257,9 +3409,12 @@ and the derived file cooking-units.sty. % % \section {cufrac} % +% Obsolete. % \begin{macrocode} \NewDocumentCommand \cufrac { O{} m } { + \msg_error:nnnn { cooking-units } { obsolete-command } { \cufrac } + { \cuam } \group_begin: \keys_set:nn { cooking-units } {#1} \@@_cufrac:n {#2} @@ -3315,6 +3470,90 @@ and the derived file cooking-units.sty. % \end{macrocode} % % +% \section{cuam} +% +% Replaces and extends \mycs{cufrac}. +% \begin{macro}{\cuam} +% \begin{macrcode} +\NewDocumentCommand \cuam { O{} m } + { + \group_begin: + \keys_set:nn { cooking-units } {#1} + \@@_cuam:n {#2} + \group_end: + } +% \end{macrcode} +% \end{macro} +% +% \begin{macro}{\@@_cuam:n} +% \begin{macrocode} +\cs_new:Npn \@@_cuam:n #1 + { + \tl_set_rescan:Nnn \l_tmpa_tl + { + \char_set_catcode_letter:N \_ % + \char_set_catcode_ignore:N\ % + } {#1} + \@@_cuam_parse:V \l_tmpa_tl + } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_cuam_parse:n #1 + { + \tl_if_in:nVTF {#1} \l_@@_input_range_sign_tl + { + \tl_set:Nn \l_tmpa_tl {#1} + \tl_replace_once:NVn \l_tmpa_tl \l_@@_input_range_sign_tl { \q_@@_range } + \@@_cuam_parse_range:V \l_tmpa_tl + }{ + \tl_if_in:nnTF {#1} { / } + { + \tl_if_in:nnTF {#1} { _ } + { \@@_cuam_parse_mixed_frac:www #1 \q_stop } + { \@@_cuam_parse_frac:ww #1 \q_stop } + }{ + \tl_if_in:nnTF {#1} { _ } + { \msg_error:nnn { cooking-units } { missing-slash } {#1} } + { \@@_cuam_parse_scale:n {#1} } + } + } + } +\cs_generate_variant:Nn \@@_cuam_parse:n { V } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new:Npn \@@_cuam_parse_range:n #1 + { + \@@_cuam_parse_range_aux:ww #1 \q_nil + } +\cs_generate_variant:Nn \@@_cuam_parse_range:n { V } +\cs_new:Npn \@@_cuam_parse_range_aux:ww #1 \q_@@_range #2 \q_nil + { + #1 \l_@@_cunum_range_sign_tl #2 + } +% \end{macrocode} +% +% +% \begin{macrocode} +\cs_new:Npn \@@_cuam_parse_scale:n #1 {#1} +% \end{macrocode} +% +% \begin{macrocode} +\cs_new:Npn \@@_cuam_parse_frac:ww #1/#2 \q_stop + { \@@_frac:nn {#1} {#2} } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new:Npn \@@_cuam_parse_mixed_frac:www #1_#2/#3 \q_stop + { + #1 + \hbox_to_wd:nn { \l_@@_mixed_frac_dim } { } + \@@_frac:nn {#2} {#3} + } +% \end{macrocode} +% % \section {Names} % % @@ -3344,7 +3583,8 @@ and the derived file cooking-units.sty. \quark_if_recursion_tail_stop_do:nn {#2} { \msg_error:nn { cooking-units } { missing-argument } } \@@_error_if_unit_not_defined:n {#1} - \deftranslation [ to=\l_@@_language_tl ] { #1 ( cu-unit ) } {#2} +% \deftranslation [ to=\l_@@_language_tl ] { #1 ( cu-unit ) } {#2} + \@@_deftranslation:Vnn \l_@@_language_tl { #1 ( cu-unit ) } {#2} \@@_cuname_parse_input_aux:nn {#1} } % \end{macrocode} @@ -3358,7 +3598,8 @@ and the derived file cooking-units.sty. { \msg_error:nn { cooking-units } { missing-argument } } \clist_if_in:NnF \g_@@_allowed_unit_phrases_clist {#1} { \@@_error_if_unit_not_defined:n {#1} } - \deftranslation [ to=\l_@@_language_tl ] { #1 (cu-unitname) } {#2} +% \deftranslation [ to=\l_@@_language_tl ] { #1 (cu-unitname) } {#2} + \@@_deftranslation:Vnn \l_@@_language_tl { #1 ( cu-unitname ) } {#2} \peek_meaning_ignore_spaces:NTF [ { \@@_cuname_parse_bracket:nw {#1} } { \@@_cuname_parse_bracket:nw {#1} [#2] } @@ -3368,7 +3609,8 @@ and the derived file cooking-units.sty. % \begin{macrocode} \cs_new:Npn \@@_cuname_parse_bracket:nw #1 [#2] { - \deftranslation [ to=\l_@@_language_tl ] { #1 ( cu-unitname pl ) } {#2} +% \deftranslation [ to=\l_@@_language_tl ] { #1 ( cu-unitname pl ) } {#2} + \@@_deftranslation:Vnn \l_@@_language_tl { #1 ( cu-unitname pl ) } {#2} \peek_meaning_ignore_spaces:NTF < { \@@_cuname_parse_arrows:nw {#1} } { \@@_cuname_parse_arrows:nw {#1} <m> } @@ -3378,7 +3620,8 @@ and the derived file cooking-units.sty. % \begin{macrocode} \cs_new:Npn \@@_cuname_parse_arrows:nw #1 <#2> { - \deftranslation [ to=\l_@@_language_tl ] { #1 ( cu-unitgender ) } {#2} +% \deftranslation [ to=\l_@@_language_tl ] { #1 ( cu-unitgender ) } {#2} + \@@_deftranslation:Vnn \l_@@_language_tl { #1 ( cu-unitgender ) } {#2} \@@_cuname_parse_input:n } % \end{macrocode} @@ -3405,8 +3648,9 @@ and the derived file cooking-units.sty. { \msg_error:nn { cooking-units } { missing-argument } } \clist_if_in:NnF \g_@@_allowed_unit_phrases_clist {#1} { \@@_error_if_unit_not_defined:n {#1} } - \deftranslation [ to=\l_@@_language_tl ] { #1 ( cu-unit ) } {#2} - \@@_cuprint_define_printed_unit:nn +% \deftranslation [ to=\l_@@_language_tl ] { #1 ( cu-unit ) } {#2} + \@@_deftranslation:Vnn \l_@@_language_tl { #1 ( cu-unit ) } {#2} +cu-unitgender \@@_cuprint_define_printed_unit:nn } % \end{macrocode} % @@ -3474,13 +3718,17 @@ and the derived file cooking-units.sty. % \end{macrocode} % % \begin{macrocode} -\newcookingunit [ Msp. ] { Msp } +\newcookingunit [ pinch ] { pn } \newcookingunit { EL } \newcookingunit { TL } +\newcookingunit [ ssp. ] { ssp } %% saltspoonful +\newcookingunit [ csp. ] { csp } %% coffeespoonful +\newcookingunit [ dsp. ] { dsp } +\newcookingunit [ Msp. ] { Msp } % \end{macrocode} % % -% +% Notiz am mich: ueberall symbol dazugeben. % \begin{macrocode} \cudefinename { German } { @@ -3510,7 +3758,7 @@ and the derived file cooking-units.sty. { in } { Zoll } % \end{macrocode} % \begin{macrocode} - { l } { Liter } + { l } [ l ] { Liter } { dl } { Deziliter } { cl } { Centiliter } { ml } { Milliliter } @@ -3524,8 +3772,10 @@ and the derived file cooking-units.sty. % \end{macrocode} % \begin{macrocode} { Msp } [ Msp. ] { Messerspitze } [ Messerspitzen ] < f > + { pn } [ Prise ] { Prise } [ Prisen ] < f > { EL } [ EL ] { Essl{\"o}ffel } { TL } [ TL ] { Teel{\"o}ffel } + { csp } [ KL ] { Mokkal{\"o}ffel } % \end{macrocode} % \begin{macrocode} { decimal-mark } { , } @@ -3565,7 +3815,7 @@ and the derived file cooking-units.sty. { in } { inch } [ inches ] % \end{macrocode} % \begin{macrocode} - { l } { litre } [ litres ] + { l } [ \ensuremath { \ell } ] { litre } [ litres ] { dl } { decilitre } [ decilitres ] { cl } { centilitre } [ centilitres ] { ml } { millilitre } [ millilitres ] @@ -3578,9 +3828,14 @@ and the derived file cooking-units.sty. { eV } { electron \space volt } % \end{macrocode} % \begin{macrocode} - { Msp } [ pn ] { pinch } [ pinches ] +% { Msp } [ pinch ] { pinch } [ pinches ] + { Msp } { Messerspitze } [ Messerspitzen ] <f> + { pn } [ pinch ] { pinch } [ pinches ] { EL } [ tsp. ] { tablespoon } [ tablespoons ] { TL } [ tbsp. ] { teaspoon } [ teaspoons ] + { dsp } { dessertspoonful } + { csp } { coffeespoonful } + { ssp } { saltspoonful } % \end{macrocode} % \begin{macrocode} { decimal-mark } { . } @@ -3606,10 +3861,14 @@ and the derived file cooking-units.sty. { in } { inch } [ inches ] % \end{macrocode} % \begin{macrocode} - { l } { liter } [ liters ] + { l } [ \ensuremath { \ell } ] { liter } [ liters ] { dl } { deciliter } [ deciliters ] { cl } { centiliter } [ centiliters ] { ml } { milliliter } [ milliliters ] +% \end{macrocode} +% \begin{macrocode} + { Msp } { Messerspitze } [ Messerspitzen ] <f> + { pn } [ pn. ] { pinch } [ pinches ] } % \end{macrocode} % @@ -3655,7 +3914,7 @@ and the derived file cooking-units.sty. { eV } { \'{e}lectron-volt } [ \'{e}lectron-volts ] % \end{macrocode} % \begin{macrocode} - { Msp } { pinc\'{e}e } < f > + { pn } { pinc\'{e}e } < f > { EL } { cuill\'{e}re \space \`{a} \space soupe } < f > { TL } { cuill\'{e}re \space \`{a} \space caf\'{e} } < f > % \end{macrocode} @@ -3720,8 +3979,8 @@ and the derived file cooking-units.sty. \fp_const:Nn \c_@@_kb_eV_fp { 8.617 330 3 e-5 } \cudefinesinglekey { C } { - { F } { #1 * 1.8 + 32 } { K } { #1 + 273.15 } + { F } { #1 * 1.8 + 32 } { Re } { #1 * 0.8 } { eV } { ( #1 + 273.15 ) * \c_@@_kb_eV_fp } } @@ -3744,7 +4003,7 @@ and the derived file cooking-units.sty. { K } { #1 * 1.25 + 273.15 } { C } { #1 * 1.25 } { F } { #1 * 2.25 + 32 } - { eV } { ( #1 - 273.15 ) * 1.25 * \c_@@_kb_eV_fp } + { eV } { ( #1 * 1.25 + 273.15 ) * \c_@@_kb_eV_fp } } % \end{macrocode} % 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 af9dbde6fbf..b12965f826b 100644 --- a/Master/texmf-dist/tex/latex/cooking-units/cooking-units.sty +++ b/Master/texmf-dist/tex/latex/cooking-units/cooking-units.sty @@ -30,8 +30,8 @@ { \RequirePackage {expl3} } \ProvidesExplPackage {cooking-units} - {2016/08/31} - {1.00} + {2016/09/05} + {1.02} {Ein Paket fuer Kocheinheiten} \@ifpackagelater { expl3 } { 2016/05/18 } { } @@ -64,7 +64,7 @@ } \cs_generate_variant:Nn \tl_replace_all:Nnn { NVn } \cs_generate_variant:Nn \tl_replace_once:Nnn { NnV, NVn } -\cs_generate_variant:Nn \tl_if_in:nnT { nVT } +\cs_generate_variant:Nn \tl_if_in:nnTF { nVTF } \cs_generate_variant:Nn \tl_if_in:NnT { NVT } \cs_generate_variant:Nn \fp_compare:nNnT { cNnT } \cs_generate_variant:Nn \fp_eval:n { c } @@ -322,6 +322,14 @@ but \ only \ as \ a \ package \ option. \msg_see_documentation_text:n { cooking-units } } +\msg_new:nnnn { cooking - units } { obsolete-command } + { + Command \ #1 is \ obsolete. \ Please \ use \ #2 instead. + } + { + Don't \ use \ the \ old \ command \ ... + \msg_see_documentation_text:n { cooking-units } + } \cs_new:Npn \__cooking_units_error_if_unit_not_defined:n #1 { \clist_if_in:NnF \g__cooking_units_list_of_defined_units_clist {#1} @@ -385,6 +393,11 @@ { change-unit } { l__cooking_units_predefined_option_ \l__cooking_units_option_unit_tl _clist } } +\cs_new:Npn \__cooking_units_deftranslation:Nnn #1#2#3 + { + \deftranslation [ to=#1 ] { #2 } {#3} + } +\cs_generate_variant:Nn \__cooking_units_deftranslation:Nnn { Vnn } \cs_new:Npn \__cooking_units_cunum_parse_input:N #1 { \tl_if_in:nnTF {#1} { \q__cooking_units_range } @@ -672,6 +685,7 @@ } {#1} \tl_if_empty:VF \l_tmpa_tl { +%% besser mit boolean arbeiten als nochmals ueberpruefen lassen? \tl_if_in:NVT \l_tmpa_tl \l__cooking_units_input_range_sign_tl { \tl_replace_once:NVn \l_tmpa_tl \l__cooking_units_input_range_sign_tl { \q__cooking_units_range } } \__cooking_units_cunum_parse_input:V \l_tmpa_tl @@ -1028,6 +1042,8 @@ } \NewDocumentCommand \cufrac { O{} m } { + \msg_error:nnnn { cooking-units } { obsolete-command } { \cufrac } + { \cuam } \group_begin: \keys_set:nn { cooking-units } {#1} \__cooking_units_cufrac:n {#2} @@ -1065,6 +1081,61 @@ \hbox_to_wd:nn { \l__cooking_units_mixed_frac_dim } { } \__cooking_units_frac:nn {#2} {#3} } +\NewDocumentCommand \cuam { O{} m } + { + \group_begin: + \keys_set:nn { cooking-units } {#1} + \__cooking_units_cuam:n {#2} + \group_end: + } +\cs_new:Npn \__cooking_units_cuam:n #1 + { + \tl_set_rescan:Nnn \l_tmpa_tl + { + \char_set_catcode_letter:N \_ % + \char_set_catcode_ignore:N\ % + } {#1} + \__cooking_units_cuam_parse:V \l_tmpa_tl + } +\cs_new_protected:Npn \__cooking_units_cuam_parse:n #1 + { + \tl_if_in:nVTF {#1} \l__cooking_units_input_range_sign_tl + { + \tl_set:Nn \l_tmpa_tl {#1} + \tl_replace_once:NVn \l_tmpa_tl \l__cooking_units_input_range_sign_tl { \q__cooking_units_range } + \__cooking_units_cuam_parse_range:V \l_tmpa_tl + }{ + \tl_if_in:nnTF {#1} { / } + { + \tl_if_in:nnTF {#1} { _ } + { \__cooking_units_cuam_parse_mixed_frac:www #1 \q_stop } + { \__cooking_units_cuam_parse_frac:ww #1 \q_stop } + }{ + \tl_if_in:nnTF {#1} { _ } + { \msg_error:nnn { cooking-units } { missing-slash } {#1} } + { \__cooking_units_cuam_parse_scale:n {#1} } + } + } + } +\cs_generate_variant:Nn \__cooking_units_cuam_parse:n { V } +\cs_new:Npn \__cooking_units_cuam_parse_range:n #1 + { + \__cooking_units_cuam_parse_range_aux:ww #1 \q_nil + } +\cs_generate_variant:Nn \__cooking_units_cuam_parse_range:n { V } +\cs_new:Npn \__cooking_units_cuam_parse_range_aux:ww #1 \q__cooking_units_range #2 \q_nil + { + #1 \l__cooking_units_cunum_range_sign_tl #2 + } +\cs_new:Npn \__cooking_units_cuam_parse_scale:n #1 {#1} +\cs_new:Npn \__cooking_units_cuam_parse_frac:ww #1/#2 \q_stop + { \__cooking_units_frac:nn {#1} {#2} } +\cs_new:Npn \__cooking_units_cuam_parse_mixed_frac:www #1_#2/#3 \q_stop + { + #1 + \hbox_to_wd:nn { \l__cooking_units_mixed_frac_dim } { } + \__cooking_units_frac:nn {#2} {#3} + } \NewDocumentCommand \cudefinename { m m } { \tl_set:Nn \l__cooking_units_language_tl {#1} @@ -1083,7 +1154,7 @@ \quark_if_recursion_tail_stop_do:nn {#2} { \msg_error:nn { cooking-units } { missing-argument } } \__cooking_units_error_if_unit_not_defined:n {#1} - \deftranslation [ to=\l__cooking_units_language_tl ] { #1 ( cu-unit ) } {#2} + \__cooking_units_deftranslation:Vnn \l__cooking_units_language_tl { #1 ( cu-unit ) } {#2} \__cooking_units_cuname_parse_input_aux:nn {#1} } \cs_new:Npn \__cooking_units_cuname_parse_input_aux:nn #1#2 @@ -1093,21 +1164,21 @@ { \msg_error:nn { cooking-units } { missing-argument } } \clist_if_in:NnF \g__cooking_units_allowed_unit_phrases_clist {#1} { \__cooking_units_error_if_unit_not_defined:n {#1} } - \deftranslation [ to=\l__cooking_units_language_tl ] { #1 (cu-unitname) } {#2} + \__cooking_units_deftranslation:Vnn \l__cooking_units_language_tl { #1 ( cu-unitname ) } {#2} \peek_meaning_ignore_spaces:NTF [ { \__cooking_units_cuname_parse_bracket:nw {#1} } { \__cooking_units_cuname_parse_bracket:nw {#1} [#2] } } \cs_new:Npn \__cooking_units_cuname_parse_bracket:nw #1 [#2] { - \deftranslation [ to=\l__cooking_units_language_tl ] { #1 ( cu-unitname pl ) } {#2} + \__cooking_units_deftranslation:Vnn \l__cooking_units_language_tl { #1 ( cu-unitname pl ) } {#2} \peek_meaning_ignore_spaces:NTF < { \__cooking_units_cuname_parse_arrows:nw {#1} } { \__cooking_units_cuname_parse_arrows:nw {#1} <m> } } \cs_new:Npn \__cooking_units_cuname_parse_arrows:nw #1 <#2> { - \deftranslation [ to=\l__cooking_units_language_tl ] { #1 ( cu-unitgender ) } {#2} + \__cooking_units_deftranslation:Vnn \l__cooking_units_language_tl { #1 ( cu-unitgender ) } {#2} \__cooking_units_cuname_parse_input:n } \NewDocumentCommand \cudefinesymbol { m m } @@ -1123,8 +1194,8 @@ { \msg_error:nn { cooking-units } { missing-argument } } \clist_if_in:NnF \g__cooking_units_allowed_unit_phrases_clist {#1} { \__cooking_units_error_if_unit_not_defined:n {#1} } - \deftranslation [ to=\l__cooking_units_language_tl ] { #1 ( cu-unit ) } {#2} - \__cooking_units_cuprint_define_printed_unit:nn + \__cooking_units_deftranslation:Vnn \l__cooking_units_language_tl { #1 ( cu-unit ) } {#2} +cu-unitgender \__cooking_units_cuprint_define_printed_unit:nn } \NewDocumentCommand \cusetup { m } { @@ -1161,9 +1232,13 @@ \newcookingunit { J } \newcookingunit { kJ } \newcookingunit { eV } -\newcookingunit [ Msp. ] { Msp } +\newcookingunit [ pinch ] { pn } \newcookingunit { EL } \newcookingunit { TL } +\newcookingunit [ ssp. ] { ssp } %% saltspoonful +\newcookingunit [ csp. ] { csp } %% coffeespoonful +\newcookingunit [ dsp. ] { dsp } +\newcookingunit [ Msp. ] { Msp } \cudefinename { German } { { kg } { Kilogramm } < n > @@ -1184,7 +1259,7 @@ { cm } { Centimeter } < n > { mm } { Millimeter } < n > { in } { Zoll } - { l } { Liter } + { l } [ l ] { Liter } { dl } { Deziliter } { cl } { Centiliter } { ml } { Milliliter } @@ -1194,8 +1269,10 @@ { kJ } { Kilojoule } { eV } { ELektronenvolt } < n > { Msp } [ Msp. ] { Messerspitze } [ Messerspitzen ] < f > + { pn } [ Prise ] { Prise } [ Prisen ] < f > { EL } [ EL ] { Essl{\"o}ffel } { TL } [ TL ] { Teel{\"o}ffel } + { csp } [ KL ] { Mokkal{\"o}ffel } { decimal-mark } { , } { one (m) } { ein } { one (f) } { eine } @@ -1221,7 +1298,7 @@ { cm } { centimetre } [ centimetres ] { mm } { millimitre } [ millimitres ] { in } { inch } [ inches ] - { l } { litre } [ litres ] + { l } [ \ensuremath { \ell } ] { litre } [ litres ] { dl } { decilitre } [ decilitres ] { cl } { centilitre } [ centilitres ] { ml } { millilitre } [ millilitres ] @@ -1230,9 +1307,13 @@ { J } { joule } [ joules ] { kJ } { kilojoule } [ kilojoules ] { eV } { electron \space volt } - { Msp } [ pn ] { pinch } [ pinches ] + { Msp } { Messerspitze } [ Messerspitzen ] <f> + { pn } [ pinch ] { pinch } [ pinches ] { EL } [ tsp. ] { tablespoon } [ tablespoons ] { TL } [ tbsp. ] { teaspoon } [ teaspoons ] + { dsp } { dessertspoonful } + { csp } { coffeespoonful } + { ssp } { saltspoonful } { decimal-mark } { . } { one (m) } { one } { one (f) } { one } @@ -1249,10 +1330,12 @@ { cm } { centimeter } [ centimeters ] { mm } { millimiter } [ millimiters ] { in } { inch } [ inches ] - { l } { liter } [ liters ] + { l } [ \ensuremath { \ell } ] { liter } [ liters ] { dl } { deciliter } [ deciliters ] { cl } { centiliter } [ centiliters ] { ml } { milliliter } [ milliliters ] + { Msp } { Messerspitze } [ Messerspitzen ] <f> + { pn } [ pn. ] { pinch } [ pinches ] } \cudefinename { French } { @@ -1282,7 +1365,7 @@ { J } { joule } [ joules ] { kJ } { kilojoule } [ kilojoules ] { eV } { \'{e}lectron-volt } [ \'{e}lectron-volts ] - { Msp } { pinc\'{e}e } < f > + { pn } { pinc\'{e}e } < f > { EL } { cuill\'{e}re \space \`{a} \space soupe } < f > { TL } { cuill\'{e}re \space \`{a} \space caf\'{e} } < f > { decimal-mark } { . } @@ -1330,8 +1413,8 @@ \fp_const:Nn \c__cooking_units_kb_eV_fp { 8.617 330 3 e-5 } \cudefinesinglekey { C } { - { F } { #1 * 1.8 + 32 } { K } { #1 + 273.15 } + { F } { #1 * 1.8 + 32 } { Re } { #1 * 0.8 } { eV } { ( #1 + 273.15 ) * \c__cooking_units_kb_eV_fp } } @@ -1354,7 +1437,7 @@ { K } { #1 * 1.25 + 273.15 } { C } { #1 * 1.25 } { F } { #1 * 2.25 + 32 } - { eV } { ( #1 - 273.15 ) * 1.25 * \c__cooking_units_kb_eV_fp } + { eV } { ( #1 * 1.25 + 273.15 ) * \c__cooking_units_kb_eV_fp } } \fp_const:Nn \c__cooking_units_K_min_fp { 0 } \fp_const:Nn \c__cooking_units_C_min_fp { -273.15 } |