diff options
author | Norbert Preining <norbert@preining.info> | 2022-06-07 03:01:10 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-06-07 03:01:10 +0000 |
commit | 76cfdb3c84a9a4d5d06a9f785b2bed2b44098806 (patch) | |
tree | b552a509a35d1f669c9d390a0d70809bb1030571 /macros/latex | |
parent | 89e8f58007e3fa8841a95b1e3d7efeacced6aed5 (diff) |
CTAN sync 202206070301
Diffstat (limited to 'macros/latex')
16 files changed, 832 insertions, 85 deletions
diff --git a/macros/latex/contrib/cooking-units/README.md b/macros/latex/contrib/cooking-units/README.md index f5ab89dd31..5f441d3c1c 100644 --- a/macros/latex/contrib/cooking-units/README.md +++ b/macros/latex/contrib/cooking-units/README.md @@ -49,7 +49,7 @@ Supported Languages * German * English -* French (suboptimal) +* French License ------- diff --git a/macros/latex/contrib/cooking-units/cooking-units.dtx b/macros/latex/contrib/cooking-units/cooking-units.dtx index 574f2b7fcd..b953801209 100644 --- a/macros/latex/contrib/cooking-units/cooking-units.dtx +++ b/macros/latex/contrib/cooking-units/cooking-units.dtx @@ -59,7 +59,7 @@ Supported Languages * German * English -* French (suboptimal) +* French License ------- @@ -221,14 +221,21 @@ and the derived file cooking-units.sty. cudefinekeys , , cudefinekeychain , cuaddtokeychain , cudeclareunitgroup + , cookingunits_print_fraction:nnn , cookingunits_print_range:nn + , ExplSyntaxOff, ExplSyntaxOn } \NewDocumentCommand \mycs { m } { - \clist_if_in:NnTF \l_cookingunits_list_of_defined_befehlen_clist {#1} + \tl_set_rescan:Nnn \l_tmpa_tl + { + \char_set_catcode_letter:N \_ % + \char_set_catcode_letter:N \: % + } {#1} + \clist_if_in:NVTF \l_cookingunits_list_of_defined_befehlen_clist \l_tmpa_tl { - \cs_if_exist:cTF {#1} - { \cs{\textcolor{blue}{#1}} } + \cs_if_exist:cTF { \l_tmpa_tl } + { \cs{\textcolor{blue}{ \l_tmpa_tl }} } { \tl_show:n {#1}\mycsERRORII } } { \tl_show:n {#1} \mycsERROR } @@ -806,6 +813,9 @@ and the derived file cooking-units.sty. % \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}.} % +% \changes {2022/06/06} {2.01} {Correction of french language. Thanks to Alexis Jeandeau} +% \changes {2022/06/06} {2.01} {Implement a way to define the plural-finding algorithm.} +% \changes {2022/06/06} {2.01} {Add two public commands \cs{cookingunits_print_fraction:nnn} and \cs{cookingunits_print_range:nn}.} % % % @@ -859,7 +869,7 @@ and the derived file cooking-units.sty. % \begin{itemize} % \item German % \item English -% \item French (currently suboptimal\footnote{You can only get limited information from the internet.}) +% \item French % \end{itemize} % Want to contribute a new language or make a correction to an existing one? % See \cref{sec:bug-feed} for more details. Wanna just check the @@ -1066,9 +1076,9 @@ and the derived file cooking-units.sty. % % % +% \section{Good to know stuff} % -% -%\subsection{Rounding temperatures} +% \subsection{Rounding temperatures} % % % By default temperatures are rounded to integers (using \opt{round-precision=0}). @@ -1088,6 +1098,40 @@ and the derived file cooking-units.sty. % \cunum[C=K]{180}{C} \\ % \end{cuexamplecode} % +% +% \subsection{At which point is the plural used?} +% While using \cCutext\ one may wonder which rules are used in order to determine +% if the printed unit is singular or plural. If rules for a specific language are not found +% the default ruleset is used. There are currently two rule sets: One default +% and one if you are using french. +% +% Each set has three seperate rules: one for \enquote{normal} numbers, one for +% ranges and one for fractions. +% +% \subsubsection*{French} +% +% Use singular if: +% \begin{description} +% \item[normal] The absolute value of the number is smaller $2$ +% \item[fraction] The absolute value of the evaluated fraction is smaller $2$. +% (e.g.\ $1\,\sfrac{1}{2} = 1.5$ uses singular, $2\,\sfrac{3}{4} = 2.75$ uses plural). +% \item[range] The absolute value of the second number is smaller $2$. +% (e.g.\ \cuam{1--2}: Take $2$.) +% \end{description} +% +% For sources see \cite{Plural-French-Academia}, \cite{Plural-French-absolute-1} \& +% \cite{Plural-French-absolute-2}\footnote{Thanks a lot to Alexis Jeandeau! I never would +% have imagined that the french language uses the sinfular for everything smaller $2$.}. +% +% \subsubsection*{Default (all other languages)} +% +% Use singular if: +% \begin{description} +% \item[normal] The number is equal to $1$. +% \item[fraction] There is no mixed fraction part and the nominator is equal to $1$. +% \item[range] The second number is equal to $1$. (e.g.\ \cuam{1--2}: Take $2$.) +% \end{description} +% % \section{Predefined units \& some notes} % \label{sec:pred-units} % @@ -1760,7 +1804,8 @@ and the derived file cooking-units.sty. % {dl} {dL} % {cl} {cL} % {ml} {mL} -% {decimal-mark} {.} +% {cutext-range-sign} {~\`{a}~} +% {decimal-mark} {,} % {one(m)} {un} % {one(f)} {une} % {one(n)} {un} @@ -3202,6 +3247,52 @@ and the derived file cooking-units.sty. % % % +% +% +% +% \section{Public Commands} +% +% This section describes some public functions, Their main usage is the printing of +% stuff. They are primtivies used between an \mycs{ExplSyntaxOn} and +% \mycs{ExplSyntaxOff}; for usage in a document you may do the following: +% \begin{lstlisting} +% \ExplSyntaxOn +% \NewDocumentCommand \cuprintfrac { O{} m m } +% { +% \cookingunits_print_fraction:nnn {#1} {#2} {#3} +% } +% \NewDocumentCommand \cuprintrange { m m } +% { +% \cookingunits_print_range:nn {#1} {#2} +% } +% \ExplSyntaxOff +% \end{lstlisting} +% +% +% \begin{function}{\cookingunits_print_fraction:nnn} +% \begin{syntax} +% \mycs{cookingunits_print_fraction:nnn} \marg{mixed-part}\marg{numerator}\marg{denominator} +% \end{syntax} +% \emph{Note:} There is no parsing and processing done in this command, it just +% prints the input. +% +% Uses the internal fraction printing command to print a fraction. \Arg{mixed-part} +% can be empty if no mixed part is needed. +% \end{function} +% +% +% \begin{function}{\cookingunits_print_range:nn} +% \begin{syntax} +% \mycs{cookingunits_print_range:nn} \marg{left-part}\marg{right-part} +% \end{syntax} +% \emph{Note:} There is no parsing and processing done in this command, ist just +% prints the input. +% +% Uses the internal range printing command to print a range (using the same range sign as +% \mycs{cunum} would use) +% \end{function} +% +% %^^A \section{Notes} % %^^A There is a unit called \enquote{Batman}. @@ -3235,8 +3326,7 @@ and the derived file cooking-units.sty. % header). % % Furthermore, as you can see I am not able to speak too many -% languages (german and english to be precise; I managed to add french -% with the help of the internet, which is not optimal) so if you are +% languages (german and english to be precise) so if you are % able to speak a language not yet implemented and would like to help % you can send me the translations known to you. A list of all units % (and their current translations) is given in \cref{sec:Translations}. @@ -3603,8 +3693,8 @@ and the derived file cooking-units.sty. % \begin{macrocode} \ProvidesExplPackage {cooking-units} - {2022/03/26} - {2.00a} + {2022/06/06} + {2.01} {Ein Paket fuer Kocheinheiten} % \end{macrocode} % @@ -4149,7 +4239,7 @@ and the derived file cooking-units.sty. % , \l_@@_pckopt_print_numeral_bool % , \l_@@_lokal_numeral_bool % , \l_@@_phrase_negative_bool -% , \l_@@_cutext_last_amount_equ_one_bool +% , \l_@@_cutext_use_single_bool % , \l_@@_symbol_was_set_by_key_bool % , \l_@@_contains_valid_key_bool % , \l_@@_check_decimal_bool @@ -4184,7 +4274,7 @@ and the derived file cooking-units.sty. \bool_new:N \l_@@_pckopt_print_numeral_bool \bool_new:N \l_@@_lokal_numeral_bool \bool_new:N \l_@@_phrase_negative_bool -\bool_new:N \l_@@_cutext_last_amount_equ_one_bool +\bool_new:N \l_@@_cutext_use_single_bool \bool_new:N \l_@@_symbol_was_set_by_key_bool \bool_new:N \l_@@_contains_valid_key_bool \bool_new:N \l_@@_check_decimal_bool @@ -6579,6 +6669,7 @@ and the derived file cooking-units.sty. \@@_culang_def_base:nnn { name } { decimal-mark } { . } \@@_culang_def_base:nnn { name-pl } { decimal-mark } { \c_@@_no_translation_str } \@@_culang_def_for:nnnn { German } { name-pl } { decimal-mark } { , } +\@@_culang_def_for:nnnn { French } { name-pl } { decimal-mark } { , } % \end{macrocode} % Note that the plural versions just exist for completing the set. % \begin{macrocode} @@ -6599,12 +6690,18 @@ and the derived file cooking-units.sty. \@@_culang_def_for:nnnn { German } { name } { one (f) } { eine } \@@_culang_def_for:nnnn { German } { name } { one (n) } { ein } % \end{macrocode} +% \begin{macrocode} +\@@_culang_def_for:nnnn { French } { name } { one (m) } { un } +\@@_culang_def_for:nnnn { French } { name } { one (f) } { une } +\@@_culang_def_for:nnnn { French } { name } { one (n) } { un } +% \end{macrocode} % % \begin{macrocode} \@@_culang_def_base:nnn { name } { cutext-range-sign } { -- } \@@_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~ } +\@@_culang_def_for:nnnn { French } { name } { cutext-range-sign } { ~\`{a}~ } % \end{macrocode} % % @@ -6754,7 +6851,7 @@ and the derived file cooking-units.sty. { \bool_if:NT \l_@@_pckopt_cutext_to_cunum_bool { \@@_set_cmd_type_to:n { cunum } } - \bool_set_false:N \l_@@_cutext_last_amount_equ_one_bool + \bool_set_false:N \l_@@_cutext_use_single_bool } % \end{macrocode} % \end{macro} @@ -7030,12 +7127,17 @@ and the derived file cooking-units.sty. \l_@@_mixed_fraction_tl \l_@@_number_tmpa_tl \l_@@_number_tmpb_tl - \@@_if_print_type_equal:nT { number } + \@@_if_print_type_equal:nTF { number } { \@@_convert_fraction_to_number_in_input:NNN \l_@@_mixed_fraction_tl \l_@@_number_tmpa_tl \l_@@_number_tmpb_tl + }{ + \@@_post_process_fraction_accordingly:NNN + \l_@@_mixed_fraction_tl + \l_@@_number_tmpa_tl + \l_@@_number_tmpb_tl } } % \end{macrocode} @@ -7226,6 +7328,24 @@ and the derived file cooking-units.sty. % \end{macrocode} % \end{macro} % +% \begin{macro}{ \@@_post_process_fraction_accordingly:NNN } +% Decided to make this into its own command. This post processes fractions +% which is only needed by \cCutext. +% \begin{macrocode} +\cs_new:Npn \@@_post_process_fraction_accordingly:NNN #1#2#3 + { + \tl_case:NnF \l_@@_cmd_type_tl + { + \c_@@_cmd_type_cunum_tl { } + \c_@@_cmd_type_cCutext_tl { \@@_cutext_post_process_fraction_input:NNN #1#2#3 } + \c_@@_cmd_type_cuam_tl { } + }{ + \@@_create_internal_error:nN { post-process-frac } \l_@@_cmd_type_tl + } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{ \@@_print_numerical_input:N } % The base printing command for numbers. Makes sure the minus sign % and decimal-mark are correct. @@ -7970,7 +8090,7 @@ and the derived file cooking-units.sty. \bool_if:NTF \l_@@_lokal_numeral_bool { \l_@@_cutext_numeral_space_tl } { \l_@@_cutext_space_tl } - \bool_if:NTF \l_@@_cutext_last_amount_equ_one_bool + \bool_if:NTF \l_@@_cutext_use_single_bool { \@@_culang_print:nV { name } \l_@@_decided_unit_tl } { \@@_culang_print:nV { name-pl } \l_@@_decided_unit_tl } } @@ -8019,8 +8139,15 @@ and the derived file cooking-units.sty. \cs_new:Npn \@@_cutext_post_process_input:NN #1#2 { \@@_if_parse_and_process_type_equal:nTF { range } - { \@@_cutext_check_if_amount_single:N #2 } - { \@@_cutext_check_if_amount_single:N #1 } + { + \@@_culang_let:nnN { pluraltest } { range } \l_@@_translation_tmpa_tl + \use:c { @@_pluraltest_range_ \l_@@_translation_tmpa_tl :NN } #1#2 +% \@@_cutext_check_if_plural_is_needed:N #2 + }{ + \@@_culang_let:nnN { pluraltest } { normal } \l_@@_translation_tmpa_tl + \use:c { @@_pluraltest_normal_ \l_@@_translation_tmpa_tl :N } #1 +% \@@_cutext_check_if_plural_is_needed:N #1 + } \bool_if:NT \l_@@_lokal_numeral_bool { \@@_if_contain_decimals:NNTF #1#2 @@ -8030,18 +8157,29 @@ and the derived file cooking-units.sty. } % \end{macrocode} % \end{macro} -% \begin{macro} { \@@_cutext_check_if_amount_single:N } -% Check if the input is equal to |#1|. Use fp as it is not necessary an integer. -% Set the boolean according to the result. +% \begin{macro} { \@@_cutext_post_process_fraction_input:NNN } % \begin{macrocode} -\cs_new:Npn \@@_cutext_check_if_amount_single:N #1 +\cs_new:Npn \@@_cutext_post_process_fraction_input:NNN #1#2#3 { - \fp_compare:nNnTF {#1} = { 1.0 } - { \bool_set_true:N } { \bool_set_false:N } - \l_@@_cutext_last_amount_equ_one_bool + \@@_culang_let:nnN { pluraltest } { fraction } \l_@@_translation_tmpa_tl + \use:c { @@_pluraltest_fraction_ \l_@@_translation_tmpa_tl :NNN } #1#2#3 } % \end{macrocode} % \end{macro} +% \begin{macro} { \@@_cutext_check_if_plural_is_needed:N } +% Check if the input is equal to |#1|. Use fp as it is not necessary an integer. +% Set the boolean according to the result. +% \begin{macrocode} +%\cs_new:Npn \@@_cutext_check_if_plural_is_needed:N #1 +% { +% \fp_compare:nNnTF {#1} = { 1.0 } +% { \bool_set_true:N } { \bool_set_false:N } +% \l_@@_cutext_use_single_bool +% } +% \end{macrocode} +% \end{macro} +% +% % \begin{macro} { \@@_check_if_integer_can_be_numerals:NN } % At this point we know that we have integers, so check if they are % below |\l_@@_print_numerals_below_int|. If they are, fine. Else, @@ -8128,7 +8266,7 @@ and the derived file cooking-units.sty. % % % Just a helper macro to tidy up the main macro. The first thing to -% do is to check if the nummerical input consits of integers. This +% do is to check if the numerical input consits of integers. This % is done both both numerical values (if a range exists). % Afterwards check if phrases are used and can be used at all. This needs % to be done before the numeral check as it can change the input. @@ -8293,6 +8431,40 @@ and the derived file cooking-units.sty. % % % +% +% \subsection{Public Primitives} +% +% Two public commands. +% \begin{macro}{ \cookingunits_print_fraction:nnn } +% \begin{macrocode} +\cs_new:Npn \cookingunits_print_fraction:nnn #1#2#3 + { + \group_begin: + \@@_set_amount:Nn \l_@@_mixed_fraction_tl {#1} + \@@_set_amount:Nn \l_@@_number_tmpa_tl {#2} + \@@_set_amount:Nn \l_@@_number_tmpb_tl {#3} + \@@_print_fractions:Nnn + \l_@@_mixed_fraction_tl + \l_@@_number_tmpa_tl + \l_@@_number_tmpb_tl + \group_end: + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{ \cookingunits_print_range:nn } +% \begin{macrocode} +\cs_new:Npn \cookingunits_print_range:nn #1#2 + { + \group_begin: + \@@_set_cmd_type_to:n { cunum } + #1 + \@@_print_range_sign: + #2 + \group_end: + } +% \end{macrocode} +% \end{macro} +% % \subsection{\mycs{cucomp}} % % @@ -9511,6 +9683,101 @@ and the derived file cooking-units.sty. % \end{macrocode} % \end{macro} % +% +% \subsection {Define plural-usage for \cCutext} +% +% \begin{macro}{ pluraltest: normal/range/fraction } +% Some translations used in a second. Define one for \enquote{normal} +% (just a number), \enquote{range} and \enquote{fraction}. +% \begin{macrocode} +\@@_culang_def_base:nnn { pluraltest } { normal } { \c_@@_no_translation_str } +\@@_culang_def_base:nnn { pluraltest } { range } { \c_@@_no_translation_str } +\@@_culang_def_base:nnn { pluraltest } { fraction } { \c_@@_no_translation_str } +% \end{macrocode} +% \end{macro} +% \begin{macro}{ @@_pluraltest_normal_<default>:N, +% @@_pluraltest_range_<default>:NN, +% @@_pluraltest_fraction_<default>:NNN } +% Here we define the default behavior, if no explicit rule is given for a language. +% By default, use the singular only if the value in question is equal to $1$. +% For ranges take the last value, for fractions make sure there are no mixed fractions +% and that the nominator is equal to $1$. +% \begin{macrocode} +\cs_set:cpn { @@_pluraltest_normal_ \c_@@_no_translation_str :N } #1 + { + \fp_compare:nNnTF {#1} = { 1.0 } + { \bool_set_true:N } { \bool_set_false:N } + \l_@@_cutext_use_single_bool + } +\cs_set:cpn { @@_pluraltest_range_ \c_@@_no_translation_str :NN } #1#2 + { + \fp_compare:nNnTF {#2} = { 1.0 } + { \bool_set_true:N } { \bool_set_false:N } + \l_@@_cutext_use_single_bool + } +\cs_set:cpn { @@_pluraltest_fraction_ \c_@@_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_@@_cutext_use_single_bool + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{ \@@_pluraltest_define:nn , \@@_pluraltest_define_range:nn , \@@_pluraltest_define_fraction:nn } +% Allow to define a when to use the singular/plural for a given language. +% Nothing more happens here. The default was already defined in the last step. +% \begin{macrocode} +\cs_new:Npn \@@_pluraltest_define:nn #1#2 + { + \@@_culang_def_for:nnnn {#1} { pluraltest } { normal } {#1} + \cs_set:cpn { @@_pluraltest_normal_ #1 :N } ##1 {#2} + } +\cs_new:Npn \@@_pluraltest_define_range:nn #1#2 + { + \@@_culang_def_for:nnnn {#1} { pluraltest } { range } {#1} + \cs_set:cpn { @@_pluraltest_range_ #1 :NN } ##1##2 {#2} + } +\cs_new:Npn \@@_pluraltest_define_fraction:nn #1#2 + { + \@@_culang_def_for:nnnn {#1} { pluraltest } { fraction } {#1} + \cs_set:cpn { @@_pluraltest_fraction_ #1 :NNN } ##1##2##3 {#2} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{ Pluraltest: French } +% As source see +% \begin{itemize} +% \item \url{https://github.com/Vidabe/cooking-units/pull/29#issue-1190629683} +% \item \url{https://www.dictionnaire-academie.fr/article/A9P2979} +% \end{itemize} +% Note: At this point the minus signs were already removed from fractions; thus +% all their values are positive. +% \begin{macrocode} +\@@_pluraltest_define:nn { French } + { + \fp_compare:nNnTF { \fp_abs:n {#1} } < { 2.0 } + { \bool_set_true:N } { \bool_set_false:N } + \l_@@_cutext_use_single_bool + } +\@@_pluraltest_define_range:nn { French } + { + \fp_compare:nNnTF { \fp_abs:n {#2} } < { 2.0 } + { \bool_set_true:N } { \bool_set_false:N } + \l_@@_cutext_use_single_bool + } +\@@_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_@@_cutext_use_single_bool + } +% \end{macrocode} +% \end{macro} +% +% % \subsection {cudefinesymbol} % % \begin{macro}{ \cudefinesymbol } @@ -10290,8 +10557,8 @@ and the derived file cooking-units.sty. { { 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 > % \end{macrocode} % \begin{macrocode} @@ -10320,19 +10587,19 @@ and the derived file cooking-units.sty. { ml } [ mL ] { millilitre } [ millilitres ] % \end{macrocode} % \begin{macrocode} - { 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 ] % \end{macrocode} % \begin{macrocode} - { 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 > + { 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 > % \end{macrocode} % \begin{macrocode} - { decimal-mark } { . } + { decimal-mark } { , } { one (m) } { un } { one (f) } { une } { one (n) } { un } @@ -10524,6 +10791,20 @@ and the derived file cooking-units.sty. % % \bibitem{StickSource} \url{https://cooking.stackexchange.com/questions/784/translating-cooking-terms-between-us-uk-au-ca-nz} % +% \bibitem{Plural-French-Academia} +% Dictionnaire de l’Académie française. +% \url{https://www.dictionnaire-academie.fr/article/A9P2979} +% [Last checked: 2022-05-29] +% +% \bibitem{Plural-French-absolute-1} +% \url{https://www.antidote.info/fr/blogue/enquetes/15-gramme-ou-15-grammes} +% [Last checked: 2022-05-29] +% +% \bibitem{Plural-French-absolute-2} +% \url{https://french.stackexchange.com/q/1975} +% [Last checked: 2022-05-29] +% +% % \end{thebibliography} % % diff --git a/macros/latex/contrib/cooking-units/cooking-units.pdf b/macros/latex/contrib/cooking-units/cooking-units.pdf Binary files differindex d4b06cbb01..7360d46430 100644 --- a/macros/latex/contrib/cooking-units/cooking-units.pdf +++ b/macros/latex/contrib/cooking-units/cooking-units.pdf diff --git a/macros/latex/contrib/fancyvrb/Changes b/macros/latex/contrib/fancyvrb/Changes index 074b484b11..b1d30e7272 100644 --- a/macros/latex/contrib/fancyvrb/Changes +++ b/macros/latex/contrib/fancyvrb/Changes @@ -1,4 +1,5 @@ --- fancyvrb.sty +4.5 2022/06/06 - added \noniterlineskip for frame=lines (hv) 4.4 2022/06/03 - fix for deleted \@penalty command _before_ top rule(hv) 4.3 2022/06/02 - prevent pagebreak after top rule (hv) 4.2a 2022/05/26 - updated documentation (hv) diff --git a/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.pdf b/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.pdf Binary files differindex 90fee99809..6adf3fd955 100644 --- a/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.pdf +++ b/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.pdf diff --git a/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.tex b/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.tex index 5fc2080267..75f426ae81 100644 --- a/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.tex +++ b/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.tex @@ -226,9 +226,9 @@ case... \begin{SideBySideExample} \begin{Verbatim}[commentchar=\%] - First line. % First line - Second. - Third line. % Third line lost... + First line. % First line + Second. + Third line. % Third line lost... \end{Verbatim} \end{SideBySideExample} diff --git a/macros/latex/contrib/fancyvrb/latex/fancyvrb.sty b/macros/latex/contrib/fancyvrb/latex/fancyvrb.sty index c7a30b7189..d5dce763a5 100644 --- a/macros/latex/contrib/fancyvrb/latex/fancyvrb.sty +++ b/macros/latex/contrib/fancyvrb/latex/fancyvrb.sty @@ -13,8 +13,8 @@ %% verbatim environments and commands and extensive documentation. %% \NeedsTeXFormat{LaTeX2e} -\def\fileversion{4.4} -\def\filedate{2022/06/03} +\def\fileversion{4.5} +\def\filedate{2022/06/06} \ProvidesPackage{fancyvrb}[\filedate\space \fileversion\space verbatim text (tvz,hv)] %\message{Style option: `fancyvrb' v\fileversion \space <\filedate> (tvz)} \csname fancyvrb@loaded\endcsname @@ -911,7 +911,8 @@ \begingroup \lineskip\z@skip \FV@SingleFrameLine{\z@}% - \kern-0.5\baselineskip\relax +% \kern-0.5\baselineskip\relax %% 20220604 (hv) + \nointerlineskip %% added 20220604 (hv) \baselineskip\z@skip \kern\FV@FrameSep\relax \penalty\@M% prevent a pagebreak _after_ the line 20220602 (hv) @@ -920,6 +921,7 @@ \begingroup \baselineskip\z@skip \kern\FV@FrameSep\relax + \nointerlineskip %% added 20220604 (hv) \penalty\@M% prevent a pagebreak _before_ the line 20220602 (hv) \FV@SingleFrameLine{\@ne}% \endgroup} diff --git a/macros/latex/contrib/hvextern/Changes b/macros/latex/contrib/hvextern/Changes index 80d21ff63d..381e9db727 100644 --- a/macros/latex/contrib/hvextern/Changes +++ b/macros/latex/contrib/hvextern/Changes @@ -1,5 +1,7 @@ hvextern.sty ---------------- +v 0.29 2022-06-06 - use skin "enhanced jigsaw" for tcolorbox + - output -> showoutput v 0.28 2022-06-01 - added option output - added macro \defMarkerType for own marker setting (is only a link to the internal macro \hv@extern@ExampleType) diff --git a/macros/latex/contrib/hvextern/doc/hvextern.pdf b/macros/latex/contrib/hvextern/doc/hvextern.pdf Binary files differindex 92deac3a7c..d5c1bb8ef9 100644 --- a/macros/latex/contrib/hvextern/doc/hvextern.pdf +++ b/macros/latex/contrib/hvextern/doc/hvextern.pdf diff --git a/macros/latex/contrib/hvextern/doc/hvextern.tex b/macros/latex/contrib/hvextern/doc/hvextern.tex index 1d1bd0fd42..22c26b7669 100644 --- a/macros/latex/contrib/hvextern/doc/hvextern.tex +++ b/macros/latex/contrib/hvextern/doc/hvextern.tex @@ -1,4 +1,4 @@ -%% $Id: hvextern.tex 562 2022-06-01 15:37:46Z herbert $ +%% $Id: hvextern.tex 570 2022-06-06 05:40:08Z herbert $ \RequirePackage{pdfmanagement-testphase} \DeclareDocumentMetadata{} \documentclass[ngerman,a4paper,twoside]{article} @@ -1467,11 +1467,11 @@ it makes no difference using the optional argument \Lkeyword{usefancyvrb} or not \subsection{No output} By default there is an image or text as output of the external run. In a case, where you are only interested in the code, which should be formatted in the same style as -other examples, you can set \Lkeyword{output} to false. +other examples, you can set \Lkeyword{showoutput} to false. \begin{externalDocument}[ - output=false, + showoutput=false, frame,compiler=pdflatex, crop, force,runs=2,code,docType=latex, @@ -1550,7 +1550,7 @@ Whith this definition and the setting \Lkeyset{docType=ltx} the last example loo frame, compiler=pdflatex, showFilename, - force=true, + force=false, runs=2,code,docType=ltx, usefancyvrb]{voss} \documentclass[chapterprefix=on,parskip=half-,DIV=12,fontsize=12pt]{scrreprt} @@ -1803,6 +1803,9 @@ foo \end{externalDocument} +\addtocontents{toc}{\protect\newpage} + + \section{Running external commands} Integrating the current directory of this document we can use the macro \Lcs{runExtCmd} with the optional argument \Lkeyword{redirect} diff --git a/macros/latex/contrib/hvextern/latex/hvextern.sty b/macros/latex/contrib/hvextern/latex/hvextern.sty index 62c61d549e..369a46df2a 100644 --- a/macros/latex/contrib/hvextern/latex/hvextern.sty +++ b/macros/latex/contrib/hvextern/latex/hvextern.sty @@ -1,4 +1,4 @@ -%% $Id: hvextern.sty 562 2022-06-01 15:37:46Z herbert $ +%% $Id: hvextern.sty 570 2022-06-06 05:40:08Z herbert $ %% This is file `hvextern.sty', %% %% Copyright (C) 2016-22 @@ -12,8 +12,8 @@ %% and version 1.3c or later is part of all distributions of LaTeX %% version 2005/12/01 or later. -\def\hvexternFileversion{0.28} -\ProvidesFile{hvextern}[2022/06/01 v\hvexternFileversion: package for running external documents (HV)] +\def\hvexternFileversion{0.29} +\ProvidesFile{hvextern}[2022/06/06 v\hvexternFileversion: package for running external documents (HV)] \RequirePackage{shellesc,xkeyval,graphicx} \RequirePackage{fancyvrb,tikz,listings,ifplatform} @@ -87,7 +87,7 @@ \define@boolkey{hv}[hv@extern@]{xindex}[true]{} \define@key{hv}{xindexOptions}[]{\def\hv@extern@xindexOptions{#1}} \define@boolkey{hv}[hv@extern@]{includegraphic}[true]{} -\define@boolkey{hv}[hv@extern@]{output}[true]{} +\define@boolkey{hv}[hv@extern@]{showoutput}[true]{} \define@boolkey{hv}[hv@extern@]{inline}[true]{\hv@extern@codefalse\hv@extern@showFilenamefalse} \define@boolkey{hv}[hv@extern@]{frame}[true]{} \define@key{hv}{framesep}[\the\fboxsep]{\setlength\hv@extern@framesep{#1}} @@ -141,7 +141,7 @@ BGbody=black!8,% Backgroundcolor for body BOpreamble=black!12,% Bodercolor for preamble BObody=black!8,% Bodercolor for body - output=true,% with false only code is shown + showoutput=true,% with false only code is shown includegraphic=true,% Grafik einbinden oder User überlassen inline=false,% Grafik nicht in derselben Zeile runs=1,% Anzahl Compiler-Durchläufe @@ -248,7 +248,7 @@ \newcommand\PreambleVerbatim[2][]{% \hv@ex@typeout{Running PreambleVerbatim with #1, #2}% \ifhv@extern@tcbox - \begin{tcolorbox}[before skip=0pt,after skip=0pt]\VerbatimInput[#1]{#2}\end{tcolorbox}% + \begin{tcolorbox}[before skip=0pt,after skip=0pt,breakable,enhanced jigsaw]\VerbatimInput[#1]{#2}\end{tcolorbox}% \else \VerbatimInput[#1]{#2}% \fi} @@ -256,7 +256,7 @@ \newcommand\BodyVerbatim[2][]{% \hv@ex@typeout{Running BodyVerbatim with #1, #2}% \ifhv@extern@tcbox - \begin{tcolorbox}[before skip=0pt,after skip=0pt]\VerbatimInput[#1]{#2}\end{tcolorbox}% + \begin{tcolorbox}[before skip=0pt,after skip=0pt,breakable,enhanced jigsaw]\VerbatimInput[#1]{#2}\end{tcolorbox}% \else \VerbatimInput[#1]{#2}% \fi} @@ -264,7 +264,7 @@ \newcommand\PreambleListing[2][]{% \hv@ex@typeout{Running PreambleListing with #1, #2}% \ifhv@extern@tcbox - \begin{tcolorbox}[before skip=0pt,after skip=0pt%,top=-2pt + \begin{tcolorbox}[before skip=0pt,after skip=0pt,breakable,enhanced jigsaw%,top=-2pt ]\expandafter\lstinputlisting\expandafter[#1,aboveskip=0pt,belowskip=0pt]{#2}\end{tcolorbox}% \else \expandafter\lstinputlisting\expandafter[#1,aboveskip=0pt,belowskip=0pt]{#2}% @@ -273,7 +273,7 @@ \newcommand\BodyListing[2][]{% \hv@ex@typeout{Running BodyListing with #1, #2}% \ifhv@extern@tcbox - \begin{tcolorbox}[before skip=0pt,after skip=0pt,%top=-2pt + \begin{tcolorbox}[before skip=0pt,after skip=0pt,breakable,enhanced jigsaw,%top=-2pt ]\expandafter\lstinputlisting\expandafter[#1,aboveskip=0pt,belowskip=0pt]{#2}\end{tcolorbox}% \else \expandafter\lstinputlisting\expandafter[#1,aboveskip=0pt,belowskip=0pt]{#2}% @@ -545,7 +545,7 @@ \hv@ex@typeout{\hvExternDateiname ----> \hv@extern@ExamplesDir}% \ShellEscape{\hv@move \hvExternDateiname.*\space \hv@extern@ExamplesDir}% \fi - \ifhv@extern@output + \ifhv@extern@showoutput \ifhv@extern@includegraphic \ifhv@extern@inline \expandafter\includegraphics\expandafter[\hv@extern@grfOptions]{\hv@extern@fullPath}% @@ -607,7 +607,7 @@ \fi \fi \fi - \fi% end of \ifoutput + \fi% end of \ifshowoutput \ifhv@extern@force\expandafter\run@hv@extern@cleanup\expandafter{\hv@extern@cleanup}\fi% cleanup \vspace{\hv@extern@belowskip}% } @@ -624,8 +624,8 @@ \ShellEscape{\hv@extern@progpath#2}% \fi \global\stepcounter{hv@example@counter}% - %------------------------------------- output ----------------------------------- - \ifhv@extern@output + %------------------------------------- showoutput ----------------------------------- + \ifhv@extern@showoutput \ifhv@extern@includegraphic \ifhv@extern@inline \expandafter\includegraphics\expandafter[\hv@extern@grfOptions]{\hv@extern@ExamplesDir\hvExternDateiname}% @@ -680,7 +680,7 @@ \fi \fi \fi - \fi% end \ifoutput + \fi% end \ifshowoutput \ifhv@extern@force\expandafter\run@hv@extern@cleanup\expandafter{\hv@extern@cleanup}\fi% cleanup \endgroup } diff --git a/macros/latex/required/babel/base/README.md b/macros/latex/required/babel/base/README.md index 2342ebae59..6b2fb1b240 100644 --- a/macros/latex/required/babel/base/README.md +++ b/macros/latex/required/babel/base/README.md @@ -1,4 +1,4 @@ -## Babel 3.75 +## Babel 3.76 This package manages culturally-determined typographical (and other) rules, and hyphenation patterns for a wide range of languages. Many @@ -8,9 +8,9 @@ is a set of ini files for about 250 languages. The latest stable version is available on <https://ctan.org/pkg/babel>. -Changes in version 3.75 are described in: +Changes in version 3.76 are described in: -https://latex3.github.io/babel/news/whats-new-in-babel-3.75.html +https://latex3.github.io/babel/news/whats-new-in-babel-3.76.html Apart from the manual, you can find information on some aspects of babel at: @@ -46,20 +46,13 @@ respective authors. ### Summary of latest changes ``` -3.75 2022-05-22 - * `\BabelEnsureInfo` is active by default, to make sure the BCP 47 - codes are always available, as they may be required by the - LaTeX kernel. - * `\localeinfo*` is like `\localeinfo` but expands to empty if - unknown (fully expandable). - * The key `character`/`ranges` in `ini` files now sets the - corresponding Unicode script ranges (as used by `onchar`). - * Fixes: - - Misplaced rule un diagbox (#43) - - Caption names of 'chapter' and 'part' swapped in Chinese (#180). - - Captions after numbers in Lithuanian. - - `hyphenrules` in the `ini` files for `en-AU` and - `en-NZ` where set to `english` instead of `ukenglish`. +3.76 2022-06-06 + * Calendar conversion with a new macro \babelcalendar: hebrew, + islamic-civil, islamic-umalqura, persian. + * Added 6 locales for Arabic: Egypt, Iraq, Jordan, Lebanon, + Palestinian Territories, Tunisia. + * More updates to CLDR 4.1: French, English, Moldavian and + Arabic. ``` ### Previous changes diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx index 6bc32b0c7b..4d1fec7dcd 100644 --- a/macros/latex/required/babel/base/babel.dtx +++ b/macros/latex/required/babel/base/babel.dtx @@ -32,7 +32,7 @@ % % \iffalse %<*filedriver> -\ProvidesFile{babel.dtx}[2022/05/22 v3.75 The Babel package] +\ProvidesFile{babel.dtx}[2022/06/06 v3.76 The Babel package] \documentclass{ltxdoc} \GetFileInfo{babel.dtx} \usepackage{fontspec} @@ -2850,7 +2850,7 @@ date corresponding to the Gregorian calendar and other lunisolar systems with the following command. \Describe{\localedate}{\oarg{calendar=.., variant=..}% - {\marg{year}\m{month}\m{day}}} + {\marg{year}\marg{month}\marg{day}}} By default the calendar is the Gregorian, but an |ini| file may define strings for other calendars (currently |ar|, |ar-|*, |he|, |fa|, |hi|). @@ -2863,6 +2863,20 @@ Even with a certain calendar there may be variants. In Kurmanji the default variant prints something like \textit{30. Çileya Pêşîn 2019}, but with |variant=izafa| it prints \textit{31’ê Çileya Pêşînê 2019}. +\Describe{\babelcalendar}{\oarg{date}% + \marg{calendar}\marg{year-macro}\m{month-macro}\m{day-macro}} + +\New{3.76} Although calendars aren’t the primary concern of \babel, the +package should be able to, at least, generate correctly the current +date in the way users would expect in their own culture. Currently, +|\localedate| can print dates in a few calendars (provided the +\textsf{ini} locale file has been imported), but year, month and day +had to be entered by hand, which is very inconvenient. With this macro, +the current date is converted and stored in the three last arguments, +which must be macros. The optional argument converts the given date, in +the form ‘\m{year}-\m{month}-\m{day}’. Please, refer to the page on the +news for 3.76 in the \babel{} site for further details. + \subsection{Accessing language info} \Describe{\languagename}{} @@ -5143,8 +5157,8 @@ help from Bernd Raichle, for which I am grateful. % \section{Tools} % % \begin{macrocode} -%<<version=3.75>> -%<<date=2022/05/22>> +%<<version=3.76>> +%<<date=2022/06/06>> % \end{macrocode} % % \textbf{Do not use the following macros in \texttt{ldf} files. They @@ -9682,6 +9696,7 @@ help from Bernd Raichle, for which I am grateful. \let\bbl@KVP@Alph\@nil \let\bbl@KVP@labels\@nil \bbl@csarg\let{KVP@labels*}\@nil + \let\bbl@calendars\@empty \global\let\bbl@inidata\@empty \global\let\bbl@extend@ini\@gobble \gdef\bbl@key@list{;}% @@ -10018,6 +10033,14 @@ help from Bernd Raichle, for which I am grateful. \let\atcatcode\relax \global\bbl@csarg\let{rqtex@\languagename}\relax \fi}% + \bbl@foreach\bbl@calendars{% + \bbl@ifunset{bbl@ca@##1}{% + \chardef\atcatcode=\catcode`\@ + \catcode`\@=11\relax + \InputIfFileExists{babel-ca-##1.tex}{}{}% + \catcode`\@=\atcatcode + \let\atcatcode\relax}% + {}}% \fi % == frenchspacing == \ifcase\bbl@howloaded\in@true\else\in@false\fi @@ -10281,7 +10304,9 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@section{##1}% \in@{=date.}{=##1}% Find a better place \ifin@ - \bbl@ini@calendar{##1}% + \bbl@ifunset{bbl@inikv@##1}% + {\bbl@ini@calendar{##1}}% + {}% \fi \in@{=identification/extension.}{=##1/##2}% \ifin@ @@ -10325,7 +10350,7 @@ help from Bernd Raichle, for which I am grateful. \bbl@endcommands} % \end{macrocode} % -% A somewhat hackish tool to handle calendar sections. To be improved. +% A somewhat hackish tool to handle calendar sections. TODO. To be improved. % % \begin{macrocode} \def\bbl@ini@calendar#1{% @@ -10342,6 +10367,9 @@ help from Bernd Raichle, for which I am grateful. \fi \ifx\bbl@tempa\relax\else \bbl@replace\bbl@tempa{=}{}% + \ifx\bbl@tempa\@empty\else + \xdef\bbl@calendars{,\bbl@tempa}% + \fi \bbl@exp{% \def\<bbl@inikv@#1>####1####2{% \\\bbl@inidate####1...\relax{####2}{\bbl@tempa}}}% @@ -10753,6 +10781,8 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macrocode} \let\bbl@calendar\@empty +\newcommand\babelcalendar[2][\the\year-\the\month-\the\day]{% + \@nameuse{bbl@ca@#2}#1\@@} \newcommand\BabelDateSpace{\nobreakspace} \newcommand\BabelDateDot{.\@} % TODO. \let instead of repeating \newcommand\BabelDated[1]{{\number#1}} @@ -22685,6 +22715,438 @@ Babel.cjk_breaks = { %</nil> % \end{macrocode} % +% \section{Calendars} +% +% The code for specific calendars are placed in the +% specific files, loaded when requested by an |ini| file in the +% |identification| section with |require.calendars|. +% +% \subsection{Islamic} +% +% Start with function to compute the Julian day. It’s based on the +% little library |calendar.js|, by John Walker, in the public domain. +% The code for the Civil calendar is based on it, too. +% +% \begin{macrocode} +%<*ca-islamic> +\ExplSyntaxOn +\def\bbl@fpmod#1#2{(#1-#2*floor(#1/#2))} +\def\bbl@cs@gregleap#1{% + (\bbl@fpmod{#1}{4} == 0) && + (!((\bbl@fpmod{#1}{100} == 0) && (\bbl@fpmod{#1}{400} != 0)))} +\def\bbl@ca@jd#1#2#3{% year, month, day + \fp_eval:n{ 1721424.5 + (365 * (#1 - 1)) + + floor((#1 - 1) / 4) + (-floor((#1 - 1) / 100)) + + floor((#1 - 1) / 400) + floor((((367 * #2) - 362) / 12) + + ((#2 <= 2) ? 0 : (\bbl@cs@gregleap{#1} ? -1 : -2)) + #3) }} +% == islamic (default) +% Not yet implemented +\def\bbl@ca@islamic#1-#2-#3\@@#4#5#6{} +% \end{macrocode} +% +% The Civil calendar. +% +% \begin{macrocode} +\def\bbl@cs@isltojd#1#2#3{ % year, month, day + ((#3 + ceil(29.5 * (#2 - 1)) + + (#1 - 1) * 354 + floor((3 + (11 * #1)) / 30) + + 1948439.5) - 1) } +\@namedef{bbl@ca@islamic-civil++}{\bbl@ca@islamicvl@x{+2}} +\@namedef{bbl@ca@islamic-civil+}{\bbl@ca@islamicvl@x{+1}} +\@namedef{bbl@ca@islamic-civil}{\bbl@ca@islamicvl@x{}} +\@namedef{bbl@ca@islamic-civil-}{\bbl@ca@islamicvl@x{-1}} +\@namedef{bbl@ca@islamic-civil--}{\bbl@ca@islamicvl@x{-2}} +\def\bbl@ca@islamicvl@x#1#2-#3-#4\@@#5#6#7{% + \edef\bbl@tempa{% + \fp_eval:n{ floor(\bbl@ca@jd{#2}{#3}{#4})+0.5 #1}}% + \edef#5{% + \fp_eval:n{ floor(((30*(\bbl@tempa-1948439.5)) + 10646)/10631) }}% + \edef#6{\fp_eval:n{ + min(12,ceil((\bbl@tempa-(29+\bbl@cs@isltojd{#5}{1}{1}))/29.5)+1) }}% + \edef#7{\fp_eval:n{ \bbl@tempa - \bbl@cs@isltojd{#5}{#6}{1} + 1} }} +% \end{macrocode} +% +% The Umm al-Qura calendar, used mainly in Saudi Arabia, is based +% on \textsf{moment-hijri}, by Abdullah Alsigar (license MIT). +% +% Since the main aim is to provide a suitable |\today|, and maybe some +% close dates, data just covers Hijri $\sim$1435/$\sim$1460 (Gregorian +% $\sim$2014/$\sim$2038). +% +% \begin{macrocode} +\def\bbl@ca@umalqura@data{56660, 56690,56719,56749,56778,56808,% + 56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,% + 57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,% + 57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,% + 57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,% + 58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,% + 58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,% + 58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,% + 58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,% + 59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,% + 59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,% + 59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,% + 60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,% + 60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,% + 60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,% + 60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,% + 61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,% + 61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,% + 61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,% + 62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,% + 62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,% + 62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,% + 63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,% + 63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,% + 63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,% + 63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,% + 64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,% + 64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,% + 64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,% + 65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,% + 65401,65431,65460,65490,65520} +\@namedef{bbl@ca@islamic-umalqura+}{\bbl@ca@islamcuqr@x{+1}} +\@namedef{bbl@ca@islamic-umalqura}{\bbl@ca@islamcuqr@x{}} +\@namedef{bbl@ca@islamic-umalqura-}{\bbl@ca@islamcuqr@x{-1}} +\def\bbl@ca@islamcuqr@x#1#2-#3-#4\@@#5#6#7{% + \ifnum#2>2014 \ifnum#2<2038 + \bbl@afterfi\expandafter\@gobble + \fi\fi + {\bbl@error{Year~out~of~range}{The~allowed~range~is~2014-2038}}% + \edef\bbl@tempd{\fp_eval:n{ % (Julian) day + \bbl@ca@jd{#2}{#3}{#4} + 0.5 - 2400000 #1}}% + \count@\@ne + \bbl@foreach\bbl@ca@umalqura@data{% + \advance\count@\@ne + \ifnum##1>\bbl@tempd\else + \edef\bbl@tempe{\the\count@}% + \edef\bbl@tempb{##1}% + \fi}% + \edef\bbl@templ{\fp_eval:n{ \bbl@tempe + 16260 + 949 }}% month~lunar + \edef\bbl@tempa{\fp_eval:n{ floor((\bbl@templ - 1 ) / 12) }}% annus + \edef#5{\fp_eval:n{ \bbl@tempa + 1 }}% + \edef#6{\fp_eval:n{ \bbl@templ - (12 * \bbl@tempa) }}% + \edef#7{\fp_eval:n{ \bbl@tempd - \bbl@tempb + 1 }}} +\ExplSyntaxOff +%</ca-islamic> +% \end{macrocode} +% +% \section{Hebrew} +% +% This is basically the set of macros written by Michail Rozman in +% 1991, with corrections and adaptions by Rama Porrat, Misha, Dan Haran +% and Boris Lavva. This must be eventually replaced by computations +% with \textsf{l3fp}. +% +% \begin{macrocode} +%<*ca-hebrew> +\newcount\bbl@cntcommon +\def\bbl@remainder#1#2#3{% + #3 = #1 % c = a + \divide #3 by #2 % c = a/b + \multiply #3 by -#2 % c = -b(a/b) + \advance #3 by #1 }% % c = a - b(a/b) +\newif\ifbbl@divisible +\def\bbl@checkifdivisible#1#2{% + {\countdef\tmp = 0 % \tmp == \count0 - temporary variable + \bbl@remainder{#1}{#2}{\tmp}% + \ifnum \tmp = 0 + \global\bbl@divisibletrue + \else + \global\bbl@divisiblefalse + \fi}} +\newif\ifbbl@gregleap +\def\bbl@ifgregleap#1{% + \bbl@checkifdivisible{#1}{4}% + \ifbbl@divisible + \bbl@checkifdivisible{#1}{100}% + \ifbbl@divisible + \bbl@checkifdivisible{#1}{400}% + \ifbbl@divisible + \bbl@gregleaptrue + \else + \bbl@gregleapfalse + \fi + \else + \bbl@gregleaptrue + \fi + \else + \bbl@gregleapfalse + \fi + \ifbbl@gregleap} +\def\bbl@gregdayspriormonths#1#2#3{% no month number 0 + {#3 = \ifcase #1 0 \or 0 \or 31 \or 59 \or 90 \or 120 \or 151 \or + 181 \or 212 \or 243 \or 273 \or 304 \or 334 \fi + \bbl@ifgregleap{#2}% + \ifnum #1 > 2 % if month after February + \advance #3 by 1 % add leap day + \fi + \fi + \global\bbl@cntcommon = #3}% + #3 = \bbl@cntcommon} +\def\bbl@gregdaysprioryears#1#2{% + {\countdef\tmpc = 4 % \tmpc==\count4 + \countdef\tmpb = 2 % \tmpb==\count2 + \tmpb = #1 % + \advance \tmpb by -1 % + \tmpc = \tmpb % \tmpc = \tmpb = year-1 + \multiply \tmpc by 365 % Days in prior years = + #2 = \tmpc % = 365*(year-1) ... + \tmpc = \tmpb % + \divide \tmpc by 4 % \tmpc = (year-1)/4 + \advance #2 by \tmpc % ... plus Julian leap days ... + \tmpc = \tmpb % + \divide \tmpc by 100 % \tmpc = (year-1)/100 + \advance #2 by -\tmpc % ... minus century years ... + \tmpc = \tmpb % + \divide \tmpc by 400 % \tmpc = (year-1)/400 + \advance #2 by \tmpc % ... plus 4-century years. + \global\bbl@cntcommon = #2}% + #2 = \bbl@cntcommon} +\def\bbl@absfromgreg#1#2#3#4{% + {\countdef\tmpd = 0 % \tmpd==\count0 + #4 = #1 % days so far this month + \bbl@gregdayspriormonths{#2}{#3}{\tmpd}% + \advance #4 by \tmpd % add days in prior months + \bbl@gregdaysprioryears{#3}{\tmpd}% + \advance #4 by \tmpd % add days in prior years + \global\bbl@cntcommon = #4}% + #4 = \bbl@cntcommon} +\newif\ifbbl@hebrleap +\def\bbl@checkleaphebryear#1{% + {\countdef\tmpa = 0 % \tmpa==\count0 + \countdef\tmpb = 1 % \tmpb==\count1 + \tmpa = #1 + \multiply \tmpa by 7 + \advance \tmpa by 1 + \bbl@remainder{\tmpa}{19}{\tmpb}% + \ifnum \tmpb < 7 % \tmpb = (7*year+1)%19 + \global\bbl@hebrleaptrue + \else + \global\bbl@hebrleapfalse + \fi}} +\def\bbl@hebrelapsedmonths#1#2{% + {\countdef\tmpa = 0 % \tmpa==\count0 + \countdef\tmpb = 1 % \tmpb==\count1 + \countdef\tmpc = 2 % \tmpc==\count2 + \tmpa = #1 % + \advance \tmpa by -1 % + #2 = \tmpa % #2 = \tmpa = year-1 + \divide #2 by 19 % Number of complete Meton cycles + \multiply #2 by 235 % #2 = 235*((year-1)/19) + \bbl@remainder{\tmpa}{19}{\tmpb}% \tmpa = years%19-years this cycle + \tmpc = \tmpb % + \multiply \tmpb by 12 % + \advance #2 by \tmpb % add regular months this cycle + \multiply \tmpc by 7 % + \advance \tmpc by 1 % + \divide \tmpc by 19 % \tmpc = (1+7*((year-1)%19))/19 - + \advance #2 by \tmpc % add leap months + \global\bbl@cntcommon = #2}% + #2 = \bbl@cntcommon} +\def\bbl@hebrelapseddays#1#2{% + {\countdef\tmpa = 0 % \tmpa==\count0 + \countdef\tmpb = 1 % \tmpb==\count1 + \countdef\tmpc = 2 % \tmpc==\count2 + \bbl@hebrelapsedmonths{#1}{#2}% + \tmpa = #2 % + \multiply \tmpa by 13753 % + \advance \tmpa by 5604 % \tmpa=MonthsElapsed*13758 + 5604 + \bbl@remainder{\tmpa}{25920}{\tmpc}% \tmpc == ConjunctionParts + \divide \tmpa by 25920 + \multiply #2 by 29 + \advance #2 by 1 + \advance #2 by \tmpa % #2 = 1 + MonthsElapsed*29 + + \bbl@remainder{#2}{7}{\tmpa}% % \tmpa == DayOfWeek + \ifnum \tmpc < 19440 + \ifnum \tmpc < 9924 + \else % New moon at 9 h. 204 p. or later + \ifnum \tmpa = 2 % on Tuesday ... + \bbl@checkleaphebryear{#1}% of a common year + \ifbbl@hebrleap + \else + \advance #2 by 1 + \fi + \fi + \fi + \ifnum \tmpc < 16789 + \else % New moon at 15 h. 589 p. or later + \ifnum \tmpa = 1 % on Monday ... + \advance #1 by -1 + \bbl@checkleaphebryear{#1}% at the end of leap year + \ifbbl@hebrleap + \advance #2 by 1 + \fi + \fi + \fi + \else + \advance #2 by 1 % new moon at or after midday + \fi + \bbl@remainder{#2}{7}{\tmpa}% % \tmpa == DayOfWeek + \ifnum \tmpa = 0 % if Sunday ... + \advance #2 by 1 + \else % + \ifnum \tmpa = 3 % Wednesday ... + \advance #2 by 1 + \else + \ifnum \tmpa = 5 % or Friday + \advance #2 by 1 + \fi + \fi + \fi + \global\bbl@cntcommon = #2}% + #2 = \bbl@cntcommon} +\def\bbl@daysinhebryear#1#2{% + {\countdef\tmpe = 12 % \tmpe==\count12 + \bbl@hebrelapseddays{#1}{\tmpe}% + \advance #1 by 1 + \bbl@hebrelapseddays{#1}{#2}% + \advance #2 by -\tmpe + \global\bbl@cntcommon = #2}% + #2 = \bbl@cntcommon} +\def\bbl@hebrdayspriormonths#1#2#3{% + {\countdef\tmpf= 14 % \tmpf==\count14 + #3 = \ifcase #1 % Days in prior month of regular year + 0 \or % no month number 0 + 0 \or % Tishri + 30 \or % Heshvan + 59 \or % Kislev + 89 \or % Tebeth + 118 \or % Shebat + 148 \or % Adar I + 148 \or % Adar II + 177 \or % Nisan + 207 \or % Iyar + 236 \or % Sivan + 266 \or % Tammuz + 295 \or % Av + 325 \or % Elul + 400 % Dummy + \fi + \bbl@checkleaphebryear{#2}% + \ifbbl@hebrleap % in leap year + \ifnum #1 > 6 % if month after Adar I + \advance #3 by 30 % add 30 days + \fi + \fi + \bbl@daysinhebryear{#2}{\tmpf}% + \ifnum #1 > 3 + \ifnum \tmpf = 353 % + \advance #3 by -1 % + \fi % Short Kislev + \ifnum \tmpf = 383 % + \advance #3 by -1 % + \fi % + \fi + \ifnum #1 > 2 + \ifnum \tmpf = 355 % + \advance #3 by 1 % + \fi % Long Heshvan + \ifnum \tmpf = 385 % + \advance #3 by 1 % + \fi % + \fi + \global\bbl@cntcommon = #3}% + #3 = \bbl@cntcommon} +\def\bbl@absfromhebr#1#2#3#4{% + {#4 = #1 + \bbl@hebrdayspriormonths{#2}{#3}{#1}% + \advance #4 by #1 % Add days in prior months this year + \bbl@hebrelapseddays{#3}{#1}% + \advance #4 by #1 % Add days in prior years + \advance #4 by -1373429 % Subtract days before Gregorian + \global\bbl@cntcommon = #4}% % 01.01.0001 + #4 = \bbl@cntcommon} +\def\bbl@hebrfromgreg#1#2#3#4#5#6{% + {\countdef\tmpx= 17 % \tmpx==\count17 + \countdef\tmpy= 18 % \tmpy==\count18 + \countdef\tmpz= 19 % \tmpz==\count19 + #6 = #3 % + \global\advance #6 by 3761 % approximation from above + \bbl@absfromgreg{#1}{#2}{#3}{#4}% + \tmpz = 1 \tmpy = 1 + \bbl@absfromhebr{\tmpz}{\tmpy}{#6}{\tmpx}% + \ifnum \tmpx > #4 % + \global\advance #6 by -1 % Hyear = Gyear + 3760 + \bbl@absfromhebr{\tmpz}{\tmpy}{#6}{\tmpx}% + \fi % + \advance #4 by -\tmpx % Days in this year + \advance #4 by 1 % + #5 = #4 % + \divide #5 by 30 % Approximation for month from below + \loop % Search for month + \bbl@hebrdayspriormonths{#5}{#6}{\tmpx}% + \ifnum \tmpx < #4 + \advance #5 by 1 + \tmpy = \tmpx + \repeat + \global\advance #5 by -1 + \global\advance #4 by -\tmpy}} +\newcount\bbl@hebrday \newcount\bbl@hebrmonth \newcount\bbl@hebryear +\newcount\bbl@gregday \newcount\bbl@gregmonth \newcount\bbl@gregyear +% +\def\bbl@ca@hebrew#1-#2-#3\@@#4#5#6{% + \bbl@gregday=#3 \bbl@gregmonth=#2 \bbl@gregyear=#1 + \bbl@hebrfromgreg + {\bbl@gregday}{\bbl@gregmonth}{\bbl@gregyear}% + {\bbl@hebrday}{\bbl@hebrmonth}{\bbl@hebryear}% + \edef#4{\the\bbl@hebryear}% + \edef#5{\the\bbl@hebrmonth}% + \edef#6{\the\bbl@hebrday}} +%</ca-hebrew> +% \end{macrocode} +% +% \section{Persian} +% +% There is an algorithm written in TeX by Jabri, Abolhassani, Pournader +% and Esfahbod, created for the first versions of the FarsiTeX system +% (no longer available), but the original license is GPL, so its use +% with LPPL is problematic. The code here follows loosely that by John +% Walker, which is free and accurate, but sadly very complex, so +% the relevant data for the years 2013-2050 have been pre-calculated +% and stored. Actually, all we need is the first day (either March 20 or +% March 21). +% +% \begin{macrocode} +%<*ca-persian> +\ExplSyntaxOn +\def\bbl@fpmod#1#2{(#1-#2*floor(#1/#2))} +\def\bbl@cs@gregleap#1{% + (\bbl@fpmod{#1}{4} == 0) && + (!((\bbl@fpmod{#1}{100} == 0) && (\bbl@fpmod{#1}{400} != 0)))} +\def\bbl@ca@jd#1#2#3{% year, month, day + \fp_eval:n{ 1721424.5 + (365 * (#1 - 1)) + + floor((#1 - 1) / 4) + (-floor((#1 - 1) / 100)) + + floor((#1 - 1) / 400) + floor((((367 * #2) - 362) / 12) + + ((#2 <= 2) ? 0 : (\bbl@cs@gregleap{#1} ? -1 : -2)) + #3) }} +\def\bbl@ca@firstjal@xx{2012,2016,2020,2024,2028,2029,% March 20 + 2032,2033,2036,2037,2040,2041,2044,2045,2048,2049} +\def\bbl@ca@persian#1-#2-#3\@@#4#5#6{% + \edef\bbl@tempa{#1}% 20XX-03-\bbl@tempe = 1 farvardin: + \ifnum\bbl@tempa>2012 \ifnum\bbl@tempa<2051 + \bbl@afterfi\expandafter\@gobble + \fi\fi + {\bbl@error{Year~out~of~range}{The~allowed~range~is~2013-2050}}% + \bbl@xin@{\bbl@tempa}{\bbl@ca@firstjal@xx}% + \ifin@\def\bbl@tempe{20}\else\def\bbl@tempe{21}\fi + \edef\bbl@tempc{\fp_eval:n{\bbl@ca@jd{\bbl@tempa}{#2}{#3}+.5}}% current + \edef\bbl@tempb{\fp_eval:n{\bbl@ca@jd{\bbl@tempa}{03}{\bbl@tempe}+.5}}% begin + \ifnum\bbl@tempc<\bbl@tempb + \edef\bbl@tempa{\fp_eval:n{\bbl@tempa-1}}% go back 1 year and redo + \bbl@xin@{\bbl@tempa}{\bbl@ca@firstjal@xx}% + \ifin@\def\bbl@tempe{20}\else\def\bbl@tempe{21}\fi + \edef\bbl@tempb{\fp_eval:n{\bbl@ca@jd{\bbl@tempa}{03}{\bbl@tempe}+.5}}% + \fi + \edef#4{\fp_eval:n{\bbl@tempa-621}}% set Jalali year + \edef#6{\fp_eval:n{\bbl@tempc-\bbl@tempb+1}}% days from 1 farvardin + \edef#5{\fp_eval:n{% set Jalali month + (#6 <= 186) ? ceil(#6 / 31) : ceil((#6 - 6) / 30)}} + \edef#6{\fp_eval:n{% set Jalali day + (#6 - ((#5 <= 7) ? ((#5 - 1) * 31) : (((#5 - 1) * 30) + 6)))}}} +\ExplSyntaxOff +%</ca-persian> +% \end{macrocode} +% % \section{Support for Plain \TeX\ (\texttt{plain.def})} % % \subsection{Not renaming \file{hyphen.tex}} diff --git a/macros/latex/required/babel/base/babel.ins b/macros/latex/required/babel/base/babel.ins index 188056d227..6988ba0b04 100644 --- a/macros/latex/required/babel/base/babel.ins +++ b/macros/latex/required/babel/base/babel.ins @@ -26,7 +26,7 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. %% -\def\filedate{2022/05/22} +\def\filedate{2022/06/06} \def\batchfile{babel.ins} \input docstrip.tex @@ -135,6 +135,9 @@ \file{switch.def}{\from{babel.dtx}{kernel}} \file{hyphen.cfg}{\from{babel.dtx}{patterns}} \file{nil.ldf}{\from{babel.dtx}{nil}} + \file{babel-ca-hebrew.tex}{\from{babel.dtx}{ca-hebrew}} + \file{babel-ca-islamic.tex}{\from{babel.dtx}{ca-islamic}} + \file{babel-ca-persian.tex}{\from{babel.dtx}{ca-persian}} \file{xebabel.def}{\from{babel.dtx}{xetex}} \file{luababel.def}{\from{babel.dtx}{luatex}} \file{txtbabel.def}{\from{babel.dtx}{texxet}} diff --git a/macros/latex/required/babel/base/babel.pdf b/macros/latex/required/babel/base/babel.pdf Binary files differindex 52960c988b..4585e8ca83 100644 --- a/macros/latex/required/babel/base/babel.pdf +++ b/macros/latex/required/babel/base/babel.pdf diff --git a/macros/latex/required/babel/base/bbcompat.dtx b/macros/latex/required/babel/base/bbcompat.dtx index 725de441f2..eeb5593f43 100644 --- a/macros/latex/required/babel/base/bbcompat.dtx +++ b/macros/latex/required/babel/base/bbcompat.dtx @@ -30,7 +30,7 @@ % % \iffalse %<*dtx> -\ProvidesFile{bbcompat.dtx}[2022/05/22 v3.75] +\ProvidesFile{bbcompat.dtx}[2022/06/06 v3.76] %</dtx> % %% File 'bbcompat.dtx' |