summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/cooking-units/cooking-units.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/cooking-units/cooking-units.sty')
-rw-r--r--Master/texmf-dist/tex/latex/cooking-units/cooking-units.sty143
1 files changed, 123 insertions, 20 deletions
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 923010ee9d3..f7564c0d864 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}
- {2022/03/26}
- {2.00a}
+ {2022/06/06}
+ {2.01}
{Ein Paket fuer Kocheinheiten}
\@ifpackagelater { expl3 } { 2022/02/24 }
{ }
@@ -276,7 +276,7 @@
\bool_new:N \l__cookingunits_pckopt_print_numeral_bool
\bool_new:N \l__cookingunits_lokal_numeral_bool
\bool_new:N \l__cookingunits_phrase_negative_bool
-\bool_new:N \l__cookingunits_cutext_last_amount_equ_one_bool
+\bool_new:N \l__cookingunits_cutext_use_single_bool
\bool_new:N \l__cookingunits_symbol_was_set_by_key_bool
\bool_new:N \l__cookingunits_contains_valid_key_bool
\bool_new:N \l__cookingunits_check_decimal_bool
@@ -1596,6 +1596,7 @@
\__cookingunits_culang_def_base:nnn { name } { decimal-mark } { . }
\__cookingunits_culang_def_base:nnn { name-pl } { decimal-mark } { \c__cookingunits_no_translation_str }
\__cookingunits_culang_def_for:nnnn { German } { name-pl } { decimal-mark } { , }
+\__cookingunits_culang_def_for:nnnn { French } { name-pl } { decimal-mark } { , }
\__cookingunits_culang_def_base:nnn { name } { one (m) } { \c__cookingunits_no_translation_str }
\__cookingunits_culang_def_base:nnn { name } { one (f) } { \c__cookingunits_no_translation_str }
\__cookingunits_culang_def_base:nnn { name } { one (n) } { \c__cookingunits_no_translation_str }
@@ -1608,10 +1609,14 @@
\__cookingunits_culang_def_for:nnnn { German } { name } { one (m) } { ein }
\__cookingunits_culang_def_for:nnnn { German } { name } { one (f) } { eine }
\__cookingunits_culang_def_for:nnnn { German } { name } { one (n) } { ein }
+\__cookingunits_culang_def_for:nnnn { French } { name } { one (m) } { un }
+\__cookingunits_culang_def_for:nnnn { French } { name } { one (f) } { une }
+\__cookingunits_culang_def_for:nnnn { French } { name } { one (n) } { un }
\__cookingunits_culang_def_base:nnn { name } { cutext-range-sign } { -- }
\__cookingunits_culang_def_base:nnn { name-pl } { cutext-range-sign } { \c__cookingunits_no_translation_str }
\__cookingunits_culang_def_for:nnnn { German } { name } { cutext-range-sign } { ~bis~ }
\__cookingunits_culang_def_for:nnnn { English } { name } { cutext-range-sign } { ~to~ }
+\__cookingunits_culang_def_for:nnnn { French } { name } { cutext-range-sign } { ~\`{a}~ }
\cs_new:Npn \__cookingunits_def_new_type:nnn #1#2#3
{
\tl_new:c { l__cookingunits_ #1 _tl }
@@ -1690,7 +1695,7 @@
{
\bool_if:NT \l__cookingunits_pckopt_cutext_to_cunum_bool
{ \__cookingunits_set_cmd_type_to:n { cunum } }
- \bool_set_false:N \l__cookingunits_cutext_last_amount_equ_one_bool
+ \bool_set_false:N \l__cookingunits_cutext_use_single_bool
}
\cs_new:Npn \__cookingunits_initialize_new_default:nnn #1#2#3
{
@@ -1846,12 +1851,17 @@
\l__cookingunits_mixed_fraction_tl
\l__cookingunits_number_tmpa_tl
\l__cookingunits_number_tmpb_tl
- \__cookingunits_if_print_type_equal:nT { number }
+ \__cookingunits_if_print_type_equal:nTF { number }
{
\__cookingunits_convert_fraction_to_number_in_input:NNN
\l__cookingunits_mixed_fraction_tl
\l__cookingunits_number_tmpa_tl
\l__cookingunits_number_tmpb_tl
+ }{
+ \__cookingunits_post_process_fraction_accordingly:NNN
+ \l__cookingunits_mixed_fraction_tl
+ \l__cookingunits_number_tmpa_tl
+ \l__cookingunits_number_tmpb_tl
}
}
\cs_new:Npn \__cookingunits_process_and_remove_minus_in_fraction:NNNN #1 #2#3#4
@@ -1975,6 +1985,17 @@
\__cookingunits_create_internal_error:nN { post-process } \l__cookingunits_cmd_type_tl
}
}
+\cs_new:Npn \__cookingunits_post_process_fraction_accordingly:NNN #1#2#3
+ {
+ \tl_case:NnF \l__cookingunits_cmd_type_tl
+ {
+ \c__cookingunits_cmd_type_cunum_tl { }
+ \c__cookingunits_cmd_type_cCutext_tl { \__cookingunits_cutext_post_process_fraction_input:NNN #1#2#3 }
+ \c__cookingunits_cmd_type_cuam_tl { }
+ }{
+ \__cookingunits_create_internal_error:nN { post-process-frac } \l__cookingunits_cmd_type_tl
+ }
+ }
\cs_new_protected:Npn \__cookingunits_print_numerical_input:N #1
{
\tl_if_in:NnT #1 { . }
@@ -2356,7 +2377,7 @@
\bool_if:NTF \l__cookingunits_lokal_numeral_bool
{ \l__cookingunits_cutext_numeral_space_tl }
{ \l__cookingunits_cutext_space_tl }
- \bool_if:NTF \l__cookingunits_cutext_last_amount_equ_one_bool
+ \bool_if:NTF \l__cookingunits_cutext_use_single_bool
{ \__cookingunits_culang_print:nV { name } \l__cookingunits_decided_unit_tl }
{ \__cookingunits_culang_print:nV { name-pl } \l__cookingunits_decided_unit_tl }
}
@@ -2384,8 +2405,13 @@
\cs_new:Npn \__cookingunits_cutext_post_process_input:NN #1#2
{
\__cookingunits_if_parse_and_process_type_equal:nTF { range }
- { \__cookingunits_cutext_check_if_amount_single:N #2 }
- { \__cookingunits_cutext_check_if_amount_single:N #1 }
+ {
+ \__cookingunits_culang_let:nnN { pluraltest } { range } \l__cookingunits_translation_tmpa_tl
+ \use:c { __cookingunits_pluraltest_range_ \l__cookingunits_translation_tmpa_tl :NN } #1#2
+ }{
+ \__cookingunits_culang_let:nnN { pluraltest } { normal } \l__cookingunits_translation_tmpa_tl
+ \use:c { __cookingunits_pluraltest_normal_ \l__cookingunits_translation_tmpa_tl :N } #1
+ }
\bool_if:NT \l__cookingunits_lokal_numeral_bool
{
\__cookingunits_if_contain_decimals:NNTF #1#2
@@ -2393,11 +2419,10 @@
{ \__cookingunits_check_if_integer_can_be_numerals:NN #1#2 }
}
}
-\cs_new:Npn \__cookingunits_cutext_check_if_amount_single:N #1
+\cs_new:Npn \__cookingunits_cutext_post_process_fraction_input:NNN #1#2#3
{
- \fp_compare:nNnTF {#1} = { 1.0 }
- { \bool_set_true:N } { \bool_set_false:N }
- \l__cookingunits_cutext_last_amount_equ_one_bool
+ \__cookingunits_culang_let:nnN { pluraltest } { fraction } \l__cookingunits_translation_tmpa_tl
+ \use:c { __cookingunits_pluraltest_fraction_ \l__cookingunits_translation_tmpa_tl :NNN } #1#2#3
}
\cs_new:Npn \__cookingunits_check_if_integer_can_be_numerals:NN #1#2
{
@@ -2563,6 +2588,27 @@
\l__cookingunits_phrase_text_tl
}
}
+\cs_new:Npn \cookingunits_print_fraction:nnn #1#2#3
+ {
+ \group_begin:
+ \__cookingunits_set_amount:Nn \l__cookingunits_mixed_fraction_tl {#1}
+ \__cookingunits_set_amount:Nn \l__cookingunits_number_tmpa_tl {#2}
+ \__cookingunits_set_amount:Nn \l__cookingunits_number_tmpb_tl {#3}
+ \__cookingunits_print_fractions:Nnn
+ \l__cookingunits_mixed_fraction_tl
+ \l__cookingunits_number_tmpa_tl
+ \l__cookingunits_number_tmpb_tl
+ \group_end:
+ }
+\cs_new:Npn \cookingunits_print_range:nn #1#2
+ {
+ \group_begin:
+ \__cookingunits_set_cmd_type_to:n { cunum }
+ #1
+ \__cookingunits_print_range_sign:
+ #2
+ \group_end:
+ }
%% To be deleted. In order to remove error messages.
\NewDocumentCommand \cudefinekeys { m m }
@@ -3208,6 +3254,63 @@
\__cookingunits_parse_definename_start_cycle:
}
\cs_generate_variant:Nn \__cookingunits_parse_name_finish_cycle_and_start_new:nn { VV }
+\__cookingunits_culang_def_base:nnn { pluraltest } { normal } { \c__cookingunits_no_translation_str }
+\__cookingunits_culang_def_base:nnn { pluraltest } { range } { \c__cookingunits_no_translation_str }
+\__cookingunits_culang_def_base:nnn { pluraltest } { fraction } { \c__cookingunits_no_translation_str }
+\cs_set:cpn { __cookingunits_pluraltest_normal_ \c__cookingunits_no_translation_str :N } #1
+ {
+ \fp_compare:nNnTF {#1} = { 1.0 }
+ { \bool_set_true:N } { \bool_set_false:N }
+ \l__cookingunits_cutext_use_single_bool
+ }
+\cs_set:cpn { __cookingunits_pluraltest_range_ \c__cookingunits_no_translation_str :NN } #1#2
+ {
+ \fp_compare:nNnTF {#2} = { 1.0 }
+ { \bool_set_true:N } { \bool_set_false:N }
+ \l__cookingunits_cutext_use_single_bool
+ }
+\cs_set:cpn { __cookingunits_pluraltest_fraction_ \c__cookingunits_no_translation_str :NNN } #1#2#3
+ {
+ \tl_if_empty:NTF #1
+ { \fp_compare:nNnTF {#2} = { 1.0 } } { \use_ii:nn }
+ { \bool_set_true:N } { \bool_set_false:N }
+ \l__cookingunits_cutext_use_single_bool
+ }
+\cs_new:Npn \__cookingunits_pluraltest_define:nn #1#2
+ {
+ \__cookingunits_culang_def_for:nnnn {#1} { pluraltest } { normal } {#1}
+ \cs_set:cpn { __cookingunits_pluraltest_normal_ #1 :N } ##1 {#2}
+ }
+\cs_new:Npn \__cookingunits_pluraltest_define_range:nn #1#2
+ {
+ \__cookingunits_culang_def_for:nnnn {#1} { pluraltest } { range } {#1}
+ \cs_set:cpn { __cookingunits_pluraltest_range_ #1 :NN } ##1##2 {#2}
+ }
+\cs_new:Npn \__cookingunits_pluraltest_define_fraction:nn #1#2
+ {
+ \__cookingunits_culang_def_for:nnnn {#1} { pluraltest } { fraction } {#1}
+ \cs_set:cpn { __cookingunits_pluraltest_fraction_ #1 :NNN } ##1##2##3 {#2}
+ }
+\__cookingunits_pluraltest_define:nn { French }
+ {
+ \fp_compare:nNnTF { \fp_abs:n {#1} } < { 2.0 }
+ { \bool_set_true:N } { \bool_set_false:N }
+ \l__cookingunits_cutext_use_single_bool
+ }
+\__cookingunits_pluraltest_define_range:nn { French }
+ {
+ \fp_compare:nNnTF { \fp_abs:n {#2} } < { 2.0 }
+ { \bool_set_true:N } { \bool_set_false:N }
+ \l__cookingunits_cutext_use_single_bool
+ }
+\__cookingunits_pluraltest_define_fraction:nn { French }
+ {
+ \quark_if_nil:NTF #1
+ { \fp_compare:nNnTF { #2/#3 } < { 2.0 } }
+ { \fp_compare:nNnTF { #1 + #2/#3 } < { 2.0 } }
+ { \bool_set_true:N } { \bool_set_false:N }
+ \l__cookingunits_cutext_use_single_bool
+ }
\NewDocumentCommand \cudefinesymbol { m m }
{
\tl_set:Nn \l__cookingunits_language_tl {#1}
@@ -3684,8 +3787,8 @@
{
{ kg } { kilogramme } [ kilogrammes ]
{ dag } { d\'{e}cagramme } [ d\'{e}cagrammes]
- { g } { gramme } [ gramme ]
- { oz } { once } < f >
+ { g } { gramme } [ grammes ]
+ { oz } { once } [ onces ] < f >
{ lb } { livre } [ livres ] < f >
{ d } { jour } [ jours ]
{ h } { heure } [ heures ] < f >
@@ -3704,15 +3807,15 @@
{ dl } [ dL ] { d\'{e}cilitre } [ d\'{e}cilitres ]
{ cl } [ cL ] { centilitre } [ centilitres ]
{ ml } [ mL ] { millilitre } [ millilitres ]
- { cal } { calorie } [ calorie ]
- { kcal } { kilocalorie } [ kilocalories ]
+ { cal } { calorie } [ calories ] < f >
+ { kcal } { kilocalorie } [ kilocalories ] < f >
{ J } { joule } [ joules ]
{ kJ } { kilojoule } [ kilojoules ]
{ eV } { \'{e}lectron-volt } [ \'{e}lectron-volts ]
- { pn } { pinc\'{e}e } < f >
- { EL } [c.\`{a}.s.] { cuill\`{e}re \space \`{a} \space soupe } < f >
- { TL } [c.\`{a}.c.] { cuill\`{e}re \space \`{a} \space caf\'{e} } < f >
- { decimal-mark } { . }
+ { pn } [ pinc\'{e}e ] { pinc\'{e}e } [ pinc\'{e}es ] < f >
+ { EL } [c.\`{a}.s.] { cuill\`{e}re \space \`{a} \space soupe } [ cuill\`{e}res \space \`{a} \space soupe ] < f >
+ { TL } [c.\`{a}.c.] { cuill\`{e}re \space \`{a} \space caf\'{e} } [ cuill\`{e}res \space \`{a} \space caf\'{e} ] < f >
+ { decimal-mark } { , }
{ one (m) } { un }
{ one (f) } { une }
{ one (n) } { un }