From d2a1e931d98897f867978375a73d2a97050fc37a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 6 Sep 2016 21:31:08 +0000 Subject: cooking-units (6sep16) git-svn-id: svn://tug.org/texlive/trunk@42002 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/cooking-units/cooking-units.sty | 117 ++++++++++++++++++--- 1 file changed, 100 insertions(+), 17 deletions(-) (limited to 'Master/texmf-dist/tex/latex/cooking-units') 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} } } \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 ] + { 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 ] + { 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 } -- cgit v1.2.3