diff options
Diffstat (limited to 'macros')
47 files changed, 5940 insertions, 2523 deletions
diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/CHANGELOG.md b/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/CHANGELOG.md index 187f8a43cd..d3ae57ada4 100644 --- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/CHANGELOG.md +++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/CHANGELOG.md @@ -1 +1 @@ -Fix frame numbering on frames when both `noframenumbering` and `allowframebreaks` options are used. +Use Fira font also for math. diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/README.md b/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/README.md index 2e6f3c2d04..a131b97bb8 100644 --- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/README.md +++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/README.md @@ -1,4 +1,4 @@ -# Focus v3.2.0 +# Focus v3.3.0 A presentation theme for LaTeX Beamer that aims at a clean and minimalist design, so to minimize distractions and put the focus directly on the content. @@ -117,5 +117,6 @@ additions and modifications (in alphabetical order): - [max](https://github.com/imntl) - [MonsieurPi](https://github.com/MonsieurPi) - [SFr682k](https://github.com/SFr682k) +- [Zortaniac](https://github.com/Zortaniac) A more detailed contribution list is found [here](https://github.com/elauksap/focus-beamertheme/graphs/contributors). diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/beamerouterthemefocus.sty b/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/beamerouterthemefocus.sty index edd9ca40d5..f61fec9585 100644 --- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/beamerouterthemefocus.sty +++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/beamerouterthemefocus.sty @@ -278,7 +278,7 @@ % Enable noframenumbering option. \define@key{beamerframe}{noframenumbering}[true]{% - \setbeamertemplate{footline}[none]% + \setbeamertemplate{footline}[noframenumbering]% \setlength{\focus@pbar@height}{0cm}% \focus@calculatefootheight% } diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/beamerthemefocus.sty b/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/beamerthemefocus.sty index 195d850f45..9bd962a9c7 100644 --- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/beamerthemefocus.sty +++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/beamerthemefocus.sty @@ -19,7 +19,7 @@ % along with beamerthemefocus. If not, see <http://www.gnu.org/licenses/>. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{beamerthemefocus}[2022/02/21 v3.2.0 Focus Beamer theme] +\ProvidesPackage{beamerthemefocus}[2022/03/09 v3.3.0 Focus Beamer theme] \mode<presentation> @@ -44,11 +44,17 @@ \if@focus@loadfirafonts \RequirePackage[T1]{fontenc} - \PassOptionsToPackage{type1}{FiraSans} - \PassOptionsToPackage{type1}{FiraMono} - + \PassOptionsToPackage{sfdefault}{FiraSans} \RequirePackage{FiraSans} + \RequirePackage{FiraMono} + + \RequirePackage{firamath-otf} + \unimathsetup{ + math-style = ISO, + bold-style = ISO, + mathrm = sym + } \fi \usecolortheme{focus} diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/focus-demo.pdf b/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/focus-demo.pdf Binary files differindex 83f1c44e30..6a81ce1763 100644..100755 --- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/focus-demo.pdf +++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/focus-demo.pdf diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/focus-demo.tex b/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/focus-demo.tex index c696f525f6..616b1765b7 100644 --- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/focus-demo.tex +++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/focus-demo.tex @@ -1,3 +1,6 @@ +% !TeX TS-program = xelatex +% !BIB TS-program = bibtex + % Full instructions available at: % https://github.com/elauksap/focus-beamertheme @@ -41,14 +44,15 @@ \end{frame} \begin{frame}{Typesetting and Math} - The packages \texttt{inputenc} and \texttt{FiraSans}\footnote{\url{https://fonts.google.com/specimen/Fira+Sans}}\textsuperscript{,}\footnote{\url{http://mozilla.github.io/Fira/}} are used to properly set the main fonts. + The packages \texttt{fontenc} and \texttt{FiraSans}\footnote{\url{https://fonts.google.com/specimen/Fira+Sans}}\textsuperscript{,}\footnote{\url{http://mozilla.github.io/Fira/}} are used to properly set the main fonts. \vfill This theme provides styling commands to typeset \emph{emphasized}, \alert{alerted}, \textbf{bold}, \textcolor{example}{example text}, \dots \vfill \texttt{FiraSans} also provides support for mathematical symbols: - \begin{equation*} - e^{i\pi} + 1 = 0. - \end{equation*} + \begin{align*} + e^{i\pi} + 1 & = 0, \\ + \int_{-\infty}^\infty e^{-x^2}\,\mathrm{d}x & = \sqrt{\pi}. + \end{align*} \end{frame} \section{Section 2} @@ -138,7 +142,6 @@ \end{frame} \begin{frame}{Backup frame} - \usebeamercolor[fg]{normal text} This is a backup frame, useful to include additional material for questions from the audience. \vfill The package \texttt{appendixnumberbeamer} is used not to number appendix frames. diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/focus-demo/demo-typeset.jpg b/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/focus-demo/demo-typeset.jpg Binary files differindex fe8629e8a7..fdd037fc98 100644..100755 --- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/focus-demo/demo-typeset.jpg +++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-focus/focus-demo/demo-typeset.jpg diff --git a/macros/latex/contrib/dtxdescribe/README.txt b/macros/latex/contrib/dtxdescribe/README.txt index ec9337e57f..51eb6dca27 100644 --- a/macros/latex/contrib/dtxdescribe/README.txt +++ b/macros/latex/contrib/dtxdescribe/README.txt @@ -1,7 +1,7 @@ The LaTeX dtxdescribe package Describe additional object types in dtx source files. -v1.03 — 2012/02/01 +v1.04 — 2022/02/01 Copyright 2016–2022 Brian Dunn — www.BDTechConcepts.com LaTeX Project Public License, version 1.3 diff --git a/macros/latex/contrib/dtxdescribe/dtxdescribe.dtx b/macros/latex/contrib/dtxdescribe/dtxdescribe.dtx index 0f12529663..be6a1e613d 100644 --- a/macros/latex/contrib/dtxdescribe/dtxdescribe.dtx +++ b/macros/latex/contrib/dtxdescribe/dtxdescribe.dtx @@ -17,7 +17,7 @@ % \iffalse %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{dtxdescribe} -%<package> [2022/02/01 v1.03 Describe additional object types in source files.] +%<package> [2022/02/01 v1.04 Describe additional object types in source files.] % %<*driver> \documentclass{ltxdoc} @@ -170,7 +170,7 @@ Keywords={LaTeX, dtx, source, DescribeMacro}% %<*package> % \fi % -% \CheckSum{1211} +% \CheckSum{0} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -194,6 +194,8 @@ Keywords={LaTeX, dtx, source, DescribeMacro}% % \changes{v1.01}{2019/03/22}{\ 2019/03/22} % \changes{v1.02}{2019/07/16}{\ 2019/07/16} % \changes{v1.03}{2022/02/01}{\ 2022/02/01} +% \changes{v1.04}{2022/02/01}{\ 2022/02/01} +% \changes{v1.04}{2022/02/01}{\ Corrected copyright date.} diff --git a/macros/latex/contrib/dtxdescribe/dtxdescribe.pdf b/macros/latex/contrib/dtxdescribe/dtxdescribe.pdf Binary files differindex 28847b413e..fc29deedad 100644 --- a/macros/latex/contrib/dtxdescribe/dtxdescribe.pdf +++ b/macros/latex/contrib/dtxdescribe/dtxdescribe.pdf diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index 54cc922175..660f3e6375 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -15,7 +15,7 @@ %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2022/03/08}{1.642} +\ProvidesExplClass{easybook}{2022/03/08}{1.643} {Easily typesetting Chinese theses or books} \bool_set_false:N \l__eb_compile_draft_bool @@ -303,7 +303,7 @@ %<*package> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e,etoolbox} -\ProvidesExplPackage{easybase}{2022/03/08}{1.642} +\ProvidesExplPackage{easybase}{2022/03/08}{1.643} {Easily typesetting Chinese theses or books} \cs_generate_variant:Nn \dim_set:Nn { NV } @@ -447,18 +447,21 @@ } } -\eb_seq_map_inline:nn +\seq_set_from_clist:Nn \l__eb_module_paths_seq { style,subfont,spread, - refset,bibset,thmset, - geoset,hdrset,tocset,list + bibset,thmset,tocset, + hdrset,refset,geoset,float } +\seq_map_inline:Nn \l__eb_module_paths_seq { \ctex_define:n { #1 .meta:nn = { ctex/#1 } {##1} } \cs_new_protected:cpn { eb#1 } ##1 { \ctex_set:nn {#1} {##1} } } -\eb_seq_map_inline:nn - { style,subfont,spread,bibset,thmset,hdrset,tocset } +\bool_until_do:nn + { \int_compare_p:nNn { \seq_count:N \l__eb_module_paths_seq } < { 8 } } + { \seq_pop_right:NN \l__eb_module_paths_seq \l_tmpa_tl } +\seq_map_inline:Nn \l__eb_module_paths_seq { \msg_new:nnn { easybase } { deprecated-#1 } { @@ -1196,193 +1199,6 @@ \cs_new:Npn \eb@footmisc@ifvoid #1#2#3 { \ifvoid #1#2\else #3\fi } \cs_set:Npn \thempfootnote { \int_to_alph:n { \c@mpfootnote } } -\contentsuse{lstlisting}{lol} -\seq_put_left:Nn \c__ctex_headings_seq { chapter } -\seq_put_right:Nn \c__ctex_headings_seq { figure } -\seq_put_right:Nn \c__ctex_headings_seq { table } -\seq_put_right:Nn \c__ctex_headings_seq { lstlisting } -\seq_remove_duplicates:N \c__ctex_headings_seq -\ctex_define:n { lstlisting/#1 .meta:nn = { ctex/#1 } {##1} } -\ctex_define:n { figure/#1 .meta:nn = { ctex/#1 } {##1} } -\ctex_define:n { table/#1 .meta:nn = { ctex/#1 } {##1} } -\ctex_define:n { list/#1 .meta:nn = { ctex/#1 } {##1} } -\cs_new_protected:Npn \eb_toc_entry_if_hang:n #1 - { - \bool_if:NTF \l__eb_toc_entry_hang_bool - { \contentspush } - { \use:n } - { - \bool_if:NTF \l__eb_toc_number_color_bool - { \textcolor{ctex@toc@number} } - { \use:n } - { \thecontentslabel } - \tl_use:c { l__eb_toc_#1_after_tl } - } - } -\cs_new_protected:Npn \RegisterTocName #1 - { - \ctex_define:n - { - #1/tocformat .tl_set:c = l__eb_toc_#1_format_tl, - #1/tocformat+ .code:n = \tl_put_right:cn { l__eb_toc_#1_format_tl } {##1}, - #1/tocformat~+ .code:n = \tl_put_right:cn { l__eb_toc_#1_format_tl } {##1}, - #1/tocindent .dim_set:c = l__eb_toc_#1_indent_dim, - #1/tocrule .tl_set:c = l__eb_toc_#1_rule_tl, - #1/tocafter .tl_set:c = l__eb_toc_#1_after_tl, - #1/tocbelow .tl_set:c = l__eb_toc_#1_below_tl - } - \titlecontents{#1} - [\dim_use:c { l__eb_toc_#1_indent_dim }] - {\tl_use:c { l__eb_toc_#1_format_tl }} - {\eb_toc_entry_if_hang:n {#1}}{} - {\tl_use:c { l__eb_toc_#1_rule_tl }} - [\tl_use:c { l__eb_toc_#1_below_tl }] - } -\seq_map_function:NN -\c__ctex_headings_seq \RegisterTocName -\eb_seq_map_inline:nn - { figure,table,lstlisting } - { - \ctex_define:n - { - #1/between .tl_set:c = l__eb_toc_#1_between_hook_tl, - #1/tocline .cs_set:cp = { eb@tocline@#1 } ##1##2, - } - } -\eb_seq_map_inline:nn - { - tocformat,tocformat+,tocformat~+, - tocindent,tocrule,tocline,tocafter,between - } - { - \ctex_define:n - { - list/#1 .meta:n = - { - figure/#1 = ##1,table/#1 = ##1, - lstlisting/#1 = ##1 - } - } - } -\eb_seq_map_inline:nn - { tocafter,tocindent,tocrule } - { - \ctex_define:nn { tocset } - { - #1-every .code:n = - { - \ctex_set:n - { - part/#1 = ##1,chapter/#1 = ##1, - section/#1 = ##1,subsection/#1 = ##1, - list/#1 = ##1 - } - } - } - } - -\ctex_define:nn { tocset } - { - lolskip .skip_set:N = \eb@toc@lol@skip, - lolskip .initial:n = 10pt, - between .tl_set:N = \l__eb_toc_main_between_hook_tl, - between .initial:n = \bool_if:NT \l__eb_class_mode_book_bool { \vspace*{-1pc} }, - bibetween .tl_set:N = \l__eb_toc_bimain_between_hook_tl, - bibetween .initial:n = \bool_if:NT \l__eb_class_mode_book_bool { \vspace*{-1pc} }, - dotalign .bool_set:N = \l__eb_toc_dot_align_bool, - dotalign .default:n = true, - dotalign .initial:n = true, - hang .bool_set:N = \l__eb_toc_entry_hang_bool, - hang .default:n = true, - hang .initial:n = true, - pagenumwd .code:n = \contentsmargin{#1}, - pagenumwd .initial:n = 1.55em, - unknown .code:n = \eb_msg_deprecated_option:n { tocset } - } -\NewDocumentCommand{\tocrule}{st-O{0.7pc}d()mO{}} - { - \normalsize\normalfont - \titlerule*[#3]{\IfValueTF{#4}{\scalebox{#4}{#5}}{#5}}#6 - \bgroup - \IfBooleanF{#2} - { - \IfBooleanTF{#1} - {\thecontentspage} - { - \bool_if:NTF \l__eb_toc_dot_align_bool - { \contentspage } - { \thecontentspage } - } - } - \egroup - } -\cs_new:Npn \p@numberline { \protect\numberline } -\cs_new:Npn \listnumberline #1 - { \p@numberline{\use:c { #1name }~\use:c { the#1 }} } -\ctex_set:n - { - part = - { - tocformat = \addvspace{1pc}\sffamily\large, - tocindent = 0em, - tocrule = \tocrule{}[\bfseries], - tocline = \CTEXnumberline{#1}#2 - }, - chapter = - { - tocformat = \addvspace{1pc}\sffamily, - tocindent = 0em, - tocrule = \tocrule{$\cdot$}[\bfseries], - tocline = \CTEXnumberline{#1}#2 - }, - section = - { - tocformat = \bool_if:NF \l__eb_class_mode_book_bool { \sffamily }, - tocindent = \bool_if:NTF \l__eb_class_mode_book_bool { 1.5em } { 0em }, - tocrule = - { - \bool_if:NTF \l__eb_class_mode_book_bool - { \tocrule{$\cdot$} } - { \tocrule{$\cdot$}[\bfseries] } - } - }, - subsection = - { - tocindent = \bool_if:NTF \l__eb_class_mode_book_bool { 3.8em } { 1.4em }, - tocrule = \tocrule{$\cdot$} - }, - list = - { - tocindent = 0em, - tocrule = \tocrule{$\cdot$}, - between = \bool_if:NT \l__eb_class_mode_book_bool { \vspace*{-10pt} } - }, - table/tocline = \listnumberline{table}#2, - figure/tocline = \listnumberline{figure}#2, - lstlisting/tocline = \listnumberline{lstlisting}#2, - tocset/tocafter-every = \hspace{1em} - } -\prop_new:N \l__eb_list_label_entry_prop -\prop_set_from_keyval:Nn \l__eb_list_label_entry_prop - { - figure = \eb@tocline@figure, - table = \eb@tocline@table - } -\cs_gset:Npn \caption@@@addcontentsline #1#2#3#4 - { - \addcontentsline{#1}{#2} - {\prop_item:Nn \l__eb_list_label_entry_prop {#2}{#3}{#4}} - } -\ctex_patch_cmd:Nnn \lst@MakeCaption - { - \addcontentsline{lol}{lstlisting} - {\protect\numberline{\thelstlisting}\lst@@caption} - } - { - \addcontentsline{lol}{lstlisting} - {\eb@tocline@lstlisting{\thelstlisting}{\lst@@caption}} - } - \newcounter{bichapter} \newcounter{bisection}[bichapter] \newcounter{bisubsection}[bisection] @@ -1394,14 +1210,13 @@ \use:c { p@#1 } { the#1 } } } -\NewDocumentCommand{\counteruse}{soD(){arabic}mO{.}d()} +\NewDocumentCommand{\counteruse}{sO{arabic}D(){.}mod()} { \IfBooleanF{#1}{\stepcounter{#4}} - \IfValueT{#6}{\setcounter{#4}{#6}} \tl_set:cn { theeb@#4 } { - \IfValueT{#2}{\use:c { the#2 }#5} - \use:c {#3}{#4} + \IfValueT{#5}{\use:c { the#5 }#3} + \use:c {#2}{#4} } \tl_use:c { theeb@#4 } \eb_current_label:n { eb@#4 } @@ -1415,7 +1230,6 @@ \cs_set:Npn \thebisection { \eb_section_counter_prefix:n { bi } } \cs_set:Npn \thebisubsection { \thebisection.\@arabic\c@bisubsection } \cs_set:Npn \thesection { \eb_section_counter_prefix:n { } } - \contentsuse{}{tec} \tl_new:N \eb@before@addbitoc@hook \NewDocumentCommand{\BeforeAddBitoc}{sm} @@ -1491,7 +1305,7 @@ } \tl_new:N \eb@bitoc@title -\keys_define:nn { eb/listoc } +\keys_define:nn { eb/floattoc } { level .tl_set:N = \eb@toc@title@level, level .initial:n = @@ -1526,11 +1340,13 @@ plan .initial:n = cn, columns .meta:n = { multoc = #1 }, title .code:n = \eb_assign_toc_title:n {#1}, - bilist .tl_gset:N = \g__eb_bilist_permute_value_tl + bilist .tl_gset:N = \g__eb_bilist_permute_value_tl, + name .tl_set:N = \l__eb_print_index_name_tl, + name .initial:n = \imki@jobname } \bool_if:NTF \l__eb_class_mode_book_bool - { \keys_define:nn { } { eb/listoc .inherit:n = ctex/chapter } } - { \keys_define:nn { } { eb/listoc .inherit:n = ctex/section } } + { \keys_define:nn { } { eb/floattoc .inherit:n = ctex/chapter } } + { \keys_define:nn { } { eb/floattoc .inherit:n = ctex/section } } \NewDocumentCommand{\eb_assign_toc_title:n} {>{\SplitArgument{1}{,}}m} {\eb_assign_toc_title_judge:nn #1} @@ -1541,13 +1357,7 @@ { \tl_clear:N \eb@bitoc@title } { \tl_set:Nn \eb@bitoc@title {#2} } } -\cs_new_protected:Npn \eb_biber_toc_title:n #1 - { - \bool_if:NTF \l__eb_class_mode_book_bool - { \bichapter*{#1}{\eb@bib@bitoc@title} } - { \bisection*{#1}{\eb@bib@bitoc@title} } - \sectionmark{#1} - } +\prop_new:N \l__eb_toc_float_label_prop \cs_new_protected:Npn \eb_toc_start_multi_column_ext:n #1 { \int_compare:nNnTF { \l__eb_toc_columns_int } > { 1 } @@ -1568,29 +1378,60 @@ \IfBooleanF{#1} {\eb@toc@title@level{\eb@toc@title}{\eb@bitoc@title}} } -\cs_new_protected:Npn \eb_toc_list_parse:nnnnn #1#2#3#4#5 +\cs_new_protected:Npn \eb_toc_float_list_parse:nnnnn #1#2#3#4#5 { \group_begin: \tl_set_eq:Nc \eb@toc@title { list#4name } - \IfValueT{#3}{\keys_set:nn { eb/listoc } {#3}} + \IfValueT{#3}{\keys_set:nn { eb/floattoc } {#3}} \eb_toc_title_level_cmd:n {#1} \eb_toc_if_title_between_hook:nn {#1} {#4} \eb_toc_start_multi_column_ext:n {#5} \group_end: } -\cs_new_protected:Npn \eb_list_content_cmd_set:nn #1#2 +\cs_new:Npn \listnumberline #1 + { + \protect\numberline + { + \exp_args:Nnv + \use:c { p@#1 } { the#1 } + } + } +\cs_new_protected:Npn \DeclareFloatList #1#2 { \exp_args:Nc \DeclareDocumentCommand { listof#1s }{st+o} - {\eb_toc_list_parse:nnnnn {##1} {##2} {##3} {#1} {#2}} + {\eb_toc_float_list_parse:nnnnn {##1} {##2} {##3} {#1} {#2}} + \ctex_define:n + { + #1/##1 .meta:nn = { ctex/##1 } {####1}, + #1/between .tl_set:c = l__eb_toc_#1_between_hook_tl, + #1/tocline .cs_set:cp = { eb@tocline@#1 } ##1##2, + #1/tocline .initial:n = \listnumberline{#1}##2 + } + \prop_put_from_keyval:Nn \l__eb_toc_float_label_prop + { #1 = \use:c { eb@tocline@#1 } } } -\eb_seq_map_inline:nn +\DeclareFloatList{table}{lot} +\DeclareFloatList{figure}{lof} +\DeclareFloatList{lstlisting}{lol} +\cs_gset:Npn \caption@@@addcontentsline #1#2#3#4 { - { figure } { lof }, - { table } { lot }, - { lstlisting } { lol } + \addcontentsline{#1}{#2} + { + \prop_if_in:NnTF \l__eb_toc_float_label_prop {#2} + { \prop_item:Nn \l__eb_toc_float_label_prop {#2} } + { \protect\numberline } + {#3}{#4} + } + } +\ctex_patch_cmd:Nnn \lst@MakeCaption + { + \addcontentsline{lol}{lstlisting} + {\protect\numberline{\thelstlisting}\lst@@caption} + } + { + \addcontentsline{lol}{lstlisting} + {\eb@tocline@lstlisting{\thelstlisting}{\lst@@caption}} } - { \eb_list_content_cmd_set:nn #1 } -\cs_set_eq:NN \listoflistings \listoflstlistings \ctex_define:n { bicontentsname .tl_set:N = \bicontentsname, @@ -1607,7 +1448,7 @@ { \chapter* } { \section* } } - \IfValueT{#3}{\keys_set:nn { eb/listoc } {#3}} + \IfValueT{#3}{\keys_set:nn { eb/floattoc } {#3}} \bool_if:NT \l__eb_toc_plan_cn_bool { \IfBooleanF{#1}{\eb@toc@title@level{\eb@toc@title}{}} @@ -1623,22 +1464,169 @@ \group_end: } +\contentsuse{lstlisting}{lol} +\seq_put_left:Nn \c__ctex_headings_seq { chapter } +\seq_put_right:Nn \c__ctex_headings_seq { table } +\seq_put_right:Nn \c__ctex_headings_seq { figure } +\seq_put_right:Nn \c__ctex_headings_seq { lstlisting } +\seq_remove_duplicates:N \c__ctex_headings_seq +\cs_new_protected:Npn \eb_toc_entry_if_hang:n #1 + { + \bool_if:NTF \l__eb_toc_entry_hang_bool + { \contentspush } + { \use:n } + { + \bool_if:NTF \l__eb_toc_number_color_bool + { \textcolor{ctex@toc@number} } + { \use:n } + { \thecontentslabel } + \tl_use:c { l__eb_toc_#1_after_tl } + } + } +\cs_new_protected:Npn \RegisterTocName #1 + { + \ctex_define:n + { + #1/tocformat .tl_set:c = l__eb_toc_#1_format_tl, + #1/tocformat+ .code:n = \tl_put_right:cn { l__eb_toc_#1_format_tl } {##1}, + #1/tocformat~+ .code:n = \tl_put_right:cn { l__eb_toc_#1_format_tl } {##1}, + #1/tocindent .dim_set:c = l__eb_toc_#1_indent_dim, + #1/tocrule .tl_set:c = l__eb_toc_#1_rule_tl, + #1/tocafter .tl_set:c = l__eb_toc_#1_after_tl, + #1/tocbelow .tl_set:c = l__eb_toc_#1_below_tl + } + \titlecontents{#1} + [\dim_use:c { l__eb_toc_#1_indent_dim }] + {\tl_use:c { l__eb_toc_#1_format_tl }} + {\eb_toc_entry_if_hang:n {#1}}{} + {\tl_use:c { l__eb_toc_#1_rule_tl }} + [\tl_use:c { l__eb_toc_#1_below_tl }] + } +\seq_map_function:NN +\c__ctex_headings_seq \RegisterTocName +\eb_seq_map_inline:nn + { + tocformat,tocformat+,tocformat~+, + tocindent,tocrule,tocline,tocafter,between + } + { + \ctex_define:n + { + float/#1 .meta:n = + { + figure/#1 = ##1,table/#1 = ##1, + lstlisting/#1 = ##1 + } + } + } +\eb_seq_map_inline:nn + { tocafter,tocindent,tocrule } + { + \ctex_define:nn { tocset } + { + #1-every .code:n = + { + \ctex_set:n + { + part/#1 = ##1,chapter/#1 = ##1, + section/#1 = ##1,subsection/#1 = ##1, + float/#1 = ##1 + } + } + } + } +\ctex_define:nn { tocset } + { + lolskip .skip_set:N = \eb@toc@lol@skip, + lolskip .initial:n = 10pt, + between .tl_set:N = \l__eb_toc_main_between_hook_tl, + between .initial:n = \bool_if:NT \l__eb_class_mode_book_bool { \vspace*{-1pc} }, + bibetween .tl_set:N = \l__eb_toc_bimain_between_hook_tl, + bibetween .initial:n = \bool_if:NT \l__eb_class_mode_book_bool { \vspace*{-1pc} }, + dotalign .bool_set:N = \l__eb_toc_dot_align_bool, + dotalign .default:n = true, + dotalign .initial:n = true, + hang .bool_set:N = \l__eb_toc_entry_hang_bool, + hang .default:n = true, + hang .initial:n = true, + pagenumwd .code:n = \contentsmargin{#1}, + pagenumwd .initial:n = 1.55em, + unknown .code:n = \eb_msg_deprecated_option:n { tocset } + } +\NewDocumentCommand{\tocrule}{st-O{0.7pc}d()mO{}} + { + \normalsize\normalfont + \titlerule*[#3]{\IfValueTF{#4}{\scalebox{#4}{#5}}{#5}}#6 + \bgroup + \IfBooleanF{#2} + { + \IfBooleanTF{#1} + {\thecontentspage} + { + \bool_if:NTF \l__eb_toc_dot_align_bool + { \contentspage } + { \thecontentspage } + } + } + \egroup + } +\ctex_set:n + { + part = + { + tocformat = \addvspace{1pc}\sffamily\large, + tocindent = 0em, + tocrule = \tocrule{}[\bfseries], + tocline = \CTEXnumberline{#1}#2 + }, + chapter = + { + tocformat = \addvspace{1pc}\sffamily, + tocindent = 0em, + tocrule = \tocrule{$\cdot$}[\bfseries], + tocline = \CTEXnumberline{#1}#2 + }, + section = + { + tocformat = \bool_if:NF \l__eb_class_mode_book_bool { \sffamily }, + tocindent = \bool_if:NTF \l__eb_class_mode_book_bool { 1.5em } { 0em }, + tocrule = + { + \bool_if:NTF \l__eb_class_mode_book_bool + { \tocrule{$\cdot$} } + { \tocrule{$\cdot$}[\bfseries] } + } + }, + subsection = + { + tocindent = \bool_if:NTF \l__eb_class_mode_book_bool { 3.8em } { 1.4em }, + tocrule = \tocrule{$\cdot$} + }, + float = + { + tocindent = 0em, + tocrule = \tocrule{$\cdot$}, + between = \bool_if:NT \l__eb_class_mode_book_bool { \vspace*{-10pt} } + }, + tocset/tocafter-every = \hspace{1em} + } + \ctex_at_end_package:nn { imakeidx } { \makeindex - \RenewDocumentCommand{\printindex}{st+oD(){\imki@jobname}} + \RenewDocumentCommand{\printindex}{st+od()} { \group_begin: \tl_set_eq:NN \eb@toc@title \indexname \cs_set_eq:NN \imki@indexlevel \use_none:n \setkeys{imkiindex}{noclearpage} - \IfValueT{#3}{\keys_set:nn { eb/listoc } {#3}} + \IfValueT{#3}{\keys_set:nn { eb/floattoc } {#3}} \cs_set_protected:Npn \imki@indexheaders { \eb_toc_title_level_cmd:n {#1} \cs_set_eq:NN \thispagestyle \use_none:n } - \imki@putindex{#4} + \imki@putindex{\l__eb_print_index_name_tl} \group_end: } } @@ -1690,9 +1678,9 @@ \ctex_define:nn { subfont } { - caption-table .tl_set:N = \l__eb_subfont_cap_table_tl, - caption-figure .tl_set:N = \l__eb_subfont_cap_figure_tl, - caption-listing .tl_set:N = \l__eb_subfont_cap_listing_tl, + caption-table .tl_set:N = \l__eb_subfont_caption_table_tl, + caption-figure .tl_set:N = \l__eb_subfont_caption_figure_tl, + caption-listing .tl_set:N = \l__eb_subfont_caption_listing_tl, caption-every .meta:n = { caption-table = #1,caption-figure = #1, @@ -1709,16 +1697,16 @@ \str_case:nnF {#1} { { table } - { \tl_put_right:Nn \l__eb_subfont_cap_table_tl {#2} } + { \tl_put_right:Nn \l__eb_subfont_caption_table_tl {#2} } { figure } - { \tl_put_right:Nn \l__eb_subfont_cap_figure_tl {#2} } + { \tl_put_right:Nn \l__eb_subfont_caption_figure_tl {#2} } { listing } - { \tl_put_right:Nn \l__eb_subfont_cap_listing_tl {#2} } + { \tl_put_right:Nn \l__eb_subfont_caption_listing_tl {#2} } { every } { - \tl_put_right:Nn \l__eb_subfont_cap_table_tl {#2} - \tl_put_right:Nn \l__eb_subfont_cap_figure_tl {#2} - \tl_put_right:Nn \l__eb_subfont_cap_listing_tl {#2} + \tl_put_right:Nn \l__eb_subfont_caption_table_tl {#2} + \tl_put_right:Nn \l__eb_subfont_caption_figure_tl {#2} + \tl_put_right:Nn \l__eb_subfont_caption_listing_tl {#2} } } { \tl_put_right:cn { l__eb_subfont_#1_tl } {#2} } @@ -1738,9 +1726,9 @@ math .initial:n = 1.354, footnote .fp_set:N = \l__eb_spread_footnote_fp, footnote .initial:n = 1.2, - caption-table .fp_set:N = \l__eb_spread_cap_table_fp, - caption-figure .fp_set:N = \l__eb_spread_cap_figure_fp, - caption-listing .fp_set:N = \l__eb_spread_cap_listing_fp, + caption-table .fp_set:N = \l__eb_spread_caption_table_fp, + caption-figure .fp_set:N = \l__eb_spread_caption_figure_fp, + caption-listing .fp_set:N = \l__eb_spread_caption_listing_fp, caption-every .meta:n = { caption-table = #1,caption-figure = #1, @@ -1761,8 +1749,8 @@ { \DeclareCaptionFont{eb@#1@font} { - \setspread{\fp_use:c { l__eb_spread_cap_#1_fp }} - \tl_use:c { l__eb_subfont_cap_#1_tl } + \setspread{\fp_use:c { l__eb_spread_caption_#1_fp }} + \tl_use:c { l__eb_subfont_caption_#1_tl } } } \captionsetup @@ -2043,7 +2031,7 @@ { \group_begin: \tl_set_eq:NN \eb@toc@title \bibname - \IfValueT{##3}{ \keys_set:nn { eb/listoc } {##3} } + \IfValueT{##3}{ \keys_set:nn { eb/floattoc } {##3} } \cs_set_protected:Npn \bibsection { \eb_toc_title_level_cmd:n {##1} @@ -2059,6 +2047,13 @@ } \cs_new_protected:Npn \eb_put_biblatex:n #1 { \PassOptionsToPackage{#1}{biblatex} } +\cs_new_protected:Npn \eb_biber_toc_title:n #1 + { + \bool_if:NTF \l__eb_class_mode_book_bool + { \bichapter*{#1}{\eb@bib@bitoc@title} } + { \bisection*{#1}{\eb@bib@bitoc@title} } + \sectionmark{#1} + } \cs_new_protected:Npn \eb_biber_biblatex_set: { \str_case:VnF \l__eb_bib_both_style_tl @@ -2317,7 +2312,7 @@ } %</package> %<*tcolorbox> -\ProvidesExplFile{eb-tcolorbox.cfg}{2022/03/08}{1.642} +\ProvidesExplFile{eb-tcolorbox.cfg}{2022/03/08}{1.643} {Customization of tcolorbox for easybook} \cs_set_protected:Npn \addtotcbstyle #1#2 diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf Binary files differindex e17b80e4c5..fe31a2f561 100644 --- a/macros/latex/contrib/easybook/easybook.pdf +++ b/macros/latex/contrib/easybook/easybook.pdf diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex index 20fd6cbb52..ae9ecb96b5 100644 --- a/macros/latex/contrib/easybook/easybook.tex +++ b/macros/latex/contrib/easybook/easybook.tex @@ -21,7 +21,7 @@ name = easybook, color-scheme = blue, title = EASYBOOK使用手册, - version = v1.642, + version = v1.643, date = 2022/03/08, authors = 瞿毅, info = 简便地排版中文学位论文或书籍, @@ -322,7 +322,7 @@ \command{backmatter} 后记区命令。页码格式与编号保持不变,章标题不编号。 \command{cleardoublepage}[\oarg{页面风格}]\Default{empty} - 清双页命令可以确保下一页文本总在奇数页开始,在奇数页使用它会产生空白偶数页。文区命令 \cs{frontmatter} 和 \cs{mainmatter} 会用到清双页命令,在启用文类选项 \option*{openright} 时标题命令 \cs*{part} 和 \cs*{chapter} 也会用到清双页命令。 + 清双页命令可以确保下一页文本总在奇数页开始,在奇数页使用它会产生空白偶数页。文区命令 \cs{frontmatter} 和 \cs{mainmatter} 会用到清双页命令,在启用文类选项 \option*{openright} 时标题命令 \cs*{part} 和 \cs*{chapter} 也会默认用到清双页命令。 \command{blankpagestyle}[\marg{页面风格}] 多出空白页的 \meta{页面风格} 用空白页面风格命令 \cs{blankpagestyle} 全局指定,或使用清双页命令的可选参数局部指定。空白页默认的风格为 \code{empty},即空的页眉页脚。 \end{commands} @@ -793,7 +793,7 @@ 模块 \module*{hdrset} 还可以灵活调整脚注编号和内容的格式。格式主要包括脚注标记的编号类型、字体、附加符号、对齐方式和缩进距离等,以及脚注内容的首行缩进、行距和字体等。基本思想是默认脚注和自定义编号脚注标记的格式分离,两种类型脚注各自正文和内容的标记又共享格式,默认脚注中正文和内容标记的编号类型分离。 \begin{options} \keychoice{footnotetype}{hang,default,flush,bottom}\Module{hdrset}\Default{hang} - 脚注的类型。悬挂缩进 \code{hang} 是默认值,\code{default} 是原始的类型,\code{flush} 使脚注内容标记位于脚注首行边缘外侧并右对齐。在一些浮动体排版的情况下,脚注可能位于页面中间,\code{bottom} 使脚注始终位于页面底端。其中 \code{bottom} 是复合选项,可以与前三种类型重复或复合使用: + 脚注的类型。悬挂缩进 \code{hang} 是默认值,\code{default} 是原始的类型,\code{flush} 使脚注内容标记位于脚注首行边缘外侧并右对齐。当存在浮动环境排版时,脚注可能位于页面中间,\code{bottom} 使脚注始终位于页面底端。其中 \code{bottom} 是复合选项,可以与前三种类型重复或复合使用: \begin{ctexexam} \ebhdrset{footnotetype = default,footnotetype = bottom} \ebhdrset{footnotetype = {hang,bottom}} @@ -892,7 +892,7 @@ \subsection{目录样式} \label{subsec:catalog style} -模块 \module*{tocset} 将使用 \pkg*{titletoc} 宏包处理目录样式。模块或扩展包括了 \module*{part}、\module*{chapter}、\module*{section}、\module*{subsection}、\module*{figure}、\module*{table} 和 \module*{lstlisting} 二级路径,而使用 \module*{list} 路径可以统一设置图片、表格和代码目录的样式。选项前带有 \ding{73} 符号表示支持所有相应\textbf{条目名}的路径,其它选项则处于 \module*{tocset} 路径下。目前支持标准的论文目录样式,更复杂的样式可以查看 \pkg*{titletoc} 的相关用法。 +模块 \module*{tocset} 将使用 \pkg*{titletoc} 宏包处理目录样式。默认包括 \module*{part}、\module*{chapter}、\module*{section}、\module*{subsection}、\module*{figure}、\module*{table} 和 \module*{lstlisting} 二级路径,而使用 \module*{float} 路径可以统一设置图片、表格和代码目录的样式。选项前带有 \ding{73} 符号表示支持所有相应\textbf{条目名}的路径,其它选项则处于 \module*{tocset} 一级路径下。目前支持标准的论文目录样式,更复杂的样式可以查看 \pkg*{titletoc} 的相关用法。 \begin{options} \keyval{tocformat}{条目格式}\dtag\smodule{tocset}% 目录中各级别条目的格式。可以设置条目字体和加入垂直间距等,垂直间距最好使用防止垂直间距重合的 \cs*{addvspace} 命令。 @@ -902,12 +902,16 @@ 目录条目左边的缩进距离,通常标题级别越低缩进越大。 \keyval{tocrule}{引导线命令}\dtag 引导线选项 \option{tocrule} 中一般可以使用基于 \cs*{xleaders} 命令的 \cs{tocrule} 绘制引导线。 + \begin{commands} + \command{tocrule}[\sarg\harg\oarg{引导点间距}\darg{放大因子}\marg{引导点}\oarg{页码格式}] + 生成目录引导线的命令,需要在引导线选项 \option{tocrule} 中使用。带有星号的命令与 \keyis{dotalign}{false} 效果相同。带有 \harg{} 号的命令不添加引导线后的目录页码。\meta{引导点间距} 需带有长度单位,\meta{放大因子} 为 \meta{引导点} 的放大倍数。\meta{页码格式} 的代码位于页码前面,可以设置页码字体和距离等,最后一个命令可以带有一个参数为页码编号。 + \end{commands} \keyval{tocafter}{距离命令}\dtag\Default{\cs*{hspace}\Marg{1em}} 目录条目编号与标题间的代码,默认为插入 \code{1em} 横向距离。 \keyval{tocbelow}{距离命令}\dtag\newtag% 在目录条目下方执行的代码,可以插入垂直距离等命令。 \keyval{tocline}{条目定义}\dtag[\textcolor{red}{\ding{73}}] - 这个选项扩展了图片、表格或代码题注在目录文件中的定义。选项中参数 \code{\#1} 代表相应题注编号 \cs*{the}\meta{计数器} 的值,参数 \code{\#2} 代表相应题注内容。 + 这个选项在章节标题基础上扩展了浮动环境的题注在目录文件中的定义。选项中参数 \code{\#1} 代表相应题注编号 \cs*{the}\meta{计数器} 的值,参数 \code{\#2} 代表相应题注内容。 \begin{ctexexam} \ctexset { @@ -924,14 +928,23 @@ \begin{commands} \command{RegisterTocName}[\marg{条目名}]\newtag% - 给 \meta{条目名} 注册上述设置目录样式的选项,选项前有红色的符号 \textcolor{red}{\ding{73}} 表示目前在注册后不可用。 + 给名称为 \meta{条目名} 的浮动环境注册设置目录样式的选项,选项前有符号 \ding{73} 表示在注册后可用。 \command{contentsuse}[\marg{条目名}\marg{扩展名}] - 激活名为 \meta{条目名} 的目录条目定制功能,它使用的目录文件后缀为 \meta{扩展名}。需要在激活条目后再使用命令 \cs{RegisterTocName} 注册选项。 - \command{tocrule}[\sarg\harg\oarg{引导点间距}\darg{放大因子}\marg{引导点}\oarg{页码格式}] - 生成目录引导线的命令,需要在引导线选项 \option{tocrule} 中使用。带有星号的命令会使当前级别的目录引导线右端与页码相连而不是对齐。带有 \harg{} 号的命令不添加引导线后的目录页码。\meta{引导点间距} 需带有长度单位,\meta{放大因子} 不带单位,为 \meta{引导点} 的放大倍数,\meta{引导点} 一般为英文句号或 \cs*{cdot} 中心点符号。\meta{页码格式} 的代码位于页码前面,可以设置页码字体和距离等,最后一个命令可以带有一个参数为页码编号。 + 激活名称为 \meta{条目名} 的浮动环境目录定制功能,它使用的目录文件后缀为 \meta{扩展名}。需要在激活条目后再使用命令 \cs{RegisterTocName} 注册选项。 + \command{DeclareFloatList}[\marg{条目名}\marg{扩展名}]\newtag% + 声明一个新的 \cs*{listof}\meta{条目名}\code{\textcolor{cs}{s}} 的浮动环境目录命令,并且支持\ref{sec:document command} 中图表目录命令的机制。使用这个命令要确保将条目加入目录的机制已经存在,推荐搭配 \pkg*{newfloat} 宏包创建新的浮动环境。选项前有符号 \textcolor{red}{\ding{73}} 表示在声明后可用。下面举一个声明算法目录的例子: + \begin{ctexexam} + \usepackage{newfloat} + \DeclareFloatingEnvironment[ + fileext = loa, + listname = 算法清单 + ]{algorithm} + \DeclareFloatList{algorithm}{loa} + \listofalgorithms[multoc] % 在正文中输出双栏算法目录 + \end{ctexexam} \command{listnumberline}[\marg{条目名}] - 在图片、表格或代码目录中插入条目编号的命令,默认包含与题注名相同的标签名。其中 \meta{条目名} 需要显示指定,即为 \code{figure}、\code{table} 或 \code{lstlisting}。关于命令的用法可见\ref{exam:list command usage}。 - \begin{ctexexam}[labelref = exam:list command usage] + 在图表等浮动环境目录中插入条目标签和编号,默认标签可以由格式命令 \cs{labelformat} 设置。注意其中 \meta{条目名} 需要用对应名称\textbf{显示指定}。 + \begin{ctexexam} \ctexset { figure/tocline = \listnumberline{figure}#2, @@ -945,8 +958,8 @@ 悬挂缩进选项 \option{hang} 使目录条目为悬挂缩进形式。缩进距离为条目编号及其与标题间距的长度和。这个选项对所有条目名同时生效。 \keyval{lolskip}{弹性长度}\Default{10pt} 代码目录中每章第一个条目上方增加的垂直距离。与 \CTeX 的表格和图片目录中每章间的条目距离选项 \option*{lotskip} 和 \option*{lofskip} 类似,在 \cls*{article} 模式中此选项失效。 - \keyval{between}{代码钩子} - 目录标题与内容间的钩子(作用于标题下方间距之后),一般插入负的垂直距离代码用于抵消目录首行额外的垂直间距。一级路径此选项对应文档主目录的钩子,二级路径为 \module*{figure}、\module*{table} 和 \module*{lstlisting},或者用位于 \module*{list} 路径的此选项统一设置相应类型目录的钩子。 + \keyval{between}{代码钩子}\dtag[\textcolor{red}{\ding{73}}] + 目录标题与内容间的钩子(作用于标题下方间距之后),一般插入负的垂直距离代码用于抵消目录首行额外的垂直间距。一级路径此选项对应文档主目录的钩子,二级路径为浮动环境的 \meta{条目名}。 \keyval{bibetween}{代码钩子}\newtag% 与选项 \option{between} 类似,是位于一级路径的英文文档主目录(如果启用)代码钩子。 \keybool{dotalign}\Default{true} @@ -1140,13 +1153,13 @@ \subsection{计数器} \begin{commands}\noitemsep \command{newcounter}[\marg{计数器}\oarg{父计数器}]\default{} - \command{counteruse}[\sarg\oarg{父计数器}\darg{编号}\marg{计数器}\oarg{分隔符}\darg{整数}] - 命令 \cs{newcounter} 是 \LaTeX 自带的创建计数器命令,计数器值输出命令 \cs{counteruse} 以一定的格式使用由它创建的计数器,将会以 \cs*{the}\meta{父计数器}\meta{分隔符}\cs*{the}\meta{计数器} 输出这种计数器的值。命令 \cs{counteruse} 仅具有\textbf{输出功能},并不会改变计数器原有的绑定关系。默认每使用一次命令 \meta{计数器} 的值增加1,带有星号的命令使 \meta{计数器} 值保持不变,\meta{计数器} 的值也可以设为指定的 \meta{整数}。计数器的 \meta{编号} 为 \code{arabic} 或 \code{alph} 等计数形式。 + \command{counteruse}[\sarg\oarg{编号}\darg{分隔符}\marg{计数器}\oarg{父计数器}] + 命令 \cs{newcounter} 是 \LaTeX 自带的创建计数器命令,计数器值输出命令 \cs{counteruse} 将会以 \cs*{the}\meta{父计数器}\meta{分隔符}\cs*{the}\meta{计数器} 形式输出这种计数器的值。命令 \cs{counteruse} 仅具有\textbf{输出功能},并不会改变计数器原有的绑定关系。默认每使用一次命令 \meta{计数器} 的值增加1,带有星号参数的命令使 \meta{计数器} 的值保持不变。计数器的 \meta{编号} 为 \code{arabic} 或 \code{alph} 等计数形式。 在一定的场合下可能用到 \cs{counteruse} 命令,比如通过新建快捷命令在一些位置使用定理环境的计数器,使用 \cs{labelformat} 设置计数器的标签引用需添加 \code{eb@}: \begin{ctexexam} \labelformat{eb@theorem}{定理#1} - \newcommand{\theoremhead}[1]{定理\counteruse[chapter]{theorem}\hspace{1em}#1} + \newcommand{\theoremhead}[1]{定理\counteruse{theorem}[chapter]\hspace{1em}#1} \theoremhead{定理内容}\label{thm:theorem} \end{ctexexam} \command{counterwithin}[\sarg\oarg{格式}\marg{计数器}\marg{父计数器}] @@ -1162,7 +1175,7 @@ \subsection{标签引用} \begin{commands} \command{labelformat}[\marg{计数器}\marg{标签引用格式}] - 标签格式命令 \cs{labelformat} 可以设置标签引用格式,\meta{标签引用格式} 中 \code{\#1} 代表 \cs*{the}\meta{计数器},可以设置引用序号的前缀和后缀。也可以使用 \pkg*{cleveref} 宏包提供更强大的标签功能。 + 标签格式命令 \cs{labelformat} 可以设置标签引用格式。\meta{标签引用格式} 中 \code{\#1} 代表 \cs*{the}\meta{计数器},可以设置引用序号的前缀和后缀。也可以使用 \pkg*{cleveref} 宏包提供更强大的标签功能。 \command{AtEndPreamble}[\marg{钩子代码}] 导言区末尾的钩子命令。为了保证兼容性 \pkg*{hyperref} 宏包被设计在导言区末尾载入,一些情况下需要合适的钩子在 \pkg*{hyperref} 后方执行 \meta{钩子代码},例如载入 \pkg*{cleveref} 宏包。 \begin{ctexexam} @@ -1182,7 +1195,7 @@ \command{caption}[\sarg\oarg{目录标题}\marg{标题}]\default{} \command{captionof}[\sarg\marg{条目名}\oarg{目录标题}\marg{标题}]\default{} \command{bicaption}[\sarg\oarg{目录中文标题}\marg{中文标题}\oarg{目录英文标题}\marg{英文标题}] - 题注命令 \cs{caption} 用于在图表上下方插入题注,需要在浮动体环境 \env*{figure} 和 \env*{table} 中使用。在浮动环境外可以使用 \cs{captionof} 命令,第一个参数指定条目名。可以搭配 \pkg*{newfloat} 宏包创建更多类型的浮动环境并设置相应题注。\cs{bicaption} 命令可以实现中英文双语题注,需要在导言区载入 \pkg*{bicaption} 宏包,具体用法见说明文档。 + 题注命令 \cs{caption} 用于在图表上下方插入题注,需要在浮动环境 \env*{figure} 和 \env*{table} 中使用。在浮动环境外可以使用 \cs{captionof} 命令,第一个参数指定条目名。可以搭配 \pkg*{newfloat} 宏包创建更多类型的浮动环境并设置相应题注。\cs{bicaption} 命令可以实现中英文双语题注,需要在导言区载入 \pkg*{bicaption} 宏包,具体用法见说明文档。 \end{commands} \subsection{化学式} @@ -1237,13 +1250,17 @@ \subsection{索引} \begin{commands} \command*{indexsetup}[\marg{键值列表}] - \pkg*{imakeidx} 宏包增强了索引的功能,这是它的的接口命令,用于设置索引表的整体格式。 + \pkg*{imakeidx} 宏包增强了索引的功能。这是它的的接口命令,用于设置索引表的整体格式。 \command*{index}[\oarg{索引名}\marg{标签}] - 索引标签命令 \cs*{index} 的 \meta{索引名} 与索引打印命令 \cs{printindex} 一致,可以存在多个索引表。 + 索引标签命令 \cs*{index} 的 \meta{索引名} 与索引输出命令 \cs{printindex} 一致,可以存在多个索引表。 \command*{makeindex}[\oarg{键值列表}] 使用 \cs*{makeindex} 命令开启索引收集。这个命令可以重复使用打印多个索引表,以不同的 \meta{索引名} 作为区分,如果仅打印一个索引表就没必要再使用。 - \command{printindex}[\sarg\oarg{键值列表}\darg{索引名}] - 现在索引表生成命令 \cs{printindex} 被重新定义,\meta{键值列表} 中的选项与\ref{sec:document command} 其它目录命令相同,但是原本接口命令 \cs*{indexsetup} 的部分选项失效。 + \command{printindex}[\sarg\oarg{键值列表}] + 现在索引表生成命令 \cs{printindex} 被重新定义。\meta{键值列表} 中的选项与\ref{sec:document command} 其它目录命令相同,但是原本接口命令 \cs*{indexsetup} 的部分选项失效。 + \begin{options} + \keyval{name}{索引名} + 指定输出名为 \meta{索引名} 的索引表,如果只使用一个索引表则默认为项目文件名不需要指定。 + \end{options} \end{commands} \subsection{边注} @@ -1301,6 +1318,7 @@ \item 增加英文主文档目录钩子选项 \option{bibetween}。 \end{version} \shortversion{v = 1.638,date = 2022/03/04,changes = 增加目录条目样式选项注册命令 \cs{RegisterTocName}。} + \shortversion{v = 1.643,date = 2022/03/08,changes = 增加浮动环境目录声明命令 \cs{DeclareFloatList} 配合 \pkg*{caption} 宏包。} \end{changelog} \nocite{*} diff --git a/macros/latex/contrib/lwarp/README.txt b/macros/latex/contrib/lwarp/README.txt index 5b687de6c9..c1143fa2bc 100644 --- a/macros/latex/contrib/lwarp/README.txt +++ b/macros/latex/contrib/lwarp/README.txt @@ -1,5 +1,5 @@ -LaTeX lwarp package v0.903 README.txt +LaTeX lwarp package v0.904 README.txt Files included are: diff --git a/macros/latex/contrib/lwarp/lwarp.dtx b/macros/latex/contrib/lwarp/lwarp.dtx index 9800198020..38e6532986 100644 --- a/macros/latex/contrib/lwarp/lwarp.dtx +++ b/macros/latex/contrib/lwarp/lwarp.dtx @@ -16,7 +16,7 @@ % \iffalse %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{lwarp} -%<package> [2022/02/01 v0.903 Allows LaTeX to directly produce HTML5 output.] +%<package> [2022/03/09 v0.904 Allows LaTeX to directly produce HTML5 output.] % %<*driver> \documentclass{ltxdoc} @@ -1272,6 +1272,25 @@ seamlessly integrating with the rest of the \HTML\ output, including any math appearing in non-\MathJax\ \SVG\ output. \end{enumerate} +\subsubsection{\MathJax\ rendering options} + +\trouble[fonts]{mathjax=\MathJax>font} +\trouble{mathjax=\MathJax>rendering} +\trouble{font>mathjax=\MathJax} +\gindex{mathjax=\MathJax>rendering} +\gindex{mathjax=\MathJax>font} +\gindex{font>mathjax=\MathJax} + +\MathJax\ v3 may render using \acro{chtml} or \SVG. +\SVG\ display renders italic characters correctly. +To select \SVG\ rendering, right-click on some math, +and select +\begin{UIdisplay} +Math Settings $\to$ Math Renderer $\to$ SVG +\end{UIdisplay} + +Wait a moment for the math to rerender. + \subsubsection{Customizing \MathJax} \label{sec:limitscustomizemathjax} \gindex{mathjax=\MathJax>custom functions} @@ -2887,37 +2906,47 @@ For wrapped figures, overhang and number of lines are ignored. } \newcommand{\limitssiunitx}{% -\pkg{sunitx} v3 is not yet supported. For now, specify version 2: -\trouble[v3 not yet!]{siunitx=\pkg{siunitx}>v3} -\begin{sourcedisplay} -\cs{usepackage}\{siunitx\}\textred{[=v2]} -\end{sourcedisplay} -This may be also be necessary before loading other packages which also use \pkg{siunitx}, -such as \pkg{chemmacros}. +\pkg{siunitx} is well supported by \pkg{lwarp}. + +\paragraph{Limitations} Some general limitations: Due to \prog{pdftotext} limitations, fraction output is replaced by symbol \margintag{fractions} output for \optn{per-mode} and \optn{quotient-mode}. -Some units will require that the expression be placed inside math mode. -\trouble[math mode required]{siunitx=\pkg{siunitx}} +\cs{cancel} is not currently supported for \pkg{siunitx} v3. -Tabular \texttt{S} and {s} columns are rendered as simple \texttt{c} columns. +Negative values are not automatically colored. + +% Some units will require that the expression be placed inside math mode. +% \trouble[math mode required]{siunitx=\pkg{siunitx}} + +Tabular \texttt{S} and {s} columns are rendered as simple \texttt{c} columns, +although key settings will be set. \trouble[\env{tabular}]{siunitx=\pkg{siunitx}>tabular S and s columns} -These may be replaced by \texttt{c} columns with each cell contained in -\cs{num} or \cs{si}. - -For math mode with \SVG\ display, the original \pkg{siunitx} code is used while -generating the \SVG\ image. -For text mode, \pkg{lwarp} uses an emulation which provides a very effective -\HTML\ interpretation of \pkg{siunitx}. -For math expressions while using \MathJax, -\trouble{siunitx=\pkg{siunitx}>mathjax=\MathJax} -\trouble[MathJax]{mathjax=\MathJax>siunitx=\pkg{siunitx}} -a limited emulation is used. -Most functions work reasonably well, but many options cannot be emulated. -Complicated parsing such as for \cs{ang} is not supported. -The result usually looks fine, and otherwise is enough to get the meaning across. +If using scientific notation, \optn{table-format}, +\optn{table-align-uncertainty}, \optn{drop-exponent}, etc.. +use \cs{tablenum} for each cell. +This is especially required for \optn{drop-exponent}, +\trouble[\optn{drop-exponent}]{siunitx=\pkg{siunitx}>drop-exponent=\optn{drop-exponent}} +without which the value will be shown incorrectly. + +\optn{table-auto-round} is ignored. +\trouble[\optn{table-auto-round}]{siunitx=\pkg{siunitx}>table-auto-round=\optn{table-auto-roound}} + +\paragraph{Math rendering} Math may be rendered in several ways in the same document: + +\begin{description} +\item [For math mode with \SVG\ display:] The original \pkg{siunitx} code is used while + generating the \SVG\ image. + +\item [For \HTML\ text mode:] \pkg{lwarp} uses \pkg{siunitx} code patched for \HTML, + and simplified units. + +\item [For math expressions while using \MathJax:] A limited emulation is used. + Most functions work reasonably well, but many options cannot be emulated. + The result usually looks fine, and otherwise is enough to get the meaning across. +\end{description} % \pkg{lwarp}'s \MathJax\ emulation for \pkg{siunitx} is meant to be a % stop-gap measure until an extension is included in \MathJax. @@ -2928,15 +2957,58 @@ The result usually looks fine, and otherwise is enough to get the meaning across % See \cs{MathJaxFilename} to select a custom \MathJax\ script, but \pkg{lwarp}'s % emulation would have to be diabled as well. -Document modifications required for \MathJax: +\paragraph{Custom units} \pkg{siunitx} allows customized units: + +\DescribeMacro{\DeclareSIUnit} \marg{name} \marg{definition} + + \cs{DeclareSIUnit} declares a version of the unit for the print version. + This is also used when the unit is printed in \SVG\ math + or a \env{lateximage}. + It is also used for \HTML\ if an \HTML-specific version is not defined + with \cs{HTMLDeclareSIUnit}. +\begin{sourcedisplay} +\cs{DeclareSIUnit}\cs{myunit}\{\cs{ensuremath}\{\cs{text}\{m\}\_{}y\}\} +\end{sourcedisplay} + +\DescribeMacro{\HTMLDeclareSIUnit} \marg{name} \marg{definition} + + Use this after the print unit has been defined. +\trouble[v3 only!]{siunitx=\pkg{siunitx}>\cs{HTMLDeclareSIUnit}} + For \pkg{siunitx} v3, + \cs{HTMLDeclareSIUnit} declares a simplified version of the unit for \HTML, + for example if the print-mode unit uses \TeX\ boxes or \cs{ensuremath}: +\begin{sourcedisplay} +\cs{HTMLDeclareSIUnit}\cs{myunit}\{\cs{text}\{m\}\cs{textsubscript}\{\cs{textit}\{y\}\}\} +\end{sourcedisplay} + +It is also possible to provide a custom unit for \MathJax: +\begin{sourcedisplay} +\cs{CustomizeMathJax}\{\cs{newcommand}\{\cs{myunit}\}\{\cs{text}\{m\}\_{}y\}\} +\end{sourcedisplay} + +\paragraph{Predefined units} Most units work as-is with \HTML. +For the following units, \pkg{lwarp} has already set \cs{HTMLDeclareSIUnit}: +\cs{celsius}, \cs{arcminute}, \cs{arcsecond}, \cs{elementarycharge}, +\cs{clight}, \cs{bohr}, \cs{electronmass}, \cs{hartree}, \cs{planckbar}. + +\paragraph{Document modifications required for \MathJax} +\trouble{siunitx=\pkg{siunitx}>mathjax=\MathJax} +\trouble[MathJax]{mathjax=\MathJax>siunitx=\pkg{siunitx}} \begin{itemize} \item Place \cs{sisetup} in the preamble before \texttt{\cs{begin}\{document\}}. \watchout[\cs{sisetup}] Changes made later may be ignored, especially with \MathJax. The \MathJax\ emulation also ignores most macro options. +\item Complex numbers are displayed as entered, + \watchout[complex numbers] + ignoring \optn{output-complex-root}. \item Custom units may be added with \cs{CustomizeMathJax}. \margintag{custom units} - See the \pkg{lwarp-siunitx} code for examples. + For example, from \pkg{lwarp-common-mathjax-siunitx}: + \begin{sourcedisplay} + \cs{CustomizeMathJax}\{\cs{newcommand}\{\cs{hartree}\}\{\cs{mathit}\{E\}\_{}\{\cs{mathrm}\{h\}\}\}\} \\ + \cs{CustomizeMathJax}\{\cs{newcommand}\{\cs{angstrom}\}\{\cs{mathrm}\{\cs{unicode}\{x212B\}\}\}\} + \end{sourcedisplay} \item Units work better using \texttt{\textasciitilde} between units \watchout[unit spacing] instead of using periods. @@ -2949,6 +3021,8 @@ Document modifications required for \MathJax: Single units do not require braces. \item For \cs{numlist}, the argument is printed as text as-is, so use space between semicolons for improved readability. +\item If using \optn{parse-numbers = false}, also use \cs{num} or \cs{qty}. + \watchout[\texttt{Missing \$\ inserted}]{siunitx=\pkg{siunitx}>Missing \$\ inserted.} \end{itemize} Also see \nameref{sec:limitsmathjax}, \cref{sec:limitsmathjax}. @@ -3172,7 +3246,7 @@ This boolean may be tested by the user for later use. %<*package> % \fi % -% \CheckSum{54471} +% \CheckSum{55400} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -3318,6 +3392,7 @@ This boolean may be tested by the user for later use. % \changes{v0.902}{2021/10/01}{\ 2021/10/01} % \changes{v0.903}{2021/12/23}{Now uses \cs{IfPackageLoadedTF}, etc.} % \changes{v0.903}{2022/02/01}{\ 2022/02/01} +% \changes{v0.904}{2022/03/09}{\ 2022/03/09} @@ -3552,6 +3627,16 @@ This boolean may be tested by the user for later use. % % \begin{description} % \needspace{2\baselineskip} +% \item[v0.904:] Added \pkg{siunitx} v3. +% \begin{itemize} +% \item Fixed \HTML\ tags inside non-Latin text. +% \item \MathJax\ now defaults to \SVG\ rendering. +% \item Added \pkg{siunitx} v3. Updated \pkg{siunitx-v2}. +% See \cref{sec:limitssiunitx} for limitations. +% \item Updated \pkg{caption}, \pkg{chemmacros}, \pkg{fbox}, \pkg{hyperref}, +% \pkg{multicol}, \pkg{wrapfig2}. +% \end{itemize} +% \needspace{2\baselineskip} % \item[v0.903:] Various updates and improvements. % \begin{itemize} % \item Error if \prog{pdftotext} not available. @@ -12050,21 +12135,46 @@ This boolean may be tested by the user for later use. % % \changes{v0.25}{2017/03/22}{Docs: Testing \pkg{lwarp}.} % +% Compiling \filenm{lwarp.ins} generates all the \filenm{*.sty} files for \pkg{lwarp}. +% It can be useful to create additional \filenm{*.ins} files to be able to +% recompile only the pieces which have changed. +% +% For example, +% \margintag{compiling individual packages} +% to be able to recompile the \pkg{lwarp} core alone, +% \DescribeFile{core.ins} +% copy \filenm{lwarp.ins} to \filenm{core.ins}, +% then modify \filenm{core.ins} to only compile: +% \begin{sourceverb} +% \generate{ +% \file{lwarp.sty}{\from{lwarp.dtx}{package}} +% } +% \end{sourceverb} +% +% For individual packages, create \filenm{packagename.ins}, set to compile only: +% \begin{sourceverb} +% \generate{ +% \file{lwarp-packagename.sty}{\from{lwarp.dtx}{packagename}} +% } +% \end{sourceverb} +% % When changes have been made, test the print output before testing the % \HTML. The print output compiles faster, and any errors in the printed % version will be easier to figure out than the \HTML\ version. % -% Remember that the configuration files are only rewritten when compiling the +% Remember that the configuration files +% \margintag{compiling \CSS\ and other generated files} +% are only rewritten when compiling the % printed version of the document. % % \changes{v0.57}{2018/05/28}{Docs: Recompiling \prog{lwarpmk} or \CSS\ files.} % When changing the source to \prog{lwarpmk} or a \CSS\ file in \filenm{lwarp.dtx}: % \begin{enumerate} % \item Change the source in \filenm{lwarp.dtx}. -% \item |pdflatex lwarp.ins| +% \item |pdflatex lwarp.ins| -or- |pdflatex core.ins| % \item |pdflatex lwarp.dtx| % \item If modifying \prog{lwarpmk} the new version should now be active. -% \item If modifying \CSS\ files: +% \item If modifying \CSS\ files or other files generated by \pkg{lwarp}: % \begin{enumerate} % \item For the document, |lwarpmk print| to update the \CSS\ files % in the project. @@ -13650,6 +13760,7 @@ This boolean may be tested by the user for later use. \LWR@loadafter{lips} \LWR@loadafter{listings} \LWR@loadafter{listliketab} +\LWR@loadafter{lltjp-siunitx} \LWR@loadafter{lltjp-tascmac} \LWR@loadafter{longtable} \LWR@loadafter{lpic} @@ -18114,7 +18225,7 @@ span.textnormal, div.textnormal { font-variant: normal; font-variant-numeric: normal ; font-family: "DejaVu Serif", "Bitstream Vera Serif", - "Lucida Bright", Georgia, serif; + "Lucida Bright", Georgia, serif; } span.textmd, div.textmd { font-weight: normal; } @@ -20541,6 +20652,8 @@ page_compositor "." % \changes{v0.891}{2020/09/07}{File: \filenm{lwarp_mathjax.txt}: Renamed \filenm{tagformat} extension.} % \changes{v0.892}{2020/09/26}{File: \filenm{lwarp_mathjax.txt}: Added \cs{left} \Slash \cs{right} delimiters.} % \changes{v0.895}{2021/01/13}{File: \filenm{lwarp_mathjax.txt}: Added \cs{ifblank}, \cs{ifstrequal} macros.} +% \changes{v0.904}{2022/02/21}{File: \filenm{lwarp_mathjax.txt}: Added \cs{gsub} macro.} +% \changes{v0.904}{2022/02/25}{File: \filenm{lwarp_mathjax.txt}: Defaults to \SVG\ instead of \acro{chtml}.} % ^^A *lwarp_mathjax.txt % % \codeconfig @@ -20593,12 +20706,13 @@ MathJax = { } // Create the command map for: - // \ifstar, \ifnextchar, \ifblank, \ifstrequal, \seteqnumber + // \ifstar, \ifnextchar, \ifblank, \ifstrequal, \gsub, \seteqnumber new CommandMap('Lwarp-macros', { ifstar: 'IfstarFunction', ifnextchar: 'IfnextcharFunction', ifblank: 'IfblankFunction', ifstrequal: 'IfstrequalFunction', + gsubstitute: 'GsubstituteFunction', seteqnumber: 'SeteqnumberFunction' }, { // This function implements an ifstar macro. @@ -20641,6 +20755,15 @@ MathJax = { useArgument(parser, isequal ? resultequal : resultnotequal); }, + // This function implements a gsub macro. + GsubstituteFunction(parser, name) { + const gsubfirst = parser.GetArgument(name); + const gsubsecond = parser.GetArgument(name); + const gsubthird = parser.GetArgument(name); + let gsubresult=gsubfirst.replace(gsubsecond, gsubthird); + useArgument(parser, gsubresult); + }, + // This function modifies the equation numbers. SeteqnumberFunction(parser, name) { // Get the macro parameters @@ -20741,7 +20864,7 @@ MathJax = { <script id="MathJax-script" - src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" + src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js" ></script> \end{filecontents*} % \end{Verbatim}% for syntax highlighting @@ -20878,7 +21001,7 @@ MathJax = { -- Copyright 2016-2022 Brian Dunn -printversion = "v0.903" +printversion = "v0.904" requiredconfversion = "2" -- also at *lwarpmk.conf function printhelp () @@ -22233,7 +22356,6 @@ end -- not --version % \end{macrocode} % \end{macro} - % \DescribeBoolean{LWR@mathmacro} True if currently defining math macros. % Used to disable \SVG\ math hashing and \MathJax\ math contents while % defining a macro using inline math. @@ -22269,6 +22391,30 @@ end -- not --version % \end{macrocode} +% \codehtml +% \begin{macrocode} +\begin{warpHTML} +% \end{macrocode} + +% A definition for |&| in case it is referred to after +% \cs{StartDefiningTabulars} but outside a \env{tabular}. +% \changes{v0.904}{2022/03/03}{Warn if \& outside \env{tabular}.} +% \begin{macrocode} +\StartDefiningTabulars +\protected\gdef&{% + \PackageWarning{lwarp}{% + An ampersand is being used inside a tabular\MessageBreak + }% +}% +\StopDefiningTabulars +% \end{macrocode} + +% \begin{macrocode} +\end{warpHTML} +% \end{macrocode} + + + % \section{Localizing dynamic math} % \label{sec:localizingdynamicmath} % \trouble{SVG image>math incorrect>dymamic} @@ -22353,21 +22499,69 @@ end -- not --version % \end{macrocode} % \HTML\ Unicode entities: + % \begin{macrocode} \let\LWR@origampersand\& % \end{macrocode} + + +% \begin{macro}{\LWR@fontfortags} \marg{macro name} +% +% Forces roman TT font for \HTML\ tags. +% \changes{v0.904}{2022/03/02}{Improved font control.} +% \begin{macrocode} +\newrobustcmd*{\LWR@fontfortags}[1]{% + \ifmmode% + \PackageError{lwarp}% + {% + An HTML tag was generated inside math.\MessageBreak + This should never occur.\MessageBreak + Something is broken in Lwarp% + }% + {(Using #1.)}% + \else% +% \end{macrocode} +% +% Used by \pkg{ltjtbook}, \pkg{platex}, and related. +% \begin{macrocode} + \ifdef{\romanencoding}% + {% + \romanencoding{\encodingdefault}% + }% + {% +% \end{macrocode} +% +% Used by \pkg{babel}: +% \begin{macrocode} + \ifdef{\latintext} + {\latintext} + {\fontencoding\encodingdefault}% + }% + \LWR@print@normalfont% + \LWR@origttfamily% + \fi% +} +% \end{macrocode} +% \end{macro} + % \begin{macro}{\HTMLentity} \marg{entitytag} +% +% \cs{protect} is in case the tag appears in \TOC, \LOF, \LOT. +% +% \changes{v0.904}{2022/02/19}{Improved font control.} % \begin{macrocode} \newcommand*{\HTMLentity}[1]{% % \LWR@traceinfo{HTMLentity \detokenize{#1}}% -\begingroup% -\LWR@hook@processingtags% -\LWR@origampersand#1;% -\endgroup% + \begingroup% + \LWR@hook@processingtags% + \LWR@fontfortags{HTMLentity}% + \protect\LWR@origampersand\LWR@isolate{#1};% + \endgroup% % \LWR@traceinfo{HTMLentity done}% } % \end{macrocode} % \end{macro} + % \begin{macro}{\HTMLunicode} \marg{hex\_unicode} % \begin{macrocode} \newcommand*{\HTMLunicode}[1]{\HTMLentity{\LWR@origpound{}x#1}} @@ -23221,13 +23415,15 @@ end -- not --version % Break ligatures and use upright apostrophes in \HTML\ tags. % % \cs{protect} is in case the tag appears in \TOC, \LOF, \LOT. +% % \changes{v0.85}{2020/04/30}{Fix: Added print macros for \pkg{fontspec}.} +% \changes{v0.904}{2022/02/19}{Improved font control.} % \begin{macrocode} \newcommand*{\LWR@htmltagc}[1]{% \LWR@traceinfo{LWR@htmltagc !\detokenize{#1}!}% \begingroup% \LWR@hook@processingtags% - \ifmmode\else\protect\LWR@print@normalfont\protect\LWR@origttfamily\fi% + \LWR@fontfortags{LWR@htmltagc}% \protect\LWR@origtextless% \LWR@isolate{#1}% \protect\LWR@origtextgreater% @@ -23411,7 +23607,7 @@ end -- not --version % \LWR@traceinfo{LWR@htmlopencomment}% \begingroup% \LWR@hook@processingtags% - \ifmmode\else\protect\LWR@print@normalfont\protect\LWR@origttfamily\fi% + \LWR@fontfortags{LWR@htmlopencomment}% \LWR@print@mbox{\LWR@origtextless{}!-\/-}% \endgroup% } @@ -23420,7 +23616,7 @@ end -- not --version % \LWR@traceinfo{LWR@htmlclosecomment}% \begingroup% \LWR@hook@processingtags% - \ifmmode\else\protect\LWR@print@normalfont\protect\LWR@origttfamily\fi% + \LWR@fontfortags{LWr@htmlclosecomment}% \LWR@print@mbox{-\/-\LWR@origtextgreater}% \endgroup% } @@ -30949,22 +31145,7 @@ end -- not --version % \subsection{Parsing `w' columns} % -% \begin{macro}{\LWR@parsewcolumn} \marg{this column type} -% The width will be ignored. -% -% The arguments to the column type are absorbed by \cs{LWR@columntype@<char>}, -% defined by \cs{LWR@modifycolumntype}. -% -% The argument is ignored, -% but provided for compatibility with \cs{LWR@parsenormalcolumn}. -% -% \begin{macrocode} -\newcommand*{\LWR@parsewcolumn}[1]{% - \LWR@columnspeclookahead{1}% - \expandafter\LWR@parsenormalcolumn\expandafter{\LWR@strresulttwo}% -} -% \end{macrocode} -% \end{macro} +% |W| and |w| columns are handled via \pkg{array} with \cs{HTMLnewcolumntype}. % \subsection{Parsing '*' columns} @@ -31204,14 +31385,6 @@ end -- not --version \LWR@modifycolumntype{b}{1}{LWR@parsenormalcolumn} {LWR@printmccoltype@normal}{LWR@printmccoldata@paragraph} % \end{macrocode} -% \changes{v0.56}{2018/05/10}{Added \pkg{array} \texttt{W} column.} -% \begin{macrocode} -\LWR@modifycolumntype{w}{2}{LWR@parsewcolumn} - {LWR@printmccoltype@normal}{LWR@printmccoldata@normal} - -\LWR@modifycolumntype{W}{2}{LWR@parsewcolumn} - {LWR@printmccoltype@normal}{LWR@printmccoldata@normal} -% \end{macrocode} % A star column: % \begin{macrocode} \LWR@modifycolumntype{*}{2}{LWR@parsestarcolumn} @@ -31220,7 +31393,11 @@ end -- not --version % % % -% \begin{macro}{\HTMLnewcolumntype} \marg{col type} \oarg{num args} \marg{replacement text} +% \begin{macro}{\HTMLnewcolumntype} +% \marg{col type} +% \oarg{num args} +% \oarg{optional arg} +% \marg{replacement text} % % A user-level macro to creates an \HTML\ version % of the replacement text for the column type. @@ -31233,11 +31410,20 @@ end -- not --version % \end{sourceverb} % % \changes{v0.901}{2021/08/17}{Improved \cs{newcolumntype} emulation.} +% \changes{v0.904}{2022/03/05}{Added optional arg.} % \begin{macrocode} -\NewDocumentCommand{\HTMLnewcolumntype}{m O{0} m}{% - \expandafter\newcommand\expandafter*% - \csname LWR@HTML@NC@rewrite@#1\endcsname[#2]{\NC@find #3}% - \LWR@formatted{NC@rewrite@#1}% +\NewDocumentCommand{\HTMLnewcolumntype}{m O{0} o m}{% + \IfValueTF{#3} + { + \expandafter\newcommand\expandafter*% + \csname LWR@HTML@NC@rewrite@#1\endcsname[#2][#3]{\NC@find #4}% + \LWR@formatted{NC@rewrite@#1}% + } + { + \expandafter\newcommand\expandafter*% + \csname LWR@HTML@NC@rewrite@#1\endcsname[#2]{\NC@find #4}% + \LWR@formatted{NC@rewrite@#1}% + } } % \end{macrocode} % \end{macro} @@ -31252,7 +31438,7 @@ end -- not --version % \end{macrocode} % % \begin{macrocode} -\NewDocumentCommand{\HTMLnewcolumntype}{m O{0} m}{} +\NewDocumentCommand{\HTMLnewcolumntype}{m O{0} o m}{} % \end{macrocode} % % \begin{macrocode} @@ -37483,8 +37669,8 @@ end -- not --version \renewcommand*{\$}{% \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% - {\LWR@origtextdollar}% - {\HTMLunicode{00024}}% + {\LWR@origtextdollar}% + {\HTMLunicode{00024}}% } % \end{macrocode} @@ -40075,7 +40261,8 @@ end -- not --version % \label{sec:siunitx} % \DescribePackage{siunitx} -% The \pkg{lwarp} core passes a few options to \pkg{siunitx}. + +% A few \HTML\ unit equivalents are defined here. % \limitssiunitx % @@ -40090,6 +40277,7 @@ end -- not --version % Options for siunitx: % \changes{v0.50}{2018/02/24}{\pkg{siunitx}: Improved units.} % \changes{v0.897}{2021/05/23}{\pkg{siunitx}: Rollback for v2.} +% \changes{v0.904}{2022/02/19}{\pkg{siunitx}: Added v3.} % \begin{macrocode} \newrobustcmd{\LWR@siunitx@textcelsius}{\HTMLentity{deg}C} \newrobustcmd{\LWR@siunitx@textdegree}{\HTMLentity{deg}} @@ -40104,15 +40292,6 @@ end -- not --version \renewrobustcmd{\LWR@siunitx@textdblprime}{\text{\ensuremath{^{\prime\prime}}}}% \renewrobustcmd{\LWR@siunitx@textplanckbar}{\text{\ensuremath{\hbar}}}% } - -\PassOptionsToPackage{ - detect-mode=true, - per-mode=symbol, % fraction is not seen by pdftotext - text-celsius = {\LWR@siunitx@textcelsius}, - text-degree = {\LWR@siunitx@textdegree}, - text-arcminute = {\LWR@siunitx@textprime} , - text-arcsecond = {\LWR@siunitx@textdblprime} , -}{siunitx-v2} % \end{macrocode} % \begin{macrocode} @@ -40120,7 +40299,14 @@ end -- not --version % \end{macrocode} - +% \codeprint +% +% The print version of \cs{HTMLDeclareSIUnit}. +% \begin{macrocode} +\begin{warpprint} +\NewDocumentCommand{\HTMLDeclareSIUnit}{o +m m}{} +\end{warpprint} +% \end{macrocode} % \section{Graphics print-mode modifications} @@ -41570,14 +41756,19 @@ color:\LWR@origpound\LWR@tempcolor% % \begin{macro}{\textnormal} \marg{text} % \changes{v0.902}{2021/09/28}{Reduce nested spans.} +% \changes{v0.904}{2022/03/02}{Improved.} % \begin{macrocode} \DeclareRobustCommand{\LWR@HTML@textnormal}[1]{% -% \textmd{\textrm{\textup{#1}}}% \LWR@HTML@mdseries% \LWR@HTML@rmfamily% \LWR@HTML@upshape% + \LWR@HTML@ulcshape% \InlineClass(% - font-weight:normal; font-family:serif; font-style:normal + font-weight: normal; + font-family: serif; + font-style: normal; + font-variant: normal; + font-variant-numeric: normal ; ){textnormal}{#1}% } @@ -41632,6 +41823,7 @@ color:\LWR@origpound\LWR@tempcolor% % \changes{v0.48}{2018/02/02}{Added. Improves font control.} % \changes{v0.56}{2018/04/27}{Added \attribute{span.textbf}, etc.} % \changes{v0.62}{2018/11/15}{Tracks depth to avoid nesting repeated font changes.} +% \changes{v0.904}{2022/03/02}{Uses \optn{textnormal} if possible.} % \begin{macrocode} \newcounter{LWR@textcurrentfontdepth} \setcounter{LWR@textcurrentfontdepth}{0} @@ -41645,13 +41837,22 @@ color:\LWR@origpound\LWR@tempcolor% }% {% \addtocounter{LWR@textcurrentfontdepth}{1}% - \InlineClass{% - text\LWR@f@family\LWR@origtilde{}% - text\LWR@f@series\LWR@origtilde{}% - text\LWR@f@shape\LWR@origtilde{}% - text\LWR@f@shapecaps% + \ifboolexpr{% + test {\ifdefstring{\LWR@f@family}{rm}} and + test {\ifdefstring{\LWR@f@series}{md}} and + test {\ifdefstring{\LWR@f@shape}{up}} and + test {\ifdefstring{\LWR@f@shapecaps}{ulc}} + }% + {\InlineClass{textnormal}{#1}}% + {% + \InlineClass{% + text\LWR@f@family\LWR@origtilde{}% + text\LWR@f@series\LWR@origtilde{}% + text\LWR@f@shape\LWR@origtilde{}% + text\LWR@f@shapecaps% + }% + {#1}% }% - {#1}% \addtocounter{LWR@textcurrentfontdepth}{-1}% }% } @@ -42000,13 +42201,16 @@ color:\LWR@origpound\LWR@tempcolor% % % \begin{macro}{\LWR@tempcolor} % \begin{macro}{\LWR@tempcolortwo} +% \begin{macro}{\LWR@tempcolorthree} % The color converted to \HTML\ colorspace. % \begin{macrocode} \newcommand*{\LWR@tempcolor}{} \newcommand*{\LWR@tempcolortwo}{} +\newcommand*{\LWR@tempcolorthree}{} % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % % \begin{macro}{\LWR@findcurrenttextcolor} @@ -44970,13 +45174,13 @@ color:\LWR@origpound\LWR@tempcolor% \LetLtxMacro\LWR@origmake@df@tag@@@\make@df@tag@@@ \renewcommand*{\make@df@tag@@}[1]{% -\LWR@remembertag{#1}% -\LWR@origmake@df@tag@@{#1}% + \LWR@remembertag{#1}% + \LWR@origmake@df@tag@@{#1}% } \renewcommand*{\make@df@tag@@@}[1]{% -\LWR@remembertag{#1}% -\LWR@origmake@df@tag@@@{#1}% + \LWR@remembertag{#1}% + \LWR@origmake@df@tag@@@{#1}% } }% not mathjax @@ -45881,6 +46085,7 @@ color:\LWR@origpound\LWR@tempcolor% % % Provide simplified column types for \HTML: % \changes{v0.901}{2021/08/12}{\pkg{array}: Improved \cs{newcolumntype} emulation.} +% \changes{v0.904}{2022/03/05}{\pkg{array}: Improved \texttt{W} and \texttt{w} processing.} % \begin{macrocode} \HTMLnewcolumntype{w}[2]{#1} \HTMLnewcolumntype{W}[2]{#1} @@ -48670,6 +48875,7 @@ color:\LWR@origpound\LWR@tempcolor% % % \changes{v0.44}{2017/11/16}{\pkg{cancel}: Added.} % \changes{v0.87}{2020/06/02}{\pkg{cancel}: Now uses \MathJax\ v3 extension.} +% \changes{v0.904}{2022/03/08}{\pkg{cancel}: Now \cs{LWR@formatted}.} % % \codehtml % @@ -48681,17 +48887,6 @@ color:\LWR@origpound\LWR@tempcolor% % % % \cs{cancelto} is math-only, so is used as-is. -% \begin{macrocode} -\LetLtxMacro\LWR@origcancel\cancel -\LetLtxMacro\LWR@origbcancel\bcancel -\LetLtxMacro\LWR@origxcancel\xcancel - -\appto\LWR@restoreorigformatting{% -\LetLtxMacro\cancel\LWR@origcancel% -\LetLtxMacro\bcancel\LWR@origbcancel% -\LetLtxMacro\xcancel\LWR@origxcancel% -} -% \end{macrocode} % \begin{noindmacro}{\LWR@cancelcolor} @@ -48709,7 +48904,7 @@ color:\LWR@origpound\LWR@tempcolor% % \begin{noindmacro}{\cancel} \marg{text} % \begin{macrocode} -\DeclareRobustCommand{\cancel}[1]{% +\DeclareRobustCommand{\LWR@HTML@cancel}[1]{% \begingroup% \CancelColor% \LWR@findcurrenttextcolor% @@ -48718,6 +48913,7 @@ color:\LWR@origpound\LWR@tempcolor% {text-decoration:line-through}% \endgroup% } +\LWR@formatted{cancel}% \LetLtxMacro\bcancel\cancel \LetLtxMacro\xcancel\cancel @@ -48898,6 +49094,19 @@ s% % \end{macrocode} +% \changes{v0.904}{2022/03/04}{\pkg{caption}: Added \cs{captiontext}.} +% \begin{macrocode} +\long\def\caption@@@text#1#2#3[#4]#5{% + \begin{BlockClass}{figurecaption}% lwarp + \begingroup + #3{\csname c@#1\endcsname #4\relax}% + #2{\caption@fnum{#1}}{#5}% + \endgroup% + \end{BlockClass}% lwarp +} +% \end{macrocode} + + % Updates for late patches for \pkg{scrextend}: % \changes{v0.88}{2020/07/15}{\pkg{caption}, \pkg{scrextend}: Fixed \cs{caption*}.} % \begin{macrocode} @@ -49102,7 +49311,16 @@ s% \renewcommand{\caption@@make@}[2]{% \caption@stepthecounter% \caption@beginhook% +% \caption@box\hsize{% +% \caption@singlelinecheck{\caption@slc{#1}{#2}\caption@singleline\caption@multiline}{\caption@multiline}% +% \caption@calcmargin +% \caption@make@leftmargin +% \caption@make@parbox{% +% \caption@make@indention \caption@@@make{#1}{#2}% +% } +% \caption@make@rightmargin +% }% \caption@endhook% } % \end{macrocode} @@ -49990,7 +50208,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% % \codehtml % % \begin{macrocode} -\LWR@ProvidesPackagePass{chemformula}[2019/10/13] +\LWR@ProvidesPackagePass{chemformula}[2022/01/23] % \end{macrocode} % \begin{macrocode} @@ -50400,7 +50618,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% % \codehtml % % \begin{macrocode} -\LWR@ProvidesPackagePass{chemmacros}[2017/08/28] +\LWR@ProvidesPackagePass{chemmacros}[2022/02/13] % \end{macrocode} % % \SVG\ file hashing assumes that the relevent options are constant for the entire document. @@ -50437,22 +50655,45 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% % \subsection{Code} % % +% \begin{macrocode} +\ExplSyntaxOn +% \end{macrocode} +% +% +% \subsection{Loading packages} +% +% Also accept the \pkg{lwarp} version: +% \changes{v0.904}{2022/03/03}{\pkg{chemmacros}: Accept \pkg{lwarp} version of pkgs.} +% \begin{macrocode} +\prg_set_conditional:Npnn \chemmacros_if_package_loaded:n #1 {p,T,F,TF} + { + \cs_if_exist:cTF {ver@#1.sty} + { \prg_return_true: } + { + \cs_if_exist:cTF {ver@lwarp-#1.sty} + { \prg_return_true: } + { \prg_return_false: } + } + } +% \end{macrocode} +% +% Nullify \pkg{hyperref} detection: +% \changes{v0.904}{2022/03/03}{\pkg{chemmacros}: Nullify \pkg{hyperref} detection.} +% \begin{macrocode} +\hook_gput_code:nnn {begindocument/end} {chemmacros} + { + \bool_set_false:N \l__chemmacros_hyperref_bool + } +% \end{macrocode} +% +% +% % \subsection{Loading modules} % % Patching \pkg{chemmacros} modules must be done \cs{AtBeginDocument}, % since modules are invoked by the user in the preamble, and each patch is % only done if the module is loaded. % -% \begin{macrocode} -\ExplSyntaxOn - -\newcommand{\@ifchemmacrosmoduleloaded}[1]{% -\@ifl@aded{\c__chemmacros_module_extension_tl}{\c__chemmacros_module_prefix_tl.#1}% -} - -\ExplSyntaxOff -% \end{macrocode} -% % % \subsection{New environments} % \label{sec:chemmacroshtmlenvs} @@ -50484,17 +50725,12 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% % \end{noindenvironment} % % -% \begin{macrocode} -\ExplSyntaxOn -% \end{macrocode} -% -% % \subsection{Acid-base} % % \changes{v0.903}{2021/12/18}{\pkg{chemmacros}: Improved alt tag sanitization.} % \begin{macrocode} \AtBeginDocument{ -\@ifchemmacrosmoduleloaded{acid-base}{ +\chemmacros_module_if_loaded:nTF{{acid-base}}{ \PackageInfo{lwarp}{Patching~chemmacros~module~acid-base} \cs_gset_protected:Npn \chemmacros_p:n #1 @@ -50526,7 +50762,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% \begingroup \boolfalse{mathjax} \LWR@subsingledollar*{\textbackslash{}pH}{chemmacros}{ - \chemmacros_p:n { \chemmacros_chemformula:n {H} } + \chemmacros_p:n { \chemmacros_formula:n {H} } } \endgroup } @@ -50535,7 +50771,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% \begingroup \boolfalse{mathjax} \LWR@subsingledollar*{\textbackslash{}pOH}{chemmacros}{ - \chemmacros_p:n { \chemmacros_chemformula:n {OH} } + \chemmacros_p:n { \chemmacros_formula:n {OH} } } \endgroup } @@ -50598,7 +50834,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% \endgroup } -}{}% \@ifchemmacrosmoduleloaded +}{}% module loaded }% AtBeginDocument % \end{macrocode} % @@ -50607,7 +50843,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% % % \begin{macrocode} \AtBeginDocument{ -\@ifchemmacrosmoduleloaded{charges}{ +\chemmacros_module_if_loaded:nTF{{charges}}{ \PackageInfo{lwarp}{Patching~chemmacros~module~charges} \cs_gset_protected:Npn \fplus { @@ -50625,7 +50861,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% \endgroup } -}{}% \@ifchemmacrosmoduleloaded +}{}% Module loaded. }% AtBeginDocument % \end{macrocode} % @@ -50634,16 +50870,16 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% % % \begin{macrocode} \AtBeginDocument{ -\@ifchemmacrosmoduleloaded{nomenclature}{ +\chemmacros_module_if_loaded:nTF{{nomenclature}}{ \PackageInfo{lwarp}{Patching~chemmacros~module~nomenclature} \cs_gset_protected:Npn \chemmacros_charge:n #1 { \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0} - {\chemmacros_chemformula:n { {}^{#1} }} + {\chemmacros_formula:n { {}^{#1} }} { \ifmmode - {\chemmacros_chemformula:n { {}^{#1} }} + {\chemmacros_formula:n { {}^{#1} }} \else { \textsuperscript{\ensuremath{#1}} } \fi @@ -50663,7 +50899,6 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% % ^^A \RenewChemIUPAC \chemprime { \HTMLunicode{2032} } % % \begin{macrocode} -\ChemCompatibilityFrom{5.8} \cs_gset_protected:Npn \__chemmacros_cip:n #1 { \tl_set:Nn \l__chemmacros_tmpa_tl {#1} @@ -50680,7 +50915,6 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% }}% lwarp } } -\EndChemCompatibility % \end{macrocode} % % \begin{macrocode} @@ -50706,9 +50940,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% \chemmacros_coordination_symbol:nnnn { \l__chemmacros_coord_use_hyphen_bool } { - \chemmacros_if_compatibility:nnTF {>} {5.7} { \c_true_bool } - { \c_false_bool } } { \chemeta } {#1} @@ -50724,9 +50956,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% \chemmacros_coordination_symbol:nnnn { \l__chemmacros_coord_use_hyphen_bool } { - \chemmacros_if_compatibility:nnTF {>} {5.7} { \c_true_bool } - { \c_false_bool } } { \chemkappa } {#1} @@ -50747,7 +50977,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% } \endgroup } -}{}% \@ifchemmacrosmoduleloaded +}{}% Module loaded. }% AtBeginDocument % \end{macrocode} % @@ -50756,7 +50986,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% % % \begin{macrocode} \AtBeginDocument{ -\@ifchemmacrosmoduleloaded{particles}{ +\chemmacros_module_if_loaded:nTF{{particles}}{ \PackageInfo{lwarp}{Patching~chemmacros~module~particles} \cs_gset_protected:Npn \chemmacros_declare_nucleophile:Nn #1#2 @@ -50766,11 +50996,10 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% \bool_if:NTF \l__chemmacros_nucleophile_elpair_bool { \chemmacros_elpair:n { #2 } - \chemmacros_if_compatibility:nnT {>=} {5.3} { \skip_horizontal:N \l__chemmacros_nucleophile_dim } - \chemmacros_chemformula:n { {}^{-} } + \chemmacros_formula:n { {}^{-} } } - { \chemmacros_chemformula:n { #2^{-} } } + { \chemmacros_formula:n { #2^{-} } } } \DeclareDocumentCommand #1 {o} {% @@ -50787,7 +51016,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% \RenewChemNucleophile \Nuc {Nu} \RenewChemNucleophile \ba {ba} -}{}% \@ifchemmacrosmoduleloaded +}{}% Module loaded. }% AtBeginDocument % \end{macrocode} % @@ -50796,7 +51025,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% % % \begin{macrocode} \AtBeginDocument{ -\@ifchemmacrosmoduleloaded{phases}{ +\chemmacros_module_if_loaded:nTF{{phases}}{ \PackageInfo{lwarp}{Patching~chemmacros~module~phases} \cs_undefine:N \chemmacros_phase:n @@ -50824,7 +51053,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% } } -}{}% \@ifchemmacrosmoduleloaded +}{}% Module loaded. }% AtBeginDocument % \end{macrocode} % @@ -50832,7 +51061,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% % % \begin{macrocode} \AtBeginDocument{ -\@ifchemmacrosmoduleloaded{mechanisms}{ +\chemmacros_module_if_loaded:nTF{{mechanisms}}{ \PackageInfo{lwarp}{Patching~chemmacros~module~mechanisms} \chemmacros_define_keys:nn {textmechanisms} @@ -50944,15 +51173,18 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% }% } -}{}% \@ifchemmacrosmoduleloaded +}{}% Module loaded. }% AtBeginDocument % \end{macrocode} % +% % \subsection{Newman} % +% There are so many options that it is hard to hash these images for reuse. +% % \begin{macrocode} \AtBeginDocument{ -\@ifchemmacrosmoduleloaded{newman}{ +\chemmacros_module_if_loaded:nTF{{newman}}{ \PackageInfo{lwarp}{Patching~chemmacros~module~newman} \RenewDocumentCommand \newman {od()m}% @@ -50969,7 +51201,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% \end{lateximage} }% -}{}% \@ifchemmacrosmoduleloaded +}{}% Module loaded. }% AtBeginDocument % \end{macrocode} % @@ -50978,7 +51210,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% % \changes{v0.903}{2021/12/18}{\pkg{chemmacros}: Improved alt tag sanitization.} % \begin{macrocode} \AtBeginDocument{ -\@ifchemmacrosmoduleloaded{orbital}{ +\chemmacros_module_if_loaded:nTF{{orbital}}{ \PackageInfo{lwarp}{Patching~chemmacros~module~orbital} \RenewDocumentCommand \orbital {om} @@ -51006,7 +51238,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% \end{lateximage} } -}{}% \@ifchemmacrosmoduleloaded +}{}% Module loaded. }% AtBeginDocument % \end{macrocode} % @@ -51017,12 +51249,17 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% % \fqquad \marg{chem} \marg{math} \marg{args number} \marg{argument list (\{\#2\}\{\#3\}...)} % \begin{macrocode} \AtBeginDocument{ -\@ifchemmacrosmoduleloaded{reactions}{ +\chemmacros_module_if_loaded:nTF{{reactions}}{ \PackageInfo{lwarp}{Patching~chemmacros~module~reactions} -\cs_gset_protected:Npn \chemmacros_declare_reaction_env:nnnn #1#2#3#4 +% #1: chem +% #2: math +% #3: args number +% #4: argument list ({#2}{#3}...) +\cs_gset_protected:Npn \__chemmacros_declare_reaction_env:nnnn #1#2#3#4 { - \exp_args:Nnx \DeclareDocumentEnvironment {#1} { O{} \prg_replicate:nn {#3+0} {m} } + \exp_args:Nnx \DeclareDocumentEnvironment {#1} + { \int_compare:nT { #3+0 = 0 } {!} O{} \prg_replicate:nn {#3+0} {m} } { \boolfalse{mathjax}% lwarp \ifdefvoid{\LWR@ThisAltText}{% lwarp @@ -51030,13 +51267,15 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% }{}% lwarp \chemmacros_add_reaction_description:n {##1} \__chemmacros_begin_reaction: - \chemmacros_reaction_read:nnw {#2} {#4} + \__chemmacros_reaction_read:nnw {#2} {#4} } { \__chemmacros_end_reaction: \gdef\LWR@ThisAltText{}% lwarp + \ignorespacesafterend } } + \cs_generate_variant:Nn \chemmacros_declare_reaction_env:nnnn {nnnV} \RenewChemReaction {reaction} {equation} @@ -51044,18 +51283,191 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% \RenewChemReaction {reactions} {align} \RenewChemReaction {reactions*} {align*} -}{}% \@ifchemmacrosmoduleloaded +}{}% Module loaded. }% AtBeginDocument % \end{macrocode} % \end{noindmacro} % % +% \subsection{Reactants} +% +% Recompiled for tabular ampersand processing, +% with the only change being \cs{StartDefiningTabulars}. +% \cs{xpatchcmd} does not work here. +% +% \begin{macrocode} +\StartDefiningTabulars% lwarp + +% #1: star: include ID in table +\RenewDocumentCommand \printreactants {s} + { + \group_begin: + \chemmacros_set_keys:nn {reactants} { switch = false } + \int_step_variable:nNn + { \seq_count:N \g_chemnum_initiated_compounds_seq } + \l__chemmacros_reactants_tmpa_tl + { + \seq_put_right:Nx + \l__chemmacros_reactants_tmpa_seq + { + \chemnum_cmpd:nnne { \c_false_bool } { \c_true_bool } {} + { + \seq_item:NV + \g_chemnum_initiated_compounds_seq + \l__chemmacros_reactants_tmpa_tl + } + & + \bool_if:nT {#1} + { + \seq_item:NV + \g_chemnum_initiated_compounds_seq + \l__chemmacros_reactants_tmpa_tl + & + } + % TODO: expl3-command ?? + \solvent + { + \seq_item:NV + \g_chemnum_initiated_compounds_seq + \l__chemmacros_reactants_tmpa_tl + } + \tabularnewline + } + \tl_set:Nx + \l__chemmacros_reactants_tmpb_tl + { + \seq_item:NV + \g_chemnum_initiated_compounds_seq + \l__chemmacros_reactants_tmpa_tl + } + \chemmacros_reactants_list_subreactant:Vn + \l__chemmacros_reactants_tmpb_tl + {#1} + } + % TODO: longtable ? + % table customizable? + % first draft of two styles + \par + \noindent + \bool_if:NTF \l__chemmacros_reactants_printreactants_style_bool + { + \str_case:Vn \l__chemmacros_reactants_printreactants_style_str + { + {xltabular} + { + \chemmacros_if_package_loaded:nTF {xltabular} + { + \bool_if:nTF {#1} + { + \begin {xltabular} + { \textwidth } + { @{}ll>{\raggedright\arraybackslash}X@{} } + } + { + \begin {xltabular} + { \textwidth } + { @{}l>{\raggedright\arraybackslash}X@{} } + } + \seq_use:Nn \l__chemmacros_reactants_tmpa_seq { } + \end{xltabular} + } + { + \msg_expandable_error:nnnn + {chemmacros} + {package-not-loaded} + { \printreactants } + {xltabular} + } + } + {longtable} + { + \chemmacros_if_package_loaded:nTF {longtable} + { + \bool_if:nTF {#1} + { + \begin {longtable}[l] + { @{}ll>{\raggedright\arraybackslash}p{0.6\textwidth}@{} } + } + { + \begin {longtable}[l] + { @{}l>{\raggedright\arraybackslash}p{0.9\textwidth}@{} } + } + \seq_use:Nn \l__chemmacros_reactants_tmpa_seq { } + \end{longtable} + } + { + \msg_expandable_error:nnnn + {chemmacros} + {package-not-loaded} + { \printreactants } + {longtable} + } + } + } + } + { + \msg_warning:nn {chemmacros} {missing-printreactants-style} + } + \group_end: + } + +% #1: full ID +% #2: star, include ID in table +\cs_gset_protected:Npn \chemmacros_reactants_list_subreactant:nn #1#2 + { + \chemnum_if_subcompounds:nT {#1} + { + \int_step_variable:nNn + { \chemnum_count_subcompounds:n {#1} } + \l__chemmacros_reactants_tmpa_tl + { + \seq_put_right:Nx + \l__chemmacros_reactants_tmpa_seq + { + \chemnum_cmpd:nnne { \c_false_bool } { \c_true_bool } {} + { + \exp_not:n {#1} + \exp_not:V \l_chemnum_compound_separator_tl + \chemnum_get_subcompound:nV + {#1} + \l__chemmacros_reactants_tmpa_tl + } + & + \bool_if:nT {#2} + { + #1 + \l_chemnum_compound_separator_tl + \chemnum_get_subcompound:nV + {#1} + \l__chemmacros_reactants_tmpa_tl + & + } + % TODO: expl3-command ?? + \solvent + { + #1 + \l_chemnum_compound_separator_tl + \chemnum_get_subcompound:nV + {#1} + \l__chemmacros_reactants_tmpa_tl + } + \tabularnewline + } + } + } + } +\cs_generate_variant:Nn \chemmacros_reactants_list_subreactant:nn {V} + +\StopDefiningTabulars% lwarp +% \end{macrocode} +% +% % \subsection{Redox} % % \changes{v0.903}{2021/12/18}{\pkg{chemmacros}: Improved alt tag sanitization.} % \begin{macrocode} \AtBeginDocument{ -\@ifchemmacrosmoduleloaded{redox}{ +\chemmacros_module_if_loaded:nTF{{redox}}{ \PackageInfo{lwarp}{Patching~chemmacros~module~redox} \NewDocumentCommand \LWR@chemmacros@ox { s m >{\SplitArgument{1}{,}}m } @@ -51086,7 +51498,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% { \LWR@subsingledollar*{% yes hash \textbackslash{}% - ox*% + ox% \{% \LWR@HTMLsanitizedetokenized{\detokenize{#3}}% \}% alt @@ -51099,7 +51511,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% \endgroup } -}{}% \@ifchemmacrosmoduleloaded +}{}% Module loaded. }% AtBeginDocument % \end{macrocode} % @@ -51108,7 +51520,7 @@ test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% % Fix for \pkg{chemmacros} as of v5.8b, when using \pkg{newfloat} and \pkg{babel}: % \begin{macrocode} \AtBeginDocument{ -\@ifchemmacrosmoduleloaded{scheme}{ +\chemmacros_module_if_loaded:nTF{{scheme}}{ \PackageInfo{lwarp}{Patching~chemmacros~module~scheme} \ifdefstring{\schemename}{los}{ @@ -51117,7 +51529,7 @@ name = \chemmacros_translate:n {scheme-name} } }{} -}{}% \@ifchemmacrosmoduleloaded +}{}% Module loaded. }% AtBeginDocument % \end{macrocode} % @@ -51125,28 +51537,9 @@ name = \chemmacros_translate:n {scheme-name} % % \begin{macrocode} \AtBeginDocument{ -\@ifchemmacrosmoduleloaded{spectroscopy}{ +\chemmacros_module_if_loaded:nTF{{spectroscopy}}{ \PackageInfo{lwarp}{Patching~chemmacros~module~spectroscopy} -\ChemCompatibilityTo{5.8} -\cs_gset_protected:Npn \__chemmacros_nmr_base:nn #1#2 - { - \tl_if_blank:VF \g__chemmacros_nmr_element_coupled_tl - { - \tl_put_left:Nn \g__chemmacros_nmr_element_coupled_tl { \{ } - \tl_put_right:Nn \g__chemmacros_nmr_element_coupled_tl { \} } - } - \tl_put_left:Nn \g__chemmacros_nmr_element_coupled_tl {#2} -% \chemmacros_chemformula:n { ^{#1} } - \textsuperscript{#1} - \bool_if:NTF \l__chemmacros_nmr_parse_bool - { \chemformula_ch:nV {} \g__chemmacros_nmr_element_coupled_tl } - { \chemmacros_chemformula:V \g__chemmacros_nmr_element_coupled_tl } - \tl_use:N \l__chemmacros_nmr_element_method_connector_tl - \tl_use:N \l__chemmacros_nmr_method_tl - } -\EndChemCompatibility -\ChemCompatibilityFrom{5.8} \cs_gset_protected:Npn \__chemmacros_nmr_base:nn #1#2 { \group_begin: @@ -51157,24 +51550,23 @@ name = \chemmacros_translate:n {scheme-name} \tl_put_right:Nn \g__chemmacros_nmr_element_coupled_tl { \} } } \tl_put_left:Nn \g__chemmacros_nmr_element_coupled_tl {#2} -% \chemmacros_chemformula:n { ^{#1} } +% \chemmacros_formula:n { ^{#1} } \textsuperscript{#1} \tl_if_blank:VF \g__chemmacros_nmr_element_coupled_tl { \bool_if:NTF \l__chemmacros_nmr_parse_bool { \chemformula_ch:nV {} \g__chemmacros_nmr_element_coupled_tl } - { \chemmacros_chemformula:V \g__chemmacros_nmr_element_coupled_tl } + { \chemmacros_formula:V \g__chemmacros_nmr_element_coupled_tl } } \tl_use:N \l__chemmacros_nmr_element_method_connector_tl \tl_use:N \l__chemmacros_nmr_method_tl \group_end: } -\EndChemCompatibility \cs_gset_protected:Npn \chemmacros_nmr_position:n #1 { - \chemmacros_chemformula:x + \chemmacros_formula:x { \exp_not:V \g__chemmacros_nmr_element_tl \bool_if:NF \l__chemmacros_nmr_position_side_bool @@ -51209,7 +51601,7 @@ name = \chemmacros_translate:n {scheme-name} \textsubscript% lwarp { \l__chemmacros_nmr_coupling_nuclei_pre_tl - \chemmacros_chemformula:n {#2} + \chemmacros_formula:n {#2} \l__chemmacros_nmr_coupling_nuclei_post_tl } } @@ -51218,7 +51610,7 @@ name = \chemmacros_translate:n {scheme-name} \tl_set:Nn \l__chemmacros_nmr_coupling_nuclei_tl { \l__chemmacros_nmr_coupling_nuclei_pre_tl - \chemmacros_chemformula:n {#2} + \chemmacros_formula:n {#2} \l__chemmacros_nmr_coupling_nuclei_post_tl } } @@ -51281,7 +51673,7 @@ name = \chemmacros_translate:n {scheme-name} \bool_if:NT \l__chemmacros_nmr_comma_bool { , ~ } \bool_if:NT \l__chemmacros_nmr_solvent_bool - { \chemmacros_chemformula:n {#4} } + { \chemmacros_formula:n {#4} } \bool_if:NT \l__chemmacros_nmr_delimiters_bool { ) } \tl_if_blank:nT {#1} {:~} @@ -51353,26 +51745,33 @@ name = \chemmacros_translate:n {scheme-name} \IfBooleanF {#1} { \bool_if:NT \l__chemmacros_nmr_use_equal_bool { ~ = } } } -}{}% \@ifchemmacrosmoduleloaded +}{}% Module loaded. }% AtBeginDocument % \end{macrocode} % +% % \subsection{Thermodynamics} % % \changes{v0.903}{2021/12/18}{\pkg{chemmacros}: Improved alt tag sanitization.} % \begin{macrocode} \AtBeginDocument{ -\@ifchemmacrosmoduleloaded{thermodynamics}{ +\chemmacros_module_if_loaded:nTF{{thermodynamics}}{ \PackageInfo{lwarp}{Patching~chemmacros~module~thermodynamics} -\cs_gset_protected:Npn \chemmacros_state:nn #1#2 +\cs_gset_protected:Npn \chemmacros_state:nnnnnn #1#2#3#4#5#6 { \group_begin: - \boolfalse{mathjax} - \chemmacros_set_keys:nn {thermodynamics} {#1} + \chemmacros_set_keys:ne {thermodynamics} + { + \exp_not:n {#1} , + \tl_if_novalue:nF {#2} { subscript-left = \exp_not:n {#2} , } + \tl_if_novalue:nF {#3} { superscript-left = \exp_not:n {#3} , } + \tl_if_novalue:nF {#5} { subscript-right = \exp_not:n {#5} , } + \tl_if_novalue:nF {#6} { superscript-right = \exp_not:n {#6} } + } \LWR@subsingledollar*{% yes hashing \textbackslash{}state% - \{\LWR@HTMLsanitizedetokenized{\detokenize{#2}}\}% alt + \{\LWR@HTMLsanitizedetokenized{\detokenize{#4}}\}% alt }{% chemmacros_state% add'l hashing #1% options @@ -51382,36 +51781,37 @@ name = \chemmacros_translate:n {scheme-name} RSB \tl_use:N \l__chemmacros_state_sb_right_tl } { - \LWR@origensuredmath{ - \chemmacros_text:V \l__chemmacros_state_pre_tl - \c_math_superscript_token - { \chemmacros_text:V \l__chemmacros_state_sp_left_tl } + \LWR@origensuredmath + { + \chemmacros_text:V \l__chemmacros_state_pre_tl + \c_math_superscript_token + { \chemmacros_text:V \l__chemmacros_state_sp_left_tl } % \end{macrocode} % Only add the subscripts if they are being used. % This avoids causing an incorrect depth, as the empty subscript will be % measured by \TeX\ but cropped out by \prog{pdfcrop}. % \begin{macrocode} - \tl_if_empty:NTF \l__chemmacros_state_sb_left_tl - {} - { - \c_math_subscript_token - { \chemmacros_text:V \l__chemmacros_state_sb_left_tl } - } - #2 - \c_math_superscript_token - { \chemmacros_text:V \l__chemmacros_state_sp_right_tl } - \tl_if_empty:NTF \l__chemmacros_state_sb_right_tl - {} - { - \c_math_subscript_token - { \chemmacros_text:V \l__chemmacros_state_sb_right_tl } - } - \chemmacros_text:V \l__chemmacros_state_post_tl - } + \tl_if_empty:NTF \l__chemmacros_state_sb_left_tl + {} + { + \c_math_subscript_token + { \chemmacros_text:V \l__chemmacros_state_sb_left_tl } + } + #4 + \c_math_superscript_token + { \chemmacros_text:V \l__chemmacros_state_sp_right_tl } + \tl_if_empty:NTF \l__chemmacros_state_sb_right_tl + {} + { + \c_math_subscript_token + { \chemmacros_text:V \l__chemmacros_state_sb_right_tl } + } + \chemmacros_text:V \l__chemmacros_state_post_tl + } } \group_end: } -\cs_generate_variant:Nn \chemmacros_state:nn { nV } +\cs_generate_variant:Nn \chemmacros_state:nnnnnn { nVVVVV } \cs_gset_protected:Npn \chemmacros_declare_state:Nn #1#2 { @@ -51435,17 +51835,26 @@ name = \chemmacros_translate:n {scheme-name} \DeclareDocumentCommand #1 { sO{}D(){}m } { \group_begin: - \chemmacros_set_keys:xn + \chemmacros_set_keys:en {thermodynamics/\chemmacros_remove_backslash:N #1} {#2} \tl_if_blank:nF {##3} { - \chemmacros_set_keys:nx {thermodynamics} + \chemmacros_set_keys:ne {thermodynamics} { subscript-\l__chemmacros_state_sb_pos_tl = \exp_not:n {##3} } } - \chemmacros_state:nV {##2} \l__chemmacros_state_symbol_tl +% \LWR@origensuredmath +% { + \chemmacros_state:nVVVVV + {##2} + \c_novalue_tl + \c_novalue_tl + \l__chemmacros_state_symbol_tl + \c_novalue_tl + \c_novalue_tl \chemmacros_set_keys_groups:nnn {thermodynamics} {variables} {##2} - \IfBooleanF {##1} { = ~ \SI {##4} { \l__chemmacros_state_unit_tl } } + \IfBooleanF {##1} { = \qty {##4} { \l__chemmacros_state_unit_tl } } +% } \group_end: } } @@ -51457,7 +51866,7 @@ name = \chemmacros_translate:n {scheme-name} \RenewChemState \entropy { symbol = S , unit = \joule\per\kelvin\per\mole , pre = } \RenewChemState \gibbs { symbol = G , unit = \kilo\joule\per\mole } -}{}% \@ifchemmacrosmoduleloaded +}{}% Module loaded. }% AtBeginDocument % \end{macrocode} % @@ -56593,7 +57002,7 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space % \codehtml % % \begin{macrocode} -\LWR@ProvidesPackagePass{fbox}[2020/06/22] +\LWR@ProvidesPackagePass{fbox}[2022/02/20] % \end{macrocode} % % This will be \cs{LWR@formatted} when \cs{AtBeginDocument}: @@ -56607,19 +57016,26 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space % \end{macrocode} % % \begin{noindmacro}{LWR@fboxpkg@border} -% \marg{1: top \Slash bottom \Slash left \Slash right} \marg{2: padding, or empty} +% \marg{1: top \Slash bottom \Slash left \Slash right} +% \marg{2: t \Slash b \Slash l \Slash r} +% \marg{3: padding, or empty} % % Accumulates \HTML\ styles for border, and padding if given: +% \changes{v0.904}{2022/03/05}{\pkg{fbox}: Added border colors.} % \begin{macrocode} -\newcommand*{\LWR@fboxpkg@border}[2]{% +\newcommand*{\LWR@fboxpkg@border}[3]{% + \colorlet{LWR@border@color}{\csuse{fbox@#2color}}% + \protect\convertcolorspec{named}{LWR@border@color}{HTML}\LWR@tempbordercolor\relax% \appto\LWR@tempone{% border-#1: % space \LWR@printlength{\LWR@atleastonept} % space - solid \LWR@origpound\LWR@tempcolor ;\LWR@indentHTML + solid \LWR@origpound% }% - \ifblank{#2}{}{% + \expandafter\appto\expandafter\LWR@tempone\expandafter{\LWR@tempbordercolor}% + \appto\LWR@tempone{ ;\LWR@indentHTML}% + \ifblank{#3}{}{% \appto\LWR@tempone{% - padding-#1: \LWR@printlength{#2} ;\LWR@indentHTML + padding-#1: \LWR@printlength{#3} ;\LWR@indentHTML }% }% } @@ -56671,20 +57087,21 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space % \end{macrocode} % % Per the original to decode the borders, in a new way: +% \changes{v0.904}{2022/03/05}{\pkg{fbox}: Added border colors.} % \begin{macrocode} \ifnum\the\@tempcntb>8\relax - \advance\@tempcntb by -8 - \LWR@fboxpkg@border{top}{\fbox@@sep}% + \advance\@tempcntb by -8\relax + \LWR@fboxpkg@border{top}{t}{\fbox@@sep}% \fi \ifnum\@tempcntb>3 - \advance\@tempcntb by -4 - \LWR@fboxpkg@border{left}{}% + \advance\@tempcntb by -4\relax + \LWR@fboxpkg@border{left}{l}{}% \fi - \ifnum\@tempcntb>1 - \LWR@fboxpkg@border{right}{}% + \ifnum\@tempcntb>1\relax + \LWR@fboxpkg@border{right}{r}{}% \fi \ifodd\@tempcntb - \LWR@fboxpkg@border{bottom}{\fbox@@sep}% + \LWR@fboxpkg@border{bottom}{b}{\fbox@@sep}% \fi % \end{macrocode} % @@ -61736,6 +62153,21 @@ do not attempt to patch lwarp's version of `hyperref'.)\MessageBreak} % \end{macrocode} +% No application for \pkg{lwarp}: +% \changes{v0.904}{2022/03/04}{\pkg{hyperref}: Added \cs{HyperDest*}.} +% \begin{macrocode} +\newcommand*{\HyperDestNameFilter}[1]{#1} +\newcommand*{\HyperDestLabelReplace}[1]{#1} +\newcommand*{\HyperDestRename}[2]{} +% \end{macrocode} + +% No application for \pkg{lwarp}: +% \changes{v0.904}{2022/03/04}{\pkg{hyperref}: Added \cs{hyperget}.} +% \begin{macrocode} +\newcommand*{\hyperget}[2]{} +% \end{macrocode} + + % \begin{noindmacro}{\hyperimage} \marg{URL} \marg{alt text} % @@ -65566,6 +65998,70 @@ do not attempt to patch lwarp's version of `hyperref'.)\MessageBreak} % % % \iffalse +%<*lltjp-siunitx> +% \fi +% +% \part{lwarp-lltjp-siunitx.sty} +% +% \section{lltjp-siunitx} +% +% \credits{The Lua\TeX-ja project team} +% +% \DescribePackage{lltjp-siunitx} +% \pkg{lltjp-siunitx} is patched for use by \pkg{lwarp}. +% +% \changes{v0.904}{2022/03/08}{\pkg{lltjp-siunitx}: Added.} +% +% \codehtml +% +% \begin{macrocode} +\LWR@ProvidesPackagePass{lltjp-siunitx}% 2021-10-31, no date assigned in file +% \end{macrocode} +% +% This is the \pkg{siunitx} v3 file, as patched by \pkg{lltjp-siunitx}. +% +% \begin{macrocode} +\ExplSyntaxOn + +\cs_set_protected:Npn \siunitx_print_text:n #1 + { + \text + { + \ltj@allalchar % <--- LuaTeX-ja + \bool_if:NT \l__siunitx_print_text_family_bool + { \fontfamily { \familydefault } } + \bool_if:NT \l__siunitx_print_text_series_bool + { \fontseries { \seriesdefault } } + \bool_if:NT \l__siunitx_print_text_shape_bool + { \fontshape { \shapedefault } } + \bool_lazy_any:nT + { + { \l__siunitx_print_text_family_bool } + { \l__siunitx_print_text_series_bool } + { \l__siunitx_print_text_shape_bool } + } + { \selectfont } + \tl_use:N \l__siunitx_print_text_font_tl + \exp_args:NnV \tl_if_head_eq_meaning:nNTF {#1} \l_siunitx_unit_fraction_tl + { + \__siunitx_print_text_fraction:Nnn #1 + } + { + \__siunitx_print_text_replace:n {#1} + } + } + } + +\ExplSyntaxOff +% \end{macrocode} +% +% \iffalse +%</lltjp-siunitx> +% \fi +% +% +% +% \iffalse %<*lltjp-tascmac> % \fi % @@ -70079,7 +70575,7 @@ background: % \codehtml % \begin{macrocode} -\LWR@ProvidesPackageDrop{multicol}[2018/12/27] +\LWR@ProvidesPackageDrop{multicol}[2021/10/28] % \end{macrocode} % Multicols are converted into a 1--3 column display, browser-supported. @@ -70120,8 +70616,10 @@ background: % \end{noindenvironment} % Emulated null functions which are not used in \HTML: +% \changes{v0.904}{2022/02/07}{\pkg{multicol}: Added \cs{newcolumn}.} % \begin{macrocode} \newcommand*{\columnbreak}{} +\newcommand*{\newcolumn}{} \newcommand*{\RLmulticolcolumns}{} \newcommand*{\LRmulticolcolumns}{} @@ -79352,20 +79850,13 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \credits{Joseph Wright} % % \DescribePackage{siunitx} -% \pkg{siunitx-v2} is patched for use by \pkg{lwarp}, +% \pkg{siunitx} is patched for use by \pkg{lwarp}, % and is emulated for \MathJax. % -% Use as: -% \begin{sourceverb} -% \usepackage{siunitx}[=v2] -% \end{sourceverb} -% -% \pkg{siunitx} v3 is not yet supported. -% \watchout -% % ^^A \limitssiunitx % % \changes{v0.897}{2021/05/23}{\pkg{siunitx}: Rollback for v2.} +% \changes{v0.904}{2022/02/19}{\pkg{siunitx}: Added v3.} % % \codehtml % @@ -79377,19 +79868,542 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \DeclareRelease{v2}{2010-05-23}{lwarp-siunitx-v2.sty} \DeclareCurrentRelease{}{2021-05-17} -\PackageWarningNoLine{lwarp} +\RequirePackage{xcolor}% for \convertcolorspec + +\LWR@ProvidesPackagePass{siunitx}[2022-02-15] + +\ExplSyntaxOn +% \end{macrocode} + +% ^^A May be of use to try to create color for negative values: +% ^^A +% ^^A % \cs_set_protected:Npn \__siunitx_number_parse_sign_aux:Nw #1#2 \q_stop +% ^^A % { +% ^^A % \tl_if_in:NnTF \l_siunitx_number_input_sign_tl {#1} +% ^^A % { +% ^^A % \tl_set:Nn \l__siunitx_number_arg_tl {#2} +% ^^A % \bool_lazy_and:nnTF +% ^^A % { \token_if_eq_charcode_p:NN #1 + } +% ^^A % { ! \l__siunitx_number_explicit_plus_bool } +% ^^A % { \tl_set:Nn \l__siunitx_number_parsed_tl { { } } } +% ^^A % { \tl_set:Nn \l__siunitx_number_parsed_tl { {#1} } } +% ^^A % +% ^^A % % If #! is { - } then is a negative number +% ^^A % +% ^^A % } +% ^^A % { \tl_set:Nn \l__siunitx_number_parsed_tl { { } } } +% ^^A % \tl_if_empty:NTF \l__siunitx_number_arg_tl +% ^^A % { \tl_clear:N \l__siunitx_number_parsed_tl } +% ^^A % { \__siunitx_number_parse_exponent: } +% ^^A % } +% ^^A % +% ^^A % +% ^^A % \cs_set_protected:Npn \siunitx_print_number:n #1 +% ^^A % { +% ^^A % \__siunitx_print_aux:nn { number } {#1} +% ^^A % } + + + + +% \begin{macrocode} +\cs_set_protected:Npn \siunitx_number_format:nN #1#2 + { + \group_begin: + \bool_if:NTF \l_siunitx_number_parse_bool + { + \siunitx_number_parse:nN {#1} \l__siunitx_number_parsed_tl + \siunitx_number_process:NN \l__siunitx_number_parsed_tl \l__siunitx_number_parsed_tl + \tl_set:Nx \l__siunitx_number_outputted_tl + { \siunitx_number_output:N \l__siunitx_number_parsed_tl } + } + { + \tl_set:Nn \l__siunitx_number_outputted_tl + { + \LWR@subsingledollar{% lwarp + \textbackslash( % space + \LWR@HTMLsanitizedetokenized{% + \detokenize{#1}% + } \textbackslash)% lwarp + }% + {siunitx unparsed}% + {\ensuremath{#1}}% lwarp + } + } + \exp_args:NNNV \group_end: + \tl_set:Nn #2 \l__siunitx_number_outputted_tl + } +% \end{macrocode} +% +% +% \begin{macrocode} +\cs_set_protected:Npn \__siunitx_compound_unparsed:n #1 + { + \tl_if_blank:nF {#1} + { \seq_put_right:Nn \l__siunitx_compound_tmp_seq + { + \LWR@subsingledollar{% lwarp + \textbackslash( % space + \LWR@HTMLsanitizedetokenized{% + \detokenize{#1}% + } \textbackslash)% lwarp + }% + {siunitx unparsed}% + {\ensuremath{#1}}% lwarp + } + } + } +% \end{macrocode} +% +% +% If not in a \env{lateximage}, always use text mode. +% Ignore current text font if resetting text family, series, and shape. +% \begin{macrocode} +\cs_set_protected:Npn \__siunitx_print_aux:nn #1#2 + { + \tl_if_empty:cTF { l__siunitx_print_ #1 _color_tl } + { \use:n } + { \exp_args:Nv \textcolor { l__siunitx_print_ #1 _color_tl } } + { + \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% lwarp + { + \use:c + { + siunitx_print_ + \tl_use:c { l__siunitx_print_ #1 _mode_tl } :n + } + {#2} + } + { + \bool_lazy_all:nTF% lwarp + { + {\l__siunitx_print_text_family_bool} + {\l__siunitx_print_text_series_bool} + {\l__siunitx_print_text_shape_bool} + } + {% No font control if reset-text-family/series/shape + \use:c + { + siunitx_print_% lwarp + text% lwarp + :n% lwarp + }% lwarp + {#2}% lwarp + } + { + \LWR@textcurrentfont{% lwarp + \use:c + { + siunitx_print_% lwarp + text% lwarp + :n% lwarp + }% lwarp + {#2}% lwarp + } + } + } + } + } +% \end{macrocode} +% +% +% To determine whether to make a complex root be italic or upright, +% \cs{l\_\_siunitx\_complex\_output\_root\_tl} is compared to +% \cs{LWR@siunitx@complexrm<i/j>}, and the \CSS\ style is set appropriately. +% \begin{macrocode} +\newcommand*{\LWR@siunitx@complexrootstyle}{textrm} + +\newcommand*{\LWR@siunitx@complexrmi}{\mathrm{i}} +\newcommand*{\LWR@siunitx@complexrmj}{\mathrm{j}} + +\newcommand*{\LWR@siunitx@setcomplexroot}{% + \renewcommand*{\LWR@siunitx@complexrootstyle}{textit}% + \ifdefequal{\l__siunitx_complex_output_root_tl}{\LWR@siunitx@complexrmi}% + {\renewcommand*{\LWR@siunitx@complexrootstyle}{textrm}}% + {}% + \ifdefequal{\l__siunitx_complex_output_root_tl}{\LWR@siunitx@complexrmj}% + {\renewcommand*{\LWR@siunitx@complexrootstyle}{textrm}}% + {}% +} +% \end{macrocode} +% +% \begin{macrocode} +\cs_set_protected:Npn \__siunitx_complex_format_auxii:n #1 + { + \LWR@siunitx@setcomplexroot% lwarp + \__siunitx_complex_format_units:n {#1} + \tl_if_empty:NF \l__siunitx_complex_real_tl + { \exp_after:wN \__siunitx_complex_drop_exponent:nnnnnnn \l__siunitx_complex_real_tl } + \exp_after:wN \__siunitx_complex_format_sign:nnnnnnn \l__siunitx_complex_img_tl + \tl_set:Nx \l__siunitx_complex_tmp_tl + { \siunitx_number_output:NN \l__siunitx_complex_img_tl \q_nil } + \exp_after:wN \__siunitx_complex_extract_exponent:w \l__siunitx_complex_tmp_tl \q_stop + \tl_set:Nx \l__siunitx_complex_tmp_tl + { + \bool_lazy_or:nnTF + { + \bool_lazy_and_p:nn + { \l_siunitx_number_bracket_ambiguous_bool } + { ! \tl_if_empty_p:N \l__siunitx_complex_exp_tl } + } + { + ! \bool_lazy_any_p:n + { + { \tl_if_blank_p:n {#1} } + { \tl_if_empty_p:N \l__siunitx_complex_real_tl } + { \tl_if_empty_p:N \l__siunitx_complex_img_tl } + } + } + { \__siunitx_complex_format_bracket:n } + { \use:n } + { + \siunitx_number_output:N \l__siunitx_complex_real_tl + \exp_not:V \l__siunitx_complex_sign_tl + \bool_if:NF \l__siunitx_complex_root_after_bool + { + \InlineClass{\LWR@siunitx@complexrootstyle}% lwarp + { + \exp_not:V \l__siunitx_complex_output_root_tl + } + } + \exp_not:V \l__siunitx_complex_tmp_tl + \bool_if:NT \l__siunitx_complex_root_after_bool + { + \InlineClass{\LWR@siunitx@complexrootstyle}% lwarp + { + \exp_not:V \l__siunitx_complex_output_root_tl + } + } + } + \exp_not:V \l__siunitx_complex_exp_tl + } + } +% \end{macrocode} +% +% +% \marg{1: deg/min/sec character} +% \marg{2: ?} +% \marg{3: ?} +% \marg{4: integer part of angle} +% \marg{5: decimal point character} +% \marg{6: decimal part of angle} +% \marg{7: ?} +% \marg{8: ?} +% +% If not in a \env{lateximage}, print a simplified verison +% without the box measurement things which conflict with \pkg{lwarp}: +% \begin{macrocode} +\cs_set_protected:Npn \__siunitx_angle_arc_print_auxii:nw + #1#2 \q_nil #3 \q_nil #4 \q_nil #5 \q_nil #6 \q_nil #7 \q_nil #8 \q_stop + { + \mode_if_math:TF + { \bool_set_true:N \l__siunitx_angle_tmp_bool } + { \bool_set_false:N \l__siunitx_angle_tmp_bool } + \siunitx_print_number:n {#2#3#4} + \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% lwarp + {% lwarp + \tl_if_blank:nTF {#6} + { \__siunitx_angle_arc_print_auxvi:n {#1} } + { + \hbox_set:Nn \l__siunitx_angle_marker_box + { + \__siunitx_angle_arc_print_auxiii:n + { \siunitx_print_number:n {#5} } + } + \hbox_set:Nn \l__siunitx_angle_unit_box + { + \__siunitx_angle_arc_print_auxiii:n + { + \siunitx_unit_format:nN {#1} \l__siunitx_angle_tmp_tl + \siunitx_print_unit:V \l__siunitx_angle_tmp_tl + \skip_horizontal:n { -\scriptspace } + } + } + \dim_compare:nNnTF { \box_wd:N \l__siunitx_angle_marker_box } > + { \box_wd:N \l__siunitx_angle_unit_box } + { + \__siunitx_angle_arc_print_auxiv:NN + \l__siunitx_angle_marker_box + \l__siunitx_angle_unit_box + } + { + \__siunitx_angle_arc_print_auxiv:NN + \l__siunitx_angle_unit_box + \l__siunitx_angle_marker_box + } + \hbox_set_to_wd:Nnn \l__siunitx_angle_marker_box + \l__siunitx_angle_tmp_dim + { + \hbox_overlap_right:n + { \box_use_drop:N \l__siunitx_angle_marker_box } + \hbox_overlap_right:n + { \box_use_drop:N \l__siunitx_angle_unit_box } + \tex_hfil:D + } + \box_use:N \l__siunitx_angle_marker_box + \skip_horizontal:N \scriptspace + \siunitx_print_number:n {#6} + } + }% +% \end{macrocode} +% +% \marg{1: deg/min/sec character} +% \marg{2: ?} +% \marg{3: ?} +% \marg{4: integer part of angle} +% \marg{5: decimal point character} +% \marg{6: decimal part of angle} +% \marg{7: ?} +% \marg{8: ?} +% \begin{macrocode} + {% lwarp: not in a lateximage, simplify for HTML + \tl_if_blank:nTF {#6} + { \__siunitx_angle_arc_print_auxvi:n {#1} } + { + \__siunitx_angle_arc_print_auxiii:n + { + \siunitx_print_number:n {#5} + } + \__siunitx_angle_arc_print_auxiii:n + { + \siunitx_unit_format:nN {#1} \l__siunitx_angle_tmp_tl + \siunitx_print_unit:V \l__siunitx_angle_tmp_tl + } + \siunitx_print_number:n {#6} + } + }% lwarp + } +% \end{macrocode} +% +% If not in a \env{lateximage}, print a simple inline fraction, +% avoiding the use of \SVG\ math: +% \begin{macrocode} +\cs_set_protected:Npn \__siunitx_print_text_fraction:Nnn #1#2#3 + { + \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% lwarp + {% + \ensuremath + { + #1 + { \mbox { \__siunitx_print_text_replace:n {#2} } } + { \mbox { \__siunitx_print_text_replace:n {#3} } } + } + }% + {% lwarp + { \mbox { \__siunitx_print_text_replace:n {#2} } }% lwarp + /% lwarp + { \mbox { \__siunitx_print_text_replace:n {#3} } }% lwarp + }% lwarp + } +% \end{macrocode} +% +% If not in a \env{lateximage}, print a \cs{textsubscript}: +% \begin{macrocode} +\cs_set_protected:Npn \__siunitx_unit_format_qualifier_subscript: + { + \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% lwarp {% - **************\MessageBreak - Siunitx version 3 is not yet supported by Lwarp.\MessageBreak - V2 emulation is used here.\MessageBreak - ************** + \__siunitx_unit_format_font: + \tl_set:Nx \l__siunitx_unit_part_tl + { + \c__siunitx_unit_math_subscript_tl + { + \exp_not:V \l_siunitx_unit_font_tl + { \exp_not:V \l__siunitx_unit_part_tl } + } + } } + {% lwarp simplified for HTML: + \__siunitx_unit_format_font: + \tl_set:Nx \l__siunitx_unit_part_tl + { + \textsubscript + { + \exp_not:V \l_siunitx_unit_font_tl + { \exp_not:V \l__siunitx_unit_part_tl } + } + } + } + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_set_protected:Npn \siunitx_quantity:nn #1#2 + { + \group_begin: + \siunitx_unit_options_apply:n {#2} + \tl_if_blank:nTF {#1} + { + \siunitx_unit_format:nN {#2} \l__siunitx_quantity_unit_tl + \siunitx_print_unit:V \l__siunitx_quantity_unit_tl + } + { + \bool_if:NTF \l_siunitx_number_parse_bool + { \__siunitx_quantity_parsed:nn {#1} {#2} } + { + \tl_set:Nn \l__siunitx_quantity_number_tl { + \LWR@subsingledollar{% lwarp + \textbackslash( % space + \LWR@HTMLsanitizedetokenized{% + \detokenize{#1}% + } \textbackslash)% lwarp + }% + {siunitx unparsed}% + {\ensuremath{#1}}% lwarp + } + \siunitx_unit_format:nN {#2} \l__siunitx_quantity_unit_tl + \siunitx_quantity_print:VV + \l__siunitx_quantity_number_tl \l__siunitx_quantity_unit_tl + } + } + \group_end: + } +% \end{macrocode} +% -\RequirePackage{xcolor}% for \convertcolorspec +% ^^A *88* \cancel +% +% \cs{cancel} for \HTML\ does not work yet. +% \begin{macrocode} +\newcommand*{\LWR@siunitx@nocancel}[1]{% + \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% + {\cancel{#1}}% SVG + {#1}% HTML +} -% \LWR@ProvidesPackagePass{siunitx}[2021-05-21] +\AtBeginDocument{ +\__siunitx_unit_set_symbolic:Npnn \cancel + { } +% { \__siunitx_unit_parse_special:n { \cancel } } + { \__siunitx_unit_parse_special:n { \LWR@siunitx@nocancel } }% lwarp +} +% \end{macrocode} +% +% +% For \HTML, use a simple unaligned \cs{num}: +% \begin{macrocode} +\newcommand{\LWR@HTML@tablenum}[2][]{\num[#1]{#2}} +\LWR@formatted{tablenum} +% \end{macrocode} +% +% +% For \HTML, the |S| column is simplified to a |c| column. +% Keys are set locally, allowing \optn{drop-exponent}, etc. +% \begin{macrocode} +\AtBeginDocument{ +\HTMLnewcolumntype{S}[1][]{>{\begingroup\sisetup{#1}}c<{\endgroup}} +} +% \end{macrocode} +% +% +% To define simplified units for \HTML: +% +% \begin{macro}{\HTMLDeclareSIUnit} \oarg{options} \marg{name} \marg{definition} +% \begin{macrocode} +\NewDocumentCommand{\HTMLDeclareSIUnit}{o +m m} +{ + \ifcsdef{ __siunitx_unit_ \token_to_str:N #2 :w } + {} + { + \PackageError{lwarp} + {% + First~use\MessageBreak + \space\space\protect\DeclareSIUnit{ + \token_to_str:N#2}{...}\MessageBreak + before~using\MessageBreak + \space\space\protect\HTMLDeclareSIUnit{ + \token_to_str:N#2}{...}% + } + {% + See~the~Lwarp~manual~section~about~special~cases,~ + regarding~siunitx.% + } + } + \csNewCommandCopycs + { __orig_siunitx_unit_ \token_to_str:N #2 :w } + { __siunitx_unit_ \token_to_str:N #2 :w } + \DeclareSIUnit[#1]{#2} + { + \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0} + {\csuse{ __orig_siunitx_unit_ \token_to_str:N #2 :w }} + {#3} + } +} +% \end{macrocode} +% \end{macro} + +% \begin{macrocode} +\ExplSyntaxOff +% \end{macrocode} + +% \HTML\ versions for existing units: +% \begin{macrocode} +\AtBeginDocument{ +\HTMLDeclareSIUnit\celsius{\LWR@siunitx@textcelsius} +\HTMLDeclareSIUnit\arcminute{\LWR@siunitx@textprime} +\HTMLDeclareSIUnit\arcsecond{\LWR@siunitx@textdblprime} +\HTMLDeclareSIUnit\elementarycharge{\textit{e}} +% +\HTMLDeclareSIUnit\clight{\text{\textit{c}\textsubscript{0}}} +\HTMLDeclareSIUnit\bohr{\text{\textit{a}\textsubscript{0}}} +\HTMLDeclareSIUnit\electronmass{\text{\textit{m}\textsubscript{e}}} +\HTMLDeclareSIUnit\hartree{\text{\textit{E}\textsubscript{h}}} +\HTMLDeclareSIUnit\planckbar{\LWR@siunitx@textplanckbar} +}% \AtBeginDocument +% \end{macrocode} +% + + + +% Initial options: +% \begin{macrocode} +\AtBeginDocument{ +\sisetup{ + per-mode=symbol, % fraction is not seen by pdftotext + angle-symbol-degree = {\LWR@siunitx@textdegree}, + angle-symbol-minute = {\LWR@siunitx@textprime} , + angle-symbol-second = {\LWR@siunitx@textdblprime} , +} +} +% \end{macrocode} +% +% +% Load late paches for \pkg{lltjp-siunitx}: +% \begin{macrocode} +\AtBeginDocument{ +\ifdef{\ltj@allalchar} + {\LWR@origRequirePackage{lwarp-lltjp-siunitx}} + {} +} +% \end{macrocode} +% +% +% For \MathJax: +% \begin{macrocode} +\LWR@origRequirePackage{lwarp-common-mathjax-siunitx} -\RequirePackage{siunitx-v2} +\CustomizeMathJax{\let\unit\si} +\CustomizeMathJax{\let\qty\SI} +\CustomizeMathJax{\let\qtylist\SIlist} +\CustomizeMathJax{\let\qtyrange\SIrange} +\CustomizeMathJax{\let\numproduct\num} +\CustomizeMathJax{\let\qtyproduct\SI} +\CustomizeMathJax{\let\complexnum\num} +\CustomizeMathJax{\newcommand{\complexqty}[3][]{(\complexnum{#2})\si{#3}}} +% \end{macrocode} +% +% Pass \optn{range-phrase} to \pkg{common-mathjax-siunitx}: +% \changes{v0.904}{2022/02/28}{\pkg{siunitx}, \MathJax: Use \optn{range-phrase}.} +% \begin{macrocode} +\ExplSyntaxOn +\AtBeginDocument{ +\edef\LWR@siunitx@rangephrase{\l_siunitx_range_phrase_tl} +\expandafter\CustomizeMathJax\expandafter{% + \expandafter\def\expandafter\LWRsiunitxrangephrase% + \expandafter{\LWR@siunitx@rangephrase}% +} +} +\ExplSyntaxOff % \end{macrocode} % \iffalse @@ -79421,16 +80435,17 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \changes{v0.38}{2017/08/26}{\pkg{siunitx}: Removed from \pkg{lwarp} core.} % \changes{v0.50}{2018/10/23}{\pkg{siunitx}: Fix: Loads \pkg{xcolor}.} % \changes{v0.897}{2021/05/23}{\pkg{siunitx-v2}: Rollback for v2.} +% \changes{v0.904}{2022/02/26}{\pkg{siunitx-v2}: Updated to v2.8e.} % % \codehtml % % \begin{macrocode} \RequirePackage{xcolor}% for \convertcolorspec -\LWR@ProvidesPackagePass{siunitx-v2}[2021-04-17] +\LWR@ProvidesPackagePass{siunitx}[=v2]% 2021-04-17 % \end{macrocode} -% \changes{v0.50}{2018/02/24}{\pkg{siunitx}: Improved units.} +% \changes{v0.50}{2018/02/24}{\pkg{siunitx-v2}: Improved units.} % \begin{macrocode} \AtBeginDocument{% in case textcomp was not loaded \DeclareSIUnit\bohr{\textit{a}\textsubscript{0}} @@ -79443,11 +80458,11 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \end{macrocode} % Support the |S| and |s| column types: -% \changes{v0.901}{2021/08/18}{\pkg{siunitx}: Improved \cs{newcolumntype} emulation.} +% \changes{v0.901}{2021/08/18}{\pkg{siunitx-v2}: Improved \cs{newcolumntype} emulation.} % \begin{macrocode} \AtBeginDocument{ -\HTMLnewcolumntype{S}{c} -\HTMLnewcolumntype{s}{c} +\HTMLnewcolumntype{S}[1][]{>{\begingroup\sisetup{#1}}c<{\endgroup}} +\HTMLnewcolumntype{s}[1][]{>{\begingroup\sisetup{#1}}c<{\endgroup}} } % \end{macrocode} @@ -79457,17 +80472,45 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % Similar for \cs{mbox}. % \SVG\ math is created explicitly when necessary, using \cs{LWR@subsingledollar}. % -% \changes{v0.42}{2017/10/16}{\pkg{siunitx}: Improved \cs{ensuremath}.} -% \changes{v0.48}{2018/02/13}{\pkg{siunitx}: Improved \SVG\ math.} +% \changes{v0.42}{2017/10/16}{\pkg{siunitx-v2}: Improved \cs{ensuremath}.} +% \changes{v0.48}{2018/02/13}{\pkg{siunitx-v2}: Improved \SVG\ math.} % \begin{macrocode} \ExplSyntaxOn % % \end{macrocode} +% +% Modified to use the print version of \cs{@ensuredmath} to avoid +% having a \env{lateximage} each time. +% \begin{macrocode} +\AtBeginDocument{ +\cs_set_protected:Npn \__siunitx_print_text: + { + \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp + \tl_replace_all:Nnn \l__siunitx_print_arg_tl { - } + { \textminus } + \__siunitx_print_text_aux: + \tl_replace_all:Nnn \l__siunitx_print_arg_tl { \mp } + { \ensuremath { \mp } } + \tl_remove_all:Nn \l__siunitx_print_arg_tl { \mathord } + \cs_set_eq:NN \PrintSubscript \__siunitx_print_text_sub:n + \cs_set_eq:NN \PrintSuperscript \__siunitx_print_text_super:n + \__siunitx_print_text_aux:NnN + _ { math_subscript } \__siunitx_print_text_sub:n + _ { active } \__siunitx_print_text_sub:n + ^ { math_superscript } \__siunitx_print_text_super:n + ^ { active } \__siunitx_print_text_super:n + \q_recursion_tail ? ? + \q_recursion_stop + \l__siunitx_print_arg_tl + } +} +% \end{macrocode} +% % Modified to set set \HTML\ \cs{textcolor} if not black: -% \changes{v0.48}{2018/02/14}{\pkg{siunitx}: Improved color output.} +% \changes{v0.48}{2018/02/14}{\pkg{siunitx-v2}: Improved color output.} % \begin{macrocode} -\cs_set_protected:Npn \__siunitx_print_aux: +\cs_new_protected:Npn \LWR@HTML@__siunitx_print_aux: { \text { @@ -79505,13 +80548,14 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', } } } +\LWR@formatted{__siunitx_print_aux:} -\cs_set_protected:Npn \__siunitx_set_math_fam:n #1 { +\cs_new_protected:Npn \LWR@HTML@__siunitx_set_math_fam:n #1 { \group_begin: - \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp - \LetLtxMacro\mbox\LWR@print@mbox% lwarp - \hbox_set:Nn \l__siunitx_tmp_box - { +% \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp +% \LetLtxMacro\mbox\LWR@print@mbox% lwarp +% \hbox_set:Nn \l__siunitx_tmp_box +% { \ensuremath { \use:c { math #1 } @@ -79519,15 +80563,14 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \int_const:cn { c__siunitx_math #1 _int } { \fam } } } - } +% } \group_end: } +\LWR@formatted{__siunitx_set_math_fam:n} -\cs_set_protected:Npn \__siunitx_combined_output:n #1 { +\cs_new_protected:Npn \LWR@HTML@__siunitx_combined_output:n #1 { % \group_begin:% lwarp - \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp - \LetLtxMacro\mbox\LWR@print@mbox% lwarp \bool_if:NTF \l__siunitx_number_parse_bool { \tl_clear:N \l__siunitx_number_out_tl @@ -79537,39 +80580,43 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', { % \end{macrocode} % For |parse-numbers=false|: -% \changes{v0.48}{2018/02/14}{\pkg{siunitx}: Improved \SVG\ math.} -% \changes{v0.50}{2018/02/24}{\pkg{siunitx}: Improved \SVG\ math \attribute{alt} tags.} -% \changes{v0.79}{2020/01/21}{\pkg{siunitx}: Improved \MathJax.} -% \changes{v0.903}{2021/12/18}{\pkg{siunitx}: Improved alt tag sanitization.} +% \changes{v0.48}{2018/02/14}{\pkg{siunitx-v2}: Improved \SVG\ math.} +% \changes{v0.50}{2018/02/24}{\pkg{siunitx-v2}: Improved \SVG\ math \attribute{alt} tags.} +% \changes{v0.79}{2020/01/21}{\pkg{siunitx-v2}: Improved \MathJax.} +% \changes{v0.903}{2021/12/18}{\pkg{siunitx-v2}: Improved alt tag sanitization.} % \begin{macrocode} \__siunitx_unit_output_pre_print: \begingroup% lwarp \boolfalse{mathjax}% lwarp % \__siunitx_print:nn { number } { \ensuremath {#1} } - \LWR@subsingledollar{% lwarp + \LWR@subsingledollar% lwarp + {% alt text \textbackslash( % space \LWR@HTMLsanitizedetokenized{% \detokenize{#1}% } \textbackslash)% lwarp - }{siunitx}{% - \__siunitx_print:nn { number } {% - \LWR@origensuredmath{#1}% - }% - }% lwarp + } + {siunitx}% addl hashing + {% + \__siunitx_print:nn { number } {% + \LWR@origensuredmath{#1}% + }% + }% lwarp \endgroup% lwarp \__siunitx_unit_output_print: } \group_end:% lwarp % } +\LWR@formatted{__siunitx_combined_output:n} % \end{macrocode} % % % For |parse-numbers=false|: -% \changes{v0.79}{2020/01/21}{\pkg{siunitx}: Improved \MathJax.} -% \changes{v0.903}{2021/12/18}{\pkg{siunitx}: Improved alt tag sanitization.} +% \changes{v0.79}{2020/01/21}{\pkg{siunitx-v2}: Improved \MathJax.} +% \changes{v0.903}{2021/12/18}{\pkg{siunitx-v2}: Improved alt tag sanitization.} % \begin{macrocode} -\cs_set_protected:Npn \__siunitx_range_numbers_aux:n #1 +\cs_new_protected:Npn \LWR@HTML@__siunitx_range_numbers_aux:n #1 { \bool_if:NTF \l__siunitx_number_parse_bool { @@ -79583,29 +80630,33 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', { \__siunitx_unit_output_pre_print: \begingroup% lwarp - \boolfalse{mathjax}% lwarp + \boolfalse{mathjax}% lwarp % \__siunitx_print:nn { number } {#1} - \LWR@subsingledollar{% lwarp - \textbackslash( % space - \LWR@HTMLsanitizedetokenized{% - \detokenize{#1}% - } \textbackslash)% lwarp - }{siunitx}{% - \__siunitx_print:nn { number } {% - \LWR@origensuredmath{#1}% - } % lwarp - }% lwarp - \endgroup% lwarp + \LWR@subsingledollar% lwarp + {% alt text + \textbackslash( % space + \LWR@HTMLsanitizedetokenized{% + \detokenize{#1}% + } \textbackslash)% lwarp + }% + {siunitx}% addl hashing + {% + \__siunitx_print:nn { number } {% + \LWR@origensuredmath{#1}% + } % lwarp + }% lwarp + \endgroup% lwarp \__siunitx_unit_output_print: } } +\LWR@formatted{__siunitx_range_numbers_aux:n} % \end{macrocode} % % For |parse-numbers=false|: -% \changes{v0.79}{2020/01/21}{\pkg{siunitx}: Improved \MathJax.} -% \changes{v0.903}{2021/12/18}{\pkg{siunitx}: Improved alt tag sanitization.} +% \changes{v0.79}{2020/01/21}{\pkg{siunitx-v2}: Improved \MathJax.} +% \changes{v0.903}{2021/12/18}{\pkg{siunitx-v2}: Improved alt tag sanitization.} % \begin{macrocode} -\cs_set_protected:Npn \__siunitx_angle_print_direct_aux:nn #1#2 { +\cs_new_protected:Npn \LWR@HTML@__siunitx_angle_print_direct_aux:nn #1#2 { \tl_if_empty:nF {#1} { \tl_set:Nn \l__siunitx_unit_tl {#2} @@ -79617,7 +80668,9 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \LWR@HTMLsanitizedetokenized{% \detokenize{#1}% } \textbackslash)% lwarp - }{siunitx}{% + }% + {siunitx}% + {% \__siunitx_print:nn { number } { \LWR@origensuredmath{#1}% }% lwarp @@ -79626,13 +80679,14 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \__siunitx_unit_output_print: } } +\LWR@formatted{__siunitx_angle_print_direct_aux:nn} % % \end{macrocode} % % For quotients, the fraction code is replaced by the symbol code: -% \changes{v0.48}{2018/02/14}{\pkg{siunitx}: Changes fraction to symbol.} +% \changes{v0.48}{2018/02/14}{\pkg{siunitx-v2}: Changes fraction to symbol.} % \begin{macrocode} -\cs_set_protected:Npn \__siunitx_number_output_quotient_fraction: { +\cs_new_protected:Npn \LWR@HTML@__siunitx_number_output_quotient_fraction: { \bool_set_true:N \l__siunitx_number_compound_bool \__siunitx_number_output_quotient_aux_i: \tl_set_eq:NN \l__siunitx_number_out_tl @@ -79642,12 +80696,13 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \l__siunitx_number_denominator_tl \__siunitx_number_output_single_aux: } +\LWR@formatted{__siunitx_number_output_quotient_fraction:} % \end{macrocode} % % For units, the fraction code is replaced by the symbol code: -% \changes{v0.48}{2018/02/14}{\pkg{siunitx}: Changes fraction to symbol.} +% \changes{v0.48}{2018/02/14}{\pkg{siunitx-v2}: Changes fraction to symbol.} % \begin{macrocode} -\cs_set_protected:Npn \__siunitx_unit_format_fraction_fraction: { +\cs_new_protected:Npn \LWR@HTML@__siunitx_unit_format_fraction_fraction: { \__siunitx_unit_format_fraction_symbol_aux: \int_compare:nNnT { \l__siunitx_unit_denominator_int } > { 1 } { @@ -79661,11 +80716,12 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \tl_put_right:NV \l__siunitx_unit_tl \l__siunitx_per_symbol_tl \tl_put_right:NV \l__siunitx_unit_tl \l__siunitx_unit_denominator_tl } +\LWR@formatted{__siunitx_unit_format_fraction_fraction:} % \end{macrocode} % -% \changes{v0.50}{2018/02/24}{\pkg{siunitx}: Improved units.} +% \changes{v0.50}{2018/02/24}{\pkg{siunitx-v2}: Improved units.} % \begin{macrocode} -\cs_set_protected:Npn \__siunitx_angle_print_astronomy_aux: { +\cs_new_protected:Npn \LWR@HTML@__siunitx_angle_print_astronomy_aux: { \prop_get:NnNT \l__siunitx_number_out_prop { mantissa-integer } \l__siunitx_tmpa_tl { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl } @@ -79693,111 +80749,350 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', { \__siunitx_angle_print_astronomy_unit: } }% lateximage {% not a lateximage - \__siunitx_print:nV { unit } \l__siunitx_unit_tl \__siunitx_print:nn { number } { { \l__siunitx_output_decimal_tl } } + \__siunitx_print:nV { unit } \l__siunitx_unit_tl }% not a lateximage \prop_get:NnNT \l__siunitx_number_out_prop { mantissa-decimal } \l__siunitx_tmpa_tl { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl } } +\LWR@formatted{__siunitx_angle_print_astronomy_aux:} % \end{macrocode} % -% \changes{v0.79}{2020/01/20}{\pkg{siunitx}: Fix: \cs{square}, \cs{cubed}.} +% \changes{v0.79}{2020/01/20}{\pkg{siunitx-v2}: Fix: \cs{square}, \cs{cubed}.} % \begin{macrocode} -\cs_set_protected:Npn \__siunitx_textsuperscript:n #1 {\textsuperscript{#1}} +\cs_new_protected:Npn \LWR@HTML@__siunitx_textsuperscript:n #1 {\textsuperscript{#1}} +\LWR@formatted{__siunitx_textsuperscript:n} + +\cs_new_eq:NN \LWR@HTML@__siunitx_print_text_super:n \textsuperscript +\LWR@formatted{__siunitx_print_text_super:n} + +\cs_new_eq:NN \LWR@HTML@__siunitx_print_text_sub:n \textsubscript +\LWR@formatted{__siunitx_print_text_sub:n} % \end{macrocode} -% -% \begin{noindmacro}{\num} \oarg{options} \marg{value} + + +% \cs{LWR@origenduresmath} is added here in case the user asks for \cs{mathrm}, etc. +% for \optn{output-exponent-marker}. % \begin{macrocode} -\RenewDocumentCommand \num { o m } { - \leavevmode - \group_begin:% lwarp - \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp - \LetLtxMacro\mbox\LWR@print@mbox% lwarp - \bool_set_false:N \l__siunitx_font_set_bool - \IfNoValueF {#1} - { \keys_set:nn { siunitx } {#1} } - \__siunitx_number_output:n {#2} - \group_end:% lwarp +\cs_new_protected:Npn \LWR@HTML@__siunitx_number_format_final_exponent: { + \prop_get:NnN \l__siunitx_number_out_prop { exponent } + \l__siunitx_tmpa_tl + \tl_if_empty:NTF \l__siunitx_output_exponent_tl + { + \tl_set:Nx \l__siunitx_tmpa_tl + { ^ { \exp_not:V \l__siunitx_tmpa_tl } } + \tl_put_left:NV \l__siunitx_tmpa_tl \l__siunitx_exponent_base_tl + } + { + \tl_set:Nx \l__siunitx_tmpa_tl + { + \LWR@origensuredmath{% lwarp + \exp_not:V \l__siunitx_output_exponent_tl + }% lwarp + \exp_not:N \mathord + \exp_not:V \l__siunitx_tmpa_tl + } + } + \prop_put:NnV \l__siunitx_number_out_prop { exponent-result } + \l__siunitx_tmpa_tl } +\LWR@formatted{__siunitx_number_format_final_exponent:} % \end{macrocode} -% \end{noindmacro} -% -% \begin{noindmacro}{\numrange} \oarg{options} \marg{value1} \marg{value2} + + +% \cs{LWR@origensuredmath} is added here to avoid using an image for the exponent product. % \begin{macrocode} -\RenewDocumentCommand \numrange { o m m } { - \leavevmode - \group_begin:% lwarp - \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp - \LetLtxMacro\mbox\LWR@print@mbox% lwarp - \bool_set_false:N \l__siunitx_font_set_bool - \IfNoValueF {#1} - { \keys_set:nn { siunitx } {#1} } - \__siunitx_range_numbers:nn {#2} {#3} - \group_end:% lwarp +\cs_new_protected:Npn \LWR@HTML@__siunitx_number_format_final_combined: { + \__siunitx_number_format_brackets:n { mantissa } + \prop_get:NnN \l__siunitx_number_out_prop { mantissa-result } + \l__siunitx_tmpa_tl + \tl_if_empty:NT \l__siunitx_output_exponent_tl + { + \tl_put_right:Nx \l__siunitx_tmpa_tl + { + \exp_not:N \LWR@origensuredmath% lwarp + { + \bool_if:NTF \l__siunitx_tight_bool + { { \exp_not:V \l__siunitx_exponent_product_tl } } + { { } \exp_not:V \l__siunitx_exponent_product_tl { } } + } + } + } + \prop_get:NnN \l__siunitx_number_out_prop { exponent-result } + \l__siunitx_tmpb_tl + \tl_put_right:NV \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl + \prop_put:NnV \l__siunitx_number_out_prop { result } + \l__siunitx_tmpa_tl + \prop_put:Nnn \l__siunitx_number_out_prop + { result-bracket-exponent } { true } } +\LWR@formatted{__siunitx_number_format_final_combined:} % \end{macrocode} -% \end{noindmacro} -% -% \begin{noindmacro}{\ang} \marg{options} \marg{angle} + + +% \cs{LWR@origensuredmath} is added here to avoid using an image for the exponent product. % \begin{macrocode} -\RenewDocumentCommand \ang { o > { \SplitArgument { 2 } { ; } } m } { - \group_begin:% lwarp - \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp - \LetLtxMacro\mbox\LWR@print@mbox% lwarp - \IfNoValueF {#1} - { \keys_set:nn { siunitx } {#1} } - \__siunitx_angle_output:nnn #2 - \group_end:% lwarp +\cs_new_protected:Npn \LWR@HTML@__siunitx_number_output_parts_aux: { + \bool_if:NTF \l__siunitx_multi_repeat_bool + { + \prop_if_in:NnT \l__siunitx_number_out_prop { mantissa-result } + { + \__siunitx_number_output_parts_aux:n { mantissa } + \__siunitx_number_output_parts_aux:n { complex } + } + \prop_get:NnNT \l__siunitx_number_out_prop { exponent-result } + \l__siunitx_tmpa_tl + { + \prop_if_in:NnT \l__siunitx_number_out_prop { mantissa-result } + { + \tl_put_left:Nx \l__siunitx_tmpa_tl + { + \exp_not:N \LWR@origensuredmath + { + \bool_if:NTF \l__siunitx_tight_bool + { { \exp_not:V \l__siunitx_exponent_product_tl } } + { { } \exp_not:V \l__siunitx_exponent_product_tl { } } + } + } + \prop_put:NnV \l__siunitx_number_out_prop { exponent } + \l__siunitx_tmpa_tl + } + \__siunitx_number_output_parts_print:n { exponent } + } + } + { \__siunitx_number_output_single: } } +\LWR@formatted{__siunitx_number_output_parts_aux:} % \end{macrocode} -% \end{noindmacro} -% -% \begin{noindmacro}{\si} \marg{options} \marg{unit} + + +% \cs{LWR@origensuredmath} is added here to avoid using an image for the exponent product. % \begin{macrocode} -\RenewDocumentCommand \si { o m } { - \leavevmode - \group_begin:% lwarp - \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp - \LetLtxMacro\mbox\LWR@print@mbox% lwarp - \bool_set_false:N \l__siunitx_font_set_bool - \IfNoValueTF {#1} - { \__siunitx_unit_output:nn {#2} { } } +\cs_new_protected:Npn \LWR@HTML@__siunitx_unit_output_print: { + \int_compare:nNnF { \l__siunitx_unit_prefix_int } = { 0 } + { + \tl_set:Nx \l__siunitx_tmpa_tl + { + \bool_if:NTF \l__siunitx_tight_bool + { + \exp_not:N \LWR@origensuredmath% lwarp + { { \exp_not:V \l__siunitx_exponent_product_tl } } + } + { + \exp_not:N \LWR@origensuredmath% lwarp + { { } \exp_not:V \l__siunitx_exponent_product_tl { } } + } + \int_use:N \l__siunitx_unit_prefix_base_int + ^ { \int_use:N \l__siunitx_unit_prefix_int } + } + \__siunitx_print:nV { number } \l__siunitx_tmpa_tl + } + \tl_if_empty:NF \l__siunitx_unit_tl + { + \__siunitx_unit_output_number_sep: + \__siunitx_print:nV { unit } \l__siunitx_unit_tl + } +} +\LWR@formatted{__siunitx_unit_output_print:} +% \end{macrocode} + + +% \cs{LWR@origensuredmath} is added here to avoid using an image for the exponent product. +% \begin{macrocode} +\cs_new_protected:Npn \LWR@HTML@__siunitx_range_exponent: + { + \bool_if:NT \l__siunitx_process_fixed_bool + { + \tl_set_eq:NN \l__siunitx_tmpa_tl \l__siunitx_exponent_product_tl + \bool_if:NT \l__siunitx_tight_bool + { + \tl_set:Nx \l__siunitx_tmpa_tl + { \exp_not:N \mathord \exp_not:o \l__siunitx_tmpa_tl } + } + \tl_set:Nx \l__siunitx_tmpa_tl + { + \exp_not:N \LWR@origensuredmath {% lwarp + { } \exp_not:o \l__siunitx_tmpa_tl { } + } + 10 \exp_not:N \PrintSuperscript + { \int_use:N \l__siunitx_process_fixed_int } + } + \__siunitx_print:nV { number } \l__siunitx_tmpa_tl + } + } +\LWR@formatted{__siunitx_range_exponent:} +% \end{macrocode} + + +% \cs{LWR@origensuredmath} is added here to avoid using an image for the exponent product. +% \begin{macrocode} +\cs_new_protected:Npn \LWR@HTML@__siunitx_table_print_S_reserved_exponent_product: + { + \tl_set_eq:NN \l__siunitx_tmpb_tl \l__siunitx_exponent_product_tl + \bool_if:NT \l__siunitx_tight_bool + { + \tl_set:Nx \l__siunitx_tmpb_tl + { \exp_not:N \mathord \exp_not:o \l__siunitx_tmpb_tl } + } + \tl_set:Nx \l__siunitx_tmpa_tl { - \keys_set:nn { siunitx } {#1} - \__siunitx_unit_output:nn {#2} {#1} + \exp_not:N \LWR@origensuredmath { { } \exp_not:o \l__siunitx_tmpb_tl { } } + \exp_not:o \l__siunitx_tmpa_tl } - \group_end:% lwarp + } +\LWR@formatted{__siunitx_table_print_S_reserved_exponent_product:} +% \end{macrocode} + + +% \cs{LWR@origensuredmath} is added here to avoid using an image for the output product. +% \begin{macrocode} +\cs_new_protected:Npn \LWR@HTML@__siunitx_number_output_product_aux: { + \bool_set_true:N \l__siunitx_number_compound_bool + \__siunitx_number_preprocess:V \l__siunitx_number_arg_tl + \bool_if:NF \l__siunitx_error_bool + { + \tl_if_empty:NTF \l__siunitx_number_multi_tl + { \__siunitx_number_output_parse_aux: } + { \__siunitx_number_output_quotient: } + \tl_if_empty:NF \l__siunitx_number_next_tl + { + \bool_if:NTF \l__siunitx_tight_bool + { + \__siunitx_print:nn { number } + { \LWR@origensuredmath { \l__siunitx_output_product_tl } } + } + { + \__siunitx_print:nn { number } + { \LWR@origensuredmath { { } \l__siunitx_output_product_tl { } } } + } + \__siunitx_number_output_parse:V \l__siunitx_number_next_tl + } + } } +\LWR@formatted{__siunitx_number_output_product_aux:} % \end{macrocode} -% \end{noindmacro} -% -% -% \begin{noindmacro}{\SIrange} \oarg{options} \marg{value1} \marg{value2} \marg{unit} + + +% Used to detect the math font. % \begin{macrocode} -\RenewDocumentCommand{\SIrange}{o m m m} -{% - \leavevmode - \group_begin:% lwarp - \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp - \LetLtxMacro\mbox\LWR@print@mbox% lwarp - \bool_set_false:N \l__siunitx_font_set_bool - \IfNoValueTF {#1} - { \__siunitx_range_unit:nnnn {#4} { } {#2} {#3} } +\cs_set_protected:Npn \__siunitx_set_math_fam:n #1 { + \group_begin: + \hbox_set:Nn \l__siunitx_tmp_box { - \keys_set:nn { siunitx } {#1} - \__siunitx_range_unit:nnnn {#4} {#1} {#2} {#3} + \LWR@origensuredmath% lwarp + { + \use:c { math #1 } + { + \int_const:cn { c__siunitx_math #1 _int } { \fam } + } + } } - \group_end:% lwarp + \group_end: } % \end{macrocode} -% \end{noindmacro} -% + +% Force \cs{text}: +% \changes{v0.904}{2022/02/26}{\pkg{siunitx-v2}: Improved range phrase.} +% \begin{macrocode} +\cs_set_protected:Npn \__siunitx_range_numbers:nn #1#2 + { + \__siunitx_range_numbers_aux:n {#1} + \text{\l__siunitx_range_phrase_tl}% lwarp + \__siunitx_range_numbers_aux:n {#2} + } +% \end{macrocode} + + +% Force \cs{text}: +% \changes{v0.904}{2022/02/26}{\pkg{siunitx-v2}: Improved range phrase.} +% \begin{macrocode} +\cs_set_protected:Npn \__siunitx_range_unit:nnnn #1#2#3#4 { + \__siunitx_unit_parse_options:nn {#1} {#2} + \bool_if:NTF \l__siunitx_range_repeat_bool + { + \__siunitx_unit_in:nn {#1} {#2} + \__siunitx_range_numbers_aux:n {#3} + \text{\l__siunitx_range_phrase_tl}% lwarp + \__siunitx_range_numbers_aux:n {#4} + } + { + \bool_if:NT \l__siunitx_process_fixed_bool + { \bool_set_true:N \l__siunitx_process_drop_exponent_bool } + \bool_if:NT \l__siunitx_range_brackets_bool + { \__siunitx_print:nV { number } \l__siunitx_bracket_open_tl } + \__siunitx_range_numbers:nn {#3} {#4} + \bool_if:NT \l__siunitx_range_brackets_bool + { \__siunitx_print:nV { number } \l__siunitx_bracket_close_tl } + \__siunitx_range_exponent: + \__siunitx_unit_output_number_sep: + \__siunitx_unit_output:nn {#1} {#2} + } +} +% \end{macrocode} + + % \begin{macrocode} \ExplSyntaxOff % \end{macrocode} +% \begin{macrocode} +\AtBeginDocument{ +\sisetup{ + detect-mode=true, + per-mode=symbol, % fraction is not seen by pdftotext + text-celsius = {\LWR@siunitx@textcelsius}, + text-degree = {\LWR@siunitx@textdegree}, + text-arcminute = {\LWR@siunitx@textprime} , + text-arcsecond = {\LWR@siunitx@textdblprime} , +} +} +% \end{macrocode} + + +% \begin{macrocode} +\LWR@origRequirePackage{lwarp-common-mathjax-siunitx} +% \end{macrocode} + + +% Passing \optn{range-phrase} to \pkg{common-mathjax-siunitx} does not +% seem to work with v2 using \pkg{translator} as it does with v3 using \pkg{translations}. +% The \optn{range-phrase} therefore is set to an en-dash. +% \changes{v0.904}{2022/02/28}{\pkg{siunitx-v2}, \MathJax: Use \optn{range-phrase}.} +% \begin{macrocode} +\AtBeginDocument{ +\CustomizeMathJax{\def\LWRsiunitxrangephrase{\unicode{x2013}}} +} +% \end{macrocode} + + +% \iffalse +%</siunitx-v2> +% \fi + + + + +% +% \iffalse +%<*common-mathjax-siunitx> +% \fi +% +% \part{lwarp-common-mathjax-siunitx.sty} + +% \section{common-mathjax-siunitx} +% +% \credits{Joseph Wright} +% +% \DescribePackage{common-mathjax-siunitx} +% \pkg{common-mathjax-siunitx} adds \MathJax\ for \pkg{siunitx} and \pkg{siunitx-v2}. +% +% \changes{v0.904}{2022/02/21}{\pkg{common-mathjax-siunitx}: Factored from \pkg{siunitx-v2}.} +% +% \codehtml +% +% % For \MathJax. % \margintag{\MathJax} % @@ -79841,9 +81136,11 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % of the arguments of each macro when used, and % the final argument of each collects any extra unused delimiters. % -% The number is split by powers (|E|, |e|, |D|, |d|), then by dimensions (|x|), -% then by plus and minus (|+|, |-|, |+-|), then into pieces before and after the decimal -% point. +% The number is split by dimensions (|x|), +% then by powers (|E|, |e|, |D|, |d|), +% then by plus \Slash minus (|+-|, \cs{pm}), +% then by plus and minus (|+|, |-|), +% then into pieces before and after the decimal point or decimal comma. % % \changes{v0.895}{2021/01/14}{\pkg{siunitx}, \MathJax: % \cs{num} sci notation, multiples, +-, decimals, comma.} @@ -79861,6 +81158,12 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \ExplSyntaxOff % \end{macrocode} % +% Any units which must be distributed across multiple dimensions: +% \begin{macrocode} +\CustomizeMathJax{\def\LWRsiunitxdistribunit{}} +% \end{macrocode} +% +% % \pkg{siunitx} accepts either commas or periods as decimal points. % \cs{LWRsiunitxprintdecimal} splits its input by periods then commas, % parsing out before and after sections to print on either side of the decimal point. @@ -79882,7 +81185,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \ifblank{#1}{0}{\mathrm{#1}}% % \end{macrocode} % -% If something is after the decimal comma, print the decimal comma and the fraction: +% If something is after the decimal comma, print the decimal and the fraction: % \begin{macrocode} \ifblank{#2}% {}% @@ -79901,7 +81204,6 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \ifblank{#2}% {}% {% -% {.}% {\LWRsiunitxdecimal}% \LWRsiunitxprintdecimalsubtwo#2,,\LWRsiunitxENDTWO% }% @@ -79916,7 +81218,9 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \begin{macrocode} \CustomizeMathJax{\def\LWRsiunitxnumplus#1+#2+#3\LWRsiunitxEND{% \ifblank{#2}% - {\LWRsiunitxprintdecimal{#1}}% no plus + {% + \LWRsiunitxprintdecimal{#1}% + }% no plus {% \ifblank{#1}% {\LWRsiunitxprintdecimal{#2}}% leading plus, ignore @@ -79926,6 +81230,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \LWRsiunitxprintdecimal{#2}% }% }% + \LWRsiunitxdistribunit% }} % \end{macrocode} % @@ -79938,42 +81243,36 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \ifblank{#1}{}{\LWRsiunitxprintdecimal{#1}}% \unicode{x02212}% mathematical minus sign \LWRsiunitxprintdecimal{#2}% + \LWRsiunitxdistribunit% }% }} % \end{macrocode} % -% The following splits by |+-| +% The following splits by |\pm| +% \changes{v0.904}{2022/02/28}{\pkg{siunitx}, \MathJax: Fixed \cs{pm}.} % \begin{macrocode} -\CustomizeMathJax{\def\LWRsiunitxnumpm#1+-#2+-#3\LWRsiunitxEND{% +\CustomizeMathJax{\def\LWRsiunitxnumpmmacro#1\pm#2\pm#3\LWRsiunitxEND{% \ifblank{#2}% {\LWRsiunitxnumminus#1---\LWRsiunitxEND}% {% \LWRsiunitxprintdecimal{#1}% \unicode{x0B1}% \pm \LWRsiunitxprintdecimal{#2}% + \LWRsiunitxdistribunit% }% }} % \end{macrocode} % -% The following splits by |x| +% The following splits by |+-| % \begin{macrocode} -\CustomizeMathJax{\def\LWRsiunitxnumx#1x#2x#3x#4\LWRsiunitxEND{% +\CustomizeMathJax{\def\LWRsiunitxnumpm#1+-#2+-#3\LWRsiunitxEND{% \ifblank{#2}% - {\LWRsiunitxnumpm#1+-+-\LWRsiunitxEND}% + {\LWRsiunitxnumpmmacro#1\pm\pm\pm\LWRsiunitxEND}% {% - \ifblank{#3}% - {% - \LWRsiunitxprintdecimal{#1}% - \times% - \LWRsiunitxprintdecimal{#2}% - }% - {% - \LWRsiunitxprintdecimal{#1}% - \times% - \LWRsiunitxprintdecimal{#2}% - \times% - \LWRsiunitxprintdecimal{#3}% - }% + \LWRsiunitxprintdecimal{#1}% + \unicode{x0B1}% \pm + \LWRsiunitxprintdecimal{#2}% + \LWRsiunitxdistribunit% }% }} % \end{macrocode} @@ -79991,7 +81290,8 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', {-}% {\LWRsiunitxprintdecimal{#1}\times}% }% - 10^{\LWRsiunitxprintdecimal{#2}} + 10^{\LWRsiunitxprintdecimal{#2}}% + \LWRsiunitxdistribunit% }} % \end{macrocode} % @@ -80000,7 +81300,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \begin{macrocode} \CustomizeMathJax{\def\LWRsiunitxnumD#1D#2D#3\LWRsiunitxEND{% \ifblank{#2}% - {\LWRsiunitxnumx#1xxxxx\LWRsiunitxEND}% + {\LWRsiunitxnumpm#1+-+-\LWRsiunitxEND}% {\mathrm{\LWRsiunitxnumscientific{#1}{#2}}}% }} % \end{macrocode} @@ -80032,16 +81332,50 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', }} % \end{macrocode} % +% +% The following splits by |x| +% \changes{v0.904}{2022/02/28}{\pkg{siunitx}, \MathJax: Split by \texttt{x} before \texttt{e}.} +% \begin{macrocode} +\CustomizeMathJax{\def\LWRsiunitxnumx#1x#2x#3x#4\LWRsiunitxEND{% + \ifblank{#2}% + {\LWRsiunitxnume#1eee\LWRsiunitxEND}% + {% + \ifblank{#3}% + {% + \LWRsiunitxnume#1eee\LWRsiunitxEND% + \times% + \LWRsiunitxnume#2eee\LWRsiunitxEND% + }% + {% + \LWRsiunitxnume#1eee\LWRsiunitxEND% + \times% + \LWRsiunitxnume#2eee\LWRsiunitxEND% + \times% + \LWRsiunitxnume#3eee\LWRsiunitxEND% + }% + }% +}} +% \end{macrocode} +% +% % \changes{v0.903}{2021/12/10}{\pkg{siunitx}, \MathJax: Improved decimal commas.} % \begin{macrocode} -\CustomizeMathJax{\newcommand{\num}[2][]{\LWRsiunitxnume#2eee\LWRsiunitxEND}} +\CustomizeMathJax{\newcommand{\num}[2][]{% + \LWRsiunitxnumx#2xxxxx\LWRsiunitxEND% +}} % \end{macrocode} % \end{noindmacro} % % % \begin{noindmacro}{\si} \oarg{options} \marg{unit} +% +% |~| is converted to a thin space. +% Not able to convert period to thin space because the period might be in +% \cs{raiseto}, for example. % \begin{macrocode} -\CustomizeMathJax{\newcommand{\si}[2][]{\mathrm{#2}}} +\CustomizeMathJax{\newcommand{\si}[2][]{% + \mathrm{\gsubstitute{#2}{~}{\,}}% +}} % \end{macrocode} % \end{noindmacro} % @@ -80051,11 +81385,15 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \changes{v0.895}{2021/01/14}{\pkg{siunitx}: \MathJax: \cs{SI} prefix parsing.} % \begin{macrocode} \CustomizeMathJax{\def\LWRsiunitxSIopt#1[#2]#3{% - {#2}\num{#1}{#3}% + \def\LWRsiunitxdistribunit{\,\si{#3}}% + {#2}\num{#1}% + \def\LWRsiunitxdistribunit{}% }} \CustomizeMathJax{\newcommand{\LWRsiunitxSI}[2]{% - \num{#1}\,{#2}% + \def\LWRsiunitxdistribunit{\,\si{#2}}% + \num{#1}% + \def\LWRsiunitxdistribunit{}% }} % \end{macrocode} % @@ -80083,8 +81421,11 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \cs{numrange} should only be used in text mode. % If used in \MathJax\ math, an en-dash is used instead of the \optn{range-phrase}. % \changes{v0.89}{2020/08/02}{\pkg{siunitx}: Unicode for endash.} +% \changes{v0.904}{2022/02/28}{\pkg{siunitx}, \MathJax: Use \optn{range-phrase}.} % \begin{macrocode} -\CustomizeMathJax{\newcommand{\numrange}[3][]{\num{#2}\,\unicode{x2013}\,\num{#3}}} +\CustomizeMathJax{\newcommand{\numrange}[3][]{% + \num{#2}\ \LWRsiunitxrangephrase\ \num{#3}% +}} % \end{macrocode} % \end{noindmacro} % @@ -80094,13 +81435,16 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % If used in \MathJax, a simple emulation is provided. % \changes{v0.903}{2021/12/10}{\pkg{siunitx}: \MathJax: Improved \cs{SIlist}.} % \begin{macrocode} -\CustomizeMathJax{\newcommand{\SIlist}[3][]{\text{#2}\,#3}} +\CustomizeMathJax{\newcommand{\SIlist}[3][]{\text{#2}\,\si{#3}}} % \end{macrocode} % \end{noindmacro} % % \begin{noindmacro}{\SIrange} \oarg{options} \marg{value1} \marg{value2} \marg{unit} +% \changes{v0.904}{2022/02/28}{\pkg{siunitx}, \MathJax: Use \optn{range-phrase}.} % \begin{macrocode} -\CustomizeMathJax{\newcommand{\SIrange}[4][]{\num{#2}\,#4\,\unicode{x2013}\,\num{#3}\,#4}} +\CustomizeMathJax{\newcommand{\SIrange}[4][]{% + \num{#2}\,#4\ \LWRsiunitxrangephrase\ \num{#3}\,#4% +}} % \end{macrocode} % \end{noindmacro} % @@ -80331,14 +81675,13 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \CustomizeMathJax{\newcommand{\yobi}{\mathrm{Yi}}} \end{warpMathJax} % \end{macrocode} - +% % \iffalse -%</siunitx-v2> +%</common-mathjax-siunitx> % \fi % % % -% % \iffalse %<*skmath> % \fi @@ -89412,7 +90755,27 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \codehtml % \begin{macrocode} -\LWR@ProvidesPackageDrop{wrapfig2}[2021-12-21] +\@ifpackageloaded{color}{}{% + \@ifpackageloaded{xcolor}{}{\LWR@origRequirePackage{xcolor}}% + } + +\RequirePackage{float} + +\IfPackageLoadedWithOptionsTF{wrapfig2}{WFold} +{}% v4.0 +{% v5+ + \floatstyle{plain} + \ifcsname chapter\endcsname + \newfloat{text}{tbp}{lotx}[chapter] + \else + \newfloat{text}{tbp}{lotx} + \fi + \floatname{text}{Text} +% \let\WF@text@caption\float@caption +} + + +\LWR@ProvidesPackageDrop{wrapfig2}[2022-02-16] \LWR@origRequirePackage{lwarp-wrapfig} % \end{macrocode} @@ -89436,17 +90799,113 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \endLWR@BlockClassWP% \end{LWR@setvirtualpage}% } +% \end{macrocode} +% +% \changes{v0.904}{2022/02/09}{\pkg{wrapfig2}: Update to v5.0.} +% \begin{macrocode} +\IfPackageLoadedWithOptionsTF{wrapfig2}{WFold} +{% v4.0: + \NewDocumentEnvironment{wraptext}% + {O{l} D||{0.5\columnwidth} D<>{0} D(){figure}}% + {% + \wrapfloat{#4}[]{#1}[]{#2}% + \tcolorbox% + } + {% + \endtcolorbox% + \endwrapfloat% + \ignorespaces% + } +}{} -\NewDocumentEnvironment{wraptext}% - {O{l} D||{0.5\columnwidth} D<>{0} D(){figure}}% -{% - \wrapfloat{#4}[]{#1}[]{#2}% - \tcolorbox% -} -{% - \endtcolorbox% - \endwrapfloat% - \ignorespaces% +\IfPackageLoadedWithOptionsTF{wrapfig2}{WFfive} +{% v5 + \definecolor{WFbackground}{rgb}{0.95,0.95,0.95} + \definecolor{WFframe}{rgb}{0.1,0.1,0.1} + \colorlet{WFtext}{black} + \def\SetWFbgd#1{\colorlet{WFbackground}{#1}} + \def\SetWFfrm#1{\colorlet{WFframe}{#1}} + \def\SetWFtxt#1{\colorlet{WFtext}{#1}} + \def\WFsplitdimens#1,#2!{\fboxrule=#1\relax\fboxsep=#2\relax} + + \NewDocumentEnvironment{wraptext}{O{0} m O{0pt} G{0.5\columnwidth}} + {% + \wrapfloat{text}[]{#2}[]{#4}% + } + {% + \endwrapfloat% + \ignorespaces% + } + + \NewDocumentCommand\includeframedtext{O{\insertwidth} m O{1pt,1ex} o}% + {% + \WFsplitdimens #3! + \convertcolorspec{named}{WFtext}{HTML}\LWR@tempcolor% + \LWR@HTML@fcolorboxBlock% + [named]{WFframe}[named]{WFbackground}{#2}% + (% + color:\ \LWR@origpound\LWR@tempcolor ; % + border-radius:\ 1ex% + )% + } +}{% v6+ + \RequirePackage{xkeyval} + + \definecolor{WFbackground}{rgb}{0.95,0.95,0.95} + \definecolor{WFframe}{rgb}{0.1,0.1,0.1} + \colorlet{WFtext}{black} + \def\SetWFbgd#1{\colorlet{WFbackground}{#1}} + \def\SetWFfrm#1{\colorlet{WFframe}{#1}} + \def\SetWFtxt#1{\colorlet{WFtext}{#1}} + \def\WFsplitdimens#1,#2!{\fboxrule=#1\relax\fboxsep=#2\relax} + + \newlength{\LWR@wrapfigtwo@radius} + \setlength{\LWR@wrapfigtwo@radius}{1ex} + + \DeclareOptionX<wraptext>{scalefactor}[0.8]{% +% \def\WFscalefactor{#1}% + } + \DeclareOptionX<wraptext>{fboxrule}[1pt]{\fboxrule=#1} + \DeclareOptionX<wraptext>{fboxsep}[1ex]{\fboxsep=#1} + \DeclareOptionX<wraptext>{framecolor}[WFframe]{\SetWFfrm{#1}} + \DeclareOptionX<wraptext>{backgroundcolor}[WFbackground]{\SetWFbgd{#1}} + \DeclareOptionX<wraptext>{textcolor}[WFtext]{\SetWFtxt{#1}} + \DeclareOptionX<wraptext>{fontstyle}[\normalfont]{#1} + \DeclareOptionX<wraptext>{radius}[\fboxsep]{% + \setlength{\LWR@wrapfigtwo@radius}{#1}% + } + \DeclareOptionX<wraptext>{insertionwidth}[0.5\columnwidth]{% +% \insertwidth=#1% + } + + \DeclareOptionX*{\PackageWarning{wrapfig2}{`\CurrentOption' ignored}} + + \ExecuteOptionsX<wraptext>{scalefactor, fboxrule, fboxsep, framecolor, + backgroundcolor, textcolor, fontstyle, radius, insertionwidth} + + \ProcessOptionsX* + + \NewDocumentEnvironment{wraptext}{O{0} m O{0pt} G{0.5\columnwidth}} + {% + \wrapfloat{text}[]{#2}[]{#4}% + } + {% + \endwrapfloat% + \ignorespaces% + } + + \NewDocumentCommand\includeframedtext{O{\insertwidth} m O{} o} + {% + \ExecuteOptionsX<wraptext>{#3}% executes possible key=value options + \convertcolorspec{named}{WFtext}{HTML}\LWR@tempcolor% + \LWR@HTML@fcolorboxBlock% + [named]{WFframe}[named]{WFbackground}% + {\LWR@textcurrentfont{#2}}% + (% + color:\ \LWR@origpound\LWR@tempcolor ; % + border-radius:\ \LWR@printlength{\LWR@wrapfigtwo@radius}% + )% + } } % \end{macrocode} @@ -89695,7 +91154,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \LWR@traceinfo{LWR@findcurrenttextcolor}% \protect\colorlet{LWR@current@color}{.}% \LWR@traceinfo{LWR@findcurrenttextcolor B}% - \protect\convertcolorspec{named}{LWR@current@color}{HTML}\LWR@tempcolor% + \protect\convertcolorspec{named}{LWR@current@color}{HTML}\LWR@tempcolor\relax% \LWR@traceinfo{LWR@findcurrenttextcolor: done}% } % \end{macrocode} @@ -89781,7 +91240,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \subsection{\HTML\ border} % % \begin{noindmacro}{\LWR@borderpadding} \marg{colorstyle} \marg{color} -% Prints the \HTML\ attributes for a black border and padding. +% Prints the \HTML\ attributes for a color border and padding. % % \cs{LWR@forceminwidth} must be used first in order to set the border width. % @@ -89958,14 +91417,16 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \label{sec:fcolorboxBlock} % \begin{macro}{\fcolorboxBlock} % \oarg{framemodel} \marg{framecolor} \oarg{boxmodel} \marg{boxcolor} \marg{text} +% \parg{add'l \HTML\ style} % % Converted into a framed \HTML\ hex background color span. % % A background color of |none| creates a colored frame without a background color. % % \changes{v0.892}{2020/10/05}{\pkg{xcolor}: Fixed second optional arg.} +% \changes{v0.904}{2022/02/09}{\pkg{xcolor}: Added optional \HTML\ style.} % \begin{macrocode} -\NewDocumentCommand{\LWR@HTML@fcolorboxBlock}{O{named} m O{#1} m +m}{% +\NewDocumentCommand{\LWR@HTML@fcolorboxBlock}{O{named} m O{#1} m +m d()}{% \LWR@traceinfo{HTML fcolorboxBlock #2 #4}% \begingroup% \LWR@hook@processingtags% @@ -89980,6 +91441,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', {% no background color \begin{BlockClass}[% \LWR@borderpadding{#1}{#2}% + \IfValueT{#6}{ ; #6}% ]{fcolorboxBlock} #5 \end{BlockClass}% @@ -89989,6 +91451,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \begin{BlockClass}[% background:\LWR@origpound\LWR@tempcolortwo\ ; % \LWR@borderpadding{#1}{#2}% + \IfValueT{#6}{ ; #6}% ]{fcolorboxBlock} #5 \end{BlockClass}% diff --git a/macros/latex/contrib/lwarp/lwarp.ins b/macros/latex/contrib/lwarp/lwarp.ins index 936ebf198b..e8aed5153e 100644 --- a/macros/latex/contrib/lwarp/lwarp.ins +++ b/macros/latex/contrib/lwarp/lwarp.ins @@ -286,6 +286,7 @@ version 2005/12/01 or later. \file{lwarp-listings.sty}{\from{lwarp.dtx}{listings}} \file{lwarp-listliketab.sty}{\from{lwarp.dtx}{listliketab}} \file{lwarp-lltjext.sty}{\from{lwarp.dtx}{lltjext}} +\file{lwarp-lltjp-siunitx.sty}{\from{lwarp.dtx}{lltjp-siunitx}} \file{lwarp-lltjp-tascmac.sty}{\from{lwarp.dtx}{lltjp-tascmac}} \file{lwarp-longtable.sty}{\from{lwarp.dtx}{longtable}} \file{lwarp-lpic.sty}{\from{lwarp.dtx}{lpic}} diff --git a/macros/latex/contrib/lwarp/lwarp.pdf b/macros/latex/contrib/lwarp/lwarp.pdf Binary files differindex a9286ae0f9..d1495eac7f 100644 --- a/macros/latex/contrib/lwarp/lwarp.pdf +++ b/macros/latex/contrib/lwarp/lwarp.pdf diff --git a/macros/latex/contrib/lwarp/lwarpmk.lua b/macros/latex/contrib/lwarp/lwarpmk.lua index b0d9a1c6f4..1cb169c65c 100755 --- a/macros/latex/contrib/lwarp/lwarpmk.lua +++ b/macros/latex/contrib/lwarp/lwarpmk.lua @@ -2,7 +2,7 @@ -- Copyright 2016-2022 Brian Dunn -printversion = "v0.903" +printversion = "v0.904" requiredconfversion = "2" -- also at *lwarpmk.conf function printhelp () diff --git a/macros/latex/contrib/messagepassing/README.md b/macros/latex/contrib/messagepassing/README.md new file mode 100644 index 0000000000..4af22705d4 --- /dev/null +++ b/macros/latex/contrib/messagepassing/README.md @@ -0,0 +1,28 @@ +# The `messagepassing` package + +This package provides an environement and commands to easily draw diagrams to represent communication protocols using message passing among processes. + +Processes are represented as horizontal (or vertical) lines, and communications as arrows between lines. The package also provides multiple macros to decorate those diagrams, for instance to annotate the diagram, to add crashes to the processes, checkpoints, etc.. + +The package works on top of tikz, which makes it easy to add ad-hoc items using regular tikz commands. +To use it, run the following commands: + +``` +$ latex messagepassing.ins +$ pdflatex messagepassing.dtx +``` + +The first command generates the file messagepassing.sty that should be placed in the same folder than your main document. The second command generates the file messagepassing.pdf (you may require multiple runs to adjust internal references), which is the documentation for the package. + + +## License + +This package is provided under the terms of the LaTeX Project Public License, version 1.3 or later. + +## Author + +The initial author of this package is Martin Vassor. + +## Related packages + + - [msc](https://www.ctan.org/pkg/msc): used to typeset message sequence diagrams, according to the Recommendation Z.120 of the International Telecommunication Union; diff --git a/macros/latex/contrib/messagepassing/messagepassing.dtx b/macros/latex/contrib/messagepassing/messagepassing.dtx new file mode 100644 index 0000000000..3811f558a5 --- /dev/null +++ b/macros/latex/contrib/messagepassing/messagepassing.dtx @@ -0,0 +1,861 @@ +% \iffalse meta-comment +% Copyright (C) 2022 by Martin Vassor +% This file may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% \fi + +% \iffalse +%<package> \NeedsTeXFormat{LaTeX2e} +%<package> \ProvidesPackage{messagepassing}[2022/02/18 v1.0 A package to draw message passing diagrams] +%<package> \RequirePackage{tikz} +%<package> \usetikzlibrary{quotes, calc, arrows.meta} +%<package> \RequirePackage{xparse} +%<package> \RequirePackage{float} +% + +%<*driver> +\documentclass{ltxdoc} +\usepackage{messagepassing} +\usepackage[hidelinks]{hyperref} +\usepackage{xspace} +\usepackage[super]{nth} +\usepackage{subcaption} +\usepackage{listings} +\lstset{ + language=[LaTeX]{TeX}, +} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{messagepassing.dtx} +\end{document} +%</driver> +% \fi + +% \CheckSum{0} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% \changes{v1.0}{2022/02/18}{Initial version for publication} +% +% \GetFileInfo{messagepassing.sty} +% +% \title{The \textsf{messagepassing} package\thanks{This document +% corresponds to \textsf{messagepassing}~\fileversion, +% dated \filedate.}} +% \author{Martin Vassor\\ \texttt{bromind+ctan@gresille.org}} +% +% +% \maketitle +% \tableofcontents +% \newcommand{\TikZ}{Ti\textit{k}Z\xspace} + +% \section{Introduction} +% This package provides an environment and associated macros to easily draw +% message passing diagrams. For instance, Execution.~\ref{mp:ex1} shows the capabilities offered +% by the package. +% +% \begin{messagepassing}[][An example of message passing][h][mp:ex1] +% \newprocesswithlength{p}{9} +% \newprocesswithlength{q}{9} +% \newprocesswithlength{r}{5} +% \crash{r}{5}{k} +% +% \checkpoint{p}{0}{c_p^0} +% \checkpoint{q}{0}{c_q^0} +% \checkpoint{r}{0}{c_r^0} +% \checkpoint{p}{4}{c_p^1} +% +% \stateinterval{p}{0}{si_p^0} +% \stateinterval{q}{0}{si_q^0} +% \stateinterval{r}{0}{si_r^0} +% +% \sendwithstateinterval{p}{1}{q}{2}{si_q^1} +% \sendwithstateinterval{r}{3}{q}{4}{si_q^2} +% \sendwithstateintervalandname{q}{5}{p}{6}{si_p^1}{\(m\)} +% \sendoutofband{q}{5}{r}{6}{\(m_\mathrm{copy}\)} +% \stateinterval{r}{6}{si_r^0} +% \restart{r}{6}{3} +% +% \annotate{r}{8}{restart} +% \annotatexplicit{p}{8}{\(1+1=2\)}{note} +% +% \colouredbox{p}{q}{7}{9}{Protocol} +% +% \drawtimeline{9} +% \end{messagepassing} + +% +% \section{Usage} +% \subsection{Loading the package} +% The package accepts two options: \verb+vertical+ and \verb+annotatevertical+. +% If the former is set, executions will be drawn with time going from top to +% bottom, instead of from left to right. Doing so, almost all +% labels\footnote{Annotations are not rotated, unless explicitly asked.} are +% rotated as well. If, \emph{in addition}, \verb+annotatevertical+ is set, then +% annotations (including named of colouredboxes) are rotated as well. + +% \subsection{Basic usage} +% \subsubsection{Creating a diagram.} + +% \DescribeEnv{messagepassing} A diagram can easily be created using the +% |messagepassing| environment. The syntax is: +% |\begin{messagepassing}| \oarg{tikz} \oarg{caption} \oarg{placement} +% \oarg{label}. +% The first optional argument (\emph{tikz}) contains arguments that are passed +% to the underlying tikz environment. The second argument (\emph{caption}) has +% two effect: if set, it turns the diagram into a floating figure, and the +% content of the argument is the caption of the floating figure. The third +% argument (\emph{placement}) is the placement option of the figure, the default +% is |p|. Finally, the fourth option (\emph{label}) is the label used to +% reference the figure. +% +% For instance, the diagram in Figure~\ref{mp:ex1} is created with the following +% commands: +% \begin{verbatim} +% \begin{messagepassing}[][An example of message passing][h][mp:ex1] +% % ... +% \end{messagepassing} +% \end{verbatim} + +% \paragraph{Setting up the diagram.} +% When created, the diagram is empty. Before actually writing the message +% exchanges, we have to set up a few things: set whether we want a timeline (and +% if it is the case, of which length), and set the number of processes with +% their names, etc. +% \subparagraph{Creating a new process.} +% Each process is characterised by its name. +% \DescribeMacro{\newprocess} The simplest macro to create a new process is then +% |\newprocess| \marg{name}, where \marg{name} is the name of the process (resp. +% \(p\), \(q\), and \(r\) in Figure~\ref{mp:ex1}). +% +% In addition, we often draw a horizontal\footnote{By default, the line is vertical if +% the option |vertical| is used.} line that represent the running process. +% Although this line can be manually +% added\footnote{|processlength|\marg{process}\marg{length} +% creates a line of length \emph{length} for process \emph{process}.}, we also +% provide a simple macro that performs both actions: +% \DescribeMacro{\newprocesswithlength} +% |\newprocesswithlength|\marg{name}\marg{length}. +% +% An other alternative is to name the state in which the process starts (in +% Fig~\ref{mp:ex1}, we call those states \(si\) as \emph{state intervals}). +% Again, this can be achieved using individual commands, but we also provide +% \DescribeMacro{\newprocesswithstateinterval} +% |\newprocesswithstateinterval|\marg{name}\marg{state name}. +% +% Finally, an other way to create a process is to create a process that +% (eventually) fails, which is represented by the process' line terminating +% early with a cross. For that, we provide \DescribeMacro{\newprocesswithcrash} +% |\newprocesswithcrash|\marg{name}\marg{length}\marg{crash coordinate name}. +% The first two arguments are similar to |\newprocesswithlength|, and the latter +% one is used to provide a name for the coordinate where the crash occurs. This +% name can later be used to place nodes. +% +% Of course, we can imagine other combinations (e.g. a process with a length and +% a state interval). We do not provide individual commands for each combination, +% but the can be easily achieved using separate commands. +% +% As an example, the processes of Fig.~\ref{mp:ex1} are created as follows. +% \begin{verbatim} +% \newprocesswithlength{p}{9} +% \newprocesswithlength{q}{9} +% \newprocesswithlength{r}{5} +% \end{verbatim} +% +% \subparagraph{Setting up a timeline.} +% An other setup action consists in setting up (if wanted) the timeline. Notice +% that this can be done \emph{at any place} in the diagram. To do so, simply use +% the command \DescribeMacro{\drawtimeline}|\drawtimeline|\marg{length}, where +% \emph{length} is the length of the desired timeline. + +% \subsubsection{Populating the run.} +% Now that we have some processes, we have to populate the diagram with some +% actions. +% +% \paragraph{Basic message.} +% The most basic action is to send a message. For that, we provide the command +% \DescribeMacro{\send} |\send|\marg{sender}\marg{send +% time}\marg{receiver}\marg{receive time}. The sender and receiver are +% identified with their names, and the sending and receiving times are given +% according to their timestamp\footnote{Notice that nothing prevents sending +% messages in the past, simply set a receiving time before the sending time.}. +% +% In addition, we can label the arrow with the message that is sent with +% \DescribeMacro{\sendwithname} +% |\sendwithname|\marg{sender}\marg{send time}\marg{receiver}\marg{receive +% time}\marg{label}. +% For instance, in Figure~\ref{fig:ex_msg}, we use |\send{p}{1}{q}{2}|. +% +% Finally, we sometimes distinguish \emph{out-of-band} messages, e.g. messages +% that do not carry informations, but that are for instance used for metadata, +% etc.. We provide the macro +% \DescribeMacro{\sendoutofband}|\sendoutofband|\marg{sender}\marg{send time}\marg{receiver}\marg{receive +% time}\marg{label}, which behaves similarly to |\sendwithname|, but prints the +% message in an other colour. +% +% \begin{figure} +% \centering +% \begin{minipage}{.35\textwidth} +% \begin{messagepassing} +% \newprocesswithlength{p}{4} +% \newprocesswithlength{q}{4} +% \send{p}{1}{q}{2} +% \sendwithname{p}{2}{q}{3}{msg} +% \end{messagepassing} +% \end{minipage} +% ~ +% \begin{minipage}{.60\textwidth} +% \iffalse +%<*example> +% \fi +% \begin{lstlisting} +\begin{messagepassing} + \newprocesswithlength{p}{4} + \newprocesswithlength{q}{4} + \send{p}{1}{q}{2} + \sendwithname{p}{2}{q}{3}{msg} +\end{messagepassing} +\end{lstlisting} +% \iffalse +%</example> +% \fi +% \end{minipage} +% \caption{A very simple protocol with a single message exchanged.} +% \label{fig:ex_msg} +% \end{figure} +% +% + +% \paragraph{Process crash and restore.} +% The crash of a process can be represented using +% \DescribeMacro{\crash} +% |\crash|\marg{process name}\marg{time}\marg{crash name}. The argument \emph{process name} +% is the name of the process that crashes, and \emph{crash name} is used to give +% a name to the crash. Naming the crash is useful for coordinates (see below). +% Finally, \emph{time} specifies when the crash occurs. Notice that this does +% not modify the timeline: it simply adds a crash token at the specified +% coordinate. This means that (i) then timeline has to stop at the crash's time; +% and (ii) it has to be restarted after. To stop the timeline, simply take the +% crash into account when setting the initial timeline. To restart the timeline, +% we provide the command +% \DescribeMacro{\restart}|\restart|\marg{name}\marg{date}\marg{duration}. +% \emph{name} specifies which process is to be restarted; \emph{date} specifies +% when the process should be restarted, and \emph{duration} specifies how long +% the process shoud be alive (i.e. what is the length of the timeline) after the +% restart. +% \begin{figure} +% \centering +% \begin{minipage}{.35\textwidth} +% \begin{messagepassing} +% \newprocesswithlength{p}{4} +% \newprocesswithlength{q}{2} +% \send{p}{1}{q}{2} +% \crash{q}{2}{crash} +% \restart{q}{3}{1} +% \end{messagepassing} +% \end{minipage} +% ~ +% \begin{minipage}{.60\textwidth} +% \iffalse +%<*example> +% \fi +% \begin{lstlisting} + \begin{messagepassing} + \newprocesswithlength{p}{4} + \newprocesswithlength{q}{2} + \send{p}{1}{q}{2} + \crash{q}{2}{crash} + \restart{q}{3}{1} + \end{messagepassing} +\end{lstlisting} +% \iffalse +%</example> +% \fi +% \end{minipage} +% \caption{A protocol with a crashed process.} +% \end{figure} +% + +% \paragraph{Tokens on the run} +% +% The package also proposes two kinds of tokens that can be added on protocols' +% lines. The first one is a \emph{checkpoint} (i.e. a state that is saved +% somewhere) and the second is used to denote the begining of a \emph{state +% interval} (a state interval denotes a period in which a process only performs +% deterministic events). The former are denoted with a small black rectangle, +% while the later is denoted with a vertical line. Although those two tokens are +% intended for the usage mentionned above, we encourage users to use them for +% other usages if need be. +% +% A checkpoint can be added with +% \DescribeMacro{\checkpoint}|\checkpoint|\marg{process}\marg{time}\marg{name}, +% where \emph{process} is the name of the process which takes a checkpoint, +% \emph{time} is the the time at which the checkpoint is taken, and \emph{name} +% is the name of the checkpoint, that is printed next to it, and can be used as +% a coordinate. Notice that the name is printed in a math environment, as we +% expect most checkpoints names to be indexed, e.g.\(c_1\), \(c_2\), etc. +% To have more control on the printed name, or if the proposed name is not a +% valid coordinate name, we offer a variant +% \DescribeMacro{\checkpointspecial}|\checkpointspecial|\marg{process}\marg{time}\marg{name}\marg{label}, +% where \emph{name} is the name of the coordinate of the checkpoint, and +% \emph{label} is the label to be printed. Notice that, in that case, the label +% is printed as is, i.e. not typeset as maths. + +% +% A state interval can be added similarly with the command +% \DescribeMacro{\stateinterval}|\stateinterval| +% \marg{process}\marg{time}\marg{name}. +% +% For the sake of completeness, if you need the name of the coordinate and the +% displayed label to be different (e.g. if the label can not be the name of a +% coordinate, for whatever reason), we also provide the command +% \DescribeMacro{\stateintervalspecial} +% |\stateintervalspecial|\marg{process}\marg{time}\marg{name}\marg{label}, in +% which \emph{name} is the name of the created coordinate, and \emph{label} is +% the label attached to the state interval. + +% \begin{figure} +% \centering +% \begin{minipage}{.35\textwidth} +% \begin{messagepassing} +% \newprocesswithlength{q}{2} +% \checkpoint{q}{1}{c_1} +% \crash{q}{2}{crash} +% \restart{q}{3}{1} +% \end{messagepassing} +% \end{minipage} +% ~ +% \begin{minipage}{.60\textwidth} +% \iffalse +%<*example> +% \fi +% \begin{lstlisting} + \begin{messagepassing} + \newprocesswithlength{q}{2} + \checkpoint{q}{1}{c_1} + \crash{q}{2}{crash} + \restart{q}{3}{1} + \end{messagepassing} +\end{lstlisting} +% \iffalse +%</example> +% \fi +% \end{minipage} +% \caption{A protocol with a checkpoint.} +% \end{figure} + +% \paragraph{Grey boxes} +% +% In Execution~\ref{mp:ex1}, we created a light-red box between processes \(p\) +% and \(q\), from time \(7\) to \(9\), to indicate that they perform a given +% protocol that we don't detail further. We call such boxes (which can be used for a lot +% of other purposes) \emph{colouredboxes}, and they +% can be added with \DescribeMacro{\colouredbox} |\colouredbox|\marg{first +% process}\marg{second process}\marg{start time}\marg{end time}\marg{label}. +% This creates a box that spans between \emph{first process} and \emph{second +% process}, from \emph{start time} to \emph{end time}, with the label +% \emph{label} printed. +% +% Notice that there are no technical restrictions to adding messages on top of a +% box, typically to highlight a specific part of a larger execution. + +% \paragraph{Annotations} +% Finally, it is possible to add annotations on the diagram. To do so, we +% provide the macro +% \DescribeMacro{\annotate}|\annotate|\marg{process}\marg{time}\marg{text} which +% adds an annotation with \emph{text} over the timeline of the given +% \emph{process} at time \emph{time}. This also creates a coordinate at the +% annotation time, which name is the content of the annotation (i.e.\ +% \emph{text}). If \emph{text} is not a valid coordinate name, then the +% alternative \DescribeMacro{\annotatexplicit} +% |\annotatexplicit|\marg{process}\marg{time}\marg{text}\marg{name} behaves +% similarly, except that the coordinate name is explicitly given in argument +% \emph{name}. + +% \subsubsection{Combined commands} +% The above commands are sufficient to use all primitives offered by the +% package. In addition, we provide a lot of \emph{combined commands}, which, as +% the name suggest, have the effect of multiple \emph{simple} commands. +% +% \begin{itemize} +% \item |\newprocesswithlength|\marg{name}\marg{lifetime}: combination of +% |\newprocess|\marg{name} and |\processlength|\marg{name}\marg{lifetime} +% \item |\newprocesswithstateinterval|\marg{process name}\marg{state interval +% name}: combination of |\newprocess|\marg{process name} and +% |\stateinterval|\marg{process name}\marg{0}\marg{state interval name} +% \item |\newprocesswithcrash|\marg{process name}\marg{crash time}\marg{crash +% name}: creates a process \emph{process name} that runs until \emph{crash +% time}. The crash is named \emph{crash name}. +% \item |\sendwithstateinterval|\marg{sender}\marg{send +% time}\marg{receiver}\marg{receive time}\marg{si name}: combines |\send| and +% |\stateinterval|. +% \item |\sendwithstateintervalandname|\marg{sender}\marg{send +% time}\marg{receiver}\marg{receive time}\marg{si name}\marg{message name}: +% combines |\sendwithname| and |\stateinterval| +% \end{itemize} + +% \subsection{Advanced usage} +% \subsubsection{Customising colours} +% +% Two parts of the package use colours: colouredboxes and out-of-band messages. By +% default both are shades of red. We provide commands to change that if desired. +% +% \DescribeMacro{\colouredboxcolor}|\colouredboxcolor|\marg{colour} changes the colour +% used for colouredboxes. Notice that this sets both the background colour (which is +% a light variant of the provided colour) and the text colour (which uses the +% provided colour). +% +% \DescribeMacro{\oobcolor}|\oobcolor|\marg{colour} changes the colour used for +% out-of-band messages. +% +% \subsubsection{Coordinates} +% +% \paragraph{\TikZ coordinates.} +% Message passing diagrams are drawn using \TikZ, which means that one can add +% arbitrary commands to a diagram. In addition, the package defines useful +% coordinates to refer to. Execution~\ref{mp:ex2} shows the \TikZ coordinate plan +% overlayed on top of Execution~\ref{mp:ex1}. +% +% On \TikZ \(y\)-axis processes are instanciated one unit apart from each other, +% in their declaration order. +% To keep the coordinate system simple, processes expand in the negative (e.g. +% the first process declared is at coordinate \((0, -1)\), the second at \((0, +% -2)\), etc.). +% +% The \TikZ \(x\)-axis corresponds to the time axis of the diagram. Therefore, +% e.g. coordinate \((3, -4)\) corresponds to the \nth{3} time step of the +% \nth{4} process. +% +% \paragraph{Named coordinates.} +% In addition to explicit coordinates explained above, the package names most of +% the points of interest in the diagram. +% +% \subparagraph{Coordinates of processes.} +% At each process declaration, a coordinate named after the name of the process +% is created. The coordinate corresponds to the beginning of the corresponding +% process' timeline (for instance, in Execution~\ref{mp:ex2}, we show coordinate +% \((\texttt{q})\), that corresponds to the process \(q\)). +% +% \subparagraph{Coordinate of states intervals (resp. checkpoints, resp. crashes).} +% Similarly to processes, each state interval (resp. checkpoint, resp. crashes) creates a +% coordinate, named after the name of the state interval (resp. checkpoint, +% resp. crashes), is created. The coordinates refers to the place of the state +% interval (resp. checkpoint, resp. crashes). For instance, in +% Execution~\ref{mp:ex2}, we show the coordinates \((\texttt{si\_q\^{}1})\), +% \((\texttt{c\_p\^{}1})\) and \((\texttt{k})\), that respectively correspond to the state interval +% \(si_q^1\), the checkpoint \(c_p^1\) and the crash\footnote{The names of +% crashes are not printed on the figure, although they are internally defined.} \(k\). +% +% \subparagraph{Coordinates of annotations.} +% When an annotation is created, a coordinate is created at the same place, on +% the process' timeline\footnote{Notice that, using the explicit variant of |annotate| +% (|annotatexplicit|), the name of the annotation has to be explicitly given.} +% For instance, in Execution~\ref{mp:ex1}, the annotation \(1+1=2\) is created +% with the explicit name ``\texttt{note}''. We show the corresponding coordinate in +% Execution~\ref{mp:ex2}. +% +% +% \begin{messagepassing}[][Showing \TikZ coordinates][h][mp:ex2] +% \newprocesswithlength{p}{9} +% \newprocesswithlength{q}{9} +% \newprocesswithlength{r}{5} +% \crash{r}{5}{k} +% +% \checkpoint{p}{0}{c_p^0} +% \checkpoint{q}{0}{c_q^0} +% \checkpoint{r}{0}{c_r^0} +% \checkpoint{p}{4}{c_p^1} +% +% \stateinterval{p}{0}{si_p^0} +% \stateinterval{q}{0}{si_q^0} +% \stateinterval{r}{0}{si_r^0} +% +% \sendwithstateinterval{p}{1}{q}{2}{si_q^1} +% \sendwithstateinterval{r}{3}{q}{4}{si_q^2} +% \sendwithstateintervalandname{q}{5}{p}{6}{si_p^1}{\(m\)} +% \sendoutofband{q}{5}{r}{6}{\(m_\mathrm{copy}\)} +% \stateinterval{r}{6}{si_r^0} +% \restart{r}{6}{3} +% +% \annotate{r}{8}{restart} +% \annotatexplicit{p}{8}{\(1+1=2\)}{note} +% +% \colouredbox{p}{q}{7}{9}{Protocol} +% \drawtimeline{9} +% +% +% \fill[fill=white, opacity=0.8] (-1, 0) rectangle (10, -5); +% +% \draw[dotted, gray] (-1,0) grid (10,-5); +% \draw[->, thick, red] (0, 0) -- (1, 0) node [anchor=south, text=black] {\((1, 0)\)}; +% \draw[->, thick, red] (0, 0) -- (0, -1) node [anchor=east, text=black] {\((0, -1)\)}; +% +% \draw[fill] (q) circle [radius=.5mm]; +% \node[anchor=east] at (q) {\((\texttt{q})\)}; +% +% \draw[fill] (si_q^1) circle [radius=.5mm]; +% \node[anchor=east] at (si_q^1) {\((\texttt{si\_q\^{}1})\)}; +% +% \draw[fill] (c_p^1) circle [radius=.5mm]; +% \node[anchor=east] at (c_p^1) {\((\texttt{c\_p\^{}1})\)}; +% +% \draw[fill] (k) circle [radius=.5mm]; +% \node[anchor=east] at (k) {\((\texttt{k})\)}; +% +% \draw[fill] (note) circle [radius=.5mm]; +% \node[anchor=east] at (note) {\((\texttt{note})\)}; +% +% \end{messagepassing} + +% \StopEventually{} +% +% \section{Implementation} + +% \begin{macrocode} +\newcounter{processnb} +\setcounter{processnb}{0} +\newcounter{maxtime} + +\pgfdeclarelayer{background} +\pgfsetlayers{background,main} + +\newfloat{float_messagepassing}{t b h p}{.mp} +\floatname{float_messagepassing}{Execution} + +\newif\ifmp@vertical\mp@verticalfalse +\DeclareOption{vertical}{ + \mp@verticaltrue +} +\newif\ifmp@annotatevertical\mp@annotateverticalfalse +\DeclareOption{annotatevertical}{ + \mp@annotateverticaltrue +} +\ProcessOptions\relax + +\ifmp@vertical + \newcommand{\mp@processnameanchor}{south} + \newcommand{\mp@timeticksanchor}{east} + \newcommand{\mp@messagelabelanchor}{south} + \newcommand{\mp@stateintervalanchor}{north west} + \newcommand{\mp@checkpointanchor}{east} + \newcommand{\mp@verticalrotation}{270} + \ifmp@annotatevertical + \newcommand{\mp@annotaterotation}{270} + \else + \newcommand{\mp@annotaterotation}{0} + \fi +\else + \newcommand{\mp@processnameanchor}{east} + \newcommand{\mp@timeticksanchor}{north} + \newcommand{\mp@messagelabelanchor}{west} + \newcommand{\mp@stateintervalanchor}{south west} + \newcommand{\mp@checkpointanchor}{north} + \newcommand{\mp@verticalrotation}{0} + \newcommand{\mp@annotaterotation}{0} +\fi + +\newcommand{\mp@oobcolor}{red} +\newcommand{\oobcolor}[1]{ + \renewcommand\mp@oobcolor{#1} +} + +\newcommand{\mp@colouredboxcolor}{red} +\newcommand{\colouredboxcolor}[1]{ + \renewcommand\mp@colouredboxcolor{#1} +} + +\newif\iftimeline +% \end{macrocode} +% + +%\begin{environment}{messagepassing} +% \begin{macrocode} +\ExplSyntaxOn +%% 1st argument: tikz arguments +%% 2nd argument: Float caption (turns in floating) +%% 3rd argument: Float placement (`p` by default) +%% 4th argument: Float label + \NewDocumentEnvironment{messagepassing} {o o o o} + { + \timelinefalse + \setcounter{processnb}{0} + \IfNoValueTF{#2} { + }{ + \IfNoValueTF{#3}{ + \begin{float_messagepassing}[p] + } { + \begin{float_messagepassing}[#3] + } + \begin{center} + } + \IfNoValueTF{#1}{ + \begin{tikzpicture}[rotate=\mp@verticalrotation] + } { + \begin{tikzpicture}[rotate=\mp@verticalrotation, #1] + } + }{ + %% Draw timeline if boolean is true + \iftimeline + \begin{pgfonlayer}{background} + \setcounter{maxtime}{\@maxtime} + \addtocounter{maxtime}{-1} + \coordinate (maxtime) at (\@maxtime, 0); + + \addtocounter{processnb}{1} + \coordinate (timeline) at (0, -\value{processnb}); + \draw (timeline) node [anchor=\mp@processnameanchor] {{\it time}}; + \draw[->] (timeline) -- ($(timeline) + (maxtime)$); + \foreach \i in {0,...,\value{maxtime}} { + \draw ($(timeline) + (\i, 0) + (0, 0.1)$) -- ($(timeline) + (\i, 0) + (0, -0.1)$) node [anchor=\mp@timeticksanchor] {$\i$}; + } + \end{pgfonlayer} + \else + \fi + \end{tikzpicture} + \IfNoValueTF{#2} { + \linebreak + } { + \end{center} + \caption{#2} + \IfNoValueTF{#4} { + }{ + \label{#4} + } + \end{float_messagepassing} + } + } +\ExplSyntaxOff +% \end{macrocode} +% \end{environment} +% +% \begin{macrocode} +%% #1: name +\newcommand{\newprocess}[1]{ + \addtocounter{processnb}{1} + \coordinate (#1) at (0, -\value{processnb}); + \draw (#1) node[anchor=\mp@processnameanchor] {$#1$}; +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: name +%% #2: width +\newcommand{\newprocesswithlength}[2]{ + \newprocess{#1} + \processlength{#1}{#2} +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: name +%% #2: state interval name +\newcommand{\newprocesswithstateinterval}[2]{ + \newprocess{#1} + \stateinterval{#1}{0}{#2} +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: name +%% #2: width +%% #3: crash name +\newcommand{\newprocesswithcrash}[3]{ + \newprocess{#1}{#2} + \crash{#1}{#2}{#3} +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: sender's name +%% #2: send date +%% #3: receiver's name +%% #4: receive date +\newcommand{\send}[4]{ + \draw[->] (#1) +(#2, 0) -- ($ (#3) +(#4, 0) $); +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: sender's name +%% #2: send date +%% #3: receiver's name +%% #4: receive date +%% #5: message name +\newcommand{\sendwithname}[5]{ + \draw[->] (#1) +(#2, 0) -- ($ (#3) +(#4, 0) $) node[anchor=\mp@messagelabelanchor, pos=0.3] {#5}; +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: process name +%% #2: process width +\newcommand{\processlength}[2]{ + \draw (#1) -- +(#2, 0); +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: sender's name +%% #2: send date +%% #3: receiver's name +%% #4: receive date +%% #5: state interval name +\newcommand{\sendwithstateinterval}[5] { + \send{#1}{#2}{#3}{#4} + \stateinterval{#3}{#4}{#5} +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: sender's name +%% #2: send date +%% #3: receiver's name +%% #4: receive date +%% #5: state interval name +%% #6: message name +\newcommand{\sendwithstateintervalandname}[6] { + \sendwithname{#1}{#2}{#3}{#4}{#6} + \stateinterval{#3}{#4}{#5} +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: sender's name +%% #2: send date +%% #3: receiver's name +%% #4: receive date +%% #5: OoB message name +\newcommand{\sendoutofband}[5]{ + \draw[->, color=\mp@oobcolor] (#1) +(#2, 0) -- ($ (#3) +(#4, 0) $) node[anchor=\mp@messagelabelanchor, pos=0.3] {#5}; +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: process's name +%% #2: state interval date +%% #3: state interval name +\newcommand{\stateinterval}[3] { + \stateintervalspecial{#1}{#2}{#3}{#3} +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: process's name +%% #2: state interval date +%% #3: coordinate name +%% #4: state interval label +\newcommand{\stateintervalspecial}[4] { + \coordinate (#3) at ($ (#1) +(#2, 0) $); + \draw (#3) + (0, 0.1) -- +(0, -0.1) node[anchor=\mp@stateintervalanchor] {$#4$}; +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: process's name +%% #2: checkpoint date +%% #3: checkpoint name +\newcommand{\checkpoint}[3]{ + \coordinate (#3) at ($ (#1) + (#2, 0) $); + \fill (#3) + (-0.05, 0.1) rectangle +(0.05, -0.1); + \draw (#3) + (0, -0.1) node[anchor=\mp@checkpointanchor] {$#3$}; +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: process's name +%% #2: checkpoint date +%% #3: checkpoint coordinate name +%% #4: checkpoint label +\newcommand{\checkpointspecial}[4]{ + \coordinate (#3) at ($ (#1) + (#2, 0) $); + \fill (#3) + (-0.05, 0.1) rectangle +(0.05, -0.1); + \draw (#3) + (0, -0.1) node[anchor=\mp@checkpointanchor] {#4}; +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: process's name +%% #2: crash date +%% #3: crash name +\newcommand{\crash}[3]{ + \coordinate (#3) at ($ (#1) + (#2, 0) $); + \draw (#3) + (-0.1, -0.1) -- +(0.1, 0.1); + \draw (#3) + (0.1, -0.1) -- +(-0.1, 0.1); +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: process's name +%% #2: restart date +%% #3: restart length +\newcommand{\restart}[3]{ + \draw (#1) + (#2, 0) -- ($ (#1) + (#2, 0) + (#3, 0) $); +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: first process's name +%% #2: second process's name +%% #3: begining of the grey box +%% #4: end of the grey box +%% #5: caption +\newcommand{\colouredbox}[5]{ + \begin{pgfonlayer}{background} + \fill[color=\mp@colouredboxcolor!20] ($(#1) + (#3, 0)$) rectangle ($(#2) + (#4, 0)$) node[midway, color = \mp@colouredboxcolor, rotate=\mp@annotaterotation]{#5}; + \end{pgfonlayer} +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: Timeline length +\newcommand{\drawtimeline}[1]{ + \timelinetrue + \def\@maxtime{#1} +} +% \end{macrocode} +% +% \begin{macrocode} +%% #1: process's name +%% #2: annotation date +%% #3: annotation +\newcommand{\annotate}[3]{ + \annotatexplicit{#1}{#2}{#3}{#3} +} +% \end{macrocode} +% +% \begin{macrocode} +%% Same than annotate, but with the coordinate name provided explicitly +%% #1: process's name +%% #2: annotation date +%% #3: annotation +%% #4: coordinate name +\newcommand{\annotatexplicit}[4]{ + \coordinate (#4) at ($ (#1) +(#2, 0.1) $); + \draw (#4) node[rotate=\mp@annotaterotation, anchor=south] {#3}; +} +% \end{macrocode} diff --git a/macros/latex/contrib/messagepassing/messagepassing.ins b/macros/latex/contrib/messagepassing/messagepassing.ins new file mode 100644 index 0000000000..750bc28697 --- /dev/null +++ b/macros/latex/contrib/messagepassing/messagepassing.ins @@ -0,0 +1,49 @@ +%% +%% Copyright (C) 2021 by Martin Vassor +%% + +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +%% + +\input docstrip.tex +\keepsilent +\usedir{tex/latex/messagepassing} +\preamble +This is a generated file. +Copyright (C) 2022 by Martin Vassor + +This file may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in: + + http://www.latex-project.org/lppl.txt + +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +\endpreamble + +\generate{\file{messagepassing.sty}{\from{messagepassing.dtx}{package}}} + +\Msg{*********************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the} +\Msg{* following file into a directory searched by TeX:} +\Msg{*} +\Msg{* \space\space messagepassing.sty} +\Msg{*} +\Msg{* To produce the documentation run the file grammar.dtx} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*********************************************************} +\endbatchfile diff --git a/macros/latex/contrib/messagepassing/messagepassing.pdf b/macros/latex/contrib/messagepassing/messagepassing.pdf Binary files differnew file mode 100644 index 0000000000..410b4d22ca --- /dev/null +++ b/macros/latex/contrib/messagepassing/messagepassing.pdf diff --git a/macros/latex/contrib/mhequ/README b/macros/latex/contrib/mhequ/README index 66890d3eef..ab177e8714 100644 --- a/macros/latex/contrib/mhequ/README +++ b/macros/latex/contrib/mhequ/README @@ -1,5 +1,5 @@ mhequ package by Martin Hairer -Version 1.7 dated 25/08/2015 +Version 1.71 dated 9 March 2022 This package provides an easy way to typeset multilign / multicolumn equations and to add subequation numbering. See the example and the diff --git a/macros/latex/contrib/mhequ/example.pdf b/macros/latex/contrib/mhequ/example.pdf Binary files differindex d6813c2b83..34bdd22f0e 100644 --- a/macros/latex/contrib/mhequ/example.pdf +++ b/macros/latex/contrib/mhequ/example.pdf diff --git a/macros/latex/contrib/mhequ/example.tex b/macros/latex/contrib/mhequ/example.tex index c0eca63f65..e839a9d89a 100644 --- a/macros/latex/contrib/mhequ/example.tex +++ b/macros/latex/contrib/mhequ/example.tex @@ -1,4 +1,5 @@ \documentclass{article} +\usepackage{amsmath} \usepackage{mhequ} \def\eref#1{(\ref{#1})} @@ -11,25 +12,45 @@ \begin{document} -\title{Using the mhequ package} +\title{Using the \texttt{mhequ} package} \author{Martin Hairer} -\date{Version 1.7, \today} +\date{Version 1.71, \today} \maketitle \thispagestyle{empty} -\label{mySec} + +This package provides two environments: \texttt{equ} for single-line equations +and \texttt{equs} for multi-line equations. They behave similarly to the built-in +\texttt{equation} and \texttt{amsmath}'s \texttt{align} environments and can essentially +be used as drop-in replacements. The main difference is that equation numbers are +handled differently: equations are numbered if and only if they have a \verb|\label|, +so there is no need for starred versions. This also applies to individual lines in +a multiline equation. Also, the \texttt{equs} environment supports blocks of equation +with more + +Since \texttt{mhequ} redefines the \verb|\tag| and \verb|\intertext| commands, it should +always be loaded \textit{after} the \texttt{amsmath} package. However, these +two commands should still behave correctly inside the \texttt{amsmath} environments. +The rest of this document demonstrates the usage of the \texttt{mhequ} package, +it is easiest to just read the source code of this document to see how it works. +See also the description given at the start of the file \texttt{mhequ.sty}. + Here is a simple labelled equation: \begin{equ}[onelab] - \sum_{i=1}^5 X_i^j X^j_i = y^j \;. + e^{i\pi} + 1 = 0 \;. \end{equ} Removing or adding the label does not require a change of environment: \begin{equ} - \sum_{i=1}^5 X_i^j X^j_i = y^j \;. + e^{i\pi} + 1 = 0 \;. \end{equ} However, if the option \texttt{numberall} is set, then every single equation is numbered. A simple list of equations can be displayed either with one number per equation +\begin{align} + f(x) &= \sin(x) + 1\;, \label{e:equ1}\\ + h(x) &= f(x) + g(x) -3\;, \label{e:equ3} +\end{align} \begin{equs} f(x) &= \sin(x) + 1\;, \label{e:equ1}\\ h(x) &= f(x) + g(x) -3\;, \label{e:equ3} @@ -37,14 +58,15 @@ per equation or with one number for the whole list \begin{equs}[e:block] f(x) &= \sin(x) + 1\;, \\ - h(x) &= f(x) + g(x) -3\;, + h(x) &= f(x) + g(x) -3\;. \end{equs} -using only a very small modification in the syntax. Of course, it can also have no number at all: +Of course, it can also have no number at all: \begin{equs} f(x) &= \sin(x) + 1\;, \\ h(x) &= f(x) + g(x) -3\;. \end{equs} -Let us make a first group: +The command \verb|\minilab{label_name}| allows us to create a counter for the lines +in a block of equations. \minilab{otherlabel} \begin{equs} f(x) &= \sin(x) + 1\;, \label{e:f}\\ @@ -53,11 +75,12 @@ Let us make a first group: \end{equs} One can refer to the whole block \eref{otherlabel} or to one line, like \eref{e:f} for example. -It is possible to use any tag one likes with the \texttt{\string\tag} +It is possible to use any tag one likes with the \verb|\tag{displayed_tag}| command \begin{equ}[mylabel] - x = y\;. \tag{$\star$} + x = y\;, \tag{$\star$} \end{equ} +which in this case was used as \verb|\tag{$\star$}|. Such an equation can be referred to as usual: \eref{mylabel}. Of course, \texttt{mhequ} can be used in conjunction with the usual \texttt{equation} environment, but \texttt{mhequ} is great, so why would you want to do this? @@ -75,7 +98,8 @@ with awkward names: \intertext{and also (this is some \texttt{\string\intertext})} x&=y+z &\qquad a&= (b+c)^2 - 5 &\qquad \ell&= m\label{labb} \end{equs} -We can even extend the block \eref{otherlabel} much later like +We can even extend the block \eref{otherlabel} much later +using the \verb|\minilab{label_name}| command: \minilab{otherlabel} \begin{equs} x&=y+z &\quad x&=y+z &\quad f(x)&= b\label{e:x1}\\ @@ -83,7 +107,7 @@ We can even extend the block \eref{otherlabel} much later like \multicol{6}{\sin^2 x + \cos^2 x = 1} \label{e:x3} \end{equs} It is possible to change the type of subnumbering and to use the -\texttt{\string\text} command without having to load \texttt{amstext}, like so +\texttt{\string\text} command without having to load \texttt{amstext}: \setlabtype{Alph} \minilab{alab} \begin{equs} diff --git a/macros/latex/contrib/mhequ/mhequ.sty b/macros/latex/contrib/mhequ/mhequ.sty index f1708e4bfc..48f7fd0bfc 100644 --- a/macros/latex/contrib/mhequ/mhequ.sty +++ b/macros/latex/contrib/mhequ/mhequ.sty @@ -1,6 +1,6 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% mhequ.sty v1.7, Copyright 2015 by Martin Hairer +% mhequ.sty v1.71, Copyright 2022 by Martin Hairer % This package is public domain. You are strongly encouraged to use % it and to distribute it further. If you have some contribution to % it, please let me know! @@ -160,7 +160,7 @@ \else\refstepcounter{equation}\fi\fi} \def\@MHputnumber{\if@MHhaslab\@MHstep\if@MHleft\@MHwritelabel\fi% - \hbox{\rm(\@MHeqno)}% + \hbox{\textrm(\@MHeqno)}% \if@MHleft\else\@MHwritelabel\fi% \fi\@MHresetlab} diff --git a/macros/latex/contrib/projlib/ProjLib.ins b/macros/latex/contrib/projlib/ProjLib.ins deleted file mode 100644 index 014bdd8680..0000000000 --- a/macros/latex/contrib/projlib/ProjLib.ins +++ /dev/null @@ -1,72 +0,0 @@ -%% -%% Copyright (C) 2021 by Jinwen XU -%% -%% This file may be distributed and/or modified under the conditions of -%% the LaTeX Project Public License, either version 1.3c of this license -%% or (at your option) any later version. The latest version of this -%% license is in: -%% -%% http://www.latex-project.org/lppl.txt -%% - -\input docstrip.tex -\keepsilent -\askforoverwritefalse - -\begingroup -\catcode`\^^M=\active% -\obeyspaces% -\gdef\copyright{% -\ds@heading% This is file... generated with the docstrip utility. - -Copyright (C) 2021 by Jinwen XU - -This is part of the ProjLib Toolkit. -}% -\gdef\lppllicense{% - -This work may be distributed and/or modified under the conditions of the -LaTeX Project Public License, either version 1.3c of this license or (at -your option) any later version. The latest version of this license is in - - http://www.latex-project.org/lppl.txt - -and version 1.3c or later is part of all distributions of LaTeX version -2005/12/01 or later. -}% -\endgroup - -\def\mypreamble{\copyright\lppllicense} -\usepreamble\mypreamble - -\generate{\file{ProjLib.sty}{\from{ProjLib.dtx}{ProjLib}}} -\generate{\file{PJLauthor.sty}{\from{ProjLib.dtx}{PJLauthor}}} -\generate{\file{PJLdate.sty}{\from{ProjLib.dtx}{PJLdate}}} -\generate{\file{PJLdraft.sty}{\from{ProjLib.dtx}{PJLdraft}}} -\generate{\file{PJLlang.sty}{\from{ProjLib.dtx}{PJLlang}}} -\generate{\file{PJLlogo.sty}{\from{ProjLib.dtx}{PJLlogo}}} -\generate{\file{PJLmath.sty}{\from{ProjLib.dtx}{PJLmath}}} -\generate{\file{PJLpaper.sty}{\from{ProjLib.dtx}{PJLpaper}}} -\generate{\file{PJLthm.sty}{\from{ProjLib.dtx}{PJLthm}}} - -\obeyspaces -\Msg{*************************************************************} -\Msg{* *} -\Msg{* To finish the installation you have to move the following *} -\Msg{* files into a directory searched by TeX: *} -\Msg{* *} -\Msg{* ProjLib.sty *} -\Msg{* PJLauthor.sty *} -\Msg{* PJLdate.sty *} -\Msg{* PJLdraft.sty *} -\Msg{* PJLlang.sty *} -\Msg{* PJLlogo.sty *} -\Msg{* PJLmath.sty *} -\Msg{* PJLpaper.sty *} -\Msg{* PJLthm.sty *} -\Msg{* *} -\Msg{* Happy TeXing! *} -\Msg{* *} -\Msg{*************************************************************} - -\endbatchfile diff --git a/macros/latex/contrib/projlib/ProjLib.sty b/macros/latex/contrib/projlib/ProjLib.sty new file mode 100644 index 0000000000..0e0cdd3666 --- /dev/null +++ b/macros/latex/contrib/projlib/ProjLib.sty @@ -0,0 +1,38 @@ +\NeedsTeXFormat{LaTeX2e}[2020-10-01] +\RequirePackage{l3keys2e} +\ProvidesExplPackage + {ProjLib} + {2022/03/09} {} + {Collective interface of the ProjLib toolkit} + +\keys_define:nn { ProjLib } + { + , unknown .code:n = { + \PassOptionsToPackage { \CurrentOption } { projlib-language } + \PassOptionsToPackage { \CurrentOption } { projlib-author } + \PassOptionsToPackage { \CurrentOption } { projlib-datetime } + \PassOptionsToPackage { \CurrentOption } { projlib-draft } + \PassOptionsToPackage { \CurrentOption } { projlib-font } + \PassOptionsToPackage { \CurrentOption } { projlib-logo } + \PassOptionsToPackage { \CurrentOption } { projlib-math } + \PassOptionsToPackage { \CurrentOption } { projlib-paper } + \PassOptionsToPackage { \CurrentOption } { projlib-theorem } + } + } +\ProcessKeysOptions { ProjLib } + +\RequirePackage { projlib-language } + +\RequirePackage { projlib-author } +\RequirePackage { projlib-datetime } +\RequirePackage { projlib-draft } +\RequirePackage { projlib-font } +\RequirePackage { projlib-logo } +\RequirePackage { projlib-math } +\RequirePackage { projlib-paper } + +\RequirePackage { projlib-theorem } + +\endinput +%% +%% End of file `ProjLib.sty'. diff --git a/macros/latex/contrib/projlib/README.md b/macros/latex/contrib/projlib/README.md index 91c7d4dcfe..3b5a6fbcf8 100644 --- a/macros/latex/contrib/projlib/README.md +++ b/macros/latex/contrib/projlib/README.md @@ -2,15 +2,17 @@ # ProjLib Toolkit -The bundle is dated 2022/02/27 +The bundle is dated 2022/03/09 Old modules are still dated 2021/12/16 and will *not* be modified. When all the new modules are finished, old files shall be removed from this bundle. ## **Important note** -The whole project is being rewritten with `expl3`. New modules have the name with prefix "projlib-", and they are in many ways better and more powerful than their predecessors. Some basically finished new modules are included in the bundle but are not yet documented. Most importantly, they are not compatible with the old modules, so they cannot appear at the same time in the same document, which, unfortunately, means that (for now) they cannot be used in classes like `einfart` or `lebhart`, etc. +The whole project is being rewritten with `expl3`. The new modules are basically finished but are not yet documented. They have the names with prefix "projlib-", and they are in many ways better and more powerful than their predecessors. Most importantly, they are not compatible with the old modules, so they cannot appear at the same time in the same document, which, unfortunately, means that (for now) they cannot be used in classes like `einfart` or `lebhart`, etc. -The newly added modules include: +The current `ProjLib.sty` is the new `expl3` version, the old one has been renamed to `PJLtoolkit.sty`. + +The new modules are: - projlib-author - projlib-datetime - projlib-draft @@ -19,9 +21,12 @@ The newly added modules include: - projlib-logo - projlib-math - projlib-paper +- projlib-theorem When all these modules are finished, the documentation will be updated accordingly. +Below are the old README. + --- > **ProjLib** can be interpreted as "***Proj**ect **Lib**rary*" (in English), or as "***Proj**et **Lib**re*" (in French). diff --git a/macros/latex/contrib/projlib/old-modules/PJLauthor.sty b/macros/latex/contrib/projlib/old-modules/PJLauthor.sty new file mode 100644 index 0000000000..67e1dbd76b --- /dev/null +++ b/macros/latex/contrib/projlib/old-modules/PJLauthor.sty @@ -0,0 +1,245 @@ +%% +%% This is file `PJLauthor.sty', +%% generated with the docstrip utility. + +%% Copyright (C) 2021 by Jinwen XU +%% +%% This is part of the ProjLib Toolkit. +%% +%% This work may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License, either version 1.3c of this license or (at +%% your option) any later version. The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[2020-10-01] +\ProvidesPackage{PJLauthor} + [2021/12/16 Enhanced author information block] +\RequirePackage{kvoptions} +\RequirePackage{etoolbox} +\SetupKeyvalOptions{ + family = @PJLauthor, + prefix = @PJLauthor@, +} +\DeclareBoolOption[false]{amsfashion} +\ProcessKeyvalOptions*\relax + +\ifdefined\subjclass\endinput\fi + +%%================================ +%% Font and style +%%================================ +\def\PJLauthor@font@author{\normalsize\normalfont\scshape} +\def\PJLauthor@font@address{\small\normalfont\itshape} +\def\PJLauthor@font@curraddr{\small\normalfont\itshape} +\def\PJLauthor@font@email{\small\normalfont\ttfamily} + +%%================================ +%% Lengths +%%================================ +\newlength{\PJLauthor@length@innersep} +\setlength{\PJLauthor@length@innersep}{.3\baselineskip} +\newlength{\PJLauthor@length@sep} +\setlength{\PJLauthor@length@sep}{.5\baselineskip} +\newlength{\PJLauthor@length@aftersep} +\setlength{\PJLauthor@length@aftersep}{.3\baselineskip} + +%%================================ +%% The macros +%%================================ +\newif\if@PJLauthor@affilon +\renewcommand*{\author}[1]{% + \gappto\@author{\phantom{A}\\[-\baselineskip]% + \vspace{\PJLauthor@length@sep}% + \PJLauthor@font@author{#1}\\\phantom{} + \@PJLauthor@affilonfalse}} +\providecommand*{\address}[1]{% + \gappto\@author{\phantom{A}\\[-\baselineskip]% + \if@PJLauthor@affilon\else% + \vspace{\PJLauthor@length@innersep}% + \fi% + \@PJLauthor@affilontrue% + \PJLauthor@font@address{#1}\\\phantom{}}% +} +\providecommand*{\curraddr}[1]{% + \gappto\@author{\phantom{A}\\[-\baselineskip]% + \if@PJLauthor@affilon\else% + \vspace{\PJLauthor@length@innersep}% + \fi% + \@PJLauthor@affilontrue% + \PJLauthor@font@curraddr{#1}\\\phantom{}}% +} +\providecommand*{\email}[1]{% + \gappto\@author{\phantom{A}\\[-\baselineskip]% + \if@PJLauthor@affilon\else% + \vspace{\PJLauthor@length@innersep}% + \fi% + \@PJLauthor@affilontrue% + \PJLauthor@font@email{#1}\\\phantom{}}% +} + +%%================================ +%% Adjustment +%%================================ +\patchcmd{\@maketitle}{\begin{tabular}[t]{c}}{}{}{} +\patchcmd{\@maketitle}{\end{tabular}}{}{}{} +\def\@author{} +\pretocmd{\@maketitle}{% + \pretocmd{\@author}{\vspace{-\PJLauthor@length@sep}}{}{\FAIL}% + \apptocmd{\@author}{% + \vspace{-\baselineskip}% + \if@PJLauthor@affilon% + \vspace{\PJLauthor@length@aftersep}% + \fi% + }{}{\FAIL}% +}{}{\FAIL} + +\ifbool{@PJLauthor@amsfashion}{ + +\RequirePackage{PJLlang} +\RequirePackage{calc} + +\providecommand{\conditionalbfseries}{\bfseries} + +\def\keywordsnameEN{\textsc{Key words and phrases}} +\def\keywordsnameFR{\textsc{Mots et phrases clés}} +\def\keywordsnameDE{\textsc{Schlüsselwörter und Phrasen}} +\def\keywordsnameIT{\textsc{Parole e frasi chiave}} +\def\keywordsnamePT{\textsc{Palavras e frases chave}} +\def\keywordsnameBR{\textsc{Palavras e frases chave}} +\def\keywordsnameES{\textsc{Palabras y frases clave}} +\def\keywordsnameCN{关键词} +\def\keywordsnameTC{關鍵詞} +\def\keywordsnameJP{キーワード} +\def\keywordsnameRU{Ключевые слова и фразы} + +\def\PJL@keywords{} +\providecommand*{\keywords}[1]{\def\PJL@keywords{#1}} + +\def\PJL@dedicatory{} +\providecommand*{\dedicatory}[1]{\def\PJL@dedicatory{#1}} + +\AtEndPreamble{ +\let\footnotemark@PJLoriginal\footnotemark% +\let\footnotemark\relax% +\let\thanks@PJLoriginal\thanks% +\newlength\PJL@starlength +\setlength{\PJL@starlength}{\widthof{*}} +\newcommand*{\PJL@prethanks}[1]{\thanks@PJLoriginal{\hspace*{-\PJL@starlength}#1}} +\renewcommand*{\thanks}[1]{% + \ifx#1\@empty\else% + \apptocmd{\@title}{% + \thanks@PJLoriginal{\hspace*{-\PJL@starlength}#1}% + }{}{\FAIL}% + \fi} +\let\author@PJLoriginal\author +\renewcommand{\author}[1]{% + \author@PJLoriginal{% + \let\footnotemark\footnotemark@PJLoriginal% + \let\thanks\thanks@PJLoriginal% + #1% + \let\footnotemark\relax% + }% +} +} + +\let\abstract@PJLoriginal\abstract% +\let\endabstract@PJLoriginal\endabstract% +\newif\if@PJLauthor@maketitle\@PJLauthor@maketitlefalse +\newif\if@PJLauthor@absbefore\@PJLauthor@absbeforefalse +\RequirePackage{fancyvrb} +\providecommand*\protected@iwrite[3]{% + \begingroup + \let\thepage\relax + #2% + \let\protect\@unexpandable@protect + \edef\reserved@a{\immediate\write#1{#3}}\reserved@a + \endgroup + \if@nobreak\ifvmode\nobreak\fi\fi +} +\patchcmd{\FVB@VerbatimOut} + {\immediate\write\FV@OutFile} + {\protected@iwrite\FV@OutFile{}} + {}{} +\renewenvironment{abstract}{% + \VerbatimOut{\jobname.pjlabs}% +}{ + \endVerbatimOut% + \if@PJLauthor@maketitle% + \begin{abstract@PJLoriginal}% + \input{\jobname.pjlabs}% + \end{abstract@PJLoriginal}% + % \ifx\PJL@keywords\@empty\else% + % \par\smallskip\noindent{\conditionalbfseries\csname keywordsname\csname\languagename ABBR\endcsname\endcsname.}~\PJL@keywords% + % \fi% + \else% + \global\@PJLauthor@absbeforetrue% + \fi% +} + +\AtEndPreamble{% +\patchcmd{\@maketitle}{\@date}{% + \ifx\@date\@empty\vspace{-2\baselineskip}% + \else\@date\fi% + \ifx\PJL@dedicatory\@empty\else% + \ifx\@date\@empty\vspace{2\baselineskip}\fi% + \par\vspace{-\parskip}\bigskip% + {\itshape\PJL@dedicatory}% + \ifx\@date\@empty% + \vspace{-1.7\baselineskip}% + \vspace{-\parskip}% + \fi% + \fi% +}{}{\FAIL} +\pretocmd{\maketitle}{% + \ifx\PJL@keywords\@empty\else% + \PJL@prethanks{{\protect\conditionalbfseries% + \csname keywordsname\csname\languagename ABBR\endcsname\endcsname.}% + ~\PJL@keywords}% + \fi}{}{\FAIL} +\apptocmd{\maketitle}{% + \if@PJLauthor@absbefore% + \begin{abstract@PJLoriginal}% + \input{\jobname.pjlabs}% + % \ifx\PJL@keywords\@empty\else% + % \par\smallskip\noindent{\conditionalbfseries\csname keywordsname\csname\languagename ABBR\endcsname\endcsname.}~\PJL@keywords% + % \fi% + \end{abstract@PJLoriginal}% + \fi% + \global\let\address\relax + \global\let\curraddr\relax + \global\let\email\relax + \global\let\dedicatory\relax + \global\let\keywords\relax + \global\@PJLauthor@maketitletrue +}{}{\FAIL} +} + +\newcommand*\subjclass[2][2020]{% + \def\@subjclass{#2}% + \@ifundefined{subjclassname@#1}{% + \ClassWarning{\@currname}{Unknown edition (#1) of Mathematics + Subject Classification; using '2020'}% + \expandafter\let\expandafter\subjclassname\csname subjclassname@2020\endcsname + }{% + \expandafter\let\expandafter\subjclassname\csname subjclassname@#1\endcsname + }% + \PJL@prethanks{{\itshape\subjclassname.}\enspace\@subjclass{}.} +} +\@namedef{subjclassname@1991}{% + \textup{1991} Mathematics Subject Classification} +\@namedef{subjclassname@2000}{% + \textup{2000} Mathematics Subject Classification} +\@namedef{subjclassname@2010}{% + \textup{2010} Mathematics Subject Classification} +\@namedef{subjclassname@2020}{% + \textup{2020} Mathematics Subject Classification} + +} + +\endinput +%% +%% End of file `PJLauthor.sty'. diff --git a/macros/latex/contrib/projlib/old-modules/PJLdate.sty b/macros/latex/contrib/projlib/old-modules/PJLdate.sty new file mode 100644 index 0000000000..783f164e7a --- /dev/null +++ b/macros/latex/contrib/projlib/old-modules/PJLdate.sty @@ -0,0 +1,74 @@ +%% +%% This is file `PJLdate.sty', +%% generated with the docstrip utility. + +%% Copyright (C) 2021 by Jinwen XU +%% +%% This is part of the ProjLib Toolkit. +%% +%% This work may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License, either version 1.3c of this license or (at +%% your option) any later version. The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[2020-10-01] +\ProvidesPackage{PJLdate} + [2021/12/16 Convert yyyy-mm-dd to normal datetime format] +\RequirePackage{kvoptions} +\RequirePackage{etoolbox} +\SetupKeyvalOptions{ + family = @PJLdate, + prefix = @PJLdate@, +} +\DeclareBoolOption[false]{draft} +\DeclareBoolOption[false]{fast} +\ProcessKeyvalOptions*\relax +\if@PJLdate@draft + \@PJLdate@fasttrue +\fi +\DeclareDocumentCommand{\TheDate}{}{\PJLdate} +\DeclareDocumentCommand{\PLdate}{}{\PJLdate} +\if@PJLdate@fast\let\PJLdate\relax\endinput\fi + +\RequirePackage{PJLlang} + +\robustify\@latex@warning@no@line + +\RequirePackage{silence} +\WarningFilter*{datetime2}{Date-Time Language Module} +\PassOptionsToPackage{fr-FR,en-US}{datetime2} +\RequirePackage{datetime2} +\RequirePackage{zhnumber} + +\let\@DTMdate@PJLoriginal\@DTMdate +\gappto{\PJLlang@langconfig@common}{% + \let\@DTMdate\@DTMdate@PJLoriginal% +} +\gappto{\PJLlang@langconfig@CN}{% + \renewcommand*{\@DTMdate}[1]{% + \expandafter\@dtm@parsedate#1\@dtm@endparsedate% + \zhdate{\@dtm@year/\@dtm@month/\@dtm@day}% + }% +} +\gappto{\PJLlang@langconfig@TC}{% + \renewcommand*{\@DTMdate}[1]{% + \expandafter\@dtm@parsedate#1\@dtm@endparsedate% + \zhdate{\@dtm@year/\@dtm@month/\@dtm@day}% + }% +} +\gappto{\PJLlang@langconfig@JP}{% + \renewcommand*{\@DTMdate}[1]{% + \expandafter\@dtm@parsedate#1\@dtm@endparsedate% + \zhdate{\@dtm@year/\@dtm@month/\@dtm@day}% + }% +} + +\providecommand*{\PJLdate}[1]{\DTMdate{#1}} + +\endinput +%% +%% End of file `PJLdate.sty'. diff --git a/macros/latex/contrib/projlib/old-modules/PJLdraft.sty b/macros/latex/contrib/projlib/old-modules/PJLdraft.sty new file mode 100644 index 0000000000..8657326842 --- /dev/null +++ b/macros/latex/contrib/projlib/old-modules/PJLdraft.sty @@ -0,0 +1,104 @@ +%% +%% This is file `PJLdraft.sty', +%% generated with the docstrip utility. + +%% Copyright (C) 2021 by Jinwen XU +%% +%% This is part of the ProjLib Toolkit. +%% +%% This work may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License, either version 1.3c of this license or (at +%% your option) any later version. The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[2020-10-01] +\ProvidesPackage{PJLdraft} + [2021/12/16 Some useful macros for the draft stage] +\RequirePackage{kvoptions} +\RequirePackage{etoolbox} +\SetupKeyvalOptions{ + family = @PJLdraft, + prefix = @PJLdraft@, +} +\DeclareBoolOption[false]{draft} +\DeclareBoolOption[false]{fast} +\ProcessKeyvalOptions*\relax +\if@PJLdraft@draft + \@PJLdraft@fasttrue +\fi + +\RequirePackage{PJLlang} +\RequirePackage{xcolor} + +\def\dnfFont{\ttfamily} +\def\needgraphFont{\ttfamily} + +\def\dnfTextEN{To be finished} +\def\needgraphTextEN{A graph is needed here} +\def\dnfTextFR{Pas encore fini} +\def\needgraphTextFR{Il manque une image ici} +\def\dnfTextDE{Nicht beendet} +\def\needgraphTextDE{Benötigen Sie ein Bild} +\def\dnfTextIT{Per essere finito} +\def\needgraphTextIT{Manca un'immagine qui} +\def\dnfTextPT{Não terminou} +\def\needgraphTextPT{Precisa de uma foto aqui} +\def\dnfTextBR{Não terminou} +\def\needgraphTextBR{Precisa de uma foto aqui} +\def\dnfTextES{Estar terminado} +\def\needgraphTextES{Falta una imagen aquí} +\def\dnfTextCN{这里尚未完成} +\def\needgraphTextCN{这里需要一张图片} +\def\dnfTextTC{這裡尚未完成} +\def\needgraphTextTC{這裡需要一張圖片} +\def\dnfTextJP{終わってない} +\def\needgraphTextJP{まだ画像が必要です} +\def\dnfTextRU{Не закончен} +\def\needgraphTextRU{Еще нужна картинка} + +\definecolor{dnfColor}{RGB}{21,122,20} +\definecolor{needgraphColor}{RGB}{70,130,180} + +\if@PJLdraft@fast + \newcommand{\plainBox}[2][-paper]{\textcolor{#1}{% + \setlength{\fboxsep}{1.5pt}% + \setlength{\fboxrule}{1.2pt}% + \fbox{#2}}} +\else + \PassOptionsToPackage{many}{tcolorbox} + \RequirePackage{tcolorbox} + \newtcbox{\plainBox}[1][-paper]{enhanced jigsaw,% + on line, arc = 1.2pt, outer arc = 1pt,breakable,% + colframe = #1,colupper=#1,opacityback=0,% + boxsep = 1pt,boxrule = 1.2pt,% + left = 1pt, right = 1pt, top = 0pt, bottom = 0pt,% + } +\fi + +\newcounter{dnfcnt} +\newcounter{needgraphcnt} + +\NewDocumentCommand{\dnf}{d<>}{% + \noindent\plainBox[dnfColor]% + {\normalfont\dnfFont\bfseries\small% + \csname dnfText\csname\languagename ABBR\endcsname\endcsname% + \stepcounter{dnfcnt}~\#\thednfcnt% + \IfNoValueF{#1}{\,: #1}}% +} +\NewDocumentCommand{\needgraph}{d<>}{% + \begin{center}% + \plainBox[needgraphColor]% + {\normalfont\needgraphFont\bfseries\small% + \csname needgraphText\csname\languagename ABBR\endcsname\endcsname% + \stepcounter{needgraphcnt}~\#\theneedgraphcnt% + \IfNoValueF{#1}{\,: #1}}% + \end{center}% +} + +\endinput +%% +%% End of file `PJLdraft.sty'. diff --git a/macros/latex/contrib/projlib/old-modules/PJLlang.sty b/macros/latex/contrib/projlib/old-modules/PJLlang.sty new file mode 100644 index 0000000000..9470226adb --- /dev/null +++ b/macros/latex/contrib/projlib/old-modules/PJLlang.sty @@ -0,0 +1,358 @@ +%% +%% This is file `PJLlang.sty', +%% generated with the docstrip utility. + +%% Copyright (C) 2021 by Jinwen XU +%% +%% This is part of the ProjLib Toolkit. +%% +%% This work may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License, either version 1.3c of this license or (at +%% your option) any later version. The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[2020-10-01] +\ProvidesPackage{PJLlang} + [2021/12/16 Multi-language configuration] +\RequirePackage{kvoptions} +\RequirePackage{etoolbox} +\SetupKeyvalOptions{% + family = @PJLlang, + prefix = @PJLlang@ +} +\DeclareBoolOption[false]{polyglossia} + +\newif\if@PJLlang@enable@all\@PJLlang@enable@alltrue +\newif\if@PJLlang@enable@EN\@PJLlang@enable@ENfalse +\newif\if@PJLlang@enable@FR\@PJLlang@enable@FRfalse +\newif\if@PJLlang@enable@DE\@PJLlang@enable@DEfalse +\newif\if@PJLlang@enable@IT\@PJLlang@enable@ITfalse +\newif\if@PJLlang@enable@PT\@PJLlang@enable@PTfalse +\newif\if@PJLlang@enable@BR\@PJLlang@enable@BRfalse +\newif\if@PJLlang@enable@ES\@PJLlang@enable@ESfalse +\newif\if@PJLlang@enable@CN\@PJLlang@enable@CNfalse +\newif\if@PJLlang@enable@TC\@PJLlang@enable@TCfalse +\newif\if@PJLlang@enable@JP\@PJLlang@enable@JPfalse +\newif\if@PJLlang@enable@RU\@PJLlang@enable@RUfalse +\def\PJLlang@babeloptions{} +\DeclareVoidOption{EN}{\@PJLlang@enable@allfalse\@PJLlang@enable@ENtrue\providecommand{\PJLlang@mainlang}{EN}\gpreto{\PJLlang@babeloptions}{,english}} +\DeclareVoidOption{english}{\@PJLlang@enable@allfalse\@PJLlang@enable@ENtrue\providecommand{\PJLlang@mainlang}{EN}\gpreto{\PJLlang@babeloptions}{,english}} +\DeclareVoidOption{English}{\@PJLlang@enable@allfalse\@PJLlang@enable@ENtrue\providecommand{\PJLlang@mainlang}{EN}\gpreto{\PJLlang@babeloptions}{,english}} +\DeclareVoidOption{FR}{\@PJLlang@enable@allfalse\@PJLlang@enable@FRtrue\providecommand{\PJLlang@mainlang}{FR}\gpreto{\PJLlang@babeloptions}{,french}} +\DeclareVoidOption{french}{\@PJLlang@enable@allfalse\@PJLlang@enable@FRtrue\providecommand{\PJLlang@mainlang}{FR}\gpreto{\PJLlang@babeloptions}{,french}} +\DeclareVoidOption{French}{\@PJLlang@enable@allfalse\@PJLlang@enable@FRtrue\providecommand{\PJLlang@mainlang}{FR}\gpreto{\PJLlang@babeloptions}{,french}} +\DeclareVoidOption{DE}{\@PJLlang@enable@allfalse\@PJLlang@enable@DEtrue\providecommand{\PJLlang@mainlang}{DE}\gpreto{\PJLlang@babeloptions}{,ngerman}} +\DeclareVoidOption{german}{\@PJLlang@enable@allfalse\@PJLlang@enable@DEtrue\providecommand{\PJLlang@mainlang}{DE}\gpreto{\PJLlang@babeloptions}{,ngerman}} +\DeclareVoidOption{ngerman}{\@PJLlang@enable@allfalse\@PJLlang@enable@DEtrue\providecommand{\PJLlang@mainlang}{DE}\gpreto{\PJLlang@babeloptions}{,ngerman}} +\DeclareVoidOption{German}{\@PJLlang@enable@allfalse\@PJLlang@enable@DEtrue\providecommand{\PJLlang@mainlang}{DE}\gpreto{\PJLlang@babeloptions}{,ngerman}} +\DeclareVoidOption{IT}{\@PJLlang@enable@allfalse\@PJLlang@enable@ITtrue\providecommand{\PJLlang@mainlang}{IT}\gpreto{\PJLlang@babeloptions}{,italian}} +\DeclareVoidOption{italian}{\@PJLlang@enable@allfalse\@PJLlang@enable@ITtrue\providecommand{\PJLlang@mainlang}{IT}\gpreto{\PJLlang@babeloptions}{,italian}} +\DeclareVoidOption{Italian}{\@PJLlang@enable@allfalse\@PJLlang@enable@ITtrue\providecommand{\PJLlang@mainlang}{IT}\gpreto{\PJLlang@babeloptions}{,italian}} +\DeclareVoidOption{PT}{\@PJLlang@enable@allfalse\@PJLlang@enable@PTtrue\providecommand{\PJLlang@mainlang}{PT}\gpreto{\PJLlang@babeloptions}{,portuguese}} +\DeclareVoidOption{portuguese}{\@PJLlang@enable@allfalse\@PJLlang@enable@PTtrue\providecommand{\PJLlang@mainlang}{PT}\gpreto{\PJLlang@babeloptions}{,portuguese}} +\DeclareVoidOption{Portuguese}{\@PJLlang@enable@allfalse\@PJLlang@enable@PTtrue\providecommand{\PJLlang@mainlang}{PT}\gpreto{\PJLlang@babeloptions}{,portuguese}} +\DeclareVoidOption{BR}{\@PJLlang@enable@allfalse\@PJLlang@enable@BRtrue\providecommand{\PJLlang@mainlang}{BR}\gpreto{\PJLlang@babeloptions}{,brazilian}} +\DeclareVoidOption{brazilian}{\@PJLlang@enable@allfalse\@PJLlang@enable@BRtrue\providecommand{\PJLlang@mainlang}{BR}\gpreto{\PJLlang@babeloptions}{,brazilian}} +\DeclareVoidOption{Brazilian}{\@PJLlang@enable@allfalse\@PJLlang@enable@BRtrue\providecommand{\PJLlang@mainlang}{BR}\gpreto{\PJLlang@babeloptions}{,brazilian}} +\DeclareVoidOption{ES}{\@PJLlang@enable@allfalse\@PJLlang@enable@EStrue\providecommand{\PJLlang@mainlang}{ES}\gpreto{\PJLlang@babeloptions}{,spanish}} +\DeclareVoidOption{spanish}{\@PJLlang@enable@allfalse\@PJLlang@enable@EStrue\providecommand{\PJLlang@mainlang}{ES}\gpreto{\PJLlang@babeloptions}{,spanish}} +\DeclareVoidOption{Spanish}{\@PJLlang@enable@allfalse\@PJLlang@enable@EStrue\providecommand{\PJLlang@mainlang}{ES}\gpreto{\PJLlang@babeloptions}{,spanish}} +\DeclareVoidOption{CN}{\@PJLlang@enable@allfalse\@PJLlang@enable@CNtrue\providecommand{\PJLlang@mainlang}{CN}} +\DeclareVoidOption{chinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@CNtrue\providecommand{\PJLlang@mainlang}{CN}} +\DeclareVoidOption{Chinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@CNtrue\providecommand{\PJLlang@mainlang}{CN}} +\DeclareVoidOption{schinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@CNtrue\providecommand{\PJLlang@mainlang}{CN}} +\DeclareVoidOption{SChinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@CNtrue\providecommand{\PJLlang@mainlang}{CN}} +\DeclareVoidOption{simplifiedchinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@CNtrue\providecommand{\PJLlang@mainlang}{CN}} +\DeclareVoidOption{SimplifiedChinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@CNtrue\providecommand{\PJLlang@mainlang}{CN}} +\DeclareVoidOption{TC}{\@PJLlang@enable@allfalse\@PJLlang@enable@TCtrue\providecommand{\PJLlang@mainlang}{TC}} +\DeclareVoidOption{tchinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@TCtrue\providecommand{\PJLlang@mainlang}{TC}} +\DeclareVoidOption{TChinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@TCtrue\providecommand{\PJLlang@mainlang}{TC}} +\DeclareVoidOption{traditionalchinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@TCtrue\providecommand{\PJLlang@mainlang}{TC}} +\DeclareVoidOption{TraditionalChinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@TCtrue\providecommand{\PJLlang@mainlang}{TC}} +\DeclareVoidOption{JP}{\@PJLlang@enable@allfalse\@PJLlang@enable@JPtrue\providecommand{\PJLlang@mainlang}{JP}\gpreto{\PJLlang@babeloptions}{,japanese}} +\DeclareVoidOption{japanese}{\@PJLlang@enable@allfalse\@PJLlang@enable@JPtrue\providecommand{\PJLlang@mainlang}{JP}\gpreto{\PJLlang@babeloptions}{,japanese}} +\DeclareVoidOption{Japanese}{\@PJLlang@enable@allfalse\@PJLlang@enable@JPtrue\providecommand{\PJLlang@mainlang}{JP}\gpreto{\PJLlang@babeloptions}{,japanese}} +\DeclareVoidOption{RU}{\@PJLlang@enable@allfalse\@PJLlang@enable@RUtrue\providecommand{\PJLlang@mainlang}{RU}\gpreto{\PJLlang@babeloptions}{,russian}} +\DeclareVoidOption{russian}{\@PJLlang@enable@allfalse\@PJLlang@enable@RUtrue\providecommand{\PJLlang@mainlang}{RU}\gpreto{\PJLlang@babeloptions}{,russian}} +\DeclareVoidOption{Russian}{\@PJLlang@enable@allfalse\@PJLlang@enable@RUtrue\providecommand{\PJLlang@mainlang}{RU}\gpreto{\PJLlang@babeloptions}{,russian}} +\ProcessKeyvalOptions*\relax + +\ExplSyntaxOn +\cs_new_protected:cpn { @clearglobaloption } #1 + { + \clist_remove_all:cn { @classoptionslist } { #1 } + } +\ExplSyntaxOff + +\@clearglobaloption{chinese} +\@clearglobaloption{Chinese} + +\providecommand{\PJLlang@mainlang}{EN} + +\if@PJLlang@enable@all + \@PJLlang@enable@ENtrue + \@PJLlang@enable@FRtrue + \@PJLlang@enable@DEtrue + \@PJLlang@enable@ITtrue + \@PJLlang@enable@PTtrue + \@PJLlang@enable@BRtrue + \@PJLlang@enable@EStrue + \@PJLlang@enable@CNtrue + \@PJLlang@enable@TCtrue + \@PJLlang@enable@JPtrue + \@PJLlang@enable@RUtrue +\fi + +\newcommand\englishABBR{EN} +\newcommand\frenchABBR{FR} +\newcommand\ngermanABBR{DE} +\newcommand\italianABBR{IT} +\newcommand\portugueseABBR{PT} +\newcommand\brazilianABBR{BR} +\newcommand\spanishABBR{ES} +\newcommand\schineseABBR{CN} +\newcommand\tchineseABBR{TC} +\newcommand\japaneseABBR{JP} +\newcommand\russianABBR{RU} + +\ExplSyntaxOn +\NewExpandableDocumentCommand{\StrToABBR}{m} + { + \str_case_e:nn { \str_foldcase:n { #1 } } + { + {cn} {CN} + {chinese} {CN} + {schinese} {CN} + {simplifiedchinese} {CN} + {tc} {TC} + {tchinese} {TC} + {traditionalchinese} {TC} + {jp} {JP} + {japanese} {JP} + {en} {EN} + {english} {EN} + {fr} {FR} + {french} {FR} + {de} {DE} + {ngerman} {DE} + {it} {IT} + {italian} {IT} + {pt} {PT} + {portuguese} {PT} + {br} {BR} + {brazilian} {BR} + {es} {ES} + {spanish} {ES} + {german} {DE} + {ru} {RU} + {russian} {RU} + } + } + +\NewExpandableDocumentCommand{\StrToTYPE}{m} + { + \str_case_e:nn { \str_foldcase:n { #1 } } + { + {cn} {CJK} + {chinese} {CJK} + {schinese} {CJK} + {simplifiedchinese} {CJK} + {tc} {CJK} + {tchinese} {CJK} + {traditionalchinese} {CJK} + {jp} {CJK} + {japanese} {CJK} + {en} {Latin} + {english} {Latin} + {fr} {Latin} + {french} {Latin} + {de} {Latin} + {ngerman} {Latin} + {it} {Latin} + {italian} {Latin} + {pt} {Latin} + {portuguese} {Latin} + {br} {Latin} + {brazilian} {Latin} + {es} {Latin} + {spanish} {Latin} + {german} {Latin} + {ru} {Latin} + {russian} {Latin} + } + } +\ExplSyntaxOff + +\RequirePackage{iftex} +\ifPDFTeX +\RequirePackage[T1]{fontenc} +\RequirePackage{inputenc} +\fi + +\if@PJLlang@polyglossia + \RequirePackage{polyglossia} + \setdefaultlanguage{english} + \setotherlanguage[frenchpart=false]{french} + \setotherlanguage{ngerman} + \setotherlanguage{spanish} + \setotherlanguage{portuguese} + \setotherlanguage[variant=brazilian]{portuguese} + \setotherlanguage{italian} + \ifPDFTeX\else + \setotherlanguage{russian} + \setotherlanguage{japanese} + \RequirePackage{silence} + \WarningFilter{polyglossia}{Asking to add empty feature to latin font(Script="CJK" to scripttag "")} + \fi +\else + \if@PJLlang@enable@all + \ifPDFTeX\else + \PassOptionsToPackage{japanese,russian}{babel} + \fi + \PassOptionsToPackage{italian,portuguese,brazilian,spanish,es-notilde,es-noquoting,ngerman,french,english,shorthands=off}{babel} + \else + \PassOptionsToPackage{\PJLlang@babeloptions}{babel} + \fi + \PassOptionsToPackage{italian,brazilian,spanish,ngerman,french,english}{cleveref} + \RequirePackage{babel} + \if@PJLlang@enable@FR + \frenchsetup{PartNameFull=false} + \fi + \if@PJLlang@enable@PT + \let\PJL@babelord\ord + \let\ord\relax + \AtBeginDocument{ + \@ifundefined{ord}{} + { + \let\PJL@userord\ord + \let\ord\relax + \newcommand{\ord}{% + \ifmmode\expandafter\PJL@userord\else\expandafter\PJL@babelord\fi% + } + } + } + \fi + + \babelprovide{schinese} + \babelprovide{tchinese} +\fi + +\let\today@PJLoriginal\today +\newcommand{\PJLlang@langconfig@common}{% + \ifdefined\DTMtoday% + \let\today\DTMtoday% + \else% + \let\today\today@PJLoriginal% + \fi% +} + +\newcommand{\PJLlang@langconfig@CN}{% + \def\abstractname{摘要}% + \def\proofname{证明}% + \def\contentsname{目录}% + \def\listfigurename{插图}% + \def\listtablename{表格}% + \def\figurename{图}% + \def\tablename{表}% + \def\indexname{索引}% + \def\appendixname{附录}% + \def\refname{参考文献}% + \def\bibname{参考文献}% + \let\today\zhtoday% + \renewcommand{\languagename}{schinese}% +} +\newcommand{\PJLlang@langconfig@TC}{% + \def\abstractname{摘要}% + \def\proofname{證明}% + \def\contentsname{目錄}% + \def\listfigurename{插圖}% + \def\listtablename{表格}% + \def\figurename{圖}% + \def\tablename{表}% + \def\indexname{索引}% + \def\appendixname{附錄}% + \def\refname{參考文獻}% + \def\bibname{參考文獻}% + \let\today\zhtoday% + \renewcommand{\languagename}{tchinese}% +} +\newcommand{\PJLlang@langconfig@JP}{% + \selectlanguage{japanese}% +} +\newcommand{\PJLlang@langconfig@EN}{% + \selectlanguage{english}% +} +\newcommand{\PJLlang@langconfig@FR}{% + \selectlanguage{french}% + \def\frenchpartname{Partie}% +} +\newcommand{\PJLlang@langconfig@DE}{% + \selectlanguage{ngerman}% +} +\newcommand{\PJLlang@langconfig@IT}{% + \selectlanguage{italian}% +} +\newcommand{\PJLlang@langconfig@PT}{% + \selectlanguage{portuguese}% +} +\newcommand{\PJLlang@langconfig@BR}{% + \selectlanguage{brazilian}% +} +\newcommand{\PJLlang@langconfig@ES}{% + \selectlanguage{spanish}% +} +\newcommand{\PJLlang@langconfig@RU}{% + \selectlanguage{russian}% +} + +\NewDocumentCommand\AddLanguageSetting{d()m}{% +\IfNoValueTF{#1}% + {\gappto{\PJLlang@langconfig@common}{#2}}% + {\expandafter\gappto\expandafter{\csname PJLlang@langconfig@\StrToABBR{#1}\endcsname}{#2}}% +} + +\RequirePackage{setspace} +\def\PJL@config@linespacing{\setstretch{1.00}} +\def\PJL@config@CJKlinespacing{\onehalfspacing} +\newcommand{\PJLsetlinespacing}[1]{\renewcommand{\PJL@config@linespacing}{#1}} +\newcommand{\PJLsetCJKlinespacing}[1]{\renewcommand{\PJL@config@CJKlinespacing}{#1}} +\@ifclassloaded{beamer}{ + \def\PJL@config@parindent{\ltx@ifpackageloaded{parskip}{}{\setlength{\parindent}{0em}}} + \def\PJL@config@CJKparindent{\ltx@ifpackageloaded{parskip}{}{\setlength{\parindent}{0em}}} +}{ + \def\PJL@config@parindent{\ltx@ifpackageloaded{parskip}{}{\setlength{\parindent}{1.5em}}} + \def\PJL@config@CJKparindent{\ltx@ifpackageloaded{parskip}{}{\setlength{\parindent}{2em}}} +} +\newcommand{\PJLsetparindent}[1]{\renewcommand{\PJL@config@parindent}{\ltx@ifpackageloaded{parskip}{}{\setlength{\parindent}{#1}}}} +\newcommand{\PJLsetCJKparindent}[1]{\renewcommand{\PJL@config@CJKparindent}{\ltx@ifpackageloaded{parskip}{}{\setlength{\parindent}{#1}}}} +\def\PJL@config@CJK{\PJL@config@CJKlinespacing\PJL@config@CJKparindent} +\def\PJL@config@Latin{\PJL@config@linespacing\PJL@config@parindent} +\NewDocumentCommand{\UseLanguageCORE}{m}{% + \PJLlang@langconfig@common% + \csname PJL@config@\StrToTYPE{#1}\endcsname% + \csname PJLlang@langconfig@\StrToABBR{#1}\endcsname% +} +\NewDocumentCommand{\UseLanguage}{m}{% + \ifx\@onlypreamble\@notprerr% + \UseLanguageCORE{#1}% + \else% + \AfterEndPreamble{\UseLanguageCORE{#1}}% + \fi% +} +\NewDocumentCommand{\UseOtherLanguage}{mm}{% +\begingroup\begingroup% + \PJLlang@langconfig@common% + \csname PJLlang@langconfig@\StrToABBR{#1}\endcsname% + #2% +\endgroup\endgroup% +} + +\expandafter\UseLanguage\expandafter{\PJLlang@mainlang} + +\endinput +%% +%% End of file `PJLlang.sty'. diff --git a/macros/latex/contrib/projlib/old-modules/PJLlogo.sty b/macros/latex/contrib/projlib/old-modules/PJLlogo.sty new file mode 100644 index 0000000000..7d24239fdc --- /dev/null +++ b/macros/latex/contrib/projlib/old-modules/PJLlogo.sty @@ -0,0 +1,72 @@ +%% +%% This is file `PJLlogo.sty', +%% generated with the docstrip utility. + +%% Copyright (C) 2021 by Jinwen XU +%% +%% This is part of the ProjLib Toolkit. +%% +%% This work may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License, either version 1.3c of this license or (at +%% your option) any later version. The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[2020-10-01] +\ProvidesPackage{PJLlogo} + [2021/12/16 The ProjLib logo] +\RequirePackage{kvoptions} +\RequirePackage{etoolbox} +\SetupKeyvalOptions{ + family = @PJLlogo, + prefix = @PJLlogo@, +} +\DeclareBoolOption[false]{draft} +\DeclareBoolOption[false]{fast} +\ProcessKeyvalOptions*\relax +\if@PJLlogo@draft + \@PJLlogo@fasttrue +\fi +\if@PJLlogo@fast\def\ProjLib{{\normalfont ProjLib}}\endinput\fi + +\RequirePackage{xcolor} +\RequirePackage{graphicx} +\ifdefined\fontspec + \newfontface{\PJLlogo@font}{LinBiolinum_R.otf} +\else + \RequirePackage[T1]{fontenc} + \newcommand{\PJLlogo@font}{\fontfamily{LinuxBiolinumT-TLF}\selectfont} +\fi + +\newcommand{\PJLSigmaJ}{% + \vbox{\offinterlineskip + \ialign{% + \hfil##\hfil\cr + \hidewidth\hskip0.15ex\scalebox{0.4}{\rotatebox{-10}{\usefont{U}{zeur}{b}{n}\symbol{"06}}}\hidewidth\cr + \noalign{\kern0.15ex} + \j\cr + }% + }% +} + +\newcommand{\ProjLib@generic}[1]{% + \begingroup + \normalfont\PJLlogo@font + \textcolor{blue!60!cyan}{P}% + \textcolor{blue!45!cyan}{r}% + \textcolor{blue!30!cyan}{o}% + \textcolor{green!70!black}{#1}% + \textcolor{red!20!yellow}{L}% + \textcolor{red!40!yellow}{i}% + \textcolor{red!60!yellow}{b}% + \endgroup +} +\DeclareRobustCommand*{\ProjLib}{\ProjLib@generic{\PJLSigmaJ}} +\DeclareRobustCommand*{\ProjLibText}{\ProjLib@generic{j}} + +\endinput +%% +%% End of file `PJLlogo.sty'. diff --git a/macros/latex/contrib/projlib/old-modules/PJLmath.sty b/macros/latex/contrib/projlib/old-modules/PJLmath.sty new file mode 100644 index 0000000000..3bd389ef50 --- /dev/null +++ b/macros/latex/contrib/projlib/old-modules/PJLmath.sty @@ -0,0 +1,315 @@ +%% +%% This is file `PJLmath.sty', +%% generated with the docstrip utility. + +%% Copyright (C) 2021 by Jinwen XU +%% +%% This is part of the ProjLib Toolkit. +%% +%% This work may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License, either version 1.3c of this license or (at +%% your option) any later version. The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[2020-10-01] +\ProvidesPackage{PJLmath} + [2021/12/16 Useful math macros and shortcuts] +\RequirePackage{kvoptions} +\RequirePackage{etoolbox} +\RequirePackage{mathtools} +\RequirePackage{mathrsfs} +\@ifpackageloaded{unicode-math}{}{\RequirePackage{amssymb}} + +%%================================ +%% Shorthands +%%================================ +\providecommand{\N}{\ensuremath{\mathbb{N}}} +\providecommand{\Z}{\ensuremath{\mathbb{Z}}} +\providecommand{\Q}{\ensuremath{\mathbb{Q}}} +\providecommand{\R}{\ensuremath{\mathbb{R}}} +\providecommand{\C}{\ensuremath{\mathbb{C}}} +\providecommand{\F}{\ensuremath{\mathbb{F}}} +\providecommand{\A}{\ensuremath{\mathbb{A}}} + +\providecommand{\bb}[1]{\ensuremath{\mathbb{#1}}} +\providecommand{\bbA}{\ensuremath{\mathbb{A}}} +\providecommand{\bbB}{\ensuremath{\mathbb{B}}} +\providecommand{\bbC}{\ensuremath{\mathbb{C}}} +\providecommand{\bbD}{\ensuremath{\mathbb{D}}} +\providecommand{\bbE}{\ensuremath{\mathbb{E}}} +\providecommand{\bbF}{\ensuremath{\mathbb{F}}} +\providecommand{\bbG}{\ensuremath{\mathbb{G}}} +\providecommand{\bbH}{\ensuremath{\mathbb{H}}} +\providecommand{\bbI}{\ensuremath{\mathbb{I}}} +\providecommand{\bbJ}{\ensuremath{\mathbb{J}}} +\providecommand{\bbK}{\ensuremath{\mathbb{K}}} +\providecommand{\bbL}{\ensuremath{\mathbb{L}}} +\providecommand{\bbM}{\ensuremath{\mathbb{M}}} +\providecommand{\bbN}{\ensuremath{\mathbb{N}}} +\providecommand{\bbO}{\ensuremath{\mathbb{O}}} +\providecommand{\bbP}{\ensuremath{\mathbb{P}}} +\providecommand{\bbQ}{\ensuremath{\mathbb{Q}}} +\providecommand{\bbR}{\ensuremath{\mathbb{R}}} +\providecommand{\bbS}{\ensuremath{\mathbb{S}}} +\providecommand{\bbT}{\ensuremath{\mathbb{T}}} +\providecommand{\bbU}{\ensuremath{\mathbb{U}}} +\providecommand{\bbV}{\ensuremath{\mathbb{V}}} +\providecommand{\bbW}{\ensuremath{\mathbb{W}}} +\providecommand{\bbX}{\ensuremath{\mathbb{X}}} +\providecommand{\bbY}{\ensuremath{\mathbb{Y}}} +\providecommand{\bbZ}{\ensuremath{\mathbb{Z}}} + +\providecommand{\mc}[1]{\ensuremath{\mathcal{#1}}} +\providecommand{\mcA}{\ensuremath{\mathcal{A}}} +\providecommand{\mcB}{\ensuremath{\mathcal{B}}} +\providecommand{\mcC}{\ensuremath{\mathcal{C}}} +\providecommand{\mcD}{\ensuremath{\mathcal{D}}} +\providecommand{\mcE}{\ensuremath{\mathcal{E}}} +\providecommand{\mcF}{\ensuremath{\mathcal{F}}} +\providecommand{\mcG}{\ensuremath{\mathcal{G}}} +\providecommand{\mcH}{\ensuremath{\mathcal{H}}} +\providecommand{\mcI}{\ensuremath{\mathcal{I}}} +\providecommand{\mcJ}{\ensuremath{\mathcal{J}}} +\providecommand{\mcK}{\ensuremath{\mathcal{K}}} +\providecommand{\mcL}{\ensuremath{\mathcal{L}}} +\providecommand{\mcM}{\ensuremath{\mathcal{M}}} +\providecommand{\mcN}{\ensuremath{\mathcal{N}}} +\providecommand{\mcO}{\ensuremath{\mathcal{O}}} +\providecommand{\mcP}{\ensuremath{\mathcal{P}}} +\providecommand{\mcQ}{\ensuremath{\mathcal{Q}}} +\providecommand{\mcR}{\ensuremath{\mathcal{R}}} +\providecommand{\mcS}{\ensuremath{\mathcal{S}}} +\providecommand{\mcT}{\ensuremath{\mathcal{T}}} +\providecommand{\mcU}{\ensuremath{\mathcal{U}}} +\providecommand{\mcV}{\ensuremath{\mathcal{V}}} +\providecommand{\mcW}{\ensuremath{\mathcal{W}}} +\providecommand{\mcX}{\ensuremath{\mathcal{X}}} +\providecommand{\mcY}{\ensuremath{\mathcal{Y}}} +\providecommand{\mcZ}{\ensuremath{\mathcal{Z}}} + +\providecommand{\cal}[1]{\ensuremath{\mathcal{#1}}} +\providecommand{\calA}{\ensuremath{\mathcal{A}}} +\providecommand{\calB}{\ensuremath{\mathcal{B}}} +\providecommand{\calC}{\ensuremath{\mathcal{C}}} +\providecommand{\calD}{\ensuremath{\mathcal{D}}} +\providecommand{\calE}{\ensuremath{\mathcal{E}}} +\providecommand{\calF}{\ensuremath{\mathcal{F}}} +\providecommand{\calG}{\ensuremath{\mathcal{G}}} +\providecommand{\calH}{\ensuremath{\mathcal{H}}} +\providecommand{\calI}{\ensuremath{\mathcal{I}}} +\providecommand{\calJ}{\ensuremath{\mathcal{J}}} +\providecommand{\calK}{\ensuremath{\mathcal{K}}} +\providecommand{\calL}{\ensuremath{\mathcal{L}}} +\providecommand{\calM}{\ensuremath{\mathcal{M}}} +\providecommand{\calN}{\ensuremath{\mathcal{N}}} +\providecommand{\calO}{\ensuremath{\mathcal{O}}} +\providecommand{\calP}{\ensuremath{\mathcal{P}}} +\providecommand{\calQ}{\ensuremath{\mathcal{Q}}} +\providecommand{\calR}{\ensuremath{\mathcal{R}}} +\providecommand{\calS}{\ensuremath{\mathcal{S}}} +\providecommand{\calT}{\ensuremath{\mathcal{T}}} +\providecommand{\calU}{\ensuremath{\mathcal{U}}} +\providecommand{\calV}{\ensuremath{\mathcal{V}}} +\providecommand{\calW}{\ensuremath{\mathcal{W}}} +\providecommand{\calX}{\ensuremath{\mathcal{X}}} +\providecommand{\calY}{\ensuremath{\mathcal{Y}}} +\providecommand{\calZ}{\ensuremath{\mathcal{Z}}} + +\providecommand{\mf}[1]{\ensuremath{\mathfrak{#1}}} +\providecommand{\mfa}{\ensuremath{\mathfrak{a}}} +\providecommand{\mfb}{\ensuremath{\mathfrak{b}}} +\providecommand{\mfc}{\ensuremath{\mathfrak{c}}} +\providecommand{\mfd}{\ensuremath{\mathfrak{d}}} +\providecommand{\mfe}{\ensuremath{\mathfrak{e}}} +\providecommand{\mff}{\ensuremath{\mathfrak{f}}} +\providecommand{\mfg}{\ensuremath{\mathfrak{g}}} +\providecommand{\mfh}{\ensuremath{\mathfrak{h}}} +\providecommand{\mfi}{\ensuremath{\mathfrak{i}}} +\providecommand{\mfj}{\ensuremath{\mathfrak{j}}} +\providecommand{\mfk}{\ensuremath{\mathfrak{k}}} +\providecommand{\mfl}{\ensuremath{\mathfrak{l}}} +\providecommand{\mfm}{\ensuremath{\mathfrak{m}}} +\providecommand{\mfn}{\ensuremath{\mathfrak{n}}} +\providecommand{\mfo}{\ensuremath{\mathfrak{o}}} +\providecommand{\mfp}{\ensuremath{\mathfrak{p}}} +\providecommand{\mfq}{\ensuremath{\mathfrak{q}}} +\providecommand{\mfr}{\ensuremath{\mathfrak{r}}} +\providecommand{\mfs}{\ensuremath{\mathfrak{s}}} +\providecommand{\mft}{\ensuremath{\mathfrak{t}}} +\providecommand{\mfu}{\ensuremath{\mathfrak{u}}} +\providecommand{\mfv}{\ensuremath{\mathfrak{v}}} +\providecommand{\mfw}{\ensuremath{\mathfrak{w}}} +\providecommand{\mfx}{\ensuremath{\mathfrak{x}}} +\providecommand{\mfy}{\ensuremath{\mathfrak{y}}} +\providecommand{\mfz}{\ensuremath{\mathfrak{z}}} +\providecommand{\mfA}{\ensuremath{\mathfrak{A}}} +\providecommand{\mfB}{\ensuremath{\mathfrak{B}}} +\providecommand{\mfC}{\ensuremath{\mathfrak{C}}} +\providecommand{\mfD}{\ensuremath{\mathfrak{D}}} +\providecommand{\mfE}{\ensuremath{\mathfrak{E}}} +\providecommand{\mfF}{\ensuremath{\mathfrak{F}}} +\providecommand{\mfG}{\ensuremath{\mathfrak{G}}} +\providecommand{\mfH}{\ensuremath{\mathfrak{H}}} +\providecommand{\mfI}{\ensuremath{\mathfrak{I}}} +\providecommand{\mfJ}{\ensuremath{\mathfrak{J}}} +\providecommand{\mfK}{\ensuremath{\mathfrak{K}}} +\providecommand{\mfL}{\ensuremath{\mathfrak{L}}} +\providecommand{\mfM}{\ensuremath{\mathfrak{M}}} +\providecommand{\mfN}{\ensuremath{\mathfrak{N}}} +\providecommand{\mfO}{\ensuremath{\mathfrak{O}}} +\providecommand{\mfP}{\ensuremath{\mathfrak{P}}} +\providecommand{\mfQ}{\ensuremath{\mathfrak{Q}}} +\providecommand{\mfR}{\ensuremath{\mathfrak{R}}} +\providecommand{\mfS}{\ensuremath{\mathfrak{S}}} +\providecommand{\mfT}{\ensuremath{\mathfrak{T}}} +\providecommand{\mfU}{\ensuremath{\mathfrak{U}}} +\providecommand{\mfV}{\ensuremath{\mathfrak{V}}} +\providecommand{\mfW}{\ensuremath{\mathfrak{W}}} +\providecommand{\mfX}{\ensuremath{\mathfrak{X}}} +\providecommand{\mfY}{\ensuremath{\mathfrak{Y}}} +\providecommand{\mfZ}{\ensuremath{\mathfrak{Z}}} + +\providecommand{\frak}[1]{\ensuremath{\mathfrak{#1}}} +\providecommand{\fraka}{\ensuremath{\mathfrak{a}}} +\providecommand{\frakb}{\ensuremath{\mathfrak{b}}} +\providecommand{\frakc}{\ensuremath{\mathfrak{c}}} +\providecommand{\frakd}{\ensuremath{\mathfrak{d}}} +\providecommand{\frake}{\ensuremath{\mathfrak{e}}} +\providecommand{\frakf}{\ensuremath{\mathfrak{f}}} +\providecommand{\frakg}{\ensuremath{\mathfrak{g}}} +\providecommand{\frakh}{\ensuremath{\mathfrak{h}}} +\providecommand{\fraki}{\ensuremath{\mathfrak{i}}} +\providecommand{\frakj}{\ensuremath{\mathfrak{j}}} +\providecommand{\frakk}{\ensuremath{\mathfrak{k}}} +\providecommand{\frakl}{\ensuremath{\mathfrak{l}}} +\providecommand{\frakm}{\ensuremath{\mathfrak{m}}} +\providecommand{\frakn}{\ensuremath{\mathfrak{n}}} +\providecommand{\frako}{\ensuremath{\mathfrak{o}}} +\providecommand{\frakp}{\ensuremath{\mathfrak{p}}} +\providecommand{\frakq}{\ensuremath{\mathfrak{q}}} +\providecommand{\frakr}{\ensuremath{\mathfrak{r}}} +\providecommand{\fraks}{\ensuremath{\mathfrak{s}}} +\providecommand{\frakt}{\ensuremath{\mathfrak{t}}} +\providecommand{\fraku}{\ensuremath{\mathfrak{u}}} +\providecommand{\frakv}{\ensuremath{\mathfrak{v}}} +\providecommand{\frakw}{\ensuremath{\mathfrak{w}}} +\providecommand{\frakx}{\ensuremath{\mathfrak{x}}} +\providecommand{\fraky}{\ensuremath{\mathfrak{y}}} +\providecommand{\frakz}{\ensuremath{\mathfrak{z}}} +\providecommand{\frakA}{\ensuremath{\mathfrak{A}}} +\providecommand{\frakB}{\ensuremath{\mathfrak{B}}} +\providecommand{\frakC}{\ensuremath{\mathfrak{C}}} +\providecommand{\frakD}{\ensuremath{\mathfrak{D}}} +\providecommand{\frakE}{\ensuremath{\mathfrak{E}}} +\providecommand{\frakF}{\ensuremath{\mathfrak{F}}} +\providecommand{\frakG}{\ensuremath{\mathfrak{G}}} +\providecommand{\frakH}{\ensuremath{\mathfrak{H}}} +\providecommand{\frakI}{\ensuremath{\mathfrak{I}}} +\providecommand{\frakJ}{\ensuremath{\mathfrak{J}}} +\providecommand{\frakK}{\ensuremath{\mathfrak{K}}} +\providecommand{\frakL}{\ensuremath{\mathfrak{L}}} +\providecommand{\frakM}{\ensuremath{\mathfrak{M}}} +\providecommand{\frakN}{\ensuremath{\mathfrak{N}}} +\providecommand{\frakO}{\ensuremath{\mathfrak{O}}} +\providecommand{\frakP}{\ensuremath{\mathfrak{P}}} +\providecommand{\frakQ}{\ensuremath{\mathfrak{Q}}} +\providecommand{\frakR}{\ensuremath{\mathfrak{R}}} +\providecommand{\frakS}{\ensuremath{\mathfrak{S}}} +\providecommand{\frakT}{\ensuremath{\mathfrak{T}}} +\providecommand{\frakU}{\ensuremath{\mathfrak{U}}} +\providecommand{\frakV}{\ensuremath{\mathfrak{V}}} +\providecommand{\frakW}{\ensuremath{\mathfrak{W}}} +\providecommand{\frakX}{\ensuremath{\mathfrak{X}}} +\providecommand{\frakY}{\ensuremath{\mathfrak{Y}}} +\providecommand{\frakZ}{\ensuremath{\mathfrak{Z}}} + +\providecommand{\ms}[1]{\ensuremath{\mathscr{#1}}} +\providecommand{\msA}{\ensuremath{\mathscr{A}}} +\providecommand{\msB}{\ensuremath{\mathscr{B}}} +\providecommand{\msC}{\ensuremath{\mathscr{C}}} +\providecommand{\msD}{\ensuremath{\mathscr{D}}} +\providecommand{\msE}{\ensuremath{\mathscr{E}}} +\providecommand{\msF}{\ensuremath{\mathscr{F}}} +\providecommand{\msG}{\ensuremath{\mathscr{G}}} +\providecommand{\msH}{\ensuremath{\mathscr{H}}} +\providecommand{\msI}{\ensuremath{\mathscr{I}}} +\providecommand{\msJ}{\ensuremath{\mathscr{J}}} +\providecommand{\msK}{\ensuremath{\mathscr{K}}} +\providecommand{\msL}{\ensuremath{\mathscr{L}}} +\providecommand{\msM}{\ensuremath{\mathscr{M}}} +\providecommand{\msN}{\ensuremath{\mathscr{N}}} +\providecommand{\msO}{\ensuremath{\mathscr{O}}} +\providecommand{\msP}{\ensuremath{\mathscr{P}}} +\providecommand{\msQ}{\ensuremath{\mathscr{Q}}} +\providecommand{\msR}{\ensuremath{\mathscr{R}}} +\providecommand{\msS}{\ensuremath{\mathscr{S}}} +\providecommand{\msT}{\ensuremath{\mathscr{T}}} +\providecommand{\msU}{\ensuremath{\mathscr{U}}} +\providecommand{\msV}{\ensuremath{\mathscr{V}}} +\providecommand{\msW}{\ensuremath{\mathscr{W}}} +\providecommand{\msX}{\ensuremath{\mathscr{X}}} +\providecommand{\msY}{\ensuremath{\mathscr{Y}}} +\providecommand{\msZ}{\ensuremath{\mathscr{Z}}} + +\providecommand{\scr}[1]{\ensuremath{\mathscr{#1}}} +\providecommand{\scrA}{\ensuremath{\mathscr{A}}} +\providecommand{\scrB}{\ensuremath{\mathscr{B}}} +\providecommand{\scrC}{\ensuremath{\mathscr{C}}} +\providecommand{\scrD}{\ensuremath{\mathscr{D}}} +\providecommand{\scrE}{\ensuremath{\mathscr{E}}} +\providecommand{\scrF}{\ensuremath{\mathscr{F}}} +\providecommand{\scrG}{\ensuremath{\mathscr{G}}} +\providecommand{\scrH}{\ensuremath{\mathscr{H}}} +\providecommand{\scrI}{\ensuremath{\mathscr{I}}} +\providecommand{\scrJ}{\ensuremath{\mathscr{J}}} +\providecommand{\scrK}{\ensuremath{\mathscr{K}}} +\providecommand{\scrL}{\ensuremath{\mathscr{L}}} +\providecommand{\scrM}{\ensuremath{\mathscr{M}}} +\providecommand{\scrN}{\ensuremath{\mathscr{N}}} +\providecommand{\scrO}{\ensuremath{\mathscr{O}}} +\providecommand{\scrP}{\ensuremath{\mathscr{P}}} +\providecommand{\scrQ}{\ensuremath{\mathscr{Q}}} +\providecommand{\scrR}{\ensuremath{\mathscr{R}}} +\providecommand{\scrS}{\ensuremath{\mathscr{S}}} +\providecommand{\scrT}{\ensuremath{\mathscr{T}}} +\providecommand{\scrU}{\ensuremath{\mathscr{U}}} +\providecommand{\scrV}{\ensuremath{\mathscr{V}}} +\providecommand{\scrW}{\ensuremath{\mathscr{W}}} +\providecommand{\scrX}{\ensuremath{\mathscr{X}}} +\providecommand{\scrY}{\ensuremath{\mathscr{Y}}} +\providecommand{\scrZ}{\ensuremath{\mathscr{Z}}} + +%%================================ +%% General symbols +%%================================ +\providecommand{\abs}[1]{\lvert#1\rvert} +\providecommand{\norm}[1]{\lVert#1\rVert} + +\providecommand*{\injection}{\ensuremath{\hookrightarrow}} +\providecommand*{\surjection}{\ensuremath{\twoheadrightarrow}} +\providecommand*{\bijection}{\ensuremath{\xrightarrow{\sim}}} + +%%================================ +%% Symbols for number theory +%%================================ +\ifdefined\@@pmod\else +\let\@@pmod\pmod +\DeclareRobustCommand{\pmod}{\@ifstar\@pmods\@@pmod} +\def\@pmods#1{\mkern4mu({\operator@font mod}\mkern 6mu#1)} +\fi + +\providecommand{\genlegendre}[4]{% + \genfrac{(}{)}{}{#1}{#3}{#4}% + \if\relax\detokenize{#2}\relax\else_{\!#2}\fi% +} +\providecommand{\legendre}[3][]{\genlegendre{}{#1}{#2}{#3}} +\providecommand{\dlegendre}[3][]{\genlegendre{0}{#1}{#2}{#3}} +\providecommand{\tlegendre}[3][]{\genlegendre{1}{#1}{#2}{#3}} + +\endinput +%% +%% End of file `PJLmath.sty'. diff --git a/macros/latex/contrib/projlib/old-modules/PJLpaper.sty b/macros/latex/contrib/projlib/old-modules/PJLpaper.sty new file mode 100644 index 0000000000..4b963c069a --- /dev/null +++ b/macros/latex/contrib/projlib/old-modules/PJLpaper.sty @@ -0,0 +1,96 @@ +%% +%% This is file `PJLpaper.sty', +%% generated with the docstrip utility. + +%% Copyright (C) 2021 by Jinwen XU +%% +%% This is part of the ProjLib Toolkit. +%% +%% This work may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License, either version 1.3c of this license or (at +%% your option) any later version. The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[2020-10-01] +\ProvidesPackage{PJLpaper} + [2021/12/16 Paper style configuration] +\RequirePackage{kvoptions} +\RequirePackage{etoolbox} +\RequirePackage{ifthen} + +\SetupKeyvalOptions{% + family = @PJLpaper, + prefix = @PJLpaper@, + setkeys=\kvsetkeys +} + +\DeclareStringOption[normal]{paperstyle} +\DeclareVoidOption{yellowpaper}{\kvsetkeys{@PJLpaper}{paperstyle=yellow}} +\DeclareVoidOption{darkpaper}{\kvsetkeys{@PJLpaper}{paperstyle=dark}} +\DeclareVoidOption{nordpaper}{\kvsetkeys{@PJLpaper}{paperstyle=nord}} +\DeclareBoolOption[false]{preview} +\ProcessKeyvalOptions*\relax + +%%================================ +%% Preview mode +%%================================ +\ifdefined\PJLnoPreview\else% + \if@PJLpaper@preview% + \RequirePackage{calc} + \AtEndPreamble{% + \setlength{\paperwidth}{\textwidth*\real{1.05}}% + \setlength{\paperheight}{% + (\textheight+\headheight+\headsep+\footskip)*\real{1.05}}% + \setlength{\oddsidemargin}{(\paperwidth-\textwidth)/2-1in}% + \setlength{\evensidemargin}{(\paperwidth-\textwidth)/2-1in}% + \setlength{\topmargin}{(\paperheight-\textheight-\headheight-\headsep-\footskip)/2- 1in}% + } + \fi +\fi + +%%================================ +%% Paper color +%%================================ +\RequirePackage{xcolor} +\definecolor{paper}{RGB}{255,255,255} +\definecolor{maintext}{RGB}{0,0,0} + +\ifthenelse{\equal{\@PJLpaper@paperstyle}{yellow}} +{ + \definecolor{paper}{RGB}{247,246,233} +} +{\relax} + +\ifthenelse{\equal{\@PJLpaper@paperstyle}{dark}} +{ + \definecolor{paper}{RGB}{30,30,30} + \definecolor{maintext}{RGB}{207,207,207} +} +{\relax} + +\ifthenelse{\equal{\@PJLpaper@paperstyle}{nord}} +{ + \definecolor{paper}{RGB}{46,52,64} + \definecolor{maintext}{RGB}{214,220,230} +} +{\relax} + +\newcommand{\PJLglobalcolor}[1]{% + \color{#1}\global\let\default@color\current@color +} + +\pagecolor{paper} +\PJLglobalcolor{maintext} +\AtEndPreamble{ +\ifdefined\tcbset% + \tcbset{colupper=maintext,collower=maintext} +\fi +} + +\endinput +%% +%% End of file `PJLpaper.sty'. diff --git a/macros/latex/contrib/projlib/ProjLib.dtx b/macros/latex/contrib/projlib/old-modules/PJLthm.sty index adfc509e76..4e6d00d4d2 100644 --- a/macros/latex/contrib/projlib/ProjLib.dtx +++ b/macros/latex/contrib/projlib/old-modules/PJLthm.sty @@ -1,1420 +1,40 @@ -% \iffalse meta-comment -% -% Copyright (C) 2021 by Jinwen XU -% ------------------------------- -% -% This file may be distributed and/or modified under the conditions of the LaTeX -% Project Public License, either version 1.3c of this license or (at your option) -% any later version. The latest version of this license is in: -% -% http://www.latex-project.org/lppl.txt -% -% \fi -% -%<*driver> -\ProvidesFile{ProjLib.dtx} -%</driver> +%% +%% This is file `PJLthm.sty', +%% generated with the docstrip utility. + +%% Copyright (C) 2021 by Jinwen XU +%% +%% This is part of the ProjLib Toolkit. +%% +%% This work may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License, either version 1.3c of this license or (at +%% your option) any later version. The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% \NeedsTeXFormat{LaTeX2e}[2020-10-01] -% -%<*ProjLib> -\ProvidesPackage{ProjLib} - [2021/12/16 The collective interface of ProjLib toolkit] -%</ProjLib> -% -%<*PJLauthor> -\ProvidesPackage{PJLauthor} - [2021/12/16 Enhanced author information block] -%</PJLauthor> -% -%<*PJLdate> -\ProvidesPackage{PJLdate} - [2021/12/16 Convert yyyy-mm-dd to normal datetime format] -%</PJLdate> -% -%<*PJLdraft> -\ProvidesPackage{PJLdraft} - [2021/12/16 Some useful macros for the draft stage] -%</PJLdraft> -% -%<*PJLlang> -\ProvidesPackage{PJLlang} - [2021/12/16 Multi-language configuration] -%</PJLlang> -% -%<*PJLlogo> -\ProvidesPackage{PJLlogo} - [2021/12/16 The ProjLib logo] -%</PJLlogo> -% -%<*PJLmath> -\ProvidesPackage{PJLmath} - [2021/12/16 Useful math macros and shortcuts] -%</PJLmath> -% -%<*PJLpaper> -\ProvidesPackage{PJLpaper} - [2021/12/16 Paper style configuration] -%</PJLpaper> -% -%<*PJLthm> \ProvidesPackage{PJLthm} [2021/12/16 Theorem setup and configuration] -%</PJLthm> -% -%# 下面两行引入宏包的代码是所有文件共用的。 -%# The following two lines are common to all files. \RequirePackage{kvoptions} \RequirePackage{etoolbox} -% -%<*PJLauthor> -%# 这段代码定义了宏包中的选项。 -%# This code defines the options in the package. -\SetupKeyvalOptions{ - family = @PJLauthor, - prefix = @PJLauthor@, -} -%# 支持 AMS 风格 -%# Support AMS fashion -\DeclareBoolOption[false]{amsfashion} -%# 处理选项 -%# Process options -\ProcessKeyvalOptions*\relax - -%# 在 AMS 文档类中不执行任何操作 -%# Do nothing if AMS class detected -\ifdefined\subjclass\endinput\fi - -%%================================ -%% Font and style -%%================================ -%# 各个作者信息元素的字体 -%# Font of the elements in the author block -\def\PJLauthor@font@author{\normalsize\normalfont\scshape} -\def\PJLauthor@font@address{\small\normalfont\itshape} -\def\PJLauthor@font@curraddr{\small\normalfont\itshape} -\def\PJLauthor@font@email{\small\normalfont\ttfamily} - -%%================================ -%% Lengths -%%================================ -%# author 和 address 之间的距离 -%# Space between author and address -\newlength{\PJLauthor@length@innersep} -\setlength{\PJLauthor@length@innersep}{.3\baselineskip} -%# 两个作者块之间的距离 -%# Space between different author blocks -\newlength{\PJLauthor@length@sep} -\setlength{\PJLauthor@length@sep}{.5\baselineskip} -%# 作者块和日期之间的距离 -%# Space between affiliation and date -\newlength{\PJLauthor@length@aftersep} -\setlength{\PJLauthor@length@aftersep}{.3\baselineskip} - -%%================================ -%% The macros -%%================================ -%# 用来记录当前是否有附加作者信息,以便调整距离 -%# To record whether there's affiliation so as to adjust the vertical space -\newif\if@PJLauthor@affilon -%# 作者 -%# author -\renewcommand*{\author}[1]{% - \gappto\@author{\phantom{A}\\[-\baselineskip]% - \vspace{\PJLauthor@length@sep}% - \PJLauthor@font@author{#1}\\\phantom{} - \@PJLauthor@affilonfalse}} -%# 地址 -%# address -\providecommand*{\address}[1]{% - \gappto\@author{\phantom{A}\\[-\baselineskip]% - \if@PJLauthor@affilon\else% - \vspace{\PJLauthor@length@innersep}% - \fi% - \@PJLauthor@affilontrue% - \PJLauthor@font@address{#1}\\\phantom{}}% -} -%# 当前地址 -%# curraddr -\providecommand*{\curraddr}[1]{% - \gappto\@author{\phantom{A}\\[-\baselineskip]% - \if@PJLauthor@affilon\else% - \vspace{\PJLauthor@length@innersep}% - \fi% - \@PJLauthor@affilontrue% - \PJLauthor@font@curraddr{#1}\\\phantom{}}% -} -%# 电子邮箱 -%# email -\providecommand*{\email}[1]{% - \gappto\@author{\phantom{A}\\[-\baselineskip]% - \if@PJLauthor@affilon\else% - \vspace{\PJLauthor@length@innersep}% - \fi% - \@PJLauthor@affilontrue% - \PJLauthor@font@email{#1}\\\phantom{}}% -} - -%%================================ -%% Adjustment -%%================================ -%# 去除 maketitle 中默认对 author 的处理 -%# Remove the tabular around \@author in maketitle -\patchcmd{\@maketitle}{\begin{tabular}[t]{c}}{}{}{} -\patchcmd{\@maketitle}{\end{tabular}}{}{}{} -%# 下面这一行是为了避免错误 "No \author given." -%# The follwing line is for avoiding the error "No \author given." -\def\@author{} -%# 修正作者块的前后等距离 -%# Adjust the spacing before and after the author block -\pretocmd{\@maketitle}{% - \pretocmd{\@author}{\vspace{-\PJLauthor@length@sep}}{}{\FAIL}% - \apptocmd{\@author}{% -% Fix the space caused by `\\\phantom{}` - \vspace{-\baselineskip}% - \if@PJLauthor@affilon% - \vspace{\PJLauthor@length@aftersep}% - \fi% - }{}{\FAIL}% -}{}{\FAIL} - -%# 若使用 AMS 风格 -%# If AMS fashion enabled -\ifbool{@PJLauthor@amsfashion}{ - -%# 使用 PJLlang 以支持自动语言转换 -%# Use `PJLlang` to support automatic language conversion -\RequirePackage{PJLlang} -\RequirePackage{calc} - -%# 设定带条件的加粗 -%# Set the conditional bold face -\providecommand{\conditionalbfseries}{\bfseries} - -%# 关键词的标签 -%# keywords' label -\def\keywordsnameEN{\textsc{Key words and phrases}} -\def\keywordsnameFR{\textsc{Mots et phrases clés}} -\def\keywordsnameDE{\textsc{Schlüsselwörter und Phrasen}} -\def\keywordsnameIT{\textsc{Parole e frasi chiave}} -\def\keywordsnamePT{\textsc{Palavras e frases chave}} -\def\keywordsnameBR{\textsc{Palavras e frases chave}} -\def\keywordsnameES{\textsc{Palabras y frases clave}} -\def\keywordsnameCN{关键词} -\def\keywordsnameTC{關鍵詞} -\def\keywordsnameJP{キーワード} -\def\keywordsnameRU{Ключевые слова и фразы} - -%# 关键词 -%# keywords -\def\PJL@keywords{} -\providecommand*{\keywords}[1]{\def\PJL@keywords{#1}} - -%# 献给 -%# dedicatory -\def\PJL@dedicatory{} -\providecommand*{\dedicatory}[1]{\def\PJL@dedicatory{#1}} - -%# 致谢,在 \author 中使用时呈现为 article 风格,在外面单独用是则呈现为 AMS 风格 -%# \thanks: behave like article-style when in \author, and ams-style (no marker) when outside -\AtEndPreamble{ -% In case that \@author changes again -\let\footnotemark@PJLoriginal\footnotemark% -\let\footnotemark\relax% -\let\thanks@PJLoriginal\thanks% -\newlength\PJL@starlength -\setlength{\PJL@starlength}{\widthof{*}} -\newcommand*{\PJL@prethanks}[1]{\thanks@PJLoriginal{\hspace*{-\PJL@starlength}#1}} -% \renewcommand*{\thanks}[1]{% -% \ifx#1\@empty\else% -% \thanks@PJLoriginal{\hspace*{-\PJL@starlength}#1}% -% \fi} -\renewcommand*{\thanks}[1]{% - \ifx#1\@empty\else% - \apptocmd{\@title}{% - \thanks@PJLoriginal{\hspace*{-\PJL@starlength}#1}% - }{}{\FAIL}% - \fi} -\let\author@PJLoriginal\author -\renewcommand{\author}[1]{% - \author@PJLoriginal{% - \let\footnotemark\footnotemark@PJLoriginal% - \let\thanks\thanks@PJLoriginal% - #1% - \let\footnotemark\relax% - }% -} -% \pretocmd{\@author}{\let\footnotemark\footnotemark@PJLoriginal\let\thanks\thanks@PJLoriginal}{}{\FAIL} -% \apptocmd{\@author}{\let\footnotemark\relax}{}{\FAIL} -} - -%# 重定义 abstract 环境以允许其出现在 maketitle 的前面 -%# Modify abstract to allow it before maketitle -\let\abstract@PJLoriginal\abstract% -\let\endabstract@PJLoriginal\endabstract% -\newif\if@PJLauthor@maketitle\@PJLauthor@maketitlefalse -\newif\if@PJLauthor@absbefore\@PJLauthor@absbeforefalse -\RequirePackage{fancyvrb} -% Taken from https://tex.stackexchange.com/a/596328 -% define the same as \protected@write, but with \immediate -\providecommand*\protected@iwrite[3]{% - \begingroup - \let\thepage\relax - #2% - \let\protect\@unexpandable@protect - \edef\reserved@a{\immediate\write#1{#3}}\reserved@a - \endgroup - \if@nobreak\ifvmode\nobreak\fi\fi -} -\patchcmd{\FVB@VerbatimOut} - {\immediate\write\FV@OutFile} - {\protected@iwrite\FV@OutFile{}} - {}{} -% -\renewenvironment{abstract}{% - \VerbatimOut{\jobname.pjlabs}% -}{ - \endVerbatimOut% - \if@PJLauthor@maketitle% - \begin{abstract@PJLoriginal}% - \input{\jobname.pjlabs}% - \end{abstract@PJLoriginal}% - % \ifx\PJL@keywords\@empty\else% - % \par\smallskip\noindent{\conditionalbfseries\csname keywordsname\csname\languagename ABBR\endcsname\endcsname.}~\PJL@keywords% - % \fi% - \else% - \global\@PJLauthor@absbeforetrue% - \fi% -} - -%# 修改 maketitle 以包含上面的诸多改动 -%# Modify maketitle to reflect the modifications above -\AtEndPreamble{% -%## 将 dedicatory 添加进 \@maketitle -%## Add dedicatory to \@maketitle -\patchcmd{\@maketitle}{\@date}{% - \ifx\@date\@empty\vspace{-2\baselineskip}% - \else\@date\fi% - \ifx\PJL@dedicatory\@empty\else% - \ifx\@date\@empty\vspace{2\baselineskip}\fi% - \par\vspace{-\parskip}\bigskip% - {\itshape\PJL@dedicatory}% - \ifx\@date\@empty% - \vspace{-1.7\baselineskip}% - \vspace{-\parskip}% - \fi% - \fi% -}{}{\FAIL} -%## 将 keywords 添加进 \maketitle -%## Add keywords to \maketitle -\pretocmd{\maketitle}{% - \ifx\PJL@keywords\@empty\else% - \PJL@prethanks{{\protect\conditionalbfseries% - \csname keywordsname\csname\languagename ABBR\endcsname\endcsname.}% - ~\PJL@keywords}% - \fi}{}{\FAIL} -%## 将 abstract 添加进 \maketitle -%## Add abstract to \maketitle -\apptocmd{\maketitle}{% - \if@PJLauthor@absbefore% - \begin{abstract@PJLoriginal}% - \input{\jobname.pjlabs}% - % \ifx\PJL@keywords\@empty\else% - % \par\smallskip\noindent{\conditionalbfseries\csname keywordsname\csname\languagename ABBR\endcsname\endcsname.}~\PJL@keywords% - % \fi% - \end{abstract@PJLoriginal}% - \fi% - \global\let\address\relax - \global\let\curraddr\relax - \global\let\email\relax - \global\let\dedicatory\relax - \global\let\keywords\relax - \global\@PJLauthor@maketitletrue -}{}{\FAIL} -%##- 这段未被采用的代码将使 maketitle 中的 \newpage 失效 -%##- Disbale the \newpage in maketitle -% \let\maketitle@PJLoriginal=\maketitle -% \renewcommand*{\maketitle}{{\let\newpage\relax\maketitle@PJLoriginal}} -} - -%# 定义 \subjclass,这段代码改编自 AMS 文档类 -%# Define \subjclass, the code is adopted from AMS classes -\newcommand*\subjclass[2][2020]{% - \def\@subjclass{#2}% - \@ifundefined{subjclassname@#1}{% - \ClassWarning{\@currname}{Unknown edition (#1) of Mathematics - Subject Classification; using '2020'}% - \expandafter\let\expandafter\subjclassname\csname subjclassname@2020\endcsname - }{% - \expandafter\let\expandafter\subjclassname\csname subjclassname@#1\endcsname - }% - \PJL@prethanks{{\itshape\subjclassname.}\enspace\@subjclass{}.} -} -\@namedef{subjclassname@1991}{% - \textup{1991} Mathematics Subject Classification} -\@namedef{subjclassname@2000}{% - \textup{2000} Mathematics Subject Classification} -\@namedef{subjclassname@2010}{% - \textup{2010} Mathematics Subject Classification} -\@namedef{subjclassname@2020}{% - \textup{2020} Mathematics Subject Classification} - -} -%</PJLauthor> -% -%<*PJLdate> -%# 这段代码定义了宏包中的选项。 -%# This code defines the options in the package. -\SetupKeyvalOptions{ - family = @PJLdate, - prefix = @PJLdate@, -} -%# 草稿模式或快速模式 -%# Draft mode or fast mode -\DeclareBoolOption[false]{draft} -\DeclareBoolOption[false]{fast} -%# 处理选项 -%# Process options -\ProcessKeyvalOptions*\relax -%# 下面的代码设定了选项之间的关系 -%# The following code sets the relationship between options -\if@PJLdate@draft - \@PJLdate@fasttrue -\fi -%# 定义 \PJLdate 的同义指令 -%# Define synonym macros of \PJLdate -\DeclareDocumentCommand{\TheDate}{}{\PJLdate} -\DeclareDocumentCommand{\PLdate}{}{\PJLdate} -%# 快速模式下直接输出原日期字符串 -%# Directly output the original date string in fast mode -\if@PJLdate@fast\let\PJLdate\relax\endinput\fi - -%# 载入多语言支持 -%# Load multi-language support -\RequirePackage{PJLlang} - -%# 下面一行是为了避免使用 authblk 时产生的错误 -%# The following line is for "authblk" -\robustify\@latex@warning@no@line - -%# 消除一些警告 -%# Eliminate some warnings -\RequirePackage{silence} -\WarningFilter*{datetime2}{Date-Time Language Module} -%# 分别引入负责西文日期和 CJK 日期的宏包 -%# Use packages resp. for western date and CJK date -\PassOptionsToPackage{fr-FR,en-US}{datetime2} -\RequirePackage{datetime2} -\RequirePackage{zhnumber} - -%# 在 CJK 模式下将 DTMdate 定义为 zhdate -%# Maps DTMdate to zhdate in CJK context -\let\@DTMdate@PJLoriginal\@DTMdate -\gappto{\PJLlang@langconfig@common}{% - \let\@DTMdate\@DTMdate@PJLoriginal% -} -\gappto{\PJLlang@langconfig@CN}{% - \renewcommand*{\@DTMdate}[1]{% - \expandafter\@dtm@parsedate#1\@dtm@endparsedate% - \zhdate{\@dtm@year/\@dtm@month/\@dtm@day}% - }% -} -\gappto{\PJLlang@langconfig@TC}{% - \renewcommand*{\@DTMdate}[1]{% - \expandafter\@dtm@parsedate#1\@dtm@endparsedate% - \zhdate{\@dtm@year/\@dtm@month/\@dtm@day}% - }% -} -\gappto{\PJLlang@langconfig@JP}{% - \renewcommand*{\@DTMdate}[1]{% - \expandafter\@dtm@parsedate#1\@dtm@endparsedate% - \zhdate{\@dtm@year/\@dtm@month/\@dtm@day}% - }% -} - -%# 提供命令 PJLdate -%# Provide the macro PJLdate -\providecommand*{\PJLdate}[1]{\DTMdate{#1}} -%</PJLdate> -% -%<*PJLdraft> -%# 这段代码定义了宏包中的选项。 -%# This code defines the options in the package. -\SetupKeyvalOptions{ - family = @PJLdraft, - prefix = @PJLdraft@, -} -%# 草稿模式或快速模式 -%# Draft mode or fast mode -\DeclareBoolOption[false]{draft} -\DeclareBoolOption[false]{fast} -%# 处理选项 -%# Process options -\ProcessKeyvalOptions*\relax -%# 下面的代码设定了选项之间的关系 -%# The following code sets the relationship between options -\if@PJLdraft@draft - \@PJLdraft@fasttrue -\fi - -%# 载入多语言支持 -%# Load multi-language support -\RequirePackage{PJLlang} -%# 载入颜色支持 -%# Load support for colors -\RequirePackage{xcolor} - -%# 命令中的默认字体 -%# Default font in the macro -\def\dnfFont{\ttfamily} -\def\needgraphFont{\ttfamily} - -%# 命令中的文字 -%# Text in the macro -\def\dnfTextEN{To be finished} -\def\needgraphTextEN{A graph is needed here} -\def\dnfTextFR{Pas encore fini} -\def\needgraphTextFR{Il manque une image ici} -\def\dnfTextDE{Nicht beendet} -\def\needgraphTextDE{Benötigen Sie ein Bild} -\def\dnfTextIT{Per essere finito} -\def\needgraphTextIT{Manca un'immagine qui} -\def\dnfTextPT{Não terminou} -\def\needgraphTextPT{Precisa de uma foto aqui} -\def\dnfTextBR{Não terminou} -\def\needgraphTextBR{Precisa de uma foto aqui} -\def\dnfTextES{Estar terminado} -\def\needgraphTextES{Falta una imagen aquí} -\def\dnfTextCN{这里尚未完成} -\def\needgraphTextCN{这里需要一张图片} -\def\dnfTextTC{這裡尚未完成} -\def\needgraphTextTC{這裡需要一張圖片} -\def\dnfTextJP{終わってない} -\def\needgraphTextJP{まだ画像が必要です} -\def\dnfTextRU{Не закончен} -\def\needgraphTextRU{Еще нужна картинка} - -%# 命令中的颜色 -%# Default color in the macro -\definecolor{dnfColor}{RGB}{21,122,20} -\definecolor{needgraphColor}{RGB}{70,130,180} - -\if@PJLdraft@fast -%# 快速模式用 fbox 定义 -%# Use fbox in fast mode - \newcommand{\plainBox}[2][-paper]{\textcolor{#1}{% - \setlength{\fboxsep}{1.5pt}% - \setlength{\fboxrule}{1.2pt}% - \fbox{#2}}} -\else -%# 正常模式用 tcolorbox 定义 -%# Use tcolorbox in normal mode - \PassOptionsToPackage{many}{tcolorbox} - \RequirePackage{tcolorbox} - \newtcbox{\plainBox}[1][-paper]{enhanced jigsaw,% - on line, arc = 1.2pt, outer arc = 1pt,breakable,% - colframe = #1,colupper=#1,opacityback=0,% - boxsep = 1pt,boxrule = 1.2pt,% - left = 1pt, right = 1pt, top = 0pt, bottom = 0pt,% - } -\fi - -%# 命令中的计数器 -%# Counters for the macro -\newcounter{dnfcnt} -\newcounter{needgraphcnt} - -%# 尚未完成的标记 -%# Mark for ``did not finish'' -\NewDocumentCommand{\dnf}{d<>}{% - \noindent\plainBox[dnfColor]% - {\normalfont\dnfFont\bfseries\small% - \csname dnfText\csname\languagename ABBR\endcsname\endcsname% - \stepcounter{dnfcnt}~\#\thednfcnt% - \IfNoValueF{#1}{\,: #1}}% -} -%# 需要图片的标记 -%# Mark for ``Graph needed'' -\NewDocumentCommand{\needgraph}{d<>}{% - \begin{center}% - \plainBox[needgraphColor]% - {\normalfont\needgraphFont\bfseries\small% - \csname needgraphText\csname\languagename ABBR\endcsname\endcsname% - \stepcounter{needgraphcnt}~\#\theneedgraphcnt% - \IfNoValueF{#1}{\,: #1}}% - \end{center}% -} -%</PJLdraft> -% -%<*PJLlang> -%# 这段代码定义了宏包中的选项。 -%# This code defines the options in the package. -\SetupKeyvalOptions{% - family = @PJLlang, - prefix = @PJLlang@ -} -%# 使用 polyglossia 而不是 babel 进行设置,目前还不完善 -%# Use polyglossia instead of babel -\DeclareBoolOption[false]{polyglossia} - -%# 用于记录该语言是否被启用 -%# To record whether the language is enabled in the document -\newif\if@PJLlang@enable@all\@PJLlang@enable@alltrue -\newif\if@PJLlang@enable@EN\@PJLlang@enable@ENfalse -\newif\if@PJLlang@enable@FR\@PJLlang@enable@FRfalse -\newif\if@PJLlang@enable@DE\@PJLlang@enable@DEfalse -\newif\if@PJLlang@enable@IT\@PJLlang@enable@ITfalse -\newif\if@PJLlang@enable@PT\@PJLlang@enable@PTfalse -\newif\if@PJLlang@enable@BR\@PJLlang@enable@BRfalse -\newif\if@PJLlang@enable@ES\@PJLlang@enable@ESfalse -\newif\if@PJLlang@enable@CN\@PJLlang@enable@CNfalse -\newif\if@PJLlang@enable@TC\@PJLlang@enable@TCfalse -\newif\if@PJLlang@enable@JP\@PJLlang@enable@JPfalse -\newif\if@PJLlang@enable@RU\@PJLlang@enable@RUfalse -%# 用来存储要传递给babel的选项 -%# To store the option list to pass to babel -\def\PJLlang@babeloptions{} -%# 语言选项:启用该语言并添加相应的 babel 参数 -%# The language options: enable the corresponding language and add the corresponding options to babel -\DeclareVoidOption{EN}{\@PJLlang@enable@allfalse\@PJLlang@enable@ENtrue\providecommand{\PJLlang@mainlang}{EN}\gpreto{\PJLlang@babeloptions}{,english}} -\DeclareVoidOption{english}{\@PJLlang@enable@allfalse\@PJLlang@enable@ENtrue\providecommand{\PJLlang@mainlang}{EN}\gpreto{\PJLlang@babeloptions}{,english}} -\DeclareVoidOption{English}{\@PJLlang@enable@allfalse\@PJLlang@enable@ENtrue\providecommand{\PJLlang@mainlang}{EN}\gpreto{\PJLlang@babeloptions}{,english}} -\DeclareVoidOption{FR}{\@PJLlang@enable@allfalse\@PJLlang@enable@FRtrue\providecommand{\PJLlang@mainlang}{FR}\gpreto{\PJLlang@babeloptions}{,french}} -\DeclareVoidOption{french}{\@PJLlang@enable@allfalse\@PJLlang@enable@FRtrue\providecommand{\PJLlang@mainlang}{FR}\gpreto{\PJLlang@babeloptions}{,french}} -\DeclareVoidOption{French}{\@PJLlang@enable@allfalse\@PJLlang@enable@FRtrue\providecommand{\PJLlang@mainlang}{FR}\gpreto{\PJLlang@babeloptions}{,french}} -\DeclareVoidOption{DE}{\@PJLlang@enable@allfalse\@PJLlang@enable@DEtrue\providecommand{\PJLlang@mainlang}{DE}\gpreto{\PJLlang@babeloptions}{,ngerman}} -\DeclareVoidOption{german}{\@PJLlang@enable@allfalse\@PJLlang@enable@DEtrue\providecommand{\PJLlang@mainlang}{DE}\gpreto{\PJLlang@babeloptions}{,ngerman}} -\DeclareVoidOption{ngerman}{\@PJLlang@enable@allfalse\@PJLlang@enable@DEtrue\providecommand{\PJLlang@mainlang}{DE}\gpreto{\PJLlang@babeloptions}{,ngerman}} -\DeclareVoidOption{German}{\@PJLlang@enable@allfalse\@PJLlang@enable@DEtrue\providecommand{\PJLlang@mainlang}{DE}\gpreto{\PJLlang@babeloptions}{,ngerman}} -\DeclareVoidOption{IT}{\@PJLlang@enable@allfalse\@PJLlang@enable@ITtrue\providecommand{\PJLlang@mainlang}{IT}\gpreto{\PJLlang@babeloptions}{,italian}} -\DeclareVoidOption{italian}{\@PJLlang@enable@allfalse\@PJLlang@enable@ITtrue\providecommand{\PJLlang@mainlang}{IT}\gpreto{\PJLlang@babeloptions}{,italian}} -\DeclareVoidOption{Italian}{\@PJLlang@enable@allfalse\@PJLlang@enable@ITtrue\providecommand{\PJLlang@mainlang}{IT}\gpreto{\PJLlang@babeloptions}{,italian}} -\DeclareVoidOption{PT}{\@PJLlang@enable@allfalse\@PJLlang@enable@PTtrue\providecommand{\PJLlang@mainlang}{PT}\gpreto{\PJLlang@babeloptions}{,portuguese}} -\DeclareVoidOption{portuguese}{\@PJLlang@enable@allfalse\@PJLlang@enable@PTtrue\providecommand{\PJLlang@mainlang}{PT}\gpreto{\PJLlang@babeloptions}{,portuguese}} -\DeclareVoidOption{Portuguese}{\@PJLlang@enable@allfalse\@PJLlang@enable@PTtrue\providecommand{\PJLlang@mainlang}{PT}\gpreto{\PJLlang@babeloptions}{,portuguese}} -\DeclareVoidOption{BR}{\@PJLlang@enable@allfalse\@PJLlang@enable@BRtrue\providecommand{\PJLlang@mainlang}{BR}\gpreto{\PJLlang@babeloptions}{,brazilian}} -\DeclareVoidOption{brazilian}{\@PJLlang@enable@allfalse\@PJLlang@enable@BRtrue\providecommand{\PJLlang@mainlang}{BR}\gpreto{\PJLlang@babeloptions}{,brazilian}} -\DeclareVoidOption{Brazilian}{\@PJLlang@enable@allfalse\@PJLlang@enable@BRtrue\providecommand{\PJLlang@mainlang}{BR}\gpreto{\PJLlang@babeloptions}{,brazilian}} -\DeclareVoidOption{ES}{\@PJLlang@enable@allfalse\@PJLlang@enable@EStrue\providecommand{\PJLlang@mainlang}{ES}\gpreto{\PJLlang@babeloptions}{,spanish}} -\DeclareVoidOption{spanish}{\@PJLlang@enable@allfalse\@PJLlang@enable@EStrue\providecommand{\PJLlang@mainlang}{ES}\gpreto{\PJLlang@babeloptions}{,spanish}} -\DeclareVoidOption{Spanish}{\@PJLlang@enable@allfalse\@PJLlang@enable@EStrue\providecommand{\PJLlang@mainlang}{ES}\gpreto{\PJLlang@babeloptions}{,spanish}} -\DeclareVoidOption{CN}{\@PJLlang@enable@allfalse\@PJLlang@enable@CNtrue\providecommand{\PJLlang@mainlang}{CN}} -\DeclareVoidOption{chinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@CNtrue\providecommand{\PJLlang@mainlang}{CN}} -\DeclareVoidOption{Chinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@CNtrue\providecommand{\PJLlang@mainlang}{CN}} -\DeclareVoidOption{schinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@CNtrue\providecommand{\PJLlang@mainlang}{CN}} -\DeclareVoidOption{SChinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@CNtrue\providecommand{\PJLlang@mainlang}{CN}} -\DeclareVoidOption{simplifiedchinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@CNtrue\providecommand{\PJLlang@mainlang}{CN}} -\DeclareVoidOption{SimplifiedChinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@CNtrue\providecommand{\PJLlang@mainlang}{CN}} -\DeclareVoidOption{TC}{\@PJLlang@enable@allfalse\@PJLlang@enable@TCtrue\providecommand{\PJLlang@mainlang}{TC}} -\DeclareVoidOption{tchinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@TCtrue\providecommand{\PJLlang@mainlang}{TC}} -\DeclareVoidOption{TChinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@TCtrue\providecommand{\PJLlang@mainlang}{TC}} -\DeclareVoidOption{traditionalchinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@TCtrue\providecommand{\PJLlang@mainlang}{TC}} -\DeclareVoidOption{TraditionalChinese}{\@PJLlang@enable@allfalse\@PJLlang@enable@TCtrue\providecommand{\PJLlang@mainlang}{TC}} -\DeclareVoidOption{JP}{\@PJLlang@enable@allfalse\@PJLlang@enable@JPtrue\providecommand{\PJLlang@mainlang}{JP}\gpreto{\PJLlang@babeloptions}{,japanese}} -\DeclareVoidOption{japanese}{\@PJLlang@enable@allfalse\@PJLlang@enable@JPtrue\providecommand{\PJLlang@mainlang}{JP}\gpreto{\PJLlang@babeloptions}{,japanese}} -\DeclareVoidOption{Japanese}{\@PJLlang@enable@allfalse\@PJLlang@enable@JPtrue\providecommand{\PJLlang@mainlang}{JP}\gpreto{\PJLlang@babeloptions}{,japanese}} -\DeclareVoidOption{RU}{\@PJLlang@enable@allfalse\@PJLlang@enable@RUtrue\providecommand{\PJLlang@mainlang}{RU}\gpreto{\PJLlang@babeloptions}{,russian}} -\DeclareVoidOption{russian}{\@PJLlang@enable@allfalse\@PJLlang@enable@RUtrue\providecommand{\PJLlang@mainlang}{RU}\gpreto{\PJLlang@babeloptions}{,russian}} -\DeclareVoidOption{Russian}{\@PJLlang@enable@allfalse\@PJLlang@enable@RUtrue\providecommand{\PJLlang@mainlang}{RU}\gpreto{\PJLlang@babeloptions}{,russian}} -%# 处理选项 -%# Process options -\ProcessKeyvalOptions*\relax - -%# 从全局参数中去除 chinese 和 Chinese -%# Remove chinese and Chinese from global options -\ExplSyntaxOn -\cs_new_protected:cpn { @clearglobaloption } #1 - { - \clist_remove_all:cn { @classoptionslist } { #1 } - } -\ExplSyntaxOff - -\@clearglobaloption{chinese} -\@clearglobaloption{Chinese} - -%# 默认语言:英语 -%# Default main language: English -\providecommand{\PJLlang@mainlang}{EN} - -%# 启用全部支持的语言 -%# Enable all supported language -\if@PJLlang@enable@all - \@PJLlang@enable@ENtrue - \@PJLlang@enable@FRtrue - \@PJLlang@enable@DEtrue - \@PJLlang@enable@ITtrue - \@PJLlang@enable@PTtrue - \@PJLlang@enable@BRtrue - \@PJLlang@enable@EStrue - \@PJLlang@enable@CNtrue - \@PJLlang@enable@TCtrue - \@PJLlang@enable@JPtrue - \@PJLlang@enable@RUtrue -\fi - -%# 语言名称的缩写 -%# Abbreviation of language name -\newcommand\englishABBR{EN} -\newcommand\frenchABBR{FR} -\newcommand\ngermanABBR{DE} -\newcommand\italianABBR{IT} -\newcommand\portugueseABBR{PT} -\newcommand\brazilianABBR{BR} -\newcommand\spanishABBR{ES} -\newcommand\schineseABBR{CN} -\newcommand\tchineseABBR{TC} -\newcommand\japaneseABBR{JP} -\newcommand\russianABBR{RU} - -%# 将字符串转换为相应的缩写 -%# Convert a string to the corresponding abbreviation -\ExplSyntaxOn -% See https://tex.stackexchange.com/a/610146 -\NewExpandableDocumentCommand{\StrToABBR}{m} - { - \str_case_e:nn { \str_foldcase:n { #1 } } - { - {cn} {CN} - {chinese} {CN} - {schinese} {CN} - {simplifiedchinese} {CN} - {tc} {TC} - {tchinese} {TC} - {traditionalchinese} {TC} - {jp} {JP} - {japanese} {JP} - {en} {EN} - {english} {EN} - {fr} {FR} - {french} {FR} - {de} {DE} - {ngerman} {DE} - {it} {IT} - {italian} {IT} - {pt} {PT} - {portuguese} {PT} - {br} {BR} - {brazilian} {BR} - {es} {ES} - {spanish} {ES} - {german} {DE} - {ru} {RU} - {russian} {RU} - } - } - -\NewExpandableDocumentCommand{\StrToTYPE}{m} - { - \str_case_e:nn { \str_foldcase:n { #1 } } - { - {cn} {CJK} - {chinese} {CJK} - {schinese} {CJK} - {simplifiedchinese} {CJK} - {tc} {CJK} - {tchinese} {CJK} - {traditionalchinese} {CJK} - {jp} {CJK} - {japanese} {CJK} - {en} {Latin} - {english} {Latin} - {fr} {Latin} - {french} {Latin} - {de} {Latin} - {ngerman} {Latin} - {it} {Latin} - {italian} {Latin} - {pt} {Latin} - {portuguese} {Latin} - {br} {Latin} - {brazilian} {Latin} - {es} {Latin} - {spanish} {Latin} - {german} {Latin} - {ru} {Latin} - {russian} {Latin} - } - } -\ExplSyntaxOff - -%# 在 pdfLaTeX 编译时载入编码设置 -%# Load the encoding settings when pdfLaTeX is used -\RequirePackage{iftex} -\ifPDFTeX -\RequirePackage[T1]{fontenc} -\RequirePackage{inputenc} -\fi - -\if@PJLlang@polyglossia -%# polyglossia 对应的设置 -%# Configure with `polyglossia` - \RequirePackage{polyglossia} - \setdefaultlanguage{english} - \setotherlanguage[frenchpart=false]{french} - \setotherlanguage{ngerman} - \setotherlanguage{spanish} - \setotherlanguage{portuguese} - \setotherlanguage[variant=brazilian]{portuguese} - \setotherlanguage{italian} - \ifPDFTeX\else - \setotherlanguage{russian} - \setotherlanguage{japanese} - \RequirePackage{silence} - \WarningFilter{polyglossia}{Asking to add empty feature to latin font(Script="CJK" to scripttag "")} - \fi -\else -%# babel 对应的设置 -%# Configure with `babel` - \if@PJLlang@enable@all - \ifPDFTeX\else - \PassOptionsToPackage{japanese,russian}{babel} - \fi - \PassOptionsToPackage{italian,portuguese,brazilian,spanish,es-notilde,es-noquoting,ngerman,french,english,shorthands=off}{babel} - \else - \PassOptionsToPackage{\PJLlang@babeloptions}{babel} - \fi - \PassOptionsToPackage{italian,brazilian,spanish,ngerman,french,english}{cleveref} - \RequirePackage{babel} - \if@PJLlang@enable@FR - \frenchsetup{PartNameFull=false} - \fi - \if@PJLlang@enable@PT - \let\PJL@babelord\ord - \let\ord\relax - \AtBeginDocument{ - \@ifundefined{ord}{} - { - \let\PJL@userord\ord - \let\ord\relax - \newcommand{\ord}{% - \ifmmode\expandafter\PJL@userord\else\expandafter\PJL@babelord\fi% - } - } - } - \fi - - \babelprovide{schinese} - \babelprovide{tchinese} -\fi - -%# 本地化 \today -%# Localize \today -\let\today@PJLoriginal\today -\newcommand{\PJLlang@langconfig@common}{% - \ifdefined\DTMtoday% - \let\today\DTMtoday% - \else% - \let\today\today@PJLoriginal% - \fi% -} - -%# 各个语言的设置 -%# The configuration for each language -\newcommand{\PJLlang@langconfig@CN}{% - \def\abstractname{摘要}% - \def\proofname{证明}% - \def\contentsname{目录}% - \def\listfigurename{插图}% - \def\listtablename{表格}% - \def\figurename{图}% - \def\tablename{表}% - \def\indexname{索引}% - \def\appendixname{附录}% - \def\refname{参考文献}% - \def\bibname{参考文献}% - \let\today\zhtoday% - \renewcommand{\languagename}{schinese}% -} -\newcommand{\PJLlang@langconfig@TC}{% - \def\abstractname{摘要}% - \def\proofname{證明}% - \def\contentsname{目錄}% - \def\listfigurename{插圖}% - \def\listtablename{表格}% - \def\figurename{圖}% - \def\tablename{表}% - \def\indexname{索引}% - \def\appendixname{附錄}% - \def\refname{參考文獻}% - \def\bibname{參考文獻}% - \let\today\zhtoday% - \renewcommand{\languagename}{tchinese}% -} -\newcommand{\PJLlang@langconfig@JP}{% - \selectlanguage{japanese}% -} -\newcommand{\PJLlang@langconfig@EN}{% - \selectlanguage{english}% -} -\newcommand{\PJLlang@langconfig@FR}{% - \selectlanguage{french}% -% The line below is currently only needed for 'babel', but also works with 'polyglossia' - \def\frenchpartname{Partie}% -} -\newcommand{\PJLlang@langconfig@DE}{% - \selectlanguage{ngerman}% -} -\newcommand{\PJLlang@langconfig@IT}{% - \selectlanguage{italian}% -} -\newcommand{\PJLlang@langconfig@PT}{% - \selectlanguage{portuguese}% -} -\newcommand{\PJLlang@langconfig@BR}{% - \selectlanguage{brazilian}% -} -\newcommand{\PJLlang@langconfig@ES}{% - \selectlanguage{spanish}% -} -\newcommand{\PJLlang@langconfig@RU}{% - \selectlanguage{russian}% -} - -%# 用于增加语言设置的用户指令 AddLanguageSetting -%# User command for adding language settings -\NewDocumentCommand\AddLanguageSetting{d()m}{% -\IfNoValueTF{#1}% - {\gappto{\PJLlang@langconfig@common}{#2}}% - {\expandafter\gappto\expandafter{\csname PJLlang@langconfig@\StrToABBR{#1}\endcsname}{#2}}% -} - -\RequirePackage{setspace} -%# 行距的设置 -%# Line spacing configuration -\def\PJL@config@linespacing{\setstretch{1.00}} -\def\PJL@config@CJKlinespacing{\onehalfspacing} -\newcommand{\PJLsetlinespacing}[1]{\renewcommand{\PJL@config@linespacing}{#1}} -\newcommand{\PJLsetCJKlinespacing}[1]{\renewcommand{\PJL@config@CJKlinespacing}{#1}} -%# 缩进的设置 -%# Parindent configuration -\@ifclassloaded{beamer}{ - \def\PJL@config@parindent{\ltx@ifpackageloaded{parskip}{}{\setlength{\parindent}{0em}}} - \def\PJL@config@CJKparindent{\ltx@ifpackageloaded{parskip}{}{\setlength{\parindent}{0em}}} -}{ - \def\PJL@config@parindent{\ltx@ifpackageloaded{parskip}{}{\setlength{\parindent}{1.5em}}} - \def\PJL@config@CJKparindent{\ltx@ifpackageloaded{parskip}{}{\setlength{\parindent}{2em}}} -} -\newcommand{\PJLsetparindent}[1]{\renewcommand{\PJL@config@parindent}{\ltx@ifpackageloaded{parskip}{}{\setlength{\parindent}{#1}}}} -\newcommand{\PJLsetCJKparindent}[1]{\renewcommand{\PJL@config@CJKparindent}{\ltx@ifpackageloaded{parskip}{}{\setlength{\parindent}{#1}}}} -%# 合并设置 -%# All-in-all configuration -\def\PJL@config@CJK{\PJL@config@CJKlinespacing\PJL@config@CJKparindent} -\def\PJL@config@Latin{\PJL@config@linespacing\PJL@config@parindent} -% -%# UseLanguage 的核心部分,只能在正文中使用 -%# The core part of UseLanguage, can be used only in the main text, not preamble -\NewDocumentCommand{\UseLanguageCORE}{m}{% - \PJLlang@langconfig@common% - \csname PJL@config@\StrToTYPE{#1}\endcsname% - \csname PJLlang@langconfig@\StrToABBR{#1}\endcsname% -} -%# 用于选定语言的 UseLanguage -%# Macro for selecting language -\NewDocumentCommand{\UseLanguage}{m}{% - \ifx\@onlypreamble\@notprerr% - \UseLanguageCORE{#1}% - \else% - \AfterEndPreamble{\UseLanguageCORE{#1}}% - \fi% -} -%# 用于局部选定语言的 UseOtherLanguage -%# Macro for selecting language locally -\NewDocumentCommand{\UseOtherLanguage}{mm}{% -\begingroup\begingroup% - \PJLlang@langconfig@common% - \csname PJLlang@langconfig@\StrToABBR{#1}\endcsname% - #2% -\endgroup\endgroup% -} - -%# 运行默认语言的设置 -%# Execute the configuration of the main language -\expandafter\UseLanguage\expandafter{\PJLlang@mainlang} -%</PJLlang> -% -%<*PJLlogo> -%# 这段代码定义了宏包中的选项。 -%# This code defines the options in the package. -\SetupKeyvalOptions{ - family = @PJLlogo, - prefix = @PJLlogo@, -} -%# 草稿模式或快速模式 -%# Draft mode or fast mode -\DeclareBoolOption[false]{draft} -\DeclareBoolOption[false]{fast} -%# 处理选项 -%# Process options -\ProcessKeyvalOptions*\relax -%# 下面的代码设定了选项之间的关系 -%# The following code sets the relationship between options -\if@PJLlogo@draft - \@PJLlogo@fasttrue -\fi -%# 快速模式下直接输出字符串 ProjLib -%# Directly output the string ``ProjLib'' in fast mode -\if@PJLlogo@fast\def\ProjLib{{\normalfont ProjLib}}\endinput\fi - -%# 以下选取字体并定义 Logo -%# Below select the font and define the logo -\RequirePackage{xcolor} -\RequirePackage{graphicx} -\ifdefined\fontspec - \newfontface{\PJLlogo@font}{LinBiolinum_R.otf} -\else - \RequirePackage[T1]{fontenc} - \newcommand{\PJLlogo@font}{\fontfamily{LinuxBiolinumT-TLF}\selectfont} -\fi - -\newcommand{\PJLSigmaJ}{% - \vbox{\offinterlineskip - \ialign{% - \hfil##\hfil\cr - \hidewidth\hskip0.15ex\scalebox{0.4}{\rotatebox{-10}{\usefont{U}{zeur}{b}{n}\symbol{"06}}}\hidewidth\cr - \noalign{\kern0.15ex} - \j\cr - }% - }% -} - -\newcommand{\ProjLib@generic}[1]{% - \begingroup - \normalfont\PJLlogo@font - \textcolor{blue!60!cyan}{P}% - \textcolor{blue!45!cyan}{r}% - \textcolor{blue!30!cyan}{o}% - \textcolor{green!70!black}{#1}% - \textcolor{red!20!yellow}{L}% - \textcolor{red!40!yellow}{i}% - \textcolor{red!60!yellow}{b}% - \endgroup -} -\DeclareRobustCommand*{\ProjLib}{\ProjLib@generic{\PJLSigmaJ}} -\DeclareRobustCommand*{\ProjLibText}{\ProjLib@generic{j}} -%</PJLlogo> -% -%<*PJLmath> -%# 载入常用数学宏包 -%# Load commonly used math packages -\RequirePackage{mathtools} -\RequirePackage{mathrsfs} -\@ifpackageloaded{unicode-math}{}{\RequirePackage{amssymb}} - -%%================================ -%% Shorthands -%%================================ -%# 常见代数结构的捷径 -%# Shortcuts for commonly used algebraic structures -\providecommand{\N}{\ensuremath{\mathbb{N}}} -\providecommand{\Z}{\ensuremath{\mathbb{Z}}} -\providecommand{\Q}{\ensuremath{\mathbb{Q}}} -\providecommand{\R}{\ensuremath{\mathbb{R}}} -\providecommand{\C}{\ensuremath{\mathbb{C}}} -\providecommand{\F}{\ensuremath{\mathbb{F}}} -\providecommand{\A}{\ensuremath{\mathbb{A}}} - -%# mathbb 的捷径 -%# Shortcuts for blackboard bold face -\providecommand{\bb}[1]{\ensuremath{\mathbb{#1}}} -\providecommand{\bbA}{\ensuremath{\mathbb{A}}} -\providecommand{\bbB}{\ensuremath{\mathbb{B}}} -\providecommand{\bbC}{\ensuremath{\mathbb{C}}} -\providecommand{\bbD}{\ensuremath{\mathbb{D}}} -\providecommand{\bbE}{\ensuremath{\mathbb{E}}} -\providecommand{\bbF}{\ensuremath{\mathbb{F}}} -\providecommand{\bbG}{\ensuremath{\mathbb{G}}} -\providecommand{\bbH}{\ensuremath{\mathbb{H}}} -\providecommand{\bbI}{\ensuremath{\mathbb{I}}} -\providecommand{\bbJ}{\ensuremath{\mathbb{J}}} -\providecommand{\bbK}{\ensuremath{\mathbb{K}}} -\providecommand{\bbL}{\ensuremath{\mathbb{L}}} -\providecommand{\bbM}{\ensuremath{\mathbb{M}}} -\providecommand{\bbN}{\ensuremath{\mathbb{N}}} -\providecommand{\bbO}{\ensuremath{\mathbb{O}}} -\providecommand{\bbP}{\ensuremath{\mathbb{P}}} -\providecommand{\bbQ}{\ensuremath{\mathbb{Q}}} -\providecommand{\bbR}{\ensuremath{\mathbb{R}}} -\providecommand{\bbS}{\ensuremath{\mathbb{S}}} -\providecommand{\bbT}{\ensuremath{\mathbb{T}}} -\providecommand{\bbU}{\ensuremath{\mathbb{U}}} -\providecommand{\bbV}{\ensuremath{\mathbb{V}}} -\providecommand{\bbW}{\ensuremath{\mathbb{W}}} -\providecommand{\bbX}{\ensuremath{\mathbb{X}}} -\providecommand{\bbY}{\ensuremath{\mathbb{Y}}} -\providecommand{\bbZ}{\ensuremath{\mathbb{Z}}} - -%# mathcal 的捷径 -%# Shortcuts for calligraphic shape -\providecommand{\mc}[1]{\ensuremath{\mathcal{#1}}} -\providecommand{\mcA}{\ensuremath{\mathcal{A}}} -\providecommand{\mcB}{\ensuremath{\mathcal{B}}} -\providecommand{\mcC}{\ensuremath{\mathcal{C}}} -\providecommand{\mcD}{\ensuremath{\mathcal{D}}} -\providecommand{\mcE}{\ensuremath{\mathcal{E}}} -\providecommand{\mcF}{\ensuremath{\mathcal{F}}} -\providecommand{\mcG}{\ensuremath{\mathcal{G}}} -\providecommand{\mcH}{\ensuremath{\mathcal{H}}} -\providecommand{\mcI}{\ensuremath{\mathcal{I}}} -\providecommand{\mcJ}{\ensuremath{\mathcal{J}}} -\providecommand{\mcK}{\ensuremath{\mathcal{K}}} -\providecommand{\mcL}{\ensuremath{\mathcal{L}}} -\providecommand{\mcM}{\ensuremath{\mathcal{M}}} -\providecommand{\mcN}{\ensuremath{\mathcal{N}}} -\providecommand{\mcO}{\ensuremath{\mathcal{O}}} -\providecommand{\mcP}{\ensuremath{\mathcal{P}}} -\providecommand{\mcQ}{\ensuremath{\mathcal{Q}}} -\providecommand{\mcR}{\ensuremath{\mathcal{R}}} -\providecommand{\mcS}{\ensuremath{\mathcal{S}}} -\providecommand{\mcT}{\ensuremath{\mathcal{T}}} -\providecommand{\mcU}{\ensuremath{\mathcal{U}}} -\providecommand{\mcV}{\ensuremath{\mathcal{V}}} -\providecommand{\mcW}{\ensuremath{\mathcal{W}}} -\providecommand{\mcX}{\ensuremath{\mathcal{X}}} -\providecommand{\mcY}{\ensuremath{\mathcal{Y}}} -\providecommand{\mcZ}{\ensuremath{\mathcal{Z}}} - -\providecommand{\cal}[1]{\ensuremath{\mathcal{#1}}} -\providecommand{\calA}{\ensuremath{\mathcal{A}}} -\providecommand{\calB}{\ensuremath{\mathcal{B}}} -\providecommand{\calC}{\ensuremath{\mathcal{C}}} -\providecommand{\calD}{\ensuremath{\mathcal{D}}} -\providecommand{\calE}{\ensuremath{\mathcal{E}}} -\providecommand{\calF}{\ensuremath{\mathcal{F}}} -\providecommand{\calG}{\ensuremath{\mathcal{G}}} -\providecommand{\calH}{\ensuremath{\mathcal{H}}} -\providecommand{\calI}{\ensuremath{\mathcal{I}}} -\providecommand{\calJ}{\ensuremath{\mathcal{J}}} -\providecommand{\calK}{\ensuremath{\mathcal{K}}} -\providecommand{\calL}{\ensuremath{\mathcal{L}}} -\providecommand{\calM}{\ensuremath{\mathcal{M}}} -\providecommand{\calN}{\ensuremath{\mathcal{N}}} -\providecommand{\calO}{\ensuremath{\mathcal{O}}} -\providecommand{\calP}{\ensuremath{\mathcal{P}}} -\providecommand{\calQ}{\ensuremath{\mathcal{Q}}} -\providecommand{\calR}{\ensuremath{\mathcal{R}}} -\providecommand{\calS}{\ensuremath{\mathcal{S}}} -\providecommand{\calT}{\ensuremath{\mathcal{T}}} -\providecommand{\calU}{\ensuremath{\mathcal{U}}} -\providecommand{\calV}{\ensuremath{\mathcal{V}}} -\providecommand{\calW}{\ensuremath{\mathcal{W}}} -\providecommand{\calX}{\ensuremath{\mathcal{X}}} -\providecommand{\calY}{\ensuremath{\mathcal{Y}}} -\providecommand{\calZ}{\ensuremath{\mathcal{Z}}} - -%# mathfrak 的捷径 -%# Shortcuts for Fraktur shape -\providecommand{\mf}[1]{\ensuremath{\mathfrak{#1}}} -\providecommand{\mfa}{\ensuremath{\mathfrak{a}}} -\providecommand{\mfb}{\ensuremath{\mathfrak{b}}} -\providecommand{\mfc}{\ensuremath{\mathfrak{c}}} -\providecommand{\mfd}{\ensuremath{\mathfrak{d}}} -\providecommand{\mfe}{\ensuremath{\mathfrak{e}}} -\providecommand{\mff}{\ensuremath{\mathfrak{f}}} -\providecommand{\mfg}{\ensuremath{\mathfrak{g}}} -\providecommand{\mfh}{\ensuremath{\mathfrak{h}}} -\providecommand{\mfi}{\ensuremath{\mathfrak{i}}} -\providecommand{\mfj}{\ensuremath{\mathfrak{j}}} -\providecommand{\mfk}{\ensuremath{\mathfrak{k}}} -\providecommand{\mfl}{\ensuremath{\mathfrak{l}}} -\providecommand{\mfm}{\ensuremath{\mathfrak{m}}} -\providecommand{\mfn}{\ensuremath{\mathfrak{n}}} -\providecommand{\mfo}{\ensuremath{\mathfrak{o}}} -\providecommand{\mfp}{\ensuremath{\mathfrak{p}}} -\providecommand{\mfq}{\ensuremath{\mathfrak{q}}} -\providecommand{\mfr}{\ensuremath{\mathfrak{r}}} -\providecommand{\mfs}{\ensuremath{\mathfrak{s}}} -\providecommand{\mft}{\ensuremath{\mathfrak{t}}} -\providecommand{\mfu}{\ensuremath{\mathfrak{u}}} -\providecommand{\mfv}{\ensuremath{\mathfrak{v}}} -\providecommand{\mfw}{\ensuremath{\mathfrak{w}}} -\providecommand{\mfx}{\ensuremath{\mathfrak{x}}} -\providecommand{\mfy}{\ensuremath{\mathfrak{y}}} -\providecommand{\mfz}{\ensuremath{\mathfrak{z}}} -\providecommand{\mfA}{\ensuremath{\mathfrak{A}}} -\providecommand{\mfB}{\ensuremath{\mathfrak{B}}} -\providecommand{\mfC}{\ensuremath{\mathfrak{C}}} -\providecommand{\mfD}{\ensuremath{\mathfrak{D}}} -\providecommand{\mfE}{\ensuremath{\mathfrak{E}}} -\providecommand{\mfF}{\ensuremath{\mathfrak{F}}} -\providecommand{\mfG}{\ensuremath{\mathfrak{G}}} -\providecommand{\mfH}{\ensuremath{\mathfrak{H}}} -\providecommand{\mfI}{\ensuremath{\mathfrak{I}}} -\providecommand{\mfJ}{\ensuremath{\mathfrak{J}}} -\providecommand{\mfK}{\ensuremath{\mathfrak{K}}} -\providecommand{\mfL}{\ensuremath{\mathfrak{L}}} -\providecommand{\mfM}{\ensuremath{\mathfrak{M}}} -\providecommand{\mfN}{\ensuremath{\mathfrak{N}}} -\providecommand{\mfO}{\ensuremath{\mathfrak{O}}} -\providecommand{\mfP}{\ensuremath{\mathfrak{P}}} -\providecommand{\mfQ}{\ensuremath{\mathfrak{Q}}} -\providecommand{\mfR}{\ensuremath{\mathfrak{R}}} -\providecommand{\mfS}{\ensuremath{\mathfrak{S}}} -\providecommand{\mfT}{\ensuremath{\mathfrak{T}}} -\providecommand{\mfU}{\ensuremath{\mathfrak{U}}} -\providecommand{\mfV}{\ensuremath{\mathfrak{V}}} -\providecommand{\mfW}{\ensuremath{\mathfrak{W}}} -\providecommand{\mfX}{\ensuremath{\mathfrak{X}}} -\providecommand{\mfY}{\ensuremath{\mathfrak{Y}}} -\providecommand{\mfZ}{\ensuremath{\mathfrak{Z}}} - -\providecommand{\frak}[1]{\ensuremath{\mathfrak{#1}}} -\providecommand{\fraka}{\ensuremath{\mathfrak{a}}} -\providecommand{\frakb}{\ensuremath{\mathfrak{b}}} -\providecommand{\frakc}{\ensuremath{\mathfrak{c}}} -\providecommand{\frakd}{\ensuremath{\mathfrak{d}}} -\providecommand{\frake}{\ensuremath{\mathfrak{e}}} -\providecommand{\frakf}{\ensuremath{\mathfrak{f}}} -\providecommand{\frakg}{\ensuremath{\mathfrak{g}}} -\providecommand{\frakh}{\ensuremath{\mathfrak{h}}} -\providecommand{\fraki}{\ensuremath{\mathfrak{i}}} -\providecommand{\frakj}{\ensuremath{\mathfrak{j}}} -\providecommand{\frakk}{\ensuremath{\mathfrak{k}}} -\providecommand{\frakl}{\ensuremath{\mathfrak{l}}} -\providecommand{\frakm}{\ensuremath{\mathfrak{m}}} -\providecommand{\frakn}{\ensuremath{\mathfrak{n}}} -\providecommand{\frako}{\ensuremath{\mathfrak{o}}} -\providecommand{\frakp}{\ensuremath{\mathfrak{p}}} -\providecommand{\frakq}{\ensuremath{\mathfrak{q}}} -\providecommand{\frakr}{\ensuremath{\mathfrak{r}}} -\providecommand{\fraks}{\ensuremath{\mathfrak{s}}} -\providecommand{\frakt}{\ensuremath{\mathfrak{t}}} -\providecommand{\fraku}{\ensuremath{\mathfrak{u}}} -\providecommand{\frakv}{\ensuremath{\mathfrak{v}}} -\providecommand{\frakw}{\ensuremath{\mathfrak{w}}} -\providecommand{\frakx}{\ensuremath{\mathfrak{x}}} -\providecommand{\fraky}{\ensuremath{\mathfrak{y}}} -\providecommand{\frakz}{\ensuremath{\mathfrak{z}}} -\providecommand{\frakA}{\ensuremath{\mathfrak{A}}} -\providecommand{\frakB}{\ensuremath{\mathfrak{B}}} -\providecommand{\frakC}{\ensuremath{\mathfrak{C}}} -\providecommand{\frakD}{\ensuremath{\mathfrak{D}}} -\providecommand{\frakE}{\ensuremath{\mathfrak{E}}} -\providecommand{\frakF}{\ensuremath{\mathfrak{F}}} -\providecommand{\frakG}{\ensuremath{\mathfrak{G}}} -\providecommand{\frakH}{\ensuremath{\mathfrak{H}}} -\providecommand{\frakI}{\ensuremath{\mathfrak{I}}} -\providecommand{\frakJ}{\ensuremath{\mathfrak{J}}} -\providecommand{\frakK}{\ensuremath{\mathfrak{K}}} -\providecommand{\frakL}{\ensuremath{\mathfrak{L}}} -\providecommand{\frakM}{\ensuremath{\mathfrak{M}}} -\providecommand{\frakN}{\ensuremath{\mathfrak{N}}} -\providecommand{\frakO}{\ensuremath{\mathfrak{O}}} -\providecommand{\frakP}{\ensuremath{\mathfrak{P}}} -\providecommand{\frakQ}{\ensuremath{\mathfrak{Q}}} -\providecommand{\frakR}{\ensuremath{\mathfrak{R}}} -\providecommand{\frakS}{\ensuremath{\mathfrak{S}}} -\providecommand{\frakT}{\ensuremath{\mathfrak{T}}} -\providecommand{\frakU}{\ensuremath{\mathfrak{U}}} -\providecommand{\frakV}{\ensuremath{\mathfrak{V}}} -\providecommand{\frakW}{\ensuremath{\mathfrak{W}}} -\providecommand{\frakX}{\ensuremath{\mathfrak{X}}} -\providecommand{\frakY}{\ensuremath{\mathfrak{Y}}} -\providecommand{\frakZ}{\ensuremath{\mathfrak{Z}}} - -%# mathscr 的捷径 -%# Shortcuts for script shape -\providecommand{\ms}[1]{\ensuremath{\mathscr{#1}}} -\providecommand{\msA}{\ensuremath{\mathscr{A}}} -\providecommand{\msB}{\ensuremath{\mathscr{B}}} -\providecommand{\msC}{\ensuremath{\mathscr{C}}} -\providecommand{\msD}{\ensuremath{\mathscr{D}}} -\providecommand{\msE}{\ensuremath{\mathscr{E}}} -\providecommand{\msF}{\ensuremath{\mathscr{F}}} -\providecommand{\msG}{\ensuremath{\mathscr{G}}} -\providecommand{\msH}{\ensuremath{\mathscr{H}}} -\providecommand{\msI}{\ensuremath{\mathscr{I}}} -\providecommand{\msJ}{\ensuremath{\mathscr{J}}} -\providecommand{\msK}{\ensuremath{\mathscr{K}}} -\providecommand{\msL}{\ensuremath{\mathscr{L}}} -\providecommand{\msM}{\ensuremath{\mathscr{M}}} -\providecommand{\msN}{\ensuremath{\mathscr{N}}} -\providecommand{\msO}{\ensuremath{\mathscr{O}}} -\providecommand{\msP}{\ensuremath{\mathscr{P}}} -\providecommand{\msQ}{\ensuremath{\mathscr{Q}}} -\providecommand{\msR}{\ensuremath{\mathscr{R}}} -\providecommand{\msS}{\ensuremath{\mathscr{S}}} -\providecommand{\msT}{\ensuremath{\mathscr{T}}} -\providecommand{\msU}{\ensuremath{\mathscr{U}}} -\providecommand{\msV}{\ensuremath{\mathscr{V}}} -\providecommand{\msW}{\ensuremath{\mathscr{W}}} -\providecommand{\msX}{\ensuremath{\mathscr{X}}} -\providecommand{\msY}{\ensuremath{\mathscr{Y}}} -\providecommand{\msZ}{\ensuremath{\mathscr{Z}}} - -\providecommand{\scr}[1]{\ensuremath{\mathscr{#1}}} -\providecommand{\scrA}{\ensuremath{\mathscr{A}}} -\providecommand{\scrB}{\ensuremath{\mathscr{B}}} -\providecommand{\scrC}{\ensuremath{\mathscr{C}}} -\providecommand{\scrD}{\ensuremath{\mathscr{D}}} -\providecommand{\scrE}{\ensuremath{\mathscr{E}}} -\providecommand{\scrF}{\ensuremath{\mathscr{F}}} -\providecommand{\scrG}{\ensuremath{\mathscr{G}}} -\providecommand{\scrH}{\ensuremath{\mathscr{H}}} -\providecommand{\scrI}{\ensuremath{\mathscr{I}}} -\providecommand{\scrJ}{\ensuremath{\mathscr{J}}} -\providecommand{\scrK}{\ensuremath{\mathscr{K}}} -\providecommand{\scrL}{\ensuremath{\mathscr{L}}} -\providecommand{\scrM}{\ensuremath{\mathscr{M}}} -\providecommand{\scrN}{\ensuremath{\mathscr{N}}} -\providecommand{\scrO}{\ensuremath{\mathscr{O}}} -\providecommand{\scrP}{\ensuremath{\mathscr{P}}} -\providecommand{\scrQ}{\ensuremath{\mathscr{Q}}} -\providecommand{\scrR}{\ensuremath{\mathscr{R}}} -\providecommand{\scrS}{\ensuremath{\mathscr{S}}} -\providecommand{\scrT}{\ensuremath{\mathscr{T}}} -\providecommand{\scrU}{\ensuremath{\mathscr{U}}} -\providecommand{\scrV}{\ensuremath{\mathscr{V}}} -\providecommand{\scrW}{\ensuremath{\mathscr{W}}} -\providecommand{\scrX}{\ensuremath{\mathscr{X}}} -\providecommand{\scrY}{\ensuremath{\mathscr{Y}}} -\providecommand{\scrZ}{\ensuremath{\mathscr{Z}}} - -%%================================ -%% General symbols -%%================================ -\providecommand{\abs}[1]{\lvert#1\rvert} -\providecommand{\norm}[1]{\lVert#1\rVert} - -\providecommand*{\injection}{\ensuremath{\hookrightarrow}} -\providecommand*{\surjection}{\ensuremath{\twoheadrightarrow}} -\providecommand*{\bijection}{\ensuremath{\xrightarrow{\sim}}} - -%%================================ -%% Symbols for number theory -%%================================ -\ifdefined\@@pmod\else -\let\@@pmod\pmod -\DeclareRobustCommand{\pmod}{\@ifstar\@pmods\@@pmod} -\def\@pmods#1{\mkern4mu({\operator@font mod}\mkern 6mu#1)} -\fi - -\providecommand{\genlegendre}[4]{% - \genfrac{(}{)}{}{#1}{#3}{#4}% - \if\relax\detokenize{#2}\relax\else_{\!#2}\fi% -} -\providecommand{\legendre}[3][]{\genlegendre{}{#1}{#2}{#3}} -\providecommand{\dlegendre}[3][]{\genlegendre{0}{#1}{#2}{#3}} -\providecommand{\tlegendre}[3][]{\genlegendre{1}{#1}{#2}{#3}} -%</PJLmath> -% -%<*PJLpaper> -\RequirePackage{ifthen} - -%# 这段代码定义了宏包中的选项。 -%# This code defines the options in the package. -\SetupKeyvalOptions{% - family = @PJLpaper, - prefix = @PJLpaper@, - setkeys=\kvsetkeys -} - -\DeclareStringOption[normal]{paperstyle} -%# 几种纸张颜色的选项 -%# Several options of different paper color style -\DeclareVoidOption{yellowpaper}{\kvsetkeys{@PJLpaper}{paperstyle=yellow}} -\DeclareVoidOption{darkpaper}{\kvsetkeys{@PJLpaper}{paperstyle=dark}} -\DeclareVoidOption{nordpaper}{\kvsetkeys{@PJLpaper}{paperstyle=nord}} -%# 预览模式:减去边框 -%# Preview mode: crop the edge -\DeclareBoolOption[false]{preview} -%# 处理选项 -%# Process options -\ProcessKeyvalOptions*\relax - -%%================================ -%% Preview mode -%%================================ -\ifdefined\PJLnoPreview\else% - \if@PJLpaper@preview% - \RequirePackage{calc} - \AtEndPreamble{% - \setlength{\paperwidth}{\textwidth*\real{1.05}}% - \setlength{\paperheight}{% - (\textheight+\headheight+\headsep+\footskip)*\real{1.05}}% - \setlength{\oddsidemargin}{(\paperwidth-\textwidth)/2-1in}% - \setlength{\evensidemargin}{(\paperwidth-\textwidth)/2-1in}% - \setlength{\topmargin}{(\paperheight-\textheight-\headheight-\headsep-\footskip)/2- 1in}% - } - \fi -\fi - -%%================================ -%% Paper color -%%================================ -\RequirePackage{xcolor} -\definecolor{paper}{RGB}{255,255,255} -\definecolor{maintext}{RGB}{0,0,0} - -\ifthenelse{\equal{\@PJLpaper@paperstyle}{yellow}} -{ - \definecolor{paper}{RGB}{247,246,233} -} -{\relax} - -\ifthenelse{\equal{\@PJLpaper@paperstyle}{dark}} -{ - \definecolor{paper}{RGB}{30,30,30} - \definecolor{maintext}{RGB}{207,207,207} -} -{\relax} - -\ifthenelse{\equal{\@PJLpaper@paperstyle}{nord}} -{ - \definecolor{paper}{RGB}{46,52,64} - \definecolor{maintext}{RGB}{214,220,230} -} -{\relax} - -\newcommand{\PJLglobalcolor}[1]{% - \color{#1}\global\let\default@color\current@color -} - -%# 设置纸张颜色、文字颜色 -%# Set the paper and text color -\pagecolor{paper} -\PJLglobalcolor{maintext} -\AtEndPreamble{ -\ifdefined\tcbset% - \tcbset{colupper=maintext,collower=maintext} -\fi -} -%</PJLpaper> -% -%<*PJLthm> -%# 这段代码定义了宏包中的选项。 -%# This code defines the options in the package. \SetupKeyvalOptions{% family = @PJLthm, prefix = @PJLthm@ } -%# 不建立定理类环境 -%# Do not setup theorem-like environments \DeclareBoolOption[false]{nothms} -%# 推迟建立定理类环境 -%# Delay the setup of theorem-like environments to the end of the preamble \DeclareBoolOption[false]{delaythms} -%# 不编号定理类环境 -%# Do not number theorem-like environments \DeclareBoolOption[false]{nothmnum} -%# 指定如何编号定理类环境 -%# Number theorem-like environments With ... \DeclareStringOption{thmnum}[PJL@thmnum@default] -%# 草稿模式或快速模式 -%# Draft mode or fast mode \DeclareBoolOption[false]{draft} \DeclareBoolOption[false]{fast} -%# 引用的名称将随当前语言的不同而改变 -%# Reference name will change with the current language \DeclareBoolOption[true]{regionalref} \DeclareBoolOption[false]{originalref} -%# 名称采用详尽设置或简易设置 -%# Detailed or simple settings for the name of theorem-like environments \DeclareBoolOption[true]{complexname} \DeclareBoolOption[false]{simplename} -%# 处理选项 -%# Process options \ProcessKeyvalOptions*\relax -%# 下面的代码设定了选项之间的关系 -%# The following code sets the relationship between options \if@PJLthm@originalref \@PJLthm@regionalreffalse \fi @@ -1449,8 +69,6 @@ \PassOptionsToPackage{nameinlink}{cleveref} \RequirePackage{crefthe} -%# 用于命名定理类环境的用户命令 -%# Macro for naming theorems \RequirePackage{xparse} \RequirePackage{xstring} \NewDocumentCommand{\NameTheorem}{omm}{% @@ -1483,8 +101,6 @@ }% } -%# 用于创建定理类环境的用户命令 -%# Macro for creating theorems \newcommand\PassFirstToSecond[2]{#2{#1}}% \NewDocumentCommand{\CreateTheorem}{sm}{% \begingroup @@ -1500,13 +116,6 @@ }% \if@PJLthm@regionalref \NewDocumentCommand{\InnerCreateTheorem}{mmmod<>d()g}{% -% #1 = star or no star -% #2 = name of environment -% #3 = emptiness or star to append to name of environment -% #4 = numbered like -% #5 = numbered within -% #6 = existed environment -% #7 = key-value configuration of names \IfBooleanTF{#1}{% \IfValueTF{#4} {\@firstoftwo} @@ -1570,26 +179,6 @@ }% \else \NewDocumentCommand{\InnerCreateTheorem}{mmmod<>d()g}{% -% #1 = Tokens denoting an xparse-boolean value; -% value "true" -> the call was \CreateTheorem*{...}... -% value "false" -> the call was \CreateTheorem{...}... -% This indicates whether the "starred" variant or the -% "unstarred" variant of \CreateTheorem was called. -% #2 = Name of environment to define. One trailing -% star is removed from the environment-name provided -% to \CreateTheorem if that environment-name has -% trailing stars. -% #3 = If the environment-name provided to \CreateTheorem has -% trailing stars: A star (*). -% If the environment-name provided to \CreateTheorem has -% no trailing stars: Empty/no tokens at all. -% #4 = numbered like=name of counter like which the environment -% shall be numbered. -% #5 = numbered within=name of counter which is superordinate -% to the environment's counter and whose stepping resets -% the environment's counter. -% #6 = existed environment name (the environment to copy) -% #7 = key-value configuration of names \IfBooleanTF{#1}{% \IfValueTF{#4} {\@firstoftwo} @@ -1625,17 +214,6 @@ } }{% \IfBooleanTF{#1}{% -% \newtheorem*{#2EN#3}{\csname#2nameEN\endcsname}% -% \newtheorem*{#2FR#3}{\csname#2nameFR\endcsname}% -% \newtheorem*{#2DE#3}{\csname#2nameDE\endcsname}% -% \newtheorem*{#2IT#3}{\csname#2nameIT\endcsname}% -% \newtheorem*{#2PT#3}{\csname#2namePT\endcsname}% -% \newtheorem*{#2BR#3}{\csname#2nameBR\endcsname}% -% \newtheorem*{#2ES#3}{\csname#2nameES\endcsname}% -% \newtheorem*{#2CN#3}{\csname#2nameCN\endcsname}% -% \newtheorem*{#2TC#3}{\csname#2nameTC\endcsname}% -% \newtheorem*{#2JP#3}{\csname#2nameJP\endcsname}% -% \newtheorem*{#2RU#3}{\csname#2nameRU\endcsname}% \if@PJLlang@enable@EN\expandafter\PassFirstToSecond\expandafter{\csname#2nameEN\endcsname}{\newtheorem*{#2EN#3}}\fi% \if@PJLlang@enable@FR\expandafter\PassFirstToSecond\expandafter{\csname#2nameFR\endcsname}{\newtheorem*{#2FR#3}}\fi% \if@PJLlang@enable@DE\expandafter\PassFirstToSecond\expandafter{\csname#2nameDE\endcsname}{\newtheorem*{#2DE#3}}\fi% @@ -1683,15 +261,8 @@ }% \NewDocumentCommand{\CreateTheoremNumberedLikeAliasCounter}{mmm}{% \newaliascnt{#1#2#3}{#1#3}% -% \newtheorem{#1#2#3}[{#1#2#3}]{\csname#1name#2\endcsname}% \expandafter\PassFirstToSecond\expandafter{\csname#1name#2\endcsname}{\newtheorem{#1#2#3}[{#1#2#3}]}% \aliascntresetthe{#1#2#3}% -% \crefname{#1#2#3}% -% {\csname#1name#2\endcsname}% -% {\csname#1name#2\endcsname}% -% \Crefname{#1#2#3}% -% {\csname#1name#2\endcsname}% -% {\csname#1name#2\endcsname}% \ifcsname cref@#1#2#3@name\endcsname\else% \expandafter\PassFirstToSecond\expandafter{\csname#1name#2\endcsname}% {% @@ -1709,52 +280,33 @@ }% \fi -% See https://tex.stackexchange.com/a/610604 \ExplSyntaxOn -% Helper-macros/scratch-macros -%----------------------------- \cs_new:Nn \PJLthm_exchange_i_iii_ii:nnn { #1 {#3} {#2} } \cs_new:Nn \__PJLthm_languageprefix: {} \cs_new:Nn \__PJLthm_countername: {} -% Message-management: -%-------------------- \msg_new:nnnn {PJLthm} {Undefined Language Dependent Specification Class} - {\token_to_str:N \CreateTheorem :\ Value\ `\tl_to_str:n{#2}'\ for\ invalid\ key\ `#1'.} + {\token_to_str:N \CreateTheorem :\ Value\ `\tl_to_str:n{#2}'\ for\ invalid\ key\ `#1'.} {Providing\ Language-dependent\ specifications\ for\ element\ `#1'\ is\ currently\ not\ implemented.} -% Nested key=value-interface by means of package l3keys: -%------------------------------------------------------- -% (l3keys is similar to pgfkeys.) -% The outer level of key=value-specifications, i.e., <language-ID>={...}, -% is processed via \keyval_parse:nnn which was added tpo expl3 in 2020/12/19. -% The inner level of key=value-specifications, -% i.e., the single keys whose values are to be specified dependant on the language, -% i.e., the "..."-content of the outer lever's {...}, -% is processed via \keys_set:nn . -% The keys for the inner level are defined via \keys_define:nn . \NewDocumentCommand \CreateTheoremSetKeys { mm } { -% #1 = name of counter -% #2 = keyval-list of language-specifications \cs_set:Nn \__PJLthm_countername: {#1} - \keyval_parse:nnn { \PJLthm_exchange_i_iii_ii:nnn { \PJLthm_setlanguagespecificparameters:nn } {} } + \keyval_parse:nnn { \PJLthm_exchange_i_iii_ii:nnn { \PJLthm_setlanguagespecificparameters:nn } {} } { \PJLthm_setlanguagespecificparameters:nn } { #2 } } \cs_new_protected:Nn \PJLthm_setlanguagespecificparameters:nn { -% #1 = language-prefix -% #2 = key-val-list for language whose prefix is language-prefix \cs_set:Nx \__PJLthm_languageprefix: {\StrToABBR{#1}} - \exp_args:No \tl_if_empty:nTF {\__PJLthm_languageprefix:} + \exp_args:No \tl_if_empty:nTF {\__PJLthm_languageprefix:} { \msg_error:nn { PJLthm } { No~language~"\exp_not:n{#1}"~defined } }% {% - \keys_set:nn { PJLthm } { #2 } + \keys_set:nn { PJLthm } { #2 } }% }% @@ -1788,7 +340,7 @@ % % Define keys for more Language Dependent Specification Classes. % - unknown.code:n = \msg_error:nnxx {PJLthm} + unknown.code:n = \msg_error:nnxx {PJLthm} {Undefined Language Dependent Specification Class} {\exp_args:No \exp_not:n \l_keys_key_str} {\exp_not:n{#1}}, @@ -1796,7 +348,6 @@ \ExplSyntaxOff -% Some command for regionalref mode \newcommand{\PJLthm@setcrefinnername}[3]{% \expandafter\def\csname PJLthm@cref@#1@name\endcsname{#2}% \expandafter\def\csname PJLthm@cref@#1@name@plural\endcsname{#3}% @@ -1817,8 +368,6 @@ {\csname PJLthm@Cref@#1\csname\languagename ABBR\endcsname @name@plural\endcsname}% } -%# 设置定理类环境名称 -%# Set the names of theorem-like environments \ifbool{@PJLthm@complexname}{ \NameTheorem{theorem}{ EN = { @@ -3018,8 +1567,6 @@ }, } }{ -%# 英文定理名称 -%# English theorems names \def\theoremnameEN{{Theorem}} \def\lemmanameEN{{Lemma}} \def\propositionnameEN{{Proposition}} @@ -3042,8 +1589,6 @@ \expandafter\def\csname definition-propositionnameEN\endcsname{\definitionnameEN-\propositionnameEN} \expandafter\def\csname definition-theoremnameEN\endcsname{\definitionnameEN-\theoremnameEN} -%# 法语定理名称 -%# French theorems names \def\theoremnameFR{{Théorème}} \def\lemmanameFR{{Lemme}} \def\propositionnameFR{{Proposition}} @@ -3066,8 +1611,6 @@ \expandafter\def\csname definition-propositionnameFR\endcsname{\definitionnameFR-\propositionnameFR} \expandafter\def\csname definition-theoremnameFR\endcsname{\definitionnameFR-\theoremnameFR} -%# 德语定理名称 -%# German theorems names \def\theoremnameDE{{Satz}} \def\lemmanameDE{{Lemma}} \def\propositionnameDE{{Proposition}} @@ -3090,8 +1633,6 @@ \expandafter\def\csname definition-propositionnameDE\endcsname{\definitionnameDE-\propositionnameDE} \expandafter\def\csname definition-theoremnameDE\endcsname{\definitionnameDE-\theoremnameDE} -%# 意大利语定理名称 -%# Italian theorems names \def\theoremnameIT{{Teorema}} \def\lemmanameIT{{Lemma}} \def\propositionnameIT{{Proposizione}} @@ -3114,8 +1655,6 @@ \expandafter\def\csname definition-propositionnameIT\endcsname{\definitionnameIT-\propositionnameIT} \expandafter\def\csname definition-theoremnameIT\endcsname{\definitionnameIT-\theoremnameIT} -%# 葡萄牙语定理名称 -%# Portuguese theorems names \def\theoremnamePT{{Teorema}} \def\lemmanamePT{{Lema}} \def\propositionnamePT{{Proposição}} @@ -3138,8 +1677,6 @@ \expandafter\def\csname definition-propositionnamePT\endcsname{\definitionnamePT-\propositionnamePT} \expandafter\def\csname definition-theoremnamePT\endcsname{\definitionnamePT-\theoremnamePT} -%# 巴西葡萄牙语定理名称 -%# Brazilian theorems names \def\theoremnameBR{{Teorema}} \def\lemmanameBR{{Lema}} \def\propositionnameBR{{Proposição}} @@ -3162,8 +1699,6 @@ \expandafter\def\csname definition-propositionnameBR\endcsname{\definitionnameBR-\propositionnameBR} \expandafter\def\csname definition-theoremnameBR\endcsname{\definitionnameBR-\theoremnameBR} -%# 西班牙语定理名称 -%# Spanish theorems names \def\theoremnameES{{Teorema}} \def\lemmanameES{{Lema}} \def\propositionnameES{{Proposición}} @@ -3186,8 +1721,6 @@ \expandafter\def\csname definition-propositionnameES\endcsname{\definitionnameES-\propositionnameES} \expandafter\def\csname definition-theoremnameES\endcsname{\definitionnameES-\theoremnameES} -%# 中文定理名称 -%# Chinese theorems names \def\theoremnameCN{{定理}} \def\lemmanameCN{{引理}} \def\propositionnameCN{{命题}} @@ -3232,8 +1765,6 @@ \expandafter\def\csname definition-propositionnameTC\endcsname{\definitionnameTC-\propositionnameTC} \expandafter\def\csname definition-theoremnameTC\endcsname{\definitionnameTC-\theoremnameTC} -%# 日文定理名称 -%# Japanese theorems names \def\theoremnameJP{{定理}} \def\lemmanameJP{{補題}} \def\propositionnameJP{{命題}} @@ -3256,8 +1787,6 @@ \expandafter\def\csname definition-propositionnameJP\endcsname{\definitionnameJP-\propositionnameJP} \expandafter\def\csname definition-theoremnameJP\endcsname{\definitionnameJP-\theoremnameJP} -%# 俄文定理名称 -%# Russian theorems names \def\theoremnameRU{{Теорема}} % Теоре́ма \def\lemmanameRU{{Лемма}} % Ле́мма \def\propositionnameRU{{Предложение}} % Предложе́ние @@ -3281,8 +1810,6 @@ \expandafter\def\csname definition-theoremnameRU\endcsname{\definitionnameRU-\theoremnameRU} } -%# 判断最高级别的标题是 section 还是 chapter -%# Detect the highest level of title: section or chapter? \newif\ifPJLthm@IsBook \ifdefined\c@chapter\PJLthm@IsBooktrue\else\PJLthm@IsBookfalse\fi \ifbool{PJLthm@IsBook}{ @@ -3290,8 +1817,6 @@ }{ \newaliascnt{PJLthm@highest}{section} } -%# 按照 thmnum 决定定理类环境如何编号 -%# Number the theorem-like environment with respect to thmnum \NewDocumentCommand{\CreateTheorem@thmnum}{m}{ \expandafter\ifstrempty\expandafter{\@PJLthm@thmnum}{ \CreateTheorem{#1}<PJLthm@highest> @@ -3304,8 +1829,6 @@ } } -%# 建立定理类环境 -%# Setup theorem-like environments \def\PJLthm@definethms{ \if@PJLthm@nothms\else \if@PJLthm@nothmnum @@ -3388,16 +1911,11 @@ \theoremstyle{definition} \fi -%# 按照 thmnum 决定公式如何编号 -%# Number the equations with respect to thmnum \expandafter\ifstrempty\expandafter{\@PJLthm@thmnum}{ -% thmnum is not used. \numberwithin{equation}{PJLthm@highest} }{ \expandafter\ifstrequal\expandafter{\@PJLthm@thmnum}{PJL@thmnum@default}{ -% thmnum is used, with no value. }{ -% thmnum is used, with value \@PJLthm@thmnum. \numberwithin{equation}{\@PJLthm@thmnum} } } @@ -3410,8 +1928,6 @@ \PJLthm@definethms \fi -%# 一些 cref 的本地化 -%# Some localization of cref \gappto{\PJLlang@langconfig@CN}{% \crefname{equation}{式}{式}% \crefname{figure}{图}{图}% @@ -3497,187 +2013,7 @@ \def\creflastgroupconjunction{ e\nobreakspace}% \def\crefrangeconjunction{ a\nobreakspace}% } -%</PJLthm> -% -%<*ProjLib> -%# 这段代码定义了宏包中的选项。 -%# This code defines the options in the package. -\SetupKeyvalOptions{ - family = @ProjLib, - prefix = @ProjLib@, -} -\DeclareBoolOption[false]{draft} -\DeclareBoolOption[false]{fast} -\DeclareBoolOption[false]{author} -\DeclareBoolOption[false]{amsfashion} -\DeclareBoolOption[false]{nothms} -\DeclareBoolOption[false]{delaythms} -\DeclareBoolOption[false]{nothmnum} -\DeclareStringOption{thmnum}[PJL@thmnum@default] -\DeclareBoolOption[true]{regionalref} -\DeclareBoolOption[false]{originalref} -\DeclareBoolOption[true]{complexname} -\DeclareBoolOption[false]{simplename} -\DeclareBoolOption[false]{useosf} -\DeclareBoolOption[false]{lmodern} -\DeclareBoolOption[false]{palatino} -\DeclareBoolOption[false]{times} -\DeclareBoolOption[false]{garamond} -\DeclareBoolOption[false]{noto} -\DeclareBoolOption[false]{biolinum} -%# 处理选项 -%# Process options -\ProcessKeyvalOptions*\relax - -%# 下面的代码设定了选项之间的关系 -%# The following code sets the relationship between options -\if@ProjLib@originalref - \@ProjLib@regionalreffalse -\fi -\if@ProjLib@simplename - \@ProjLib@complexnamefalse -\fi -\if@ProjLib@draft - \@ProjLib@fasttrue -\fi - -%# 向组件传递一些参数 -%# Pass some options to the components -\if@ProjLib@fast - \PassOptionsToPackage{fast}{PJLdate} - \PassOptionsToPackage{fast}{PJLdraft} - \PassOptionsToPackage{fast}{PJLlogo} - \PassOptionsToPackage{fast}{PJLthm} -\fi -\if@ProjLib@nothms - \PassOptionsToPackage{nothms}{PJLthm} -\fi -\if@ProjLib@delaythms - \PassOptionsToPackage{delaythms}{PJLthm} -\fi -\if@ProjLib@nothmnum - \PassOptionsToPackage{nothmnum}{PJLthm} -\fi -\expandafter\ifstrempty\expandafter{\@ProjLib@thmnum}{}{ - \expandafter\ifstrequal\expandafter{\@ProjLib@thmnum}{PJL@thmnum@default}{ - \PassOptionsToPackage{thmnum}{PJLthm} - }{ - \PassOptionsToPackage{thmnum=\@ProjLib@thmnum}{PJLthm} - } -} -\if@ProjLib@regionalref\else - \PassOptionsToPackage{originalref}{PJLthm} -\fi -\if@ProjLib@complexname\else - \PassOptionsToPackage{simplename}{PJLthm} -\fi - -%# 加载不默认载入的组件 -%# Load those components not by default loaded -\if@ProjLib@amsfashion - \PassOptionsToPackage{amsfashion}{PJLauthor} - \RequirePackage{PJLauthor} -\fi -\if@ProjLib@author - \RequirePackage{PJLauthor} -\fi -%# 加载组件 -%# Load the components -\RequirePackage{PJLdate} -\RequirePackage{PJLdraft} -\RequirePackage{PJLlogo} -\RequirePackage{PJLmath} -\RequirePackage{PJLpaper} -\RequirePackage{PJLthm} - -%# 配置字体选项 -%# Configure the font options below -% -% \PJL@font@alreadyset should contain the current font name -% A message can then be shown as: Font "(font name)" has been set -\ifdefined\PJL@font@alreadyset\else - -\if@ProjLib@lmodern - \RequirePackage{amssymb} - \if@ProjLib@useosf - \RequirePackage{cfr-lm} - \else - \RequirePackage{lmodern} - \fi - \PJLsetlinespacing{\setstretch{1.00}} -\fi - -\if@ProjLib@palatino - % \RequirePackage{amssymb} - \RequirePackage{mathpazo} - \PassOptionsToPackage{defaultsups}{newpxtext} - \RequirePackage{newpxtext} - % \RequirePackage{newpxmath} - \let\openbox\relax - \PJLsetlinespacing{\setstretch{1.07}} - \if@ProjLib@useosf\useosf\fi -\fi - -\if@ProjLib@times - % \RequirePackage{amssymb} - \PassOptionsToPackage{defaultsups}{newtxtext} - \RequirePackage{newtxtext} - \RequirePackage{newtxmath} - \let\openbox\relax - \PJLsetlinespacing{\setstretch{1.00}} - \if@ProjLib@useosf\useosf\fi -\fi - -\if@ProjLib@garamond - % \RequirePackage{amssymb} - \if@ProjLib@useosf\else - \PassOptionsToPackage{lining}{ebgaramond} - \fi - \RequirePackage{ebgaramond-maths} - \RequirePackage{ebgaramond} - % \RequirePackage{garamondlibre} - \PJLsetlinespacing{\setstretch{1.00}} -\fi - -\if@ProjLib@noto - \if@ProjLib@useosf - \PassOptionsToPackage{oldstyle}{notomath} - \fi - \RequirePackage{anyfontsize} - \RequirePackage{notomath} - \PJLsetlinespacing{\setstretch{1.00}} -\fi - -\if@ProjLib@biolinum - % \RequirePackage{amssymb} - % \RequirePackage{mathpazo} - % \RequirePackage[sansmath]{libertinust1math} - \ifPDFTeX - \if@ProjLib@useosf - \PassOptionsToPackage{osf}{biolinum} - \fi - \RequirePackage{biolinum} - \renewcommand*\familydefault{\biolinum@family} - \else - \PassOptionsToPackage{no-math}{fontspec} - \RequirePackage{fontspec} - \setmainfont{LinBiolinum_R.otf}[ - BoldFont = LinBiolinum_RB.otf , - ItalicFont = LinBiolinum_RI.otf , - BoldItalicFont = LinBiolinum_RBO.otf, - \if@ProjLib@useosf Numbers = OldStyle\fi ] - \fi - \PJLsetlinespacing{\setstretch{1.05}} - \RequirePackage[italic,defaultmathsizes]{mathastext} -\fi - -%# 结束字体选项的配置 -%# End of the configuration of font options -\fi - -%# 使用 microtype 优化排版细节 -%# Use `microtype` to get details better -\RequirePackage{microtype} -%</ProjLib> -\endinput
\ No newline at end of file +\endinput +%% +%% End of file `PJLthm.sty'. diff --git a/macros/latex/contrib/projlib/old-modules/PJLtoolkit.sty b/macros/latex/contrib/projlib/old-modules/PJLtoolkit.sty new file mode 100644 index 0000000000..b11b34a2a7 --- /dev/null +++ b/macros/latex/contrib/projlib/old-modules/PJLtoolkit.sty @@ -0,0 +1,184 @@ +%% +%% This is file `ProjLib.sty', +%% generated with the docstrip utility. + +%% Copyright (C) 2021 by Jinwen XU +%% +%% This is part of the ProjLib Toolkit. +%% +%% This work may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License, either version 1.3c of this license or (at +%% your option) any later version. The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[2020-10-01] +\ProvidesPackage{PJLtoolkit} + [2021/12/16 The collective interface of ProjLib toolkit] +\RequirePackage{kvoptions} +\RequirePackage{etoolbox} +\SetupKeyvalOptions{ + family = @ProjLib, + prefix = @ProjLib@, +} +\DeclareBoolOption[false]{draft} +\DeclareBoolOption[false]{fast} +\DeclareBoolOption[false]{author} +\DeclareBoolOption[false]{amsfashion} +\DeclareBoolOption[false]{nothms} +\DeclareBoolOption[false]{delaythms} +\DeclareBoolOption[false]{nothmnum} +\DeclareStringOption{thmnum}[PJL@thmnum@default] +\DeclareBoolOption[true]{regionalref} +\DeclareBoolOption[false]{originalref} +\DeclareBoolOption[true]{complexname} +\DeclareBoolOption[false]{simplename} +\DeclareBoolOption[false]{useosf} +\DeclareBoolOption[false]{lmodern} +\DeclareBoolOption[false]{palatino} +\DeclareBoolOption[false]{times} +\DeclareBoolOption[false]{garamond} +\DeclareBoolOption[false]{noto} +\DeclareBoolOption[false]{biolinum} +\ProcessKeyvalOptions*\relax + +\if@ProjLib@originalref + \@ProjLib@regionalreffalse +\fi +\if@ProjLib@simplename + \@ProjLib@complexnamefalse +\fi +\if@ProjLib@draft + \@ProjLib@fasttrue +\fi + +\if@ProjLib@fast + \PassOptionsToPackage{fast}{PJLdate} + \PassOptionsToPackage{fast}{PJLdraft} + \PassOptionsToPackage{fast}{PJLlogo} + \PassOptionsToPackage{fast}{PJLthm} +\fi +\if@ProjLib@nothms + \PassOptionsToPackage{nothms}{PJLthm} +\fi +\if@ProjLib@delaythms + \PassOptionsToPackage{delaythms}{PJLthm} +\fi +\if@ProjLib@nothmnum + \PassOptionsToPackage{nothmnum}{PJLthm} +\fi +\expandafter\ifstrempty\expandafter{\@ProjLib@thmnum}{}{ + \expandafter\ifstrequal\expandafter{\@ProjLib@thmnum}{PJL@thmnum@default}{ + \PassOptionsToPackage{thmnum}{PJLthm} + }{ + \PassOptionsToPackage{thmnum=\@ProjLib@thmnum}{PJLthm} + } +} +\if@ProjLib@regionalref\else + \PassOptionsToPackage{originalref}{PJLthm} +\fi +\if@ProjLib@complexname\else + \PassOptionsToPackage{simplename}{PJLthm} +\fi + +\if@ProjLib@amsfashion + \PassOptionsToPackage{amsfashion}{PJLauthor} + \RequirePackage{PJLauthor} +\fi +\if@ProjLib@author + \RequirePackage{PJLauthor} +\fi +\RequirePackage{PJLdate} +\RequirePackage{PJLdraft} +\RequirePackage{PJLlogo} +\RequirePackage{PJLmath} +\RequirePackage{PJLpaper} +\RequirePackage{PJLthm} + +\ifdefined\PJL@font@alreadyset\else + +\if@ProjLib@lmodern + \RequirePackage{amssymb} + \if@ProjLib@useosf + \RequirePackage{cfr-lm} + \else + \RequirePackage{lmodern} + \fi + \PJLsetlinespacing{\setstretch{1.00}} +\fi + +\if@ProjLib@palatino + % \RequirePackage{amssymb} + \RequirePackage{mathpazo} + \PassOptionsToPackage{defaultsups}{newpxtext} + \RequirePackage{newpxtext} + % \RequirePackage{newpxmath} + \let\openbox\relax + \PJLsetlinespacing{\setstretch{1.07}} + \if@ProjLib@useosf\useosf\fi +\fi + +\if@ProjLib@times + % \RequirePackage{amssymb} + \PassOptionsToPackage{defaultsups}{newtxtext} + \RequirePackage{newtxtext} + \RequirePackage{newtxmath} + \let\openbox\relax + \PJLsetlinespacing{\setstretch{1.00}} + \if@ProjLib@useosf\useosf\fi +\fi + +\if@ProjLib@garamond + % \RequirePackage{amssymb} + \if@ProjLib@useosf\else + \PassOptionsToPackage{lining}{ebgaramond} + \fi + \RequirePackage{ebgaramond-maths} + \RequirePackage{ebgaramond} + % \RequirePackage{garamondlibre} + \PJLsetlinespacing{\setstretch{1.00}} +\fi + +\if@ProjLib@noto + \if@ProjLib@useosf + \PassOptionsToPackage{oldstyle}{notomath} + \fi + \RequirePackage{anyfontsize} + \RequirePackage{notomath} + \PJLsetlinespacing{\setstretch{1.00}} +\fi + +\if@ProjLib@biolinum + % \RequirePackage{amssymb} + % \RequirePackage{mathpazo} + % \RequirePackage[sansmath]{libertinust1math} + \ifPDFTeX + \if@ProjLib@useosf + \PassOptionsToPackage{osf}{biolinum} + \fi + \RequirePackage{biolinum} + \renewcommand*\familydefault{\biolinum@family} + \else + \PassOptionsToPackage{no-math}{fontspec} + \RequirePackage{fontspec} + \setmainfont{LinBiolinum_R.otf}[ + BoldFont = LinBiolinum_RB.otf , + ItalicFont = LinBiolinum_RI.otf , + BoldItalicFont = LinBiolinum_RBO.otf, + \if@ProjLib@useosf Numbers = OldStyle\fi ] + \fi + \PJLsetlinespacing{\setstretch{1.05}} + \RequirePackage[italic,defaultmathsizes]{mathastext} +\fi + +\fi + +\WarningFilter{microtype}{Unable} +\RequirePackage{microtype} + +\endinput +%% +%% End of file `ProjLib.sty'. diff --git a/macros/latex/contrib/projlib/new-modules/projlib-author.sty b/macros/latex/contrib/projlib/projlib-author.sty index ef0906d249..2ad44ff6a3 100644 --- a/macros/latex/contrib/projlib/new-modules/projlib-author.sty +++ b/macros/latex/contrib/projlib/projlib-author.sty @@ -2,14 +2,15 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {projlib-author} - {2022/02/24} {} + {2022/03/09} {} {Enhanced author information block} \keys_define:nn { projlib-author } { - , amsfashion .bool_set:N = \l__projlib_author_amsfashion_bool - , amsfashion .initial:n = { false } , ams-fashion .bool_set:N = \l__projlib_author_amsfashion_bool + , ams-fashion .initial:n = { false } + , ams~fashion .bool_set:N = \l__projlib_author_amsfashion_bool + , ams fashion .bool_set:N = \l__projlib_author_amsfashion_bool , unknown .code:n = {} } \ProcessKeysOptions { projlib-author } diff --git a/macros/latex/contrib/projlib/new-modules/projlib-datetime.sty b/macros/latex/contrib/projlib/projlib-datetime.sty index d96d31d93b..07c1473171 100644 --- a/macros/latex/contrib/projlib/new-modules/projlib-datetime.sty +++ b/macros/latex/contrib/projlib/projlib-datetime.sty @@ -2,7 +2,7 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {projlib-datetime} - {2022/02/24} {} + {2022/03/03} {} {Convert numeric date-time string to natural language} \tl_new:N \g__projlib_datetime_input_format_tl @@ -386,7 +386,9 @@ { \group_begin: \keys_set:nn { projlib-datetime-command } { #1 } - \__projlib_datetime_display_date_according_to_format:nn { #2 } {} + \tl_set:Nn \l_tmpa_tl { #2 } + \regex_replace_all:nnN { \D } { - } \l_tmpa_tl + \__projlib_datetime_display_date_according_to_format:nn { \l_tmpa_tl } {} \group_end: } @@ -394,7 +396,9 @@ { \group_begin: \keys_set:nn { projlib-datetime-command } { #1 } - \__projlib_datetime_display_date_according_to_format:nn { #2 } { _uppercase } + \tl_set:Nn \l_tmpa_tl { #2 } + \regex_replace_all:nnN { \D } { - } \l_tmpa_tl + \__projlib_datetime_display_date_according_to_format:nn { \l_tmpa_tl } { _uppercase } \group_end: } diff --git a/macros/latex/contrib/projlib/new-modules/projlib-draft.sty b/macros/latex/contrib/projlib/projlib-draft.sty index 6c7fe818c7..6c7fe818c7 100644 --- a/macros/latex/contrib/projlib/new-modules/projlib-draft.sty +++ b/macros/latex/contrib/projlib/projlib-draft.sty diff --git a/macros/latex/contrib/projlib/new-modules/projlib-font.sty b/macros/latex/contrib/projlib/projlib-font.sty index 4b2e85f4dc..c308c1c66d 100644 --- a/macros/latex/contrib/projlib/new-modules/projlib-font.sty +++ b/macros/latex/contrib/projlib/projlib-font.sty @@ -2,7 +2,7 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {projlib-font} - {2022/02/26} {} + {2022/03/01} {} {Font selection and configuration} \keys_define:nn { projlib-font } @@ -83,6 +83,8 @@ { \PassOptionsToPackage { lining } { ebgaramond } } + \RequirePackage [ cmintegrals, cmbraces ] { newtxmath } + \cs_undefine:c { openbox } \RequirePackage { ebgaramond-maths } \RequirePackage { ebgaramond } \projlib_font_set_linespacing_latin:n { \setstretch { 1.00 } } @@ -101,6 +103,7 @@ \bool_if:NT \l__projlib_font_biolinum_bool { + \RequirePackage [ OT1 ] { eulervm } \sys_if_engine_pdftex:TF { \bool_if:NT \l__projlib_font_useosf_bool @@ -132,6 +135,10 @@ \RequirePackage [ italic, defaultmathsizes ] { mathastext } } +\RequirePackage { silence } +\WarningFilter { microtype } { Unable } +\RequirePackage { microtype } + \endinput %% %% End of file `projlib-font.sty'. diff --git a/macros/latex/contrib/projlib/new-modules/projlib-language.sty b/macros/latex/contrib/projlib/projlib-language.sty index 6167de8d04..4a67c6a018 100644 --- a/macros/latex/contrib/projlib/new-modules/projlib-language.sty +++ b/macros/latex/contrib/projlib/projlib-language.sty @@ -2,7 +2,7 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {projlib-language} - {2022/02/26} {} + {2022/03/09} {} {Multi-language configuration} \clist_const:Nn \c__projlib_language_supported_clist @@ -76,19 +76,23 @@ , CN .meta:n = { schinese } , chinese .meta:n = { schinese } , schinese .code:n = { \projlib_language_set_option_no_babel:n { schinese } } - , simplifiedchinese .meta:n = { schinese } , simplified-chinese .meta:n = { schinese } + , simplified~chinese .meta:n = { schinese } + , simplified chinese .meta:n = { schinese } , Chinese .meta:n = { schinese } , SChinese .meta:n = { schinese } - , SimplifiedChinese .meta:n = { schinese } , Simplified-Chinese .meta:n = { schinese } + , Simplified~Chinese .meta:n = { schinese } + , Simplified Chinese .meta:n = { schinese } , TC .meta:n = { tchinese } , tchinese .code:n = { \projlib_language_set_option_no_babel:n { tchinese } } - , traditionalchinese .meta:n = { tchinese } , traditional-chinese .meta:n = { tchinese } + , traditional~chinese .meta:n = { tchinese } + , traditional chinese .meta:n = { tchinese } , TChinese .meta:n = { tchinese } - , TraditionalChinese .meta:n = { tchinese } , Traditional-Chinese .meta:n = { tchinese } + , Traditional~Chinese .meta:n = { tchinese } + , Traditional Chinese .meta:n = { tchinese } , JP .meta:n = { japanese } , japanese .code:n = { \projlib_language_set_option:n { japanese } } , Japanese .meta:n = { japanese } diff --git a/macros/latex/contrib/projlib/new-modules/projlib-logo.sty b/macros/latex/contrib/projlib/projlib-logo.sty index d9ffb5c1ed..d9ffb5c1ed 100644 --- a/macros/latex/contrib/projlib/new-modules/projlib-logo.sty +++ b/macros/latex/contrib/projlib/projlib-logo.sty diff --git a/macros/latex/contrib/projlib/new-modules/projlib-math.sty b/macros/latex/contrib/projlib/projlib-math.sty index 977a428003..977a428003 100644 --- a/macros/latex/contrib/projlib/new-modules/projlib-math.sty +++ b/macros/latex/contrib/projlib/projlib-math.sty diff --git a/macros/latex/contrib/projlib/new-modules/projlib-paper.sty b/macros/latex/contrib/projlib/projlib-paper.sty index 5e1f9ac04e..bb13bbe00a 100644 --- a/macros/latex/contrib/projlib/new-modules/projlib-paper.sty +++ b/macros/latex/contrib/projlib/projlib-paper.sty @@ -2,31 +2,42 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {projlib-paper} - {2022/02/25} {} - {Paper style configuration} + {2022/03/09} {} + {Configuration of the paper style} \keys_define:nn { projlib-paper } { - , preview-mode .bool_set:N = \l__projlib_paper_preview_bool - , preview-mode .initial:n = { false } - , paperstyle .tl_set:N = \l__projlib_paper_paperstyle_tl - , paperstyle .initial:n = { normal } - , yellowpaper .meta:n = { paperstyle = yellow } - , yellow-paper .meta:n = { paperstyle = yellow } - , parchmentpaper .meta:n = { paperstyle = parchment } - , parchment-paper .meta:n = { paperstyle = parchment } - , greenpaper .meta:n = { paperstyle = green } - , green-paper .meta:n = { paperstyle = green } - , lightgraypaper .meta:n = { paperstyle = lightgray } - , lightgray-paper .meta:n = { paperstyle = lightgray } - , light-gray-paper .meta:n = { paperstyle = lightgray } - , graypaper .meta:n = { paperstyle = gray } - , gray-paper .meta:n = { paperstyle = gray } - , nordpaper .meta:n = { paperstyle = nord } - , nord-paper .meta:n = { paperstyle = nord } - , darkpaper .meta:n = { paperstyle = dark } - , dark-paper .meta:n = { paperstyle = dark } - , unknown .code:n = {} + , preview-mode .bool_set:N = \l__projlib_paper_preview_bool + , preview-mode .initial:n = { false } + , paper-style .tl_set:N = \l__projlib_paper_paperstyle_tl + , paper-style .initial:n = { normal } + , paper-style .value_required:n = true + , paper~style .tl_set:N = \l__projlib_paper_paperstyle_tl + , paper style .tl_set:N = \l__projlib_paper_paperstyle_tl + , yellow-paper .meta:n = { paperstyle = yellow } + , yellow~paper .meta:n = { paperstyle = yellow } + , yellow paper .meta:n = { paperstyle = yellow } + , parchment-paper .meta:n = { paperstyle = parchment } + , parchment~paper .meta:n = { paperstyle = parchment } + , parchment paper .meta:n = { paperstyle = parchment } + , green-paper .meta:n = { paperstyle = green } + , green~paper .meta:n = { paperstyle = green } + , green paper .meta:n = { paperstyle = green } + , light-gray-paper .meta:n = { paperstyle = lightgray } + , light~gray~paper .meta:n = { paperstyle = lightgray } + , light gray-paper .meta:n = { paperstyle = lightgray } + , light gray~paper .meta:n = { paperstyle = lightgray } + , light gray paper .meta:n = { paperstyle = lightgray } + , gray-paper .meta:n = { paperstyle = gray } + , gray~paper .meta:n = { paperstyle = gray } + , gray paper .meta:n = { paperstyle = gray } + , nord-paper .meta:n = { paperstyle = nord } + , nord~paper .meta:n = { paperstyle = nord } + , nord paper .meta:n = { paperstyle = nord } + , dark-paper .meta:n = { paperstyle = dark } + , dark~paper .meta:n = { paperstyle = dark } + , dark paper .meta:n = { paperstyle = dark } + , unknown .code:n = {} } \ProcessKeysOptions { projlib-paper } diff --git a/macros/latex/contrib/projlib/projlib-theorem.sty b/macros/latex/contrib/projlib/projlib-theorem.sty new file mode 100644 index 0000000000..092ca2f0ea --- /dev/null +++ b/macros/latex/contrib/projlib/projlib-theorem.sty @@ -0,0 +1,1184 @@ +\NeedsTeXFormat{LaTeX2e}[2020-10-01] +\RequirePackage{l3keys2e} +\ProvidesExplPackage + {projlib-theorem} + {2022/03/09} {} + {Configuration of theorem-like environments} + +\keys_define:nn { projlib-theorem } + { + , no-theorems .bool_set:N = \l__projlib_theorem_no_theorems_bool + , no-theorems .initial:n = { false } + , no~theorems .bool_set:N = \l__projlib_theorem_no_theorems_bool + , no theorems .bool_set:N = \l__projlib_theorem_no_theorems_bool + , nothms .bool_set:N = \l__projlib_theorem_no_theorems_bool + , no-theorem-numbering .bool_set:N = \l__projlib_theorem_no_theorem_numbering_bool + , no-theorem-numbering .initial:n = { false } + , no~theorem~numbering .bool_set:N = \l__projlib_theorem_no_theorem_numbering_bool + , no theorem numbering .bool_set:N = \l__projlib_theorem_no_theorem_numbering_bool + , nothmnum .bool_set:N = \l__projlib_theorem_no_theorem_numbering_bool + , theorem-numbering .tl_set:N = \l__projlib_theorem_theorem_numbering_tl + , theorem-numbering .default:n = { * } + , theorem~numbering .tl_set:N = \l__projlib_theorem_theorem_numbering_tl + , theorem~numbering .default:n = { * } + , theorem numbering .tl_set:N = \l__projlib_theorem_theorem_numbering_tl + , theorem numbering .default:n = { * } + , thmnum .tl_set:N = \l__projlib_theorem_theorem_numbering_tl + , thmnum .default:n = { * } + , complex-name .bool_set:N = \l__projlib_theorem_complexname_bool + , complex-name .initial:n = { true } + , complex~name .bool_set:N = \l__projlib_theorem_complexname_bool + , complex name .bool_set:N = \l__projlib_theorem_complexname_bool + , simple-name .bool_set:N = \l__projlib_theorem_simplename_bool + , simple-name .initial:n = { false } + , simple~name .bool_set:N = \l__projlib_theorem_simplename_bool + , simple name .bool_set:N = \l__projlib_theorem_simplename_bool + , no-preset-names .bool_set_inverse:N = \l__projlib_theorem_presetname_bool + , no-preset-names .initial:n = { false } + , no~preset~names .bool_set_inverse:N = \l__projlib_theorem_presetname_bool + , no preset names .bool_set_inverse:N = \l__projlib_theorem_presetname_bool + , unknown .code:n = { \PassOptionsToPackage { \CurrentOption } { create-theorem } } + } +\ProcessKeysOptions { projlib-theorem } + +\clist_const:Nn \c__projlib_theorem_supported_clist + { + assertion , + assumption , + axiom , + conclusion , + conjecture , + convention , + corollary , + definition , + example , + exercise , + fact , + hypothesis , + lemma , + notation , + observation , + postulate , + problem , + property , + proposition , + question , + remark , + theorem , + } + +\@ifclassloaded { beamer } + { + \RequirePackage { silence } + \WarningFilter { cleveref } { hyperref~package~loaded~with~implicit=false~option } + \bool_set_true:N \l__projlib_theorem_no_theorem_numbering_bool + \bool_if:NF \l__projlib_theorem_no_theorems_bool + { + \cs_undefine:c { theorem } + \cs_undefine:c { lemma } + \cs_undefine:c { corollary } + \cs_undefine:c { definition } + \cs_undefine:c { fact } + \cs_undefine:c { example } + \cs_undefine:c { problem } + } + } {} + +\RequirePackage { projlib-language } + +\bool_if:NF \l__projlib_theorem_complexname_bool + { + \PassOptionsToPackage { no preset names } { create-theorem } + } + +\RequirePackage { amsthm } +\RequirePackage { create-theorem } + + +\bool_if:NF \l__projlib_theorem_no_theorems_bool + { + \bool_if:NTF \l__projlib_theorem_no_theorem_numbering_bool + { + \exp_args:Nv \CreateTheorem { c__projlib_theorem_supported_clist } { numberless } + } + { + \tl_if_blank:eTF \l__projlib_theorem_theorem_numbering_tl + { + \cs_if_exist:cTF { c@chapter } + { % with \chapter + \CreateTheorem {theorem} { parent counter = chapter } + } + { % without \chapter + \CreateTheorem {theorem} { parent counter = section } + } + } + { + \tl_if_eq:NnTF \l__projlib_theorem_theorem_numbering_tl { * } + { + \CreateTheorem {theorem} { } + } + { + \CreateTheorem {theorem} { parent counter = \l__projlib_theorem_theorem_numbering_tl } + } + } + + \exp_args:Nv \CreateTheorem { c__projlib_theorem_supported_clist } { shared counter = theorem, quiet } + } + } + + +\AddLanguageSetting [ schinese ] + { + \crefname { equation } { 式 } { 式 } + \crefname { figure } { 图 } { 图 } + \crefname { table } { 表 } { 表 } + \crefname { appendix } { 附录 } { 附录 } + \Crefname { equation } { 式 } { 式 } + \Crefname { figure } { 图 } { 图 } + \Crefname { table } { 表 } { 表 } + \Crefname { appendix } { 附录 } { 附录 } + \tl_gset:Nn { \crefpairconjunction } { 、 } + \tl_gset:Nn { \crefmiddleconjunction } { 、 } + \tl_gset:Nn { \creflastconjunction } { \nobreakspace 和 \nobreakspace } + \tl_gset:Nn { \crefpairgroupconjunction } { \nobreakspace 和 \nobreakspace } + \tl_gset:Nn { \crefmiddlegroupconjunction } { 、 } + \tl_gset:Nn { \creflastgroupconjunction } { \nobreakspace 以及 \nobreakspace } + \tl_gset:Nn { \crefrangeconjunction } { ~ } + } + +\AddLanguageSetting [ tchinese ] + { + \crefname { equation } { 式 } { 式 } + \crefname { figure } { 圖 } { 圖 } + \crefname { table } { 表 } { 表 } + \crefname { appendix } { 附錄 } { 附錄 } + \Crefname { equation } { 式 } { 式 } + \Crefname { figure } { 圖 } { 圖 } + \Crefname { table } { 表 } { 表 } + \Crefname { appendix } { 附錄 } { 附錄 } + \tl_gset:Nn { \crefpairconjunction } { 、 } + \tl_gset:Nn { \crefmiddleconjunction } { 、 } + \tl_gset:Nn { \creflastconjunction } { \nobreakspace 與 \nobreakspace } + \tl_gset:Nn { \crefpairgroupconjunction } { \nobreakspace 與 \nobreakspace } + \tl_gset:Nn { \crefmiddlegroupconjunction } { 、 } + \tl_gset:Nn { \creflastgroupconjunction } { \nobreakspace 以及 \nobreakspace } + \tl_gset:Nn { \crefrangeconjunction } { ~ } + } + +\AddLanguageSetting [ japanese ] + { + \crefname { equation } { 式 } { 式 } + \crefname { figure } { 図 } { 図 } + \crefname { table } { 表 } { 表 } + \Crefname { appendix } { 付録 } { 付録 } + \Crefname { equation } { 式 } { 式 } + \Crefname { figure } { 図 } { 図 } + \Crefname { table } { 表 } { 表 } + \Crefname { appendix } { 付録 } { 付録 } + \tl_gset:Nn { \crefpairconjunction } { \nobreakspace と \nobreakspace } + \tl_gset:Nn { \crefmiddleconjunction } { \nobreakspace と \nobreakspace } + \tl_gset:Nn { \creflastconjunction } { \nobreakspace と \nobreakspace } + \tl_gset:Nn { \crefpairgroupconjunction } { \nobreakspace と \nobreakspace } + \tl_gset:Nn { \crefmiddlegroupconjunction } { \nobreakspace と \nobreakspace } + \tl_gset:Nn { \creflastgroupconjunction } { \nobreakspace 及び \nobreakspace } + \tl_gset:Nn { \crefrangeconjunction } { ~ } + } + +\AddLanguageSetting [ russian ] + { + \crefname { equation } { уравнение } { уравнения } + \crefname { figure } { рис. } { рис. } + \crefname { table } { таблица } { таблицы } + \crefname { appendix } { приложение } { приложения } + \Crefname { equation } { Уравнение } { Уравнения } + \Crefname { figure } { Рис. } { Рис. } + \Crefname { table } { Таблица } { Таблицы } + \Crefname { appendix } { Приложение } { Приложения } + \tl_gset:Nn { \crefpairconjunction } { \nobreakspace и \nobreakspace } + \tl_gset:Nn { \crefmiddleconjunction } { , \nobreakspace } + \tl_gset:Nn { \creflastconjunction } { \nobreakspace и \nobreakspace } + \tl_gset:Nn { \crefpairgroupconjunction } { \nobreakspace и \nobreakspace } + \tl_gset:Nn { \crefmiddlegroupconjunction } { , \nobreakspace } + \tl_gset:Nn { \creflastgroupconjunction } { \nobreakspace и \nobreakspace } + \tl_gset:Nn { \crefrangeconjunction } { \nobreakspace \textasciitilde \nobreakspace } + } + +\AddLanguageSetting [ portuguese ] + { + \crefname { equation } { eq. } { eqs. } + \crefname { figure } { fig. } { figs. } + \crefname { table } { tabela } { tabelas } + \crefname { appendix } { apêndice } { apêndices } + \Crefname { equation } { Eq. } { Eqs. } + \Crefname { figure } { Fig. } { Figs. } + \Crefname { table } { Tabela } { Tabelas } + \Crefname { appendix } { Apêndice } { Apêndices } + \tl_gset:Nn { \crefpairconjunction } { \nobreakspace e \nobreakspace } + \tl_gset:Nn { \crefmiddleconjunction } { , \nobreakspace } + \tl_gset:Nn { \creflastconjunction } { \nobreakspace e \nobreakspace } + \tl_gset:Nn { \crefpairgroupconjunction } { \nobreakspace e \nobreakspace } + \tl_gset:Nn { \crefmiddlegroupconjunction } { , \nobreakspace } + \tl_gset:Nn { \creflastgroupconjunction } { \nobreakspace e \nobreakspace } + \tl_gset:Nn { \crefrangeconjunction } { \nobreakspace a \nobreakspace } + } + + +\bool_if:NF \l__projlib_theorem_presetname_bool { \endinput } +\bool_if:NT \l__projlib_theorem_complexname_bool { \endinput } + + +\NameTheorem { assertion } + { + , heading = { + , english = Assertion + , french = Assertion + , ngerman = Behauptung + , italian = Asserzione + , portuguese = Asserção + , brazilian = Asserção + , spanish = Aserción + , schinese = 断言 + , tchinese = 斷言 + , japanese = アサーション + , russian = Утверждение + } + , crefname = { + , english = {Assertion}{Assertion} + , french = [l']{Assertion}[les]{Assertion} + , ngerman = {Behauptung}{Behauptung} + , italian = [l']{Asserzione}[le]{Asserzione} + , portuguese = [a]{Asserção}[as]{Asserção} + , brazilian = [a]{Asserção}[as]{Asserção} + , spanish = [la]{Aserción}[las]{Aserción} + , schinese = {断言}{断言} + , tchinese = {斷言}{斷言} + , japanese = {アサーション}{アサーション} + , russian = {Утверждение}{Утверждение} + } + , Crefname = { + , english = {Assertion}{Assertion} + , french = [L']{Assertion}[Les]{Assertion} + , ngerman = {Behauptung}{Behauptung} + , italian = [L']{Asserzione}[Le]{Asserzione} + , portuguese = [A]{Asserção}[As]{Asserção} + , brazilian = [A]{Asserção}[As]{Asserção} + , spanish = [La]{Aserción}[Las]{Aserción} + , schinese = {断言}{断言} + , tchinese = {斷言}{斷言} + , japanese = {アサーション}{アサーション} + , russian = {Утверждение}{Утверждение} + } + } + +\NameTheorem { assumption } + { + , heading = { + , english = Assumption + , french = Supposition + , ngerman = Annahme + , italian = Supposizione + , portuguese = Suposição + , brazilian = Suposição + , spanish = Suposición + , schinese = 假定 + , tchinese = 假定 + , japanese = 仮定 + , russian = Предположение + } + , crefname = { + , english = {Assumption}{Assumption} + , french = [la]{Supposition}[les]{Supposition} + , ngerman = {Annahme}{Annahme} + , italian = [la]{Supposizione}[le]{Supposizione} + , portuguese = [a]{Suposição}[as]{Suposição} + , brazilian = [a]{Suposição}[as]{Suposição} + , spanish = [la]{Suposición}[las]{Suposición} + , schinese = {假定}{假定} + , tchinese = {假定}{假定} + , japanese = {仮定}{仮定} + , russian = {Предположение}{Предположение} + } + , Crefname = { + , english = {Assumption}{Assumption} + , french = [La]{Supposition}[Les]{Supposition} + , ngerman = {Annahme}{Annahme} + , italian = [la]{Supposizione}[le]{Supposizione} + , portuguese = [A]{Suposição}[As]{Suposição} + , brazilian = [A]{Suposição}[As]{Suposição} + , spanish = [La]{Suposición}[Las]{Suposición} + , schinese = {假定}{假定} + , tchinese = {假定}{假定} + , japanese = {仮定}{仮定} + , russian = {Предположение}{Предположение} + } + } + +\NameTheorem { axiom } + { + , heading = { + , english = Axiom + , french = Axiome + , ngerman = Axiom + , italian = Assioma + , portuguese = Axioma + , brazilian = Axioma + , spanish = Axioma + , schinese = 公理 + , tchinese = 公理 + , japanese = 公理 + , russian = Аксиома + } + , crefname = { + , english = {Axiom}{Axiom} + , french = [l']{Axiome}[les]{Axiome} + , ngerman = {Axiom}{Axiom} + , italian = [l']{Assioma}[gli]{Assioma} + , portuguese = [o]{Axioma}[os]{Axioma} + , brazilian = [o]{Axioma}[os]{Axioma} + , spanish = [el]{Axioma}[los]{Axioma} + , schinese = {公理}{公理} + , tchinese = {公理}{公理} + , japanese = {公理}{公理} + , russian = {Аксиома}{Аксиома} + } + , Crefname = { + , english = {Axiom}{Axiom} + , french = [L']{Axiome}[Les]{Axiome} + , ngerman = {Axiom}{Axiom} + , italian = [L']{Assioma}[Gli]{Assioma} + , portuguese = [O]{Axioma}[Os]{Axioma} + , brazilian = [O]{Axioma}[Os]{Axioma} + , spanish = [El]{Axioma}[Los]{Axioma} + , schinese = {公理}{公理} + , tchinese = {公理}{公理} + , japanese = {公理}{公理} + , russian = {Аксиома}{Аксиома} + } + } + +\NameTheorem { conclusion } + { + , heading = { + , english = Conclusion + , french = Conclusion + , ngerman = Schlussfolgerung + , italian = Conclusione + , portuguese = Conclusão + , brazilian = Conclusão + , spanish = Conclusión + , schinese = 结论 + , tchinese = 結論 + , japanese = 結論 + , russian = Вывод + } + , crefname = { + , english = {Conclusion}{Conclusion} + , french = [la]{Conclusion}[Les]{Conclusion} + , ngerman = {Schlussfolgerung}{Schlussfolgerung} + , italian = [la]{Conclusione}[le]{Conclusione} + , portuguese = [a]{Conclusão}[as]{Conclusão} + , brazilian = [a]{Conclusão}[as]{Conclusão} + , spanish = [la]{Conclusión}[las]{Conclusión} + , schinese = {结论}{结论} + , tchinese = {結論}{結論} + , japanese = {結論}{結論} + , russian = {Вывод}{Вывод} + } + , Crefname = { + , english = {Conclusion}{Conclusion} + , french = [La]{Conclusion}[Les]{Conclusion} + , ngerman = {Schlussfolgerung}{Schlussfolgerung} + , italian = [La]{Conclusione}[Le]{Conclusione} + , portuguese = [A]{Conclusão}[As]{Conclusão} + , brazilian = [A]{Conclusão}[As]{Conclusão} + , spanish = [La]{Conclusión}[Las]{Conclusión} + , schinese = {结论}{结论} + , tchinese = {結論}{結論} + , japanese = {結論}{結論} + , russian = {Вывод}{Вывод} + } + } + +\NameTheorem { conjecture } + { + , heading = { + , english = Conjecture + , french = Conjecture + , ngerman = Vermutung + , italian = Congettura + , portuguese = Conjetura + , brazilian = Conjectura + , spanish = Conjetura + , schinese = 猜想 + , tchinese = 猜想 + , japanese = 予想 + , russian = Гипотеза + } + , crefname = { + , english = {Conjecture}{Conjecture} + , french = [la]{Conjecture}[les]{Conjecture} + , ngerman = {Vermutung}{Vermutung} + , italian = [la]{Congettura}[le]{Congettura} + , portuguese = [a]{Conjetura}[as]{Conjetura} + , brazilian = [a]{Conjectura}[as]{Conjectura} + , spanish = [la]{Conjetura}[las]{Conjetura} + , schinese = {猜想}{猜想} + , tchinese = {猜想}{猜想} + , japanese = {予想}{予想} + , russian = {Гипотеза}{Гипотеза} + } + , Crefname = { + , english = {Conjecture}{Conjecture} + , french = [La]{Conjecture}[Les]{Conjecture} + , ngerman = {Vermutung}{Vermutung} + , italian = [La]{Congettura}[Le]{Congettura} + , portuguese = [A]{Conjetura}[As]{Conjetura} + , brazilian = [A]{Conjectura}[As]{Conjectura} + , spanish = [La]{Conjetura}[Las]{Conjetura} + , schinese = {猜想}{猜想} + , tchinese = {猜想}{猜想} + , japanese = {予想}{予想} + , russian = {Гипотеза}{Гипотеза} + } + } + +\NameTheorem { convention } + { + , heading = { + , english = Convention + , french = Convention + , ngerman = Konvention + , italian = Convenzione + , portuguese = Convenção + , brazilian = Convenção + , spanish = Convención + , schinese = 约定 + , tchinese = 約定 + , japanese = 慣例 + , russian = Конвенция + } + , crefname = { + , english = {Convention}{Convention} + , french = [la]{Convention}[les]{Convention} + , ngerman = {Konvention}{Konvention} + , italian = [la]{Convenzione}[le]{Convenzione} + , portuguese = [a]{Convenção}[as]{Convenção} + , brazilian = [a]{Convenção}[as]{Convenção} + , spanish = [la]{Convención}[las]{Convención} + , schinese = {约定}{约定} + , tchinese = {約定}{約定} + , japanese = {慣例}{慣例} + , russian = {Конвенция}{Конвенция} + } + , Crefname = { + , english = {Convention}{Convention} + , french = [La]{Convention}[Les]{Convention} + , ngerman = {Konvention}{Konvention} + , italian = [La]{Convenzione}[Le]{Convenzione} + , portuguese = [A]{Convenção}[As]{Convenção} + , brazilian = [A]{Convenção}[As]{Convenção} + , spanish = [La]{Convención}[Las]{Convención} + , schinese = {约定}{约定} + , tchinese = {約定}{約定} + , japanese = {慣例}{慣例} + , russian = {Конвенция}{Конвенция} + } + } + +\NameTheorem { corollary } + { + , heading = { + , english = Corollary + , french = Corollaire + , ngerman = Korollar + , italian = Corollario + , portuguese = Corolário + , brazilian = Corolário + , spanish = Corolario + , schinese = 推论 + , tchinese = 推論 + , japanese = 系 + , russian = Следствие + } + , crefname = { + , english = {Corollary}{Corollary} + , french = [le]{Corollaire}[les]{Corollaire} + , ngerman = {Korollar}{Korollar} + , italian = [il]{Corollario}[i]{Corollario} + , portuguese = [o]{Corolário}[os]{Corolário} + , brazilian = [o]{Corolário}[os]{Corolário} + , spanish = [el]{Corolario}[los]{Corolario} + , schinese = {推论}{推论} + , tchinese = {推論}{推論} + , japanese = {系}{系} + , russian = {Следствие}{Следствие} + } + , Crefname = { + , english = {Corollary}{Corollary} + , french = [Le]{Corollaire}[Les]{Corollaire} + , ngerman = {Korollar}{Korollar} + , italian = [Il]{Corollario}[I]{Corollario} + , portuguese = [O]{Corolário}[Os]{Corolário} + , brazilian = [O]{Corolário}[Os]{Corolário} + , spanish = [El]{Corolario}[Los]{Corolario} + , schinese = {推论}{推论} + , tchinese = {推論}{推論} + , japanese = {系}{系} + , russian = {Следствие}{Следствие} + } + } + +\NameTheorem { definition } + { + , heading = { + , english = Definition + , french = Définition + , ngerman = Definition + , italian = Definizione + , portuguese = Definição + , brazilian = Definição + , spanish = Definición + , schinese = 定义 + , tchinese = 定義 + , japanese = 定義 + , russian = Определение + } + , crefname = { + , english = {Definition}{Definition} + , french = [la]{Définition}[les]{Définition} + , ngerman = {Definition}{Definition} + , italian = [la]{Definizione}[le]{Definizione} + , portuguese = [a]{Definição}[as]{Definição} + , brazilian = [a]{Definição}[as]{Definição} + , spanish = [la]{Definición}[las]{Definición} + , schinese = {定义}{定义} + , tchinese = {定義}{定義} + , japanese = {定義}{定義} + , russian = {Определение}{Определение} + } + , Crefname = { + , english = {Definition}{Definition} + , french = [La]{Définition}[Les]{Définition} + , ngerman = {Definition}{Definition} + , italian = [La]{Definizione}[Le]{Definizione} + , portuguese = [A]{Definição}[As]{Definição} + , brazilian = [A]{Definição}[As]{Definição} + , spanish = [La]{Definición}[Las]{Definición} + , schinese = {定义}{定义} + , tchinese = {定義}{定義} + , japanese = {定義}{定義} + , russian = {Определение}{Определение} + } + } + +\NameTheorem { example } + { + , heading = { + , english = Example + , french = Exemple + , ngerman = Beispiel + , italian = Esempio + , portuguese = Exemplo + , brazilian = Exemplo + , spanish = Ejemplo + , schinese = 例 + , tchinese = 例 + , japanese = 例 + , russian = Пример + } + , crefname = { + , english = {Example}{Example} + , french = [l']{Example}[les]{Example} + , ngerman = {Beispiel}{Beispiel} + , italian = [l']{Esempio}[gli]{Esempio} + , portuguese = [o]{Exemplo}[os]{Exemplo} + , brazilian = [o]{Exemplo}[os]{Exemplo} + , spanish = [el]{Ejemplo}[los]{Ejemplo} + , schinese = {例}{例} + , tchinese = {例}{例} + , japanese = {例}{例} + , russian = {Пример}{Пример} + } + , Crefname = { + , english = {Example}{Example} + , french = [L']{Example}[Les]{Example} + , ngerman = {Beispiel}{Beispiel} + , italian = [L']{Esempio}[Gli]{Esempio} + , portuguese = [O]{Exemplo}[Os]{Exemplo} + , brazilian = [O]{Exemplo}[Os]{Exemplo} + , spanish = [El]{Ejemplo}[Los]{Ejemplo} + , schinese = {例}{例} + , tchinese = {例}{例} + , japanese = {例}{例} + , russian = {Пример}{Пример} + } + } + +\NameTheorem { exercise } + { + , heading = { + , english = Exercise + , french = Exercice + , ngerman = Übung + , italian = Esercizio + , portuguese = Exercício + , brazilian = Exercício + , spanish = Ejercicio + , schinese = 练习 + , tchinese = 練習 + , japanese = 練習 + , russian = Упражнение + } + , crefname = { + , english = {Exercise}{Exercise} + , french = [l']{Exercice}[les]{Exercice} + , ngerman = {Übung}{Übung} + , italian = [l']{Esercizio}[gli]{Esercizio} + , portuguese = [o]{Exercício}[os]{Exercício} + , brazilian = [o]{Exercício}[os]{Exercício} + , spanish = [el]{Ejercicio}[los]{Ejercicio} + , schinese = {练习}{练习} + , tchinese = {練習}{練習} + , japanese = {練習}{練習} + , russian = {Упражнение}{Упражнение} + } + , Crefname = { + , english = {Exercise}{Exercise} + , french = [L']{Exercice}[Les]{Exercice} + , ngerman = {Übung}{Übung} + , italian = [L']{Esercizio}[Gli]{Esercizio} + , portuguese = [O]{Exercício}[Os]{Exercício} + , brazilian = [O]{Exercício}[Os]{Exercício} + , spanish = [El]{Ejercicio}[Los]{Ejercicio} + , schinese = {练习}{练习} + , tchinese = {練習}{練習} + , japanese = {練習}{練習} + , russian = {Упражнение}{Упражнение} + } + } + +\NameTheorem { fact } + { + , heading = { + , english = Fact + , french = Fait + , ngerman = Fakt + , italian = Fatto + , portuguese = Facto + , brazilian = Fato + , spanish = Hecho + , schinese = 事实 + , tchinese = 事實 + , japanese = 事実 + , russian = Факт + } + , crefname = { + , english = {Fact}{Fact} + , french = [le]{Fait}[les]{Fait} + , ngerman = {Fakt}{Fakt} + , italian = [il]{Fatto}[i]{Fatto} + , portuguese = [o]{Facto}[os]{Facto} + , brazilian = [o]{Fato}[os]{Fato} + , spanish = [el]{Hecho}[los]{Hecho} + , schinese = {事实}{事实} + , tchinese = {事實}{事實} + , japanese = {事実}{事実} + , russian = {Факт}{Факт} + } + , Crefname = { + , english = {Fact}{Fact} + , french = [Le]{Fait}[Les]{Fait} + , ngerman = {Fakt}{Fakt} + , italian = [Il]{Fatto}[I]{Fatto} + , portuguese = [O]{Facto}[Os]{Facto} + , brazilian = [O]{Fato}[Os]{Fato} + , spanish = [El]{Hecho}[Los]{Hecho} + , schinese = {事实}{事实} + , tchinese = {事實}{事實} + , japanese = {事実}{事実} + , russian = {Факт}{Факт} + } + } + +\NameTheorem { hypothesis } + { + , heading = { + , english = Hypothesis + , french = Hypothèse + , ngerman = Hypothese + , italian = Ipotesi + , portuguese = Hipótese + , brazilian = Hipótese + , spanish = Hipótesis + , schinese = 假设 + , tchinese = 假設 + , japanese = 仮設 + , russian = Гипотеза + } + , crefname = { + , english = {Hypothesis}{Hypothesis} + , french = [l']{Hypothèse}[les]{Hypothèse} + , ngerman = {Hypothese}{Hypothese} + , italian = [l']{Ipotesi}[le]{Ipotesi} + , portuguese = [a]{Hipótese}[as]{Hipótese} + , brazilian = [a]{Hipótese}[as]{Hipótese} + , spanish = [la]{Hipótesis}[las]{Hipótesis} + , schinese = {假设}{假设} + , tchinese = {假設}{假設} + , japanese = {仮設}{仮設} + , russian = {Гипотеза}{Гипотеза} + } + , Crefname = { + , english = {Hypothesis}{Hypothesis} + , french = [L']{Hypothèse}[Les]{Hypothèse} + , ngerman = {Hypothese}{Hypothese} + , italian = [L']{Ipotesi}[Le]{Ipotesi} + , portuguese = [A]{Hipótese}[As]{Hipótese} + , brazilian = [A]{Hipótese}[As]{Hipótese} + , spanish = [La]{Hipótesis}[Las]{Hipótesis} + , schinese = {假设}{假设} + , tchinese = {假設}{假設} + , japanese = {仮設}{仮設} + , russian = {Гипотеза}{Гипотеза} + } + } + +\NameTheorem { lemma } + { + , heading = { + , english = Lemma + , french = Lemme + , ngerman = Lemma + , italian = Lemma + , portuguese = Lema + , brazilian = Lema + , spanish = Lema + , schinese = 引理 + , tchinese = 引理 + , japanese = 補題 + , russian = Лемма + } + , crefname = { + , english = {Lemma}{Lemma} + , french = [le]{Lemme}[les]{Lemme} + , ngerman = {Lemma}{Lemma} + , italian = [il]{Lemma}[i]{Lemma} + , portuguese = [o]{Lema}[os]{Lema} + , brazilian = [o]{Lema}[os]{Lema} + , spanish = [el]{Lema}[las]{Lema} + , schinese = {引理}{引理} + , tchinese = {引理}{引理} + , japanese = {補題}{補題} + , russian = {Лемма}{Лемма} + } + , Crefname = { + , english = {Lemma}{Lemma} + , french = [Le]{Lemme}[Les]{Lemme} + , ngerman = {Lemma}{Lemma} + , italian = [Il]{Lemma}[I]{Lemma} + , portuguese = [O]{Lema}[Os]{Lema} + , brazilian = [O]{Lema}[Os]{Lema} + , spanish = [el]{Lema}[las]{Lema} + , schinese = {引理}{引理} + , tchinese = {引理}{引理} + , japanese = {補題}{補題} + , russian = {Лемма}{Лемма} + } + } + +\NameTheorem { notation } + { + , heading = { + , english = Notation + , french = Notation + , ngerman = Notation + , italian = Notazione + , portuguese = Notação + , brazilian = Notação + , spanish = Notación + , schinese = 记号 + , tchinese = 記號 + , japanese = 記法 + , russian = Нотация + } + , crefname = { + , english = {Notation}{Notation} + , french = [la]{Notation}[les]{Notation} + , ngerman = {Notation}{Notation} + , italian = [la]{Notazione}[le]{Notazione} + , portuguese = [a]{Notação}[as]{Notação} + , brazilian = [a]{Notação}[as]{Notação} + , spanish = [la]{Notación}[las]{Notación} + , schinese = {记号}{记号} + , tchinese = {記號}{記號} + , japanese = {記法}{記法} + , russian = {Нотация}{Нотация} + } + , Crefname = { + , english = {Notation}{Notation} + , french = [La]{Notation}[Les]{Notation} + , ngerman = {Notation}{Notation} + , italian = [La]{Notazione}[Le]{Notazione} + , portuguese = [A]{Notação}[As]{Notação} + , brazilian = [A]{Notação}[As]{Notação} + , spanish = [La]{Notación}[Las]{Notación} + , schinese = {记号}{记号} + , tchinese = {記號}{記號} + , japanese = {記法}{記法} + , russian = {Нотация}{Нотация} + } + } + +\NameTheorem { observation } + { + , heading = { + , english = Observation + , french = Observation + , ngerman = Beobachtung + , italian = Osservazione + , portuguese = Observação + , brazilian = Observação + , spanish = Observación + , schinese = 观察 + , tchinese = 觀察 + , japanese = 観察 + , russian = Наблюдение + } + , crefname = { + , english = {Observation}{Observation} + , french = [la]{Observation}[les]{Observation} + , ngerman = {Beobachtung}{Beobachtung} + , italian = [l']{Osservazione}[le]{Osservazione} + , portuguese = [a]{Observação}[as]{Observação} + , brazilian = [a]{Observação}[as]{Observação} + , spanish = [la]{Observación}[las]{Observación} + , schinese = {观察}{观察} + , tchinese = {觀察}{觀察} + , japanese = {観察}{観察} + , russian = {Наблюдение}{Наблюдение} + } + , Crefname = { + , english = {Observation}{Observation} + , french = [La]{Observation}[Les]{Observation} + , ngerman = {Beobachtung}{Beobachtung} + , italian = [L']{Osservazione}[Le]{Osservazione} + , portuguese = [A]{Observação}[As]{Observação} + , brazilian = [A]{Observação}[As]{Observação} + , spanish = [La]{Observación}[Las]{Observación} + , schinese = {观察}{观察} + , tchinese = {觀察}{觀察} + , japanese = {観察}{観察} + , russian = {Наблюдение}{Наблюдение} + } + } + +\NameTheorem { postulate } + { + , heading = { + , english = Postulate + , french = Postulat + , ngerman = Postulat + , italian = Postulato + , portuguese = Postulado + , brazilian = Postulado + , spanish = Postulado + , schinese = 公设 + , tchinese = 公設 + , japanese = 公準 + , russian = Постулат + } + , crefname = { + , english = {Postulate}{Postulate} + , french = [le]{Postulat}[les]{Postulat} + , ngerman = {Postulat}{Postulat} + , italian = [il]{Postulato}[i]{Postulato} + , portuguese = [o]{Postulado}[os]{Postulado} + , brazilian = [o]{Postulado}[os]{Postulado} + , spanish = [el]{Postulado}[los]{Postulado} + , schinese = {公设}{公设} + , tchinese = {公設}{公設} + , japanese = {公準}{公準} + , russian = {Постулат}{Постулат} + } + , Crefname = { + , english = {Postulate}{Postulate} + , french = [Le]{Postulat}[Les]{Postulat} + , ngerman = {Postulat}{Postulat} + , italian = [Il]{Postulato}[I]{Postulato} + , portuguese = [O]{Postulado}[Os]{Postulado} + , brazilian = [O]{Postulado}[Os]{Postulado} + , spanish = [El]{Postulado}[Los]{Postulado} + , schinese = {公设}{公设} + , tchinese = {公設}{公設} + , japanese = {公準}{公準} + , russian = {Постулат}{Постулат} + } + } + +\NameTheorem { problem } + { + , heading = { + , english = Problem + , french = Problème + , ngerman = Problem + , italian = Problema + , portuguese = Problema + , brazilian = Problema + , spanish = Problema + , schinese = 问题 + , tchinese = 問題 + , japanese = 問題 + , russian = Проблема + } + , crefname = { + , english = {Problem}{Problem} + , french = [le]{Problème}[les]{Problème} + , ngerman = {Problem}{Problem} + , italian = [il]{Problema}[i]{Problema} + , portuguese = [o]{Problema}[os]{Problema} + , brazilian = [o]{Problema}[os]{Problema} + , spanish = [el]{Problema}[los]{Problema} + , schinese = {问题}{问题} + , tchinese = {問題}{問題} + , japanese = {問題}{問題} + , russian = {Проблема}{Проблема} + } + , Crefname = { + , english = {Problem}{Problem} + , french = [Le]{Problème}[Les]{Problème} + , ngerman = {Problem}{Problem} + , italian = [Il]{Problema}[I]{Problema} + , portuguese = [O]{Problema}[Os]{Problema} + , brazilian = [O]{Problema}[Os]{Problema} + , spanish = [El]{Problema}[Los]{Problema} + , schinese = {问题}{问题} + , tchinese = {問題}{問題} + , japanese = {問題}{問題} + , russian = {Проблема}{Проблема} + } + } + +\NameTheorem { property } + { + , heading = { + , english = Property + , french = Propriété + , ngerman = Eigenschaft + , italian = Proprietà + , portuguese = Propriedade + , brazilian = Propriedade + , spanish = Propiedad + , schinese = 性质 + , tchinese = 性質 + , japanese = 性質 + , russian = Имущество + } + , crefname = { + , english = {Property}{Property} + , french = [la]{Propriété}[les]{Propriété} + , ngerman = {Eigenschaft}{Eigenschaft} + , italian = [la]{Proprietà}[le]{Proprietà} + , portuguese = [a]{Propriedade}[as]{Propriedade} + , brazilian = [a]{Propriedade}[as]{Propriedade} + , spanish = [la]{Propiedad}[las]{Propiedad} + , schinese = {性质}{性质} + , tchinese = {性質}{性質} + , japanese = {性質}{性質} + , russian = {Имущество}{Имущество} + } + , Crefname = { + , english = {Property}{Property} + , french = [La]{Propriété}[Les]{Propriété} + , ngerman = {Eigenschaft}{Eigenschaft} + , italian = [La]{Proprietà}[Le]{Proprietà} + , portuguese = [A]{Propriedade}[As]{Propriedade} + , brazilian = [A]{Propriedade}[As]{Propriedade} + , spanish = [La]{Propiedad}[Las]{Propiedad} + , schinese = {性质}{性质} + , tchinese = {性質}{性質} + , japanese = {性質}{性質} + , russian = {Имущество}{Имущество} + } + } + +\NameTheorem { proposition } + { + , heading = { + , english = Proposition + , french = Proposition + , ngerman = Proposition + , italian = Proposizione + , portuguese = Proposição + , brazilian = Proposição + , spanish = Proposición + , schinese = 命题 + , tchinese = 命題 + , japanese = 命題 + , russian = Предложение + } + , crefname = { + , english = {Proposition}{Proposition} + , french = [la]{Proposition}[les]{Proposition} + , ngerman = {Proposition}{Proposition} + , italian = [la]{Proposizione}[le]{Proposizione} + , portuguese = [a]{Proposição}[as]{Proposição} + , brazilian = [a]{Proposição}[as]{Proposição} + , spanish = [la]{Proposición}[las]{Proposición} + , schinese = {命题}{命题} + , tchinese = {命題}{命題} + , japanese = {命題}{命題} + , russian = {Предложение}{Предложение} + } + , Crefname = { + , english = {Proposition}{Proposition} + , french = [La]{Proposition}[Les]{Proposition} + , ngerman = {Proposition}{Proposition} + , italian = [La]{Proposizione}[Le]{Proposizione} + , portuguese = [A]{Proposição}[As]{Proposição} + , brazilian = [A]{Proposição}[As]{Proposição} + , spanish = [La]{Proposición}[Las]{Proposición} + , schinese = {命题}{命题} + , tchinese = {命題}{命題} + , japanese = {命題}{命題} + , russian = {Предложение}{Предложение} + } + } + +\NameTheorem { question } + { + , heading = { + , english = Question + , french = Question + , ngerman = Frage + , italian = Domanda + , portuguese = Pergunta + , brazilian = Pergunta + , spanish = Pregunta + , schinese = 问题 + , tchinese = 問題 + , japanese = 問題 + , russian = Вопрос + } + , crefname = { + , english = {Question}{Question} + , french = [la]{Question}[les]{Question} + , ngerman = {Frage}{Frage} + , italian = [la]{Domanda}[le]{Domanda} + , portuguese = [a]{Pergunta}[as]{Pergunta} + , brazilian = [a]{Pergunta}[as]{Pergunta} + , spanish = [la]{Pregunta}[las]{Pregunta} + , schinese = {问题}{问题} + , tchinese = {問題}{問題} + , japanese = {問題}{問題} + , russian = {Вопрос}{Вопрос} + } + , Crefname = { + , english = {Question}{Question} + , french = [La]{Question}[Les]{Question} + , ngerman = {Frage}{Frage} + , italian = [La]{Domanda}[Le]{Domanda} + , portuguese = [A]{Pergunta}[As]{Pergunta} + , brazilian = [A]{Pergunta}[As]{Pergunta} + , spanish = [La]{Pregunta}[Las]{Pregunta} + , schinese = {问题}{问题} + , tchinese = {問題}{問題} + , japanese = {問題}{問題} + , russian = {Вопрос}{Вопрос} + } + } + +\NameTheorem { remark } + { + , heading = { + , english = Remark + , french = Remarque + , ngerman = Bemerkung + , italian = Commento + , portuguese = Comentário + , brazilian = Comentário + , spanish = Comentario + , schinese = 备注 + , tchinese = 備註 + , japanese = 注釈 + , russian = Замечание + } + , crefname = { + , english = {Remark}{Remark} + , french = [la]{Remarque}[les]{Remarque} + , ngerman = {Bemerkung}{Bemerkung} + , italian = [il]{Commento}[i]{Commento} + , portuguese = [o]{Comentário}[os]{Comentário} + , brazilian = [o]{Comentário}[os]{Comentário} + , spanish = [el]{Comentario}[los]{Comentario} + , schinese = {备注}{备注} + , tchinese = {備註}{備註} + , japanese = {注釈}{注釈} + , russian = {Замечание}{Замечание} + } + , Crefname = { + , english = {Remark}{Remark} + , french = [La]{Remarque}[Les]{Remarque} + , ngerman = {Bemerkung}{Bemerkung} + , italian = [Il]{Commento}[I]{Commento} + , portuguese = [O]{Comentário}[Os]{Comentário} + , brazilian = [O]{Comentário}[Os]{Comentário} + , spanish = [El]{Comentario}[Los]{Comentario} + , schinese = {备注}{备注} + , tchinese = {備註}{備註} + , japanese = {注釈}{注釈} + , russian = {Замечание}{Замечание} + } + } + +\NameTheorem { theorem } + { + , heading = { + , english = Theorem + , french = Théorème + , ngerman = Satz + , italian = Teorema + , portuguese = Teorema + , brazilian = Teorema + , spanish = Teorema + , schinese = 定理 + , tchinese = 定理 + , japanese = 定理 + , russian = Теорема + } + , crefname = { + , english = {Theorem}{Theorem} + , french = [le]{Théorème}[les]{Théorème} + , ngerman = {Satz}{Satz} + , italian = [il]{Teorema}[i]{Teorema} + , portuguese = [o]{Teorema}[os]{Teorema} + , brazilian = [o]{Teorema}[os]{Teorema} + , spanish = [el]{Teorema}[los]{Teorema} + , schinese = {定理}{定理} + , tchinese = {定理}{定理} + , japanese = {定理}{定理} + , russian = {Теорема}{Теорема} + } + , Crefname = { + , english = {Theorem}{Theorem} + , french = [Le]{Théorème}[Les]{Théorème} + , ngerman = {Satz}{Satz} + , italian = [Il]{Teorema}[I]{Teorema} + , portuguese = [O]{Teorema}[Os]{Teorema} + , brazilian = [O]{Teorema}[Os]{Teorema} + , spanish = [El]{Teorema}[Los]{Teorema} + , schinese = {定理}{定理} + , tchinese = {定理}{定理} + , japanese = {定理}{定理} + , russian = {Теорема}{Теорема} + } + } + +\endinput +%% +%% End of file `projlib-theorem.sty'. + + +接下来: +1. ✅ 定义 \SetTheorem,用于处理编号和名称样式的问题 +2. ✅ 定义 complexname 与 simplename +3. ✅ 给出定理类环境的初始化,注意 no-theorem 与 no-theorem-numbering 等选项 |