diff options
author | Norbert Preining <norbert@preining.info> | 2024-10-09 03:04:31 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-10-09 03:04:31 +0000 |
commit | 2fdd6360b8943e29f7f2beb9c820913c3e2b3783 (patch) | |
tree | 4ec568f2f0bb86ef000fdc4a4f4822718fbd8801 /macros/latex/contrib | |
parent | e84c1272f5d94f43b893ba3b6b66e9dbf59218e1 (diff) |
CTAN sync 202410090304
Diffstat (limited to 'macros/latex/contrib')
33 files changed, 403 insertions, 1225 deletions
diff --git a/macros/latex/contrib/atveryend/README.md b/macros/latex/contrib/atveryend/README.md index bee5e0cae1..08c31231f8 100644 --- a/macros/latex/contrib/atveryend/README.md +++ b/macros/latex/contrib/atveryend/README.md @@ -1,13 +1,14 @@ -# atveryend +# atveryend package for LaTeX -atveryend package for LaTeX +Version: 2024-08-06 v1.12 +This LaTeX package provides some wrapper commands +around LaTeX end document hooks. -This LaTeX package provides two hooks for \end{document} -that are executed after the hook of \AtEndDocument. -\AfterLastShipout can be used for code that is to be executed -right after the last \clearpage before the aux file -is closed. \AtVeryEndDocument is used for code after closing -and final reading of the aux file. +## Copyright (C) +* 2009-2011 Heiko Oberdiek +* 2016-2024 Oberdiek Package Support Group +## License +LATEX Project Public License, version 1.3c or later. diff --git a/macros/latex/contrib/atveryend/atveryend.dtx b/macros/latex/contrib/atveryend/atveryend.dtx index 24c67081b3..8e9b3bb74c 100644 --- a/macros/latex/contrib/atveryend/atveryend.dtx +++ b/macros/latex/contrib/atveryend/atveryend.dtx @@ -1,12 +1,12 @@ % \iffalse meta-comment % % File: atveryend.dtx -% Version: 2019-12-11 v1.11 +% Version: 2024-08-06 v1.12 % Info: Hooks at the very end of document % % Copyright (C) % 2009-2011 Heiko Oberdiek -% 2016-2019 Oberdiek Package Support Group +% 2016-2024 Oberdiek Package Support Group % https://github.com/ho-tex/atveryend/issues % % This work may be distributed and/or modified under the @@ -80,7 +80,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: atveryend 2019-12-11 v1.11 Hooks at the very end of document (HO)} +\Msg{* Package: atveryend 2024-08-06 v1.12 Hooks at the very end of document (HO)} \Msg{************************************************************************} \keepsilent @@ -92,11 +92,11 @@ This is a generated file. Project: atveryend -Version: 2019-12-11 v1.11 +Version: 2024-08-06 v1.12 Copyright (C) 2009-2011 Heiko Oberdiek - 2016-2019 Oberdiek Package Support Group + 2016-2024 Oberdiek Package Support Group This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either @@ -154,7 +154,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{atveryend.drv}% - [2019-12-11 v1.11 Hooks at the very end of document (HO)]% + [2024-08-06 v1.12 Hooks at the very end of document (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc}[2011/11/22] \begin{document} @@ -168,103 +168,56 @@ and the derived files % \GetFileInfo{atveryend.drv} % % \title{The \xpackage{atveryend} package} -% \date{2019-12-11 v1.11} +% \date{2024-08-06 v1.12} % \author{Heiko Oberdiek\thanks % {Please report any issues at \url{https://github.com/ho-tex/atveryend/issues}}} % % \maketitle % % \begin{abstract} -% This \LaTeX\ package provides two hooks for \verb|\end{document}| -% that are executed after the hook of \cs{AtEndDocument}. -% \cs{AfterLastShipout} can be used for code that is to be executed -% right after the last \cs{clearpage} before the \xext{aux} file -% is closed. \cs{AtVeryEndDocument} is used for code after closing -% and final reading of the \xext{aux} file. +% This \LaTeX\ package is a small wrapper around standard \LaTeX{} hooks at the end +% of a document. +% % \end{abstract} % -% \tableofcontents % % \section{Documentation} -% -% There are packages (e.g. \xpackage{hyperref} \cite{hyperref}, -% \xpackage{lastpage} \cite{lastpage}) -% that want to call code after the typesetting is done, for example -% to remember the last page number. \LaTeX\ provides the hook -% \cs{AtEndDocument} (\xpackage{clsguide} \cite{clsguide}). -% There are packages that use this hook to do their job for -% typesetting pages (e.g. \xpackage{endfloat} emits the floats here -% \cite{endfloat}). -% Also a user might provide additional code in \cs{AtEndDocument}. -% Therefore packages have to call \cs{clearpage} in \cs{AtEndDocument} -% to get after the last shipout page. But this is not too reliable, -% because the right timing is important between packages that want -% or have to do things before the last page is output and packages -% that only work properly if they can reach the point after the -% last shipout. -% -% Therefore the task of this package is to provide additional -% hooks for |\end{document}|. All hooks are called after -% the hook of \cs{AtEndDocument}. -% \begin{declcs}{BeforeClearDocument} \M{code} -% \end{declcs} -% The code is called before the final \cs{clearpage} in -% \cs{enddocument}. However it is unknown, whether the last -% page is already shipped out or if this will be triggered by the -% final \cs{clearpage}. -% +% +% In the past this package patched the command \cs{enddocument} to +% provided two additional hooks for \verb|\end{document}| +% that were executed after the hook of \cs{AtEndDocument}. +% +% Since 2020 this patching is no longer needed as the +% hooks are provided by \LaTeX{} directly. Since this time the code of the package +% was no longer used as \LaTeX{} suppressed the loading of the package +% and replaced the commands by commands based on the new hooks. In version 1.12 +% this new code was moved into \texttt{atveryend} directly. +% +% The package defines the following user commands and maps them +% to \cs{AddToHook} calls. A description of the used +% hooks can be found in \texttt{lhooks-doc.pdf}. +% % \begin{declcs}{AfterLastShipout} \M{code} % \end{declcs} -% The code is called after the final \cs{clearpage} of \cs{enddocument} -% before the main \xext{aux} file is closed. This is the right place -% to remember the last page in the \xext{aux} file, for instance. +% This adds the code to the \texttt{enddocument/afterlastpage} hook. % % \begin{declcs}{AtVeryEndDocument} \M{code} % \end{declcs} -% The code is called after the \xext{aux} file is closed and read in again. -% It is the place for final checks, rerun hints, final messages. +% This adds the code to the \texttt{enddocument/afteraux} hook. % % \begin{declcs}{AtEndAfterFileList} \M{code} % \end{declcs} -% After the \xext{aux} file closing and reading \hologo{LaTeX} -% prints the file list if requested by \cs{listfiles}. -% Then this hook is executed. -% +% This adds the code to the \texttt{enddocument/info} hook.% +% % \begin{declcs}{AtVeryVeryEnd} \M{code} % \end{declcs} -% This code is called right before the final \cs{@@end}. -% -% \subsection{Related work} -% -% \begin{description} -% \item[Package \xpackage{scrfile}:] -% Markus Kohm has written package \xpackage{scrlfile} -% (part of KOMA-Script \cite{koma}) -% that provides -% hooks \cs{BeforeClosingMainAux} and after \cs{AfterReadingMainAux}. -% They have the same function as the hooks of this package. In fact -% this package uses them, if they are available. -% \item[Class \xclass{revtex4-1}:] -% This class calls \cs{clear@document} in \cs{enddocument} -% that wraps the final call of \cs{clearpage}. -% Thus it can be used as hook to call stuff after that \cs{clearpage}. -% This is also done by this package. -% \item[Package \xpackage{etoolbox}:] -% It provides \cs{AfterEndDocument}, a hook right before -% \cs{deadcycles} or \cs{@@end} \cite{etoolbox}. -% \end{description} -% This package tries to combine as many approaches as possible: -% \begin{itemize} -% \item It looks for a known \cs{enddocument} and redefines it. -% \item Hooks that are provided by others are used (package -% \xpackage{scrlfile} or class \xclass{revtex4-1}. -% \item It redefines \cs{@checkend} and \cs{@dofilelist} to insert -% the hooks similar to package \xpackage{scrlfile}. -% \item The hook execution is wrapped in a macro that -% is redefined by its first call to prevent calling the hook -% more than once. -% \end{itemize} +% This adds the code to the \texttt{enddocument/end} hook. % +% \begin{declcs}{BeforeClearDocument} \M{code} +% \end{declcs} +% This adds the code to the \texttt{enddocument} hook. +% It is recommended to use \cs{AtEndDocument} instead. +% % \StopEventually{ % } % @@ -273,899 +226,45 @@ and the derived files %<*package> % \end{macrocode} % -% \begin{macrocode} -\begingroup\catcode61\catcode48\catcode32=10\relax% - \catcode13=5 % ^^M - \endlinechar=13 % - \catcode123=1 % { - \catcode125=2 % } - \catcode64=11 % @ - \def\x{\endgroup - \expandafter\edef\csname AtVeryEnd@AtEnd\endcsname{% - \endlinechar=\the\endlinechar\relax - \catcode13=\the\catcode13\relax - \catcode32=\the\catcode32\relax - \catcode35=\the\catcode35\relax - \catcode61=\the\catcode61\relax - \catcode64=\the\catcode64\relax - \catcode123=\the\catcode123\relax - \catcode125=\the\catcode125\relax - }% - }% -\x\catcode61\catcode48\catcode32=10\relax% -\catcode13=5 % ^^M -\endlinechar=13 % -\catcode35=6 % # -\catcode64=11 % @ -\catcode123=1 % { -\catcode125=2 % } -\def\TMP@EnsureCode#1#2{% - \edef\AtVeryEnd@AtEnd{% - \AtVeryEnd@AtEnd - \catcode#1=\the\catcode#1\relax - }% - \catcode#1=#2\relax -} -\TMP@EnsureCode{9}{10}% (tab) -\TMP@EnsureCode{39}{12}% ' -\TMP@EnsureCode{40}{12}% ( -\TMP@EnsureCode{41}{12}% ) -\TMP@EnsureCode{42}{12}% * -\TMP@EnsureCode{45}{12}% - -\TMP@EnsureCode{46}{12}% . -\TMP@EnsureCode{47}{12}% / -\TMP@EnsureCode{62}{12}% > -\TMP@EnsureCode{91}{12}% [ -\TMP@EnsureCode{93}{12}% ] -\TMP@EnsureCode{96}{12}% ` -\edef\AtVeryEnd@AtEnd{\AtVeryEnd@AtEnd\noexpand\endinput} -% \end{macrocode} -% % Package identification. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{atveryend}% - [2019-12-11 v1.11 Hooks at the very end of document (HO)] + [2024-08-06 v1.12 Hooks at the very end of document (HO)] % \end{macrocode} % % \subsection{Tools} % -% \begin{macro}{\AtVeryEnd@ifundefined} -% \begin{macrocode} -\def\AtVeryEnd@ifundefined#1{% - \begingroup\expandafter\expandafter\expandafter\endgroup - \expandafter\ifx\csname #1\endcsname\relax - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi -} -% \end{macrocode} -% \end{macro} -% -% \subsection{Hooks} -% -% \begin{macro}{\AtVeryEnd@BeforeClearDocumentHook} -% \begin{macrocode} -\let\AtVeryEnd@BeforeClearDocumentHook\@empty -% \end{macrocode} -% \end{macro} -% \begin{macro}{\AtVeryEnd@AfterLastShipoutHook} -% \begin{macrocode} -\let\AtVeryEnd@AfterLastShipoutHook\@empty -% \end{macrocode} -% \end{macro} -% \begin{macro}{\AtVeryEnd@AtVeryEndDocumentHook} -% \begin{macrocode} -\let\AtVeryEnd@AtVeryEndDocumentHook\@empty -% \end{macrocode} -% \end{macro} -% \begin{macro}{\AtVeryEnd@AtEndAfterFileListHook} -% \begin{macrocode} -\let\AtVeryEnd@AtEndAfterFileListHook\@empty -% \end{macrocode} -% \end{macro} -% \begin{macro}{\AtVeryEnd@AtVeryVeryEndHook} -% \begin{macrocode} -\let\AtVeryEnd@AtVeryVeryEndHook\@empty -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\BeforeClearDocument} -% \begin{macrocode} -\newcommand*{\BeforeClearDocument}{% - \g@addto@macro\AtVeryEnd@BeforeClearDocumentHook -} -% \end{macrocode} -% \end{macro} % \begin{macro}{\AfterLastShipout} % \begin{macrocode} -\newcommand*{\AfterLastShipout}{% - \g@addto@macro\AtVeryEnd@AfterLastShipoutHook -} +\newcommand\AfterLastShipout {\AddToHook{enddocument/afterlastpage}} % \end{macrocode} % \end{macro} % \begin{macro}{\AtVeryEndDocument} % \begin{macrocode} -\newcommand*{\AtVeryEndDocument}{% - \g@addto@macro\AtVeryEnd@AtVeryEndDocumentHook -} +\newcommand\AtVeryEndDocument {\AddToHook{enddocument/afteraux}} % \end{macrocode} % \end{macro} % \begin{macro}{\AtEndAfterFileList} % \begin{macrocode} -\newcommand*{\AtEndAfterFileList}{% - \g@addto@macro\AtVeryEnd@AtEndAfterFileListHook -} +\newcommand\AtEndAfterFileList{\AddToHook{enddocument/info}} % \end{macrocode} % \end{macro} % \begin{macro}{\AtVeryVeryEnd} % \begin{macrocode} -\newcommand*{\AtVeryVeryEnd}{% - \g@addto@macro\AtVeryEnd@AtVeryVeryEndHook -} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\Call@BeforeClearDocument} -% \begin{macrocode} -\newcommand*{\Call@BeforeClearDocument}{% - \let\BeforeClearDocument\@firstofone - \ifx\AtVeryEnd@BeforeClearDocumentHook\@empty - \PackageInfo{atveryend}{Empty hook `BeforeClearDocument'}% - \else - \PackageInfo{atveryend}{Executing hook `BeforeClearDocument'}% - \AtVeryEnd@BeforeClearDocumentHook - \fi - \global\let\AtVeryEnd@BeforeClearDocumentHook\@undefined - \global\let\Call@BeforeClearDocument\relax -} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\Call@AfterLastShipout} -% \begin{macrocode} -\newcommand*{\Call@AfterLastShipout}{% - \let\AfterLastShipout\@firstofone - \ifx\AtVeryEnd@AfterLastShipoutHook\@empty - \PackageInfo{atveryend}{Empty hook `AfterLastShipout'}% - \else - \PackageInfo{atveryend}{Executing hook `AfterLastShipout'}% - \AtVeryEnd@AfterLastShipoutHook - \fi - \global\let\AtVeryEnd@AfterLastShipoutHook\@undefined - \global\let\Call@AfterLastShipout\relax -} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\Call@AtVeryEndDocument} -% \begin{macrocode} -\newcommand*{\Call@AtVeryEndDocument}{% - \let\AtVeryEndDocument\@firstofone - \ifx\AtVeryEnd@AtVeryEndDocumentHook\@empty - \PackageInfo{atveryend}{Empty hook `AtVeryEndDocument'}% - \else - \PackageInfo{atveryend}{Executing hook `AtVeryEndDocument'}% - \AtVeryEnd@AtVeryEndDocumentHook - \fi - \global\let\AtVeryEnd@AtVeryEndDocumentHook\@undefined - \global\let\Call@AtVeryEndDocument\relax -} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\Call@AtEndAfterFileList} -% \begin{macrocode} -\newcommand*{\Call@AtEndAfterFileList}{% - \Call@AtVeryEndDocument - \let\AtEndAfterFileList\@firstofone - \ifx\AtVeryEnd@AtEndAfterFileListHook\@empty - \PackageInfo{atveryend}{Empty hook `AtEndAfterFileList'}% - \else - \PackageInfo{atveryend}{Executing hook `AtEndAfterFileList'}% - \AtVeryEnd@AtEndAfterFileListHook - \fi - \global\let\AtVeryEnd@AtEndAfterFileListHook\@undefined - \global\let\Call@AtEndAfterFileList\relax -} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\Call@AtVeryVeryEnd} -% \begin{macrocode} -\newcommand*{\Call@AtVeryVeryEnd}{% - \Call@AtEndAfterFileList - \let\AtVeryVeryEnd\@firstofone - \ifx\AtVeryEnd@AtVeryVeryEndHook\@empty - \PackageInfo{atveryend}{Empty hook `AtVeryVeryEnd'}% - \else - \PackageInfo{atveryend}{Executing hook `AtVeryVeryEnd'}% - \AtVeryEnd@AtVeryVeryEndHook - \fi - \global\let\AtVeryEnd@AtVeryVeryEndHook\@undefined - \global\let\Call@AtVeryVeryEnd\relax -} -% \end{macrocode} -% \end{macro} -% -% \subsection{Redefining \cs{enddocument}} -% -% This approach looks for known versions of \cs{enddocument} -% and redefines it. Class \xclass{seminar} -% and package \xpackage{slidesec} are not checked, because -% there would be too much combinations to check. -% -% \subsubsection{\LaTeX\ kernel} -% -% \begin{macro}{\AtVeryEnd@test@standard} -% \begin{macrocode} -\def\AtVeryEnd@test@standard{% - \let\AtEndDocument\@firstofone - \@enddocumenthook - \@checkend{document}% - \clearpage - \begingroup - \if@filesw - \immediate\closeout\@mainaux - \let\@setckpt\@gobbletwo - \let\@newl@bel\@testdef - \@tempswafalse - \makeatletter - \input\jobname.aux % - \fi - \@dofilelist - \ifdim \font@submax >\fontsubfuzz\relax - \@font@warning{Size substitutions with differences\MessageBreak - up to \font@submax\space have occurred.\@gobbletwo}% - \fi - \@defaultsubs - \@refundefined - \if@filesw - \ifx \@multiplelabels \relax - \if@tempswa - \@latex@warning@no@line{Label(s) may have changed. % - Rerun to get cross-references right}% - \fi - \else - \@multiplelabels - \fi - \fi - \endgroup - \deadcycles\z@ - \@@end -} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\AtVeryEnd@enddocument@standard} -% \begin{macrocode} -\def\AtVeryEnd@enddocument@standard{% - \let\AtEndDocument\@firstofone - \@enddocumenthook - \@checkend{document}% - \Call@BeforeClearDocument - \clearpage - \Call@AfterLastShipout - \begingroup - \if@filesw - \immediate\closeout\@mainaux - \let\@setckpt\@gobbletwo - \let\@newl@bel\@testdef - \@tempswafalse - \makeatletter - \input\jobname.aux % - \fi - \Call@AtVeryEndDocument - \@dofilelist - \Call@AtEndAfterFileList - \ifdim \font@submax >\fontsubfuzz\relax - \@font@warning{Size substitutions with differences\MessageBreak - up to \font@submax\space have occurred.\@gobbletwo}% - \fi - \@defaultsubs - \@refundefined - \if@filesw - \ifx \@multiplelabels \relax - \if@tempswa - \@latex@warning@no@line{Label(s) may have changed. % - Rerun to get cross-references right}% - \fi - \else - \@multiplelabels - \fi - \fi - \endgroup - \deadcycles\z@ - \Call@AtVeryVeryEnd - \@@end -} -% \end{macrocode} -% \end{macro} -% -% \subsubsection{\LaTeX\ kernel 2011/06/27} -% -% The \hologo{LaTeX2e} release 2011/06/27 has changed \cs{enddocument} -% (\cs{input} is replaced by \cs{@@input}). -% \begin{macro}{\AtVeryEnd@test@standard20110627} -% \begin{macrocode} -\expandafter\def\csname AtVeryEnd@test@standard20110627\endcsname{% - \let\AtEndDocument\@firstofone - \@enddocumenthook - \@checkend{document}% - \clearpage - \begingroup - \if@filesw - \immediate\closeout\@mainaux - \let\@setckpt\@gobbletwo - \let\@newl@bel\@testdef - \@tempswafalse - \makeatletter - \@@input\jobname.aux % - \fi - \@dofilelist - \ifdim \font@submax >\fontsubfuzz\relax - \@font@warning{Size substitutions with differences\MessageBreak - up to \font@submax\space have occurred.\@gobbletwo}% - \fi - \@defaultsubs - \@refundefined - \if@filesw - \ifx \@multiplelabels \relax - \if@tempswa - \@latex@warning@no@line{Label(s) may have changed. % - Rerun to get cross-references right}% - \fi - \else - \@multiplelabels - \fi - \fi - \endgroup - \deadcycles\z@ - \@@end -} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\AtVeryEnd@enddocument@standard20110627} -% \begin{macrocode} -\expandafter\def\csname AtVeryEnd@enddocument@standard20110627\endcsname{% - \let\AtEndDocument\@firstofone - \@enddocumenthook - \@checkend{document}% - \Call@BeforeClearDocument - \clearpage - \Call@AfterLastShipout - \begingroup - \if@filesw - \immediate\closeout\@mainaux - \let\@setckpt\@gobbletwo - \let\@newl@bel\@testdef - \@tempswafalse - \makeatletter - \@@input\jobname.aux % - \fi - \Call@AtVeryEndDocument - \@dofilelist - \Call@AtEndAfterFileList - \ifdim \font@submax >\fontsubfuzz\relax - \@font@warning{Size substitutions with differences\MessageBreak - up to \font@submax\space have occurred.\@gobbletwo}% - \fi - \@defaultsubs - \@refundefined - \if@filesw - \ifx \@multiplelabels \relax - \if@tempswa - \@latex@warning@no@line{Label(s) may have changed. % - Rerun to get cross-references right}% - \fi - \else - \@multiplelabels - \fi - \fi - \endgroup - \deadcycles\z@ - \Call@AtVeryVeryEnd - \@@end -} -% \end{macrocode} -% \end{macro} -% -% \subsubsection{Package \xpackage{booklet}, file \xpackage{2up.tex}} -% -% \begin{macro}{\AtVeryEnd@test@booklet} -% \begin{macrocode} -\expandafter\def\expandafter\AtVeryEnd@test@booklet\expandafter{% - \expandafter\twoupclearpage - \AtVeryEnd@test@standard -} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\AtVeryEnd@enddocument@booklet} -% \begin{macrocode} -\expandafter\def\expandafter\AtVeryEnd@enddocument@booklet\expandafter{% - \expandafter\twoclearpage - \AtVeryEnd@enddocument@standard -} -% \end{macrocode} -% \end{macro} -% -% \subsubsection{Class \xclass{dinbrief}} -% -% \begin{macro}{\AtVeryEnd@test@dinbrief} -% \begin{macrocode} -\def\AtVeryEnd@test@dinbrief{% - \@checkend{document} % - \newpage - \begingroup - \if@filesw - \ifnum\c@labelgen>0 % - \immediate\closeout\@mainlbl - \makeatletter - \input \jobname@lbl\relax - \clearpage - \fi - \immediate\closeout\@mainaux - \fi - \endgroup - \deadcycles\z@ - \@@end -} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\AtVeryEnd@enddocument@dinbrief} -% \begin{macrocode} -\def\AtVeryEnd@enddocument@dinbrief{% - \@checkend{document}% - \Call@BeforeClearDocument - \newpage - \Call@AfterLastShipout - \begingroup - \if@filesw - \ifnum\c@labelgen>\z@ - \immediate\closeout\@mainlbl - \makeatletter - \input \jobname@lbl\relax - \clearpage - \fi - \immediate\closeout\@mainaux - \fi - \Call@AtVeryEndDocument - \csname @dofilelist\endcsname - \Call@AtEndAfterFileList - \endgroup - \deadcycles\z@ - \Call@AtVeryVeryEnd - \@@end -} -% \end{macrocode} -% \end{macro} -% -% \subsubsection{Class \xclass{combine}} -% -% \begin{macro}{\AtVeryEnd@test@combine} -% \begin{macrocode} -\def\AtVeryEnd@test@combine{% - \@enddocumenthook - \@checkend{document}% - \clearpage - \begingroup - \if@filesw - \immediate\closeout\@mainaux - \immediate\closeout\@partaux - \let\@setckpt\@gobbletwo - \let\@newl@bel\@testdef - \@tempswafalse - \makeatletter \input\c@lmainauxfile %% change here - \fi - \c@lenddoca %% a replacement - \@refundefined - \endgroup - \deadcycles\z@ - \@@end -} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\AtVeryEnd@enddocument@combine} -% \begin{macrocode} -\def\AtVeryEnd@enddocument@combine{% - \@enddocumenthook - \@checkend{document}% - \Call@BeforeClearDocument - \clearpage - \Call@AfterLastShipout - \begingroup - \if@filesw - \immediate\closeout\@mainaux - \immediate\closeout\@partaux - \let\@setckpt\@gobbletwo - \let\@newl@bel\@testdef - \@tempswafalse - \makeatletter \input\c@lmainauxfile %% change here - \fi - \Call@AtVeryEndDocument - \c@lenddoca %% a replacement - \@refundefined - \endgroup - \deadcycles\z@ - \Call@AtVeryVeryEnd - \@@end -} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\AtVeryEnd@test@c@lenddoca} -% \begin{macrocode} -\long\def\AtVeryEnd@test@c@lenddoca{% - \@dofilelist - \ifdim\font@submax>\fontsubfuzz\relax - \@font@warning{% - Size substitutions with differences\MessageBreak - up to \font@submax\space have occured.\@gobbletwo - }% - \fi - \@defaultsubs - \if@filesw - \ifx\@multiplelabels\relax - \if@tempswa - \@latex@warning@no@line{% - Label(s) may have changed. % - Rerun to get cross-references right% - }% - \fi - \else - \@multiplelabels - \fi - \fi -} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\c@lenddoca} -% \begin{macrocode} -\ifx\AtVeryEnd@c@lenddoca\c@lenddoca - \def\c@lenddoca{% - \@dofilelist - \Call@AtEndAfterFileList - \ifdim\font@submax>\fontsubfuzz\relax - \@font@warning{% - Size substitutions with differences\MessageBreak - up to \font@submax\space have occured.\@gobbletwo - }% - \fi - \@defaultsubs - \if@filesw - \ifx\@multiplelabels\relax - \if@tempswa - \@latex@warning@no@line{% - Label(s) may have changed. % - Rerun to get cross-references right% - }% - \fi - \else - \@multiplelabels - \fi - \fi - }% -\fi -% \end{macrocode} -% \end{macro} -% -% \subsubsection{Class \xpackage{jpsj2}} -% -% \begin{macro}{\AtVeryEnd@test@jpsj} -% \begin{macrocode} -\def\AtVeryEnd@test@jpsj{% - \if@lastpagebalancing - \global\let\@outputdblcol=\balancing@outputdblcol - \fi - \@checkend{document}% - \clearpage - \begingroup - \if@filesw - \immediate\closeout\@mainaux - \def\global\@namedef##1##2{}% - \def\newlabel{\@testdef r}% - \def\bibcite{\@testdef b}% - \@tempswafalse - \makeatletter - \input \jobname.aux % - \if@tempswa - \@warning{% - Label(s) may have changed. % - Rerun to get cross-references right% - }% - \fi - \fi - \endgroup - \deadcycles\z@ - \@@end -} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\AtVeryEnd@enddocument@jpsj} -% \begin{macrocode} -\def\AtVeryEnd@enddocument@jpsj{% - \if@lastpagebalancing - \global\let\@outputdblcol=\balancing@outputdblcol - \fi - \@checkend{document}% - \Call@BeforeClearDocument - \clearpage - \Call@AfterLastShipout - \begingroup - \if@filesw - \immediate\closeout\@mainaux - \def\global\@namedef##1##2{}% - \def\newlabel{\@testdef r}% - \def\bibcite{\@testdef b}% - \@tempswafalse - \makeatletter - \input \jobname.aux % - \if@tempswa - \@warning{% - Label(s) may have changed. % - Rerun to get cross-references right% - }% - \fi - \fi - \Call@AtVeryEndDocument - \csname @dofilelist\endcsname - \Call@AtEndAfterFileList - \endgroup - \deadcycles\z@ - \Call@AtVeryVeryEnd - \@@end -} -% \end{macrocode} -% \end{macro} -% -% \subsubsection{Testing and redefining} -% -% \begin{macro}{\AtVeryEnd@Test} -% \begin{macrocode} -\def\AtVeryEnd@Test#1#2{% - \expandafter\ifx\csname AtVeryEnd@test@#2\endcsname#1% - \expandafter\let\expandafter#1% - \csname AtVeryEnd@enddocument@#2\endcsname - \begingroup - \let\on@line\@empty - \PackageInfo{atveryend}{% - \string#1 detected (#2)% - }% - \endgroup - \expandafter\AtVeryEnd@SkipToNil - \fi -} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\AtVeryEnd@SkipToNil} -% \begin{macrocode} -\def\AtVeryEnd@SkipToNil#1\@nil{} +\newcommand\AtVeryVeryEnd {\AddToHook{enddocument/end}} % \end{macrocode} % \end{macro} -% \begin{macro}{\AtVeryEnd@RedefEndDocument} +% \begin{macro}{\BeforeClearDocument} % \begin{macrocode} -\def\AtVeryEnd@RedefEndDocument#1{% - \ifx#1\@undefined - \else - \AtVeryEnd@Test#1{standard20110627}% - \AtVeryEnd@Test#1{standard}% - \AtVeryEnd@Test#1{booklet}% - \AtVeryEnd@Test#1{dinbrief}% - \AtVeryEnd@Test#1{combine}% - \AtVeryEnd@Test#1{jpsj}% - \AtVeryEnd@SkipToNil - \@nil - \fi -} +\newcommand\BeforeClearDocument{\AddToHook{enddocument}} % \end{macrocode} % \end{macro} -% \begin{macrocode} -\AtVeryEnd@RedefEndDocument\enddocument -\AtVeryEnd@RedefEndDocument\AP@enddocument % afterpage.sty -\AtVeryEnd@RedefEndDocument\hyper@back@cite@enddocument % htx-bc.sty -\AtVeryEnd@RedefEndDocument\hyper@enddocument % hyper.sty -\AtVeryEnd@RedefEndDocument\hyper@fn@enddocument % hyper.sty -\AtVeryEnd@RedefEndDocument\cweb@save@enddocument % cweb.cls -\AtVeryEnd@RedefEndDocument\prev@enddocument % flushend.sty -\AtVeryEnd@RedefEndDocument\endorigdocument % gaceta.cls -\AtVeryEnd@RedefEndDocument\keependdoc % aguplus.sty -\AtVeryEnd@RedefEndDocument\EMenddocument % t-angles.sty -\AtVeryEnd@RedefEndDocument\docmute@enddocument % docmute.sty -\AtVeryEnd@RedefEndDocument\a@enddocument % alatex.sty -\AtVeryEnd@RedefEndDocument\enddocumentasusual % frenchle.sty -\AtVeryEnd@RedefEndDocument\old@enddocument % uwthesis.cls -% \end{macrocode} -% -% \subsection{Hack into \cs{enddocument}} -% -% \begin{macrocode} -\def\AtVeryEnd@document{document}% -\def\AtVeryEnd@RedefCheckEnd{% - \expandafter\def\expandafter\@checkend - \expandafter##\expandafter1\expandafter{% - \@checkend{##1}% - \def\AtVeryEnd@temp{##1}% - \ifx\AtVeryEnd@temp\AtVeryEnd@document - \let\AtVeryEnd@OrgClearpage\clearpage - \def\clearpage{% - \let\clearpage\AtVeryEnd@OrgClearpage - \Call@BeforeClearDocument - \clearpage - \Call@AfterLastShipout - }% - \fi - }% - \aftergroup\AtVeryEnd@RedefCheckEnd -}% -\AtBeginDocument{% - \AtEndDocument{% - \AtVeryEnd@RedefCheckEnd - }% -} -% \end{macrocode} -% -% \begin{macrocode} -\AtEndDocument{% - \@ifundefined{@dofilelist}{% - \gdef\@dofilelist{% - \Call@AtVeryEndDocument - \Call@AtEndAfterFileList - }% - }{% - \begingroup - \toks@\expandafter{\@dofilelist}% - \xdef\@dofilelist{% - \noexpand\Call@AtVeryEndDocument - \the\toks@ - \noexpand\Call@AtEndAfterFileList - }% - \endgroup - }% -} -% \end{macrocode} -% -% \subsection{Using hooks of other packages} -% -% \subsubsection{Package \xpackage{scrlfile}} -% -% \begin{macrocode} -\AtBeginDocument{% - \@ifpackageloaded{scrlfile}{% - \AtVeryEnd@ifundefined{BeforeClosingMainAux}{}{% - \BeforeClosingMainAux{\Call@AfterLastShipout}% - }% - \AtVeryEnd@ifundefined{AfterReadingMainAux}{}{% - \AfterReadingMainAux{\Call@AtVeryEndDocument}% - }% - }{}% -% \end{macrocode} -% -% \subsubsection{Package \xpackage{etoolbox}} -% -% \begin{macrocode} - \@ifpackageloaded{etoolbox}{% - \AtVeryEnd@ifundefined{AfterEndDocument}{}{% - \AfterEndDocument{\Call@AtVeryEndDocument}% - }% - }{}% -% \end{macrocode} -% \begin{macrocode} -} -% \end{macrocode} -% -% \subsection{Class \xclass{letter}} -% -% The class \xclass{letter} and some similar classes -% insert material (\cs{@startlabels}) at the end of the document. -% However, this method violates -% a precondition of this package that the \cs{clearpage} in -% \cs{enddocument} is the final call with no material at -% later times. Therefore we move the label making -% from the \xext{aux} file to \cs{AtEndDocument}. -% \begin{macrocode} -\def\AtVeryEnd@temp{% - \AtBeginDocument{% - \let\@startlabels\startlabels - \let\@mlabel\mlabel - \if@filesw - \immediate\write\@mainaux{\string\@startlabels}% - \fi - }% - \AtEndDocument{% - \if@filesw - \immediate\write\@mainaux{\string\clearpage}% - \fi - }% -} -\ifx\makelabels\AtVeryEnd@temp -\else - \expandafter\AtVeryEnd@AtEnd -\fi% -\let\AtVeryEnd@PatchLetter=N% -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname endletter\endcsname\relax -\else - \long\def\AtVeryEnd@TestEndLetter#1\@auxout#2#3\AtVeryEnd@Nil{% - \def\AtVeryEnd@temp{#2}% - \ifx\AtVeryEnd@temp\@empty - \else - \@onelevel@sanitize\AtVeryEnd@temp - \edef\AtVeryEnd@StringMlabel{% - \string\string - \string\@mlabel - \expandafter\@gobble\string\{% - }% - \def\AtVeryEnd@CatchFirst##1##2##3##4##5##6##7##8{% - ##1##2##3##4##5##6##7##8\AtVeryEnd@CatchSecond - }% - \def\AtVeryEnd@CatchSecond##1##2##3##4##5##6##7##8##9\@nil{% - ##1##2##3##4##5##6##7##8% - }% - \edef\AtVeryEnd@temp{% - \expandafter\AtVeryEnd@CatchFirst\AtVeryEnd@temp - {}{}{}{}{}{}{}{}% - {}{}{}{}{}{}{}{}% - \@nil - }% - \ifx\AtVeryEnd@temp\AtVeryEnd@StringMlabel - \expandafter\def\expandafter\endletter\expandafter{% - \endletter - \begingroup - \let\\=\relax - \let\protect\@unexpandable@protect - \let\@mlabel=\relax - \edef\x{\endgroup - \noexpand\AtEndDocument{% - \@gobble#2% - }% - }% - \x - }% - \let\AtVeryEnd@PatchLetter=Y% - \fi - \fi - }% - \expandafter\AtVeryEnd@TestEndLetter\endletter - \@auxout{}\AtVeryEnd@Nil -\fi -\ifx\AtVeryEnd@PatchLetter Y% - \begingroup - \let\on@line\@empty - \PackageInfo{atveryend}{% - \@backslashchar makelabels detected. % - Moving labels\MessageBreak - from `.aux' file to \@backslashchar AtEndDocument% - }% - \endgroup - \def\makelabels{% - \AtBeginDocument{% - \let\@startlabels\startlabels - \let\@mlabel\mlabel - }% - }% - \AtEndDocument{% - \AtVeryEnd@ifundefined{@startlabels}{% - }{% - \clearpage - \@startlabels - }% - }% - \AfterLastShipout{% - \let\@startlabels\relax - \let\@mlabel\@gobbletwo - }% -\else - \PackageWarningNoLine{atveryend}{% - \@backslashchar makelabels detected, but labels cannot\MessageBreak - be moved to \@backslashchar AtEndDocument, because\MessageBreak - \@backslashchar endletter is not in expected form% - }% -\fi -% \end{macrocode} % % \begin{macrocode} -\AtVeryEnd@AtEnd% %</package> % \end{macrocode} -%% \section{Installation} +% \section{Installation} % % \subsection{Download} % @@ -1175,28 +274,7 @@ and the derived files % \item[\CTAN{macros/latex/contrib/atveryend/atveryend.dtx}] The source file. % \item[\CTAN{macros/latex/contrib/atveryend/atveryend.pdf}] Documentation. % \end{description} -% -% -% \paragraph{Bundle.} All the packages of the bundle `atveryend' -% are also available in a TDS compliant ZIP archive. There -% the packages are already unpacked and the documentation files -% are generated. The files and directories obey the TDS standard. -% \begin{description} -% \item[\CTANinstall{install/macros/latex/contrib/atveryend.tds.zip}] -% \end{description} -% \emph{TDS} refers to the standard ``A Directory Structure -% for \TeX\ Files'' (\CTANpkg{tds}). Directories -% with \xfile{texmf} in their name are usually organized this way. -% -% \subsection{Bundle installation} -% -% \paragraph{Unpacking.} Unpack the \xfile{atveryend.tds.zip} in the -% TDS tree (also known as \xfile{texmf} tree) of your choice. -% Example (linux): -% \begin{quote} -% |unzip atveryend.tds.zip -d ~/texmf| -% \end{quote} -% +% % \subsection{Package installation} % % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting @@ -1332,51 +410,6 @@ and the derived files % suggestions and comments. % \end{description} % -% \begin{thebibliography}{9} -% -% \bibitem{clsguide} -% The \LaTeX3 Project: -% \textit{\LaTeX2e\ for class and package writers} -% 2006/02/15; -% \CTANpkg{clsguide}. -% -% \bibitem{endfloat} -% James Darrell McCauley, Jeff Goldberg: -% \textit{The \xpackage{endfloat} package}; -% 1995/10/11 v2.4i; -% \CTANpkg{endfloat}. -% -% \bibitem{etoolbox} -% Philipp Lehmann: -% \textit{The \xpackage{etoolbox} package}; -% 2009/08/06 v1.8; -% \CTANpkg{etoolbox}. -% -% \bibitem{hyperref} -% Sebastian Rahtz, Heiko Oberdiek: -% \textit{The \xpackage{hyperref} package}; -% 2009/12/05 v6.79l; -% \CTANpkg{hyperref}. -% -% \bibitem{koma} -% Markus Kohm: -% \textit{KOMA-Script}; -% 2009/07/24 v3.04a; -% \url{https://www.komascript.de/}. -% -% \bibitem{lastpage} -% Jeff Goldberg: -% \textit{The \xpackage{lastpage} package}; -% 1994/07/20 v0.1b; -% \CTANpkg{lastpage}. -% -% \bibitem{revtex} -% APS, AIP, Arthur Orgawa; -% ReVTeX 4.1; -% 2009/10/13 v4.1; -% \url{http://authors.aps.org/revtex4/}. -% -% \end{thebibliography} % % \begin{History} % \begin{Version}{2009/12/06 v1.0} @@ -1434,6 +467,10 @@ and the derived files % \begin{Version}{2019-12-11 v1.11} % \item Updated % \end{Version} +% +% \begin{Version}{2024-08-06 v1.12} +% \item Switch to kernel hooks +% \end{Version} % \end{History} % % \PrintIndex diff --git a/macros/latex/contrib/atveryend/atveryend.pdf b/macros/latex/contrib/atveryend/atveryend.pdf Binary files differindex 04b0fcc205..ebd947940d 100644 --- a/macros/latex/contrib/atveryend/atveryend.pdf +++ b/macros/latex/contrib/atveryend/atveryend.pdf diff --git a/macros/latex/contrib/easybook/README.md b/macros/latex/contrib/easybook/README.md index 2d2798797e..6d6f3bee0c 100644 --- a/macros/latex/contrib/easybook/README.md +++ b/macros/latex/contrib/easybook/README.md @@ -1,5 +1,5 @@ # The `easybook` document class -Easily typesetting Chinese theses or books (v2024ee) +Easily typesetting Chinese theses or books (v2024ef) ## Abstract `easybook` is a pure academic template created based on the `ctexbook` book document class. It also has the functions of `book` and `article` document class. Combined with the general framework design of the theses of many universities in China, providing multiple commands and interfaces allows users to easily customize the theses templates. Its basic macro package `easybase` can also be used with `ctex` and standard document classes. diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index bdfebd96d0..8f960d5c95 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -14,7 +14,7 @@ % This work has the LPPL maintenance status `maintained'. %<class|package>\NeedsTeXFormat{LaTeX2e}[2021/11/15] %<*class> -\ProvidesExplClass{easybook}{2024/10/03}{2024ee} +\ProvidesExplClass{easybook}{2024/10/08}{2024ef} {Easily typesetting Chinese theses or books} \bool_new:N \l__eb_compile_draft_bool @@ -43,6 +43,7 @@ class.code:n = { }, floatpage.code:n = { }, theorem .code:n = { }, + chem .code:n = { }, unknown .code:n = \clist_gput_right:NV \g__eb_doc_options_clist \CurrentOption } @@ -301,7 +302,7 @@ %</class> %<*package> \RequirePackage{etoolbox} -\ProvidesExplPackage{easybase}{2024/10/03}{2024ee} +\ProvidesExplPackage{easybase}{2024/10/08}{2024ef} {Easily typesetting Chinese theses or books} \cs_generate_variant:Nn \dim_set:Nn { NV } @@ -400,10 +401,15 @@ theorem .choices:nn = { thmtools,keytheorems,false } { \tl_set:Nn \l__eb_theorem_support_tl {#1} }, - theorem .value_required:n = true, theorem/true .meta:n = { theorem = thmtools }, theorem .default:n = thmtools, theorem .initial:n = thmtools, + chem .choices:nn = + { chemformula,mhchem,false } + { \tl_set:Nn \l__eb_chem_support_tl {#1} }, + chem/true .meta:n = { chem = chemformula }, + chem .default:n = chemformula, + chem .initial:n = chemformula, paper .code:n = \eb_put_geometry:n {#1}, paper .initial:n = a4paper, class .choice:, @@ -508,11 +514,10 @@ { [text]{spbmark}, [{shortlabels,inline}]{enumitem}, - chemformula,siunitx,pifont, - geometry,marginnote, - pdfpages,multicol, + siunitx,pifont, + geometry,marginnote,multicol, fancyhdr,titletoc,caption, - tabularray, + tabularray,graphicx,xcolor, listings } \cs_new_protected:Npn \eb_package_date_check:nn #1#2 @@ -571,7 +576,8 @@ } } -\includepdfset{fitpaper = true} +\ctex_at_end_package:nn { pdfpages } + { \includepdfset{fitpaper = true} } \geometry { vmargin = 2.54cm, @@ -2193,7 +2199,6 @@ \captionsetup[table][bi-second]{name = Table} } \UseTblrLibrary{booktabs} - \bool_if:NF \l__eb_float_page_bool { \tl_gset:Nn \textfraction { 0.1 } @@ -2209,11 +2214,6 @@ \setcounter{topnumber}{4} \setcounter{bottomnumber}{4} \setcounter{totalnumber}{8} -\tl_set:Nn \fontsubfuzz { 0.5pt } -\dim_zero_new:N \mathindent -\allowdisplaybreaks[4] -\everymath{\displaystyle} -\DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps,.tif} \dim_new:N \hangwd \cs_set_protected:Npn \hangpara #1#2 @@ -2270,7 +2270,7 @@ width .dim_set:N = \l__eb_eqsymb_width_dim, width .initial:n = 10pt, delim .tl_set:N = \l__eb_eqsymb_delim_tl, - delim .initial:n = \tl_if_eq:NnTF \l__ctex_scheme_tl { chinese } { —— } { --- }, + delim .initial:n = \tl_if_eq:NnTF \l__ctex_scheme_tl { chinese } { —— } { --- }, space .dim_set:N = \l__eb_eqsymb_space_dim, space .initial:n = 0.25em, item-align .tl_set:N = \l__eb_eqsymb_item_align_tl, @@ -2447,24 +2447,42 @@ { \eb_theorem_load_keytheorems: } } { \cs_undefine:N \proof } -\setchemformula +\cs_new_protected:Npn \eb_chem_load_chemformula: { - math-scripts = false, - charge-hshift = 0.25em, - subscript-vshift = -0.2ex - } -\IfPackageAtLeastTF{siunitx}{2021/06/22} - { - \sisetup + \RequirePackage{chemformula} + \setchemformula { - number-mode = match, - range-phrase = \ensuremath{\sim}, - range-units = single, - print-unity-mantissa = false, - table-alignment-mode = none, - group-digits = none + charge-hshift = 0pt, + subscript-vshift = -0.2ex } - }{} + } +\cs_new_protected:Npn \eb_chem_load_mhchem: + { + \RequirePackage[version = 4]{mhchem} + \mhchemoptions{layout = stacked} + } +\str_case:VnF \l__eb_chem_support_tl + { + { chemformula } + { \eb_chem_load_chemformula: } + { mhchem } + { \eb_chem_load_mhchem: } + } + { \RequirePackage{amsmath} } +\tl_set:Nn \fontsubfuzz { 0.5pt } +\everymath{\displaystyle} +\dim_zero_new:N \mathindent +\allowdisplaybreaks[4] +\DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps,.tif} +\sisetup + { + number-mode = match, + range-phrase = \ensuremath{\sim}, + range-units = single, + print-unity-mantissa = false, + table-alignment-mode = none, + group-digits = none + } \ctex_at_end_package:nn { unicode-math } { \msg_redirect_module:nnn { unicode-math } { warning } { info } } \ctex_at_end_package:nn { tcolorbox } @@ -2752,7 +2770,7 @@ } \ctex_define:n { - lstlistlistingname .tl_set:N = \listlstlistingname, + listlstlistingname .tl_set:N = \listlstlistingname, lstlistingname .tl_set:N = \lstlistingname, listtheoremname .tl_set:N = \listtheoremname } @@ -2763,7 +2781,7 @@ contentsname = 目\hspace{1em}录, listfigurename = 插图清单, listtablename = 附表清单, - lstlistlistingname = 代码清单, + listlstlistingname = 代码清单, lstlistingname = 代码, listtheoremname = 定理清单 } @@ -2773,7 +2791,7 @@ { \keys_set_known:nn { ctex } { - lstlistlistingname = List~of~Codes, + listlstlistingname = List~of~Codes, lstlistingname = Code } } @@ -2873,7 +2891,7 @@ } %</package> %<*tcolorbox> -\ProvidesExplFile{eb-tcolorbox.cfg}{2024/10/03}{2024ee} +\ProvidesExplFile{eb-tcolorbox.cfg}{2024/10/08}{2024ef} {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 b89d5741e4..4d1f0b0974 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 dfd80ec600..1c8fe85a21 100644 --- a/macros/latex/contrib/easybook/easybook.tex +++ b/macros/latex/contrib/easybook/easybook.tex @@ -23,8 +23,8 @@ name = easybook, color-scheme = blue, title = EASYBOOK使用手册, - version = v2024ee, - date = 2024/10/03, + version = v2024ef, + date = 2024/10/08, authors = 瞿毅, info = 简便地排版中文学位论文或书籍, email = toquyi@163.com, @@ -253,13 +253,14 @@ $\blacktriangleright$需要注意正确\textbf{编译索引}要增加 \code{-she cell{5}{2} = PaleTurquoise, cell{5}{1} = GreenYellow, cell{1}{2} = GreenYellow, - cell{3}{1,4} = GreenYellow + cell{3}{1,4} = GreenYellow, + cell{4}{2} = GreenYellow } amsthm & bicaption & ctex & caption & chemformula \\ enumitem & etoolbox & fancyhdr & geometry & hyperref \\ imakeidx & listings & marginnote & mathtools & multicol \\ pifont & pdfpages & siunitx & spbmark & thmtools \\ - tcolorbox & titletoc & tabularray & & + tcolorbox & titletoc & tabularray & xcolor & graphicx \end{longtblr} \section{全局选项} @@ -284,6 +285,14 @@ $\blacktriangleright$需要注意正确\textbf{编译索引}要增加 \code{-she 开启这个选项后浮动环境 \env{table} 和 \env{figure} 的比例参数会使用默认值。关闭它则尽可能避免出现浮动页,使图表环境与正文段落更加紧凑,减少多余的空白版面。 \keychoice{theorem}{\fbox{thmtools},keytheorems,false}\newtagv[Changed]{2024ea}% 是否提供定理功能支持,定理模块的介绍可见\ref{subsec:theorem}。选项 \code{thmtools} 会载入 \pkg*{amsthm} 和 \pkg*{thmtools} 宏包,选项 \code{keytheorems} 会载入 \pkg*{keytheorems} 宏包,选项 \code{false} 不载入定理功能宏包。 + \keychoice{chem}{\fbox{chemformula},mhchem,false}\newtagv{2024ef}% + 是否提供化学式功能支持。选项 \code{chemformula} 会载入 \pkg*{chemformula} 宏包,选项 \code{mhchem} 会载入 \pkg*{mhchem} 宏包,选项 \code{false} 不载入化学式功能宏包。\pkg*{chemformula} 的工作原理与 \pkg*{mhchem} 非常相似,但对化合物、化学计量数和箭头的输入方式控制更为严格。 + \command{ch}[\oarg{键值列表}\marg{化学式}] + \pkg*{chemformula} 的无机化学式书写命令。化合物表达式中的原子数不需要加下标符号,化学计量数与表达式间隔一个空格。 + \begin{ctexexam} + \ch{[Cu(NH3)4]^2+} + \ch{Cu2S + 2 O2 - 2 e^- == 2 Cu^2+ + SO4^2-} + \end{ctexexam} \end{cnltxlist} \subsection{配置字体} @@ -333,7 +342,7 @@ $\blacktriangleright$需要注意正确\textbf{编译索引}要增加 \code{-she \subsection{\textsf{article} 模式} \begin{cnltxlist} \keychoice{class}{\fbox{book},article} - 使用 \easybook{} 文档类可以有两种模式,默认为 \cls*{book} 模式。选用 \code{article} 会变为 \code{oneside} 单面排版,同时使文档编号、结构等与标准 \cls*{article} 文档类的特性相似,可用于短篇幅的文章,不需要再使用 \cs*{chapter} 命令。此时\ref{subsec:directory command} 中目录命令的 \option{chapter} 选项会失效,将以 \code{section} 标题级别输出目录。如果使用 \cls*{ctexart} 配合 \pkg*{easybase} 宏包,则选项值 \code{book} 会失效。 + 使用 \easybook{} 文档类可以有两种模式,默认为 \cls*{book} 模式。选用 \code{article} 可用于短篇幅的文章,文档会变为 \code{oneside} 单面排版,同时标题编号和封面等与标准 \cls*{article} 文档类相似,若使用 \cs{chapter} 命令会报错。如果使用 \cls*{ctexart} 配合 \pkg*{easybase} 宏包,则选项值 \code{book} 会失效。 \opt{book} 开启 \cls*{book} 书籍模式,与 \keyis*{class}{book} 等效。 \opt{article} @@ -901,7 +910,7 @@ $\blacktriangleright$需要注意正确\textbf{编译索引}要增加 \code{-she \command{tocrule}[\sarg\harg\oarg{引导点间距}\darg{放大因子}\marg{引导点}\oarg{页码格式}] 生成目录引导线的命令,需要在引导线选项 \option{tocrule} 中使用。带有星号的命令与 \keyis{dotalign}{false} 效果相同。命令带 \harg{} 号参数不输出目录页码,此时无格式的页码被保存在 \cs{thecontentspage} 命令中,可以配合盒子命令设置不同的页码左右间距和对齐方式。\meta{放大因子} 为 \meta{引导点} 的放大倍数。\meta{页码格式} 中最后一个命令可以带有一个参数用于接受页码。 \keyval{toclabel}{标题标签定义}\dtag\newtagv{2024as}% - 目录中各类型条目标题标签的定义,可与 \option{tocline} 选项联用设置标题。其中参数 \code{\#1} 代表标签的编号 \cs{thecontentslabel},参数 \code{\#2} 代表 \meta{条目名}。定义最后的命令可带有一个参数,用于接受标题内容,一些特殊情况例如需要将标题内容放在标签后,可以通过定义命令实现: + 目录中各类型条目标题标签的定义,可与 \option{tocline} 选项联用设置标题。其中参数 \code{\#1} 代表标签的编号 \cs{thecontentslabel},参数 \code{\#2} 代表 \meta{条目名}。定义最后的命令可带有一个参数,用于接受标题内容,一些特殊情况例如需要将标题内容放在标签前,可以通过定义命令实现: \begin{ctexexam} \newcommand{\seqentry}[2]{#2-#1} % #2为标题内容 \ctexset{chapter/toclabel = \seqentry{#1}} @@ -1294,34 +1303,27 @@ $\blacktriangleright$需要注意正确\textbf{编译索引}要增加 \code{-she 悬挂缩进环境 \env{hangparas} 有两个必选参数,使其中的段落均保持悬挂缩进。每个段落的缩进将以 \meta{缩进长度} 从 \meta{缩进开始行数} 开始。 \end{cnltxlist} -\subsection{代码} -代码抄录宏包 \pkg*{listings} 提供了完善的代码排版功能,并且不需要前端处理器。 +\subsection{计数器} \begin{cnltxlist} - \command{lstdefinestyle}[\marg{代码风格}\marg{键值列表}] - 代码风格定义命令,提供大量选项对代码样式进行高度定制。可以根据需要的代码语言定义多种风格,默认使用的 \meta{代码风格} 为适用于\TeX 语言的 \code{lst-latex}。 - \command{lstinline}[\oarg{键值列表}\marg{行内代码}] - 行内代码抄录命令。较原生的 \cs*{verb} 命令有较大改进,具有代码语言和样式支持。 - \environment{lstlisting}[\oarg{键值列表}] - 行间代码抄录环境。支持多种语言库,默认使用 \code{LaTeX} 代码语言,可使用 \meta{键值列表} 局部修改代码样式。另外还提供了 \cs{lstnewenvironment} 命令包装自定义名称的代码环境。 + \command{newcounter}[\marg{计数器}\oarg{父计数器}] + 创建一个初始值为0的计数器。若 \meta{计数器} 已经存在则报错,若指定 \meta{父计数器} 则将它加入 \meta{父计数器} 的递增归零清单。 + \command{declarecounter}[\marg{计数器}\oarg{父计数器}]\newtagv{2024ed}% + 创建一个初始值为0的计数器,与 \cs{newcounter} 的区别是若 \meta{计数器} 已经存在仍会强制创建。 + \command{setcounter}[\marg{计数器}\marg{整数}] + 将计数器的值设定为指定值。 + \command{stepcounter}[\marg{计数器}] + 使计数器的值递增1,同时它的递增归零清单中的子计数器值归零。 + \command{counterwithin}[\sarg\oarg{格式}\marg{计数器}\oarg{连字符}\marg{父计数器}] + 对计数器进行绑定的命令。将 \meta{计数器} 绑定于 \meta{父计数器},即 \meta{父计数器} 的值递增时 \meta{计数器} 的值会归零。输出格式 \cs*{the}\meta{计数器} 被定义为 \cs*{the}\meta{父计数器}\meta{连字符}\meta{格式}\marg{计数器}。\meta{格式} 一般为更改计数器编号形式的命令,默认为 \cs*{arabic}。带有星号参数的命令仅进行绑定不更改输出格式。 + \command{counterwithout}[\sarg\oarg{格式}\marg{计数器}\marg{父计数器}] + 对计数器关系进行解绑的命令。将 \meta{计数器} 解绑于 \meta{父计数器},同时输出格式被改为 \meta{格式}\marg{计数器}。带有星号参数的命令仅进行解绑不更改输出格式。 \begin{ctexexam} - \lstdefinestyle{lst-pascal} - { - language = Pascal, - numbers = left, - firstnumber = last, - frame = shadowbox, - backgroundcolor = \color{MistyRose}, - rulesepcolor = \color{DarkGray} - } - \lstnewenvironment{mypascal}[1][]{\lstset{style = lst-pascal,#1}}{} + \counterwithin[\Roman]{child}[-]{parent} + \counterwithout*{child}{parent} \end{ctexexam} \end{cnltxlist} -\begin{cnltxlist}[itemsep = 0ex] - \keyval{lstlistlistingname}{代码目录标题名}\default{} - \keyval{lstlistingname}{代码题注标题名} - 代码目录名与代码环境题注名选项 \option{lstlistlistingname} 和 \option{lstlistingname} 用法与 \CTeX 使用手册标题汉化一节类似,可以看作对这节的扩展。 -\end{cnltxlist} +\section{扩展功能} \subsection{盒子} \label{subsec:box} @@ -1365,7 +1367,33 @@ $\blacktriangleright$需要注意正确\textbf{编译索引}要增加 \code{-she 行内盒子命令 \cs{eboxii} 则有直角边缘和四周框线,效果类似带背景色的 \cs*{fbox} 盒子。 \end{cnltxlist} -\section{扩展功能} +\subsection{代码} +代码抄录宏包 \pkg*{listings} 提供了完善的代码排版功能,并且不需要前端处理器。 +\begin{cnltxlist} + \command{lstdefinestyle}[\marg{代码风格}\marg{键值列表}] + 代码风格定义命令,提供大量选项对代码样式进行高度定制。可以根据需要的代码语言定义多种风格,默认使用的 \meta{代码风格} 为适用于\TeX 语言的 \code{lst-latex}。 + \command{lstinline}[\oarg{键值列表}\marg{行内代码}] + 行内代码抄录命令。较原生的 \cs*{verb} 命令有较大改进,具有代码语言和样式支持。 + \environment{lstlisting}[\oarg{键值列表}] + 行间代码抄录环境。支持多种语言库,默认使用 \code{LaTeX} 代码语言,可使用 \meta{键值列表} 局部修改代码样式。另外还提供了 \cs{lstnewenvironment} 命令包装自定义名称的代码环境。 + \begin{ctexexam} + \lstdefinestyle{lst-pascal} + { + language = Pascal, + numbers = left, + firstnumber = last, + frame = shadowbox, + backgroundcolor = \color{MistyRose}, + rulesepcolor = \color{DarkGray} + } + \lstnewenvironment{mypascal}[1][]{\lstset{style = lst-pascal,#1}}{} + \end{ctexexam} + \begin{cnltxlist}[itemsep = 0ex] + \keyval{listlstlistingname}{代码目录标题名}\default{} + \keyval{lstlistingname}{代码题注标题名} + 代码目录名与代码环境题注名选项 \option{listlstlistingname} 和 \option{lstlistingname} 用法与 \CTeX 使用手册标题汉化一节类似,可以看作对这节的扩展。 + \end{cnltxlist} +\end{cnltxlist} \subsection{物理量} 使用 \pkg*{siunitx} 宏包提供国际单位制的物理量支持。\pkg*{siunitx} 宏包旨在为 \hologo{LaTeX} 用户提供一种统一的方法,以便正确、轻松地排版数字和单位。\pkg*{siunitx} 的设计理念是默认遵循约定的规则,但允许通过选项设置进行更改。 @@ -1386,37 +1414,6 @@ $\blacktriangleright$需要注意正确\textbf{编译索引}要增加 \code{-she \end{ctexexam} \end{cnltxlist} -\subsection{化学式} -除了以普通公式的方式,化学式的输出还可用 \pkg*{chemformula} 宏包实现。\pkg*{chemformula} 的工作原理与 \pkg*{mhchem} 非常相似,但对化合物、化学计量数和箭头的输入方式更为严格。同时 \pkg*{chemformula} 提供了多种自定义输出的可能性。 -\begin{cnltxlist} - \command{ch}[\oarg{键值列表}\marg{化学式}] - 无机化学式使用 \cs{ch} 命令书写。化合物表达式中的原子数不需要加下标符号,化学计量数与表达式间隔一个空格。 - \begin{ctexexam} - \ch{[Cu(NH3)4]^2+} - \ch{Cu2S + 2 O2 - 2 e^- == 2 Cu^2+ + SO4^2-} - \end{ctexexam} -\end{cnltxlist} - -\subsection{计数器} -\begin{cnltxlist} - \command{newcounter}[\marg{计数器}\oarg{父计数器}] - 创建一个初始值为0的计数器。若 \meta{计数器} 已经存在则报错,若指定 \meta{父计数器} 则将它加入 \meta{父计数器} 的递增归零清单。 - \command{declarecounter}[\marg{计数器}\oarg{父计数器}]\newtagv{2024ed}% - 创建一个初始值为0的计数器,与 \cs{newcounter} 的区别是若 \meta{计数器} 已经存在仍会强制创建。 - \command{setcounter}[\marg{计数器}\marg{整数}] - 将计数器的值设定为指定值。 - \command{stepcounter}[\marg{计数器}] - 使计数器的值递增1,同时它的递增归零清单中的子计数器值归零。 - \command{counterwithin}[\sarg\oarg{格式}\marg{计数器}\oarg{连字符}\marg{父计数器}] - 对计数器进行绑定的命令。将 \meta{计数器} 绑定于 \meta{父计数器},即 \meta{父计数器} 的值递增时 \meta{计数器} 的值会归零。输出格式 \cs*{the}\meta{计数器} 被定义为 \cs*{the}\meta{父计数器}\meta{连字符}\meta{格式}\marg{计数器}。\meta{格式} 一般为更改计数器编号形式的命令,默认为 \cs*{arabic}。带有星号参数的命令仅进行绑定不更改输出格式。 - \command{counterwithout}[\sarg\oarg{格式}\marg{计数器}\marg{父计数器}] - 对计数器关系进行解绑的命令。将 \meta{计数器} 解绑于 \meta{父计数器},同时输出格式被改为 \meta{格式}\marg{计数器}。带有星号参数的命令仅进行解绑不更改输出格式。 - \begin{ctexexam} - \counterwithin[\Roman]{child}[-]{parent} - \counterwithout*{child}{parent} - \end{ctexexam} -\end{cnltxlist} - \subsection{标签引用} \begin{cnltxlist} \command{labelformat}[\marg{计数器}\marg{标签引用格式}] diff --git a/macros/latex/contrib/l3build/CHANGELOG.md b/macros/latex/contrib/l3build/CHANGELOG.md index f2231144d8..1355a64326 100644 --- a/macros/latex/contrib/l3build/CHANGELOG.md +++ b/macros/latex/contrib/l3build/CHANGELOG.md @@ -7,6 +7,13 @@ this project uses date-based 'snapshot' version identifiers. ## [Unreleased] +## [2024-10-08] + +### Fixed +- Test for uncompleted conditionals in tests (may require `.tlg` update) +- Global `typesetopts` no longer ignored for `luatex` and `lualatex` (issue \#351) +- Handling of spaces in options + ## [2024-05-27] ### Changed @@ -785,7 +792,8 @@ this project uses date-based 'snapshot' version identifiers. - Rationalise short option names: removed `-d`, `-E`, `-r` - Target `cmdcheck`: specific to LaTeX kernel work -[Unreleased]: https://github.com/latex3/l3build/compare/2024-05-27...HEAD +[Unreleased]: https://github.com/latex3/l3build/compare/2024-10-08...HEAD +[2024-10-08]: https://github.com/latex3/l3build/compare/2024-05-27...2024-10-08 [2024-05-27]: https://github.com/latex3/l3build/compare/2024-02-08...2024-05-27 [2024-02-08]: https://github.com/latex3/l3build/compare/2024-01-18...2024-02-08 [2024-01-18]: https://github.com/latex3/l3build/compare/2024-01-09...2024-01-18 diff --git a/macros/latex/contrib/l3build/README.md b/macros/latex/contrib/l3build/README.md index 1b49dc0b0c..af293a25e4 100644 --- a/macros/latex/contrib/l3build/README.md +++ b/macros/latex/contrib/l3build/README.md @@ -1,7 +1,7 @@ l3build: a testing and building system for LaTeX ================================================= -Release 2024-05-27 +Release 2024-10-08 Overview -------- diff --git a/macros/latex/contrib/l3build/l3build-arguments.lua b/macros/latex/contrib/l3build/l3build-arguments.lua index b7687a71a9..ac34f90f3b 100644 --- a/macros/latex/contrib/l3build/l3build-arguments.lua +++ b/macros/latex/contrib/l3build/l3build-arguments.lua @@ -45,6 +45,7 @@ option_list = date = { desc = "Sets the date to insert into sources", + short = "d", type = "string" }, debug = @@ -267,7 +268,7 @@ local function argparse() result[optname] = optarg else local opts = result[optname] or { } - for hit in gmatch(optarg, "([^,%s]+)") do + for hit in gmatch(optarg, "([^,]+)") do insert(opts, hit) end result[optname] = opts diff --git a/macros/latex/contrib/l3build/l3build-aux.lua b/macros/latex/contrib/l3build/l3build-aux.lua index bf0b85c698..eea2625e90 100644 --- a/macros/latex/contrib/l3build/l3build-aux.lua +++ b/macros/latex/contrib/l3build/l3build-aux.lua @@ -102,7 +102,7 @@ end ---@param modules table List of modules. ---@param target string ---@param opts table ----@return number 0 on proper termination, a non 0 error code otherwise. +---@return number 0 on a successful completion, a non 0 error code otherwise. ---@see many places, including latex2e/build.lua ---@usage Public function call(modules, target, opts) @@ -155,7 +155,7 @@ end ---Unpack the given dependencies. ---A dependency is the path of a directory relative to the main one. ---@param deps table regular array of dependencies. ----@return number 0 on proper termination, a non 0 error code otherwise. +---@return number 0 on a successful completion, a non 0 error code otherwise. ---@see stdmain, check, unpack, typesetting ---@usage Private? function dep_install(deps) diff --git a/macros/latex/contrib/l3build/l3build-check.lua b/macros/latex/contrib/l3build/l3build-check.lua index d6d30e3e2a..a0c1ba7c7e 100644 --- a/macros/latex/contrib/l3build/l3build-check.lua +++ b/macros/latex/contrib/l3build/l3build-check.lua @@ -95,10 +95,10 @@ function checkinit_hook() return 0 end local function rewrite(source,result,processor,...) local file = assert(open(source,"rb")) - local content = gsub(file:read("*all") .. "\n","\r\n","\n") + local content = gsub(file:read("a") .. "\n","\r\n","\n") close(file) local new_content = processor(content,...) - local newfile = open(result,"w") + local newfile = assert(open(result,"w")) output(newfile) write(new_content) close(newfile) @@ -828,9 +828,9 @@ function runtest(name, engine, hide, ext, test_type, breakout) ) -- On Windows, concatenating here will suppress any non-zero errorlevel -- from the main run, so we split into two parts. - if runtest_tasks(jobname(lvtfile),i) ~= "" then - local errorlevel = - runcmd(preamble .. runtest_tasks(jobname(lvtfile),i),testdir) + local tasks = runtest_tasks(jobname(lvtfile),i) + if tasks ~= "" then + local errorlevel = runcmd(preamble .. tasks,testdir) if errorlevel ~= 0 then errlevels[i] = errorlevel end end -- Break the loop if the result is stable @@ -919,7 +919,7 @@ local function showsavecommands(failurelist) end end print(" To regenerate the test files, run\n") - local f = open(testdir .. "/.savecommands", "w") + local f = assert(open(testdir .. "/.savecommands", "w")) for _, cmds in pairs(savecmds) do print(" " .. cmds) f:write(cmds, "\n") @@ -1089,9 +1089,9 @@ function showfailedlog(name) for _,i in ipairs(ordered_filelist(testdir, name..".log")) do print(" - " .. testdir .. "/" .. i) print("") - local f = open(testdir .. "/" .. i,"r") - local content = f:read("*all") - close(f) + local f = assert(open(testdir .. "/" .. i,"r")) + local content = f:read("a") + f:close() print("-----------------------------------------------------------------------------------") print(content) print("-----------------------------------------------------------------------------------") @@ -1103,9 +1103,9 @@ function showfaileddiff() for _,i in ipairs(ordered_filelist(testdir, "*" .. os_diffext)) do print(" - " .. testdir .. "/" .. i) print("") - local f = open(testdir .. "/" .. i,"r") - local content = f:read("*all") - close(f) + local f = assert(open(testdir .. "/" .. i,"r")) + local content = f:read("a") + f:close() print("-----------------------------------------------------------------------------------") print(content) print("-----------------------------------------------------------------------------------") diff --git a/macros/latex/contrib/l3build/l3build-ctan.lua b/macros/latex/contrib/l3build/l3build-ctan.lua index c1feb2564a..167cd33541 100644 --- a/macros/latex/contrib/l3build/l3build-ctan.lua +++ b/macros/latex/contrib/l3build/l3build-ctan.lua @@ -85,7 +85,7 @@ function ctan() options["engine"] = nil local function dirzip(dir, zipname) zipname = zipname .. ".zip" - local zip = newzip(dir .. '/' .. zipname) + local zip = assert(newzip(dir .. '/' .. zipname)) local function tab_to_check(table) local patterns = {} for n,i in ipairs(table) do diff --git a/macros/latex/contrib/l3build/l3build-manifest-setup.lua b/macros/latex/contrib/l3build/l3build-manifest-setup.lua index 8654b3deb5..55c568828e 100644 --- a/macros/latex/contrib/l3build/l3build-manifest-setup.lua +++ b/macros/latex/contrib/l3build/l3build-manifest-setup.lua @@ -335,7 +335,7 @@ end -- From the first match of a pattern in a file: manifest_extract_filedesc = function(filehandle) - local all_file = filehandle:read("*all") + local all_file = filehandle:read("a") local matchstr = "\\section{(.-)}" filedesc = string.match(all_file,matchstr) diff --git a/macros/latex/contrib/l3build/l3build-manifest.lua b/macros/latex/contrib/l3build/l3build-manifest.lua index aa5a061bd3..b8202bc0cb 100644 --- a/macros/latex/contrib/l3build/l3build-manifest.lua +++ b/macros/latex/contrib/l3build/l3build-manifest.lua @@ -33,6 +33,9 @@ for those people who are interested. `l3build-manifest-setup.lua`. --]] +local ctanfiles +local tdsfiles + function manifest() -- build list of ctan files @@ -55,7 +58,7 @@ function manifest() manifest_write(manifest_entries) - printline = "Manifest written to " .. manifestfile + local printline = "Manifest written to " .. manifestfile print((printline:gsub(".","*"))) print(printline) print((printline:gsub(".","*"))) return 0 @@ -153,6 +156,7 @@ manifest_build_init = function(entry) end +local open = io.open manifest_build_file = function(entry,this_file) @@ -173,7 +177,7 @@ manifest_build_file = function(entry,this_file) if not(entry.skipfiledescription) then - local ff = assert(io.open(entry.dir .. "/" .. this_file, "r")) + local ff = assert(open(entry.dir .. "/" .. this_file, "r")) this_descr = manifest_extract_filedesc(ff,this_file) ff:close() @@ -197,7 +201,7 @@ end manifest_write = function(manifest_entries) - local f = assert(io.open(manifestfile, "w")) + local f = assert(open(manifestfile, "w")) manifest_write_opening(f) for ii,vv in ipairs(manifest_entries) do diff --git a/macros/latex/contrib/l3build/l3build-stdmain.lua b/macros/latex/contrib/l3build/l3build-stdmain.lua index 70d7560f20..e66ba1d3f5 100644 --- a/macros/latex/contrib/l3build/l3build-stdmain.lua +++ b/macros/latex/contrib/l3build/l3build-stdmain.lua @@ -35,7 +35,7 @@ function listmodules() if entry ~= "." and entry ~= ".." then local attr = lfs.attributes(entry) assert(type(attr) == "table") - if attr.mode == "directory" then + if attr.mode == "directory" and fileexists(entry .."/" .."build.lua") then if not exclmodules[entry] then insert(modules, entry) end diff --git a/macros/latex/contrib/l3build/l3build-tagging.lua b/macros/latex/contrib/l3build/l3build-tagging.lua index 0753123f99..225ba23874 100644 --- a/macros/latex/contrib/l3build/l3build-tagging.lua +++ b/macros/latex/contrib/l3build/l3build-tagging.lua @@ -39,9 +39,12 @@ end local function update_file_tag(file,tagname,tagdate) local filename = basename(file) print("Tagging ".. filename) + ---@type file*? local f = assert(open(file,"rb")) - local content = f:read("*all") + ---@cast f file* + local content = f:read("a") f:close() + f = nil -- Deal with Unix/Windows line endings content = gsub(content .. (match(content,"\n$") and "" or "\n"), "\r\n", "\n") diff --git a/macros/latex/contrib/l3build/l3build-unpack.lua b/macros/latex/contrib/l3build/l3build-unpack.lua index 3c73dc8d14..ba8a5b5934 100644 --- a/macros/latex/contrib/l3build/l3build-unpack.lua +++ b/macros/latex/contrib/l3build/l3build-unpack.lua @@ -69,11 +69,12 @@ function bundleunpack(sourcedirs, sources) return errorlevel end end + local popen = io.popen for _,i in ipairs(unpackfiles) do for _,p in ipairs(tree(unpackdir, i)) do local path, name = splitpath(p.src) local localdir = abspath(localdir) - local success = io.popen( + local success = assert(popen( "cd " .. unpackdir .. "/" .. path .. os_concat .. os_setenv .. " TEXINPUTS=." .. os_pathsep .. localdir .. (unpacksearch and os_pathsep or "") .. @@ -84,7 +85,7 @@ function bundleunpack(sourcedirs, sources) unpackexe .. " " .. unpackopts .. " " .. name .. (options["quiet"] and (" > " .. os_null) or ""), "w" - ):write(string.rep("y\n", 300)):close() + ):write(string.rep("y\n", 300))):close() if not success then return 1 end diff --git a/macros/latex/contrib/l3build/l3build-upload.lua b/macros/latex/contrib/l3build/l3build-upload.lua index 87158d1b01..645445feb4 100644 --- a/macros/latex/contrib/l3build/l3build-upload.lua +++ b/macros/latex/contrib/l3build/l3build-upload.lua @@ -94,9 +94,9 @@ function upload(tagnames) -- Get data from command line if appropriate if options["file"] then - local f = open(options["file"],"r") - uploadconfig.announcement = assert(f:read('*a')) - close(f) + local f = assert(open(options["file"],"r")) + uploadconfig.announcement = assert(f:read('a')) + f:close() end uploadconfig.announcement = options["message"] or uploadconfig.announcement or file_contents(uploadconfig.announcement_file) uploadconfig.email = options["email"] or uploadconfig.email @@ -139,10 +139,13 @@ function upload(tagnames) -- curl file version local curloptfile = uploadconfig.curlopt_file or (ctanzip .. ".curlopt") - local curlopt=open(curloptfile,"w") + ---@type file*? + local curlopt=assert(open(curloptfile,"w")) + ---@cast curlopt file* output(curlopt) write(ctan_post) - close(curlopt) + curlopt:close() + curlopt = nil ctan_post=curlexe .. " --config " .. curloptfile @@ -376,12 +379,12 @@ end -- if filename is non nil and file readable return contents otherwise nil function file_contents (filename) if filename ~= nil then - local f= open(filename,"r") + local f= assert(open(filename,"r")) if f==nil then return nil else - local s = f:read("*all") - close(f) + local s = f:read("a") + f:close() return s end else diff --git a/macros/latex/contrib/l3build/l3build-zip.lua b/macros/latex/contrib/l3build/l3build-zip.lua index 5107415173..0c326b7236 100644 --- a/macros/latex/contrib/l3build/l3build-zip.lua +++ b/macros/latex/contrib/l3build/l3build-zip.lua @@ -132,7 +132,7 @@ local meta = {__index = { }} return function(filename) - local f, msg = open(filename, 'wb') + local f, msg = open(filename, 'wb') -- closed just above if not f then return f, msg end return setmetatable({ f = f, diff --git a/macros/latex/contrib/l3build/l3build.1 b/macros/latex/contrib/l3build/l3build.1 index d42e486f3c..d602f8c98f 100644 --- a/macros/latex/contrib/l3build/l3build.1 +++ b/macros/latex/contrib/l3build/l3build.1 @@ -1,4 +1,4 @@ -.TH L3BUILD 1 "2024-05-27" "LaTeX" +.TH L3BUILD 1 "2024-10-08" "LaTeX" .SH NAME l3build @@ -7,16 +7,19 @@ l3build Usage l3build <target> [<options>] [<names>] .SH DESCRIPTION ------- -The l3build module is designed to support the development of + +The "l3build" module is designed to support the development of high-quality LaTeX code by providing: -* A unit testing system -* Automated typesetting of code sources -* A reliable packaging system for CTAN releases + + * A unit testing system + + * Automated typesetting of code sources + + * A reliable packaging system for CTAN releases The bundle consists of a Lua script to run the tasks and a -.tex file which provides the testing environment. These were +".tex" file which provides the testing environment. These were originally developed for supporting LaTeX development but are designed such that they can be readily used by others. Full documentation is provided. @@ -38,7 +41,7 @@ Valid targets are: .SH OPTIONS Valid options are: --config|-c Sets the config(s) used for running tests - --date Sets the date to insert into sources + --date|-d Sets the date to insert into sources --debug Runs target in debug mode --dirty Skips cleaning up the test area --dry-run Dry run for install or upload diff --git a/macros/latex/contrib/l3build/l3build.dtx b/macros/latex/contrib/l3build/l3build.dtx index 2433c7a311..642da13e90 100644 --- a/macros/latex/contrib/l3build/l3build.dtx +++ b/macros/latex/contrib/l3build/l3build.dtx @@ -251,7 +251,7 @@ % }^^A % } % -% \date{Released 2024-05-27} +% \date{Released 2024-10-08} % % \maketitle % \tableofcontents @@ -369,7 +369,7 @@ % As well as these targets, the system recognises the options % \begin{itemize} % \item |--config| (|-c|) Configuration(s) to use for testing -% \item |--date| Date to use when tagging data +% \item |--date| (|-d|) Date to use when tagging data % \item |--debug| Runs the target in debug mode (not supported by all targets) % \item |--dirty| Skips cleaning up of the test area % \item |--dry-run| Runs the \texttt{install} target but does not copy @@ -388,7 +388,7 @@ % \item |--message| (|-m|) Text for upload announcement % \item |--quiet| (|-q|) Suppresses output from unpacking % \item |--rerun| Runs tests without unpacking/set up -% \item |--show-log-on-error| To be used in addition to \texttt{--halt-on-error} and results +% \item |--show-log-on-error| To be used in addition to |--halt-on-error| and results % in the full \texttt{.log} file of a failed test to be shown on the console % \item |--show-saves| (|-S|) When tests fail, prints the \texttt{l3build save} commands needed % to regenerate the tests assuming that the failures were false negatives. @@ -460,9 +460,19 @@ % \end{buildcmd} % % \begin{buildcmd}{clean} -% This command removes all temporary files used for package bundling and regression testing. -% In the standard layout, these are all files within the directories defined by \var{localdir}, \var{testdir}, \var{typesetdir} and \var{unpackdir}, as well as all files defined in the \var{cleanfiles} variable in the same directory as the script. -% The defaults are |.pdf| files from typesetting (|doc|) and |.zip| files from bundling (|ctan|). +% This target is meant as preparation for other targets, for example |ctan|. +% It removes the contents of \var{distribdir} and all temporary files used for package bundling and regression testing. +% These are all files within the directories \var{unpackdir}, \var{testdir}, \var{typesetdir} and \var{localdir}. +% In addition, all the files in \var{maindir} (the directory of |build.lua| in the standard layout), +% \var{sourcefiledir} and \var{docfiledir} are removed when matched by \var{cleanfiles} +% but not by \var{sourcefiles}. +% In a standard way are removed |.log| and |.pdf| files from the |doc| target and +% |.zip| files from the |ctan| target. +% +% When applied to a bundle, the |clean| target is first applied to each +% embedded modules (listed in |modules|). +% In addition, all the files in the directory of |build.lua| are removed +% when matched by \var{cleanfiles}, while ignoring \var{sourcefiles}. Finally |ctandir| and |tdsdir| are removed. % \end{buildcmd} % % @@ -1662,35 +1672,42 @@ % % \begin{variable}{options} % The |options| table holds the values passed to \pkg{l3build} at the -% command line. The possible entries in the table are given in the table -% below. +% command line. Each possible \meta{entry} given below corresponds to +% |--|\meta{entry} given at the command line, except the |target| entry +% which is self explanatory and the |names| entry which corresponds to \meta{name(s)} +% for |check|, |doc|, |save| and |tag| targets. % \begin{center} % \begin{tabular}{ll} % \toprule -% Entry & Type \\ +% Entry & Lua type \\ % \midrule -% \var{config} & Table \\ -% \var{date} & String \\ -% \var{dirty} & Boolean \\ -% \var{dry-run} & Boolean \\ -% \var{email} & String \\ -% \var{engine} & Table \\ -% \var{epoch} & String \\ -% \var{file} & string \\ -% \var{first} & Boolean \\ -% \var{full} & Boolean \\ -% \var{halt-on-error} & Boolean \\ -% \var{help} & Boolean \\ -% \var{message} & string \\ -% \var{names} & Table \\ -% \var{quiet} & Boolean \\ -% \var{rerun} & Boolean \\ -% \var{shuffle} & Boolean \\ -% \var{stdengine} & Boolean \\ -% \var{texmfhome} & String \\ +% \var{config} & |table| \\ +% \var{date} & |string| \\ +% \var{dirty} & |boolean| \\ +% \var{dry-run} & |boolean| \\ +% \var{email} & |string| \\ +% \var{engine} & |table| \\ +% \var{epoch} & |string| \\ +% \var{file} & |string| \\ +% \var{first} & |boolean| \\ +% \var{full} & |boolean| \\ +% \var{halt-on-error} & |boolean| \\ +% \var{help} & |boolean| \\ +% \var{message} & |string| \\ +% \var{names} & |table| \\ +% \var{quiet} & |boolean| \\ +% \var{rerun} & |boolean| \\ +% \var{shuffle} & |boolean| \\ +% \var{stdengine} & |boolean| \\ +% \var{target} & |string| \\ +% \var{texmfhome} & |string| \\ % \bottomrule % \end{tabular} % \end{center} +% The Lua tables mentionned here are in fact arrays of strings. +% From the |build.lua| file, one can modify the string and boolean values, +% add or remove entries in arrays. But it is not recommended to affect a +% whole new Lua table to |options| nor to its array entries. % \end{variable} % % \subsection{Utility functions} @@ -1946,7 +1963,7 @@ % |tex(|\meta{file},\meta{dir},\meta{cmd}|)| % \end{syntax} % Runs \meta{cmd} (by default \luavar{typesetexe} \luavar{typesetopts}) on the -% \meta{name} inside the \meta{dir}. +% \meta{file} inside the \meta{dir}. % \end{function} % % \begin{function}{runcmd()} @@ -2127,7 +2144,7 @@ % \begin{verbatim} % manifest_extract_filedesc = function(filehandle,filename) % -% local all_file = filehandle:read("*all") +% local all_file = filehandle:read("a") % local matchstr = "\\section{(.-)}" % % filedesc = string.match(all_file,matchstr) @@ -2288,8 +2305,8 @@ \ifnum\currentgrouplevel>0 % \LONGTYPEOUT{Bad grouping: \the\currentgrouplevel!}% \fi - \ifnum\currentiflevel>2 % - \LONGTYPEOUT{Bad conditionals: \the\numexpr\currentiflevel-2!}% + \ifnum\currentiflevel>1 % + \LONGTYPEOUT{Bad conditionals: \the\numexpr\currentiflevel-1!}% \fi \LONGTYPEOUT{^^JEND-TEST-LOG^^J}% \@@@end diff --git a/macros/latex/contrib/l3build/l3build.lua b/macros/latex/contrib/l3build/l3build.lua index bb53a2ce55..675806dd57 100755 --- a/macros/latex/contrib/l3build/l3build.lua +++ b/macros/latex/contrib/l3build/l3build.lua @@ -25,7 +25,7 @@ for those people who are interested. --]] -- Version information -release_date = "2024-05-27" +release_date = "2024-10-08" -- File operations are aided by the LuaFileSystem module local lfs = require("lfs") @@ -128,7 +128,7 @@ if forcecheckepoch then end if forcedocepoch then if match(typesetexe,"luatex") or match(typesetexe,"lualatex") then - typesetopts = typsetopts .. " -utc" + typesetopts = typesetopts .. " -utc" end end diff --git a/macros/latex/contrib/l3build/l3build.pdf b/macros/latex/contrib/l3build/l3build.pdf Binary files differindex 93f4b8f3ab..1fe75083d3 100644 --- a/macros/latex/contrib/l3build/l3build.pdf +++ b/macros/latex/contrib/l3build/l3build.pdf diff --git a/macros/latex/contrib/minted/CHANGELOG_MINTED_LATEX_PACKAGE.md b/macros/latex/contrib/minted/CHANGELOG_MINTED_LATEX_PACKAGE.md index ce573e9c1e..88e443ea35 100644 --- a/macros/latex/contrib/minted/CHANGELOG_MINTED_LATEX_PACKAGE.md +++ b/macros/latex/contrib/minted/CHANGELOG_MINTED_LATEX_PACKAGE.md @@ -1,6 +1,15 @@ # Changelog — minted LaTeX package +## v3.1.2 (2024/10/07) + +* There is now only a single `\read` allocation for reading temporary files + when `highlightmode` is set to `fast` or `fastfirst`. Previously, there + was one allocation per temp file, which could cause allocation errors when + several temp files were highlighted during the same compile (#413). + + + ## v3.1.1 (2024/10/03) * Fixed bugs in processing temporary files regardless of `highlightmode` from diff --git a/macros/latex/contrib/minted/minted.dtx b/macros/latex/contrib/minted/minted.dtx index 0fe35161ce..a8f9b33952 100644 --- a/macros/latex/contrib/minted/minted.dtx +++ b/macros/latex/contrib/minted/minted.dtx @@ -27,7 +27,7 @@ %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{minted} %<*package> - [2024/10/03 v3.1.1 Yet another Pygments shim for LaTeX] + [2024/10/07 v3.1.2 Yet another Pygments shim for LaTeX] %</package> %<*driver> \documentclass{ltxdoc} @@ -2611,7 +2611,8 @@ \minted@error{minted Python executable returned incomplete configuration data; this may indicate a bug in minted or file corruption}}% {\global\let\minted@cachepath\minted@config@cachepath - \minted@highlightmode@init}}% + \minted@highlightmode@init + \ifbool{minted@fasthighlightmode}{\newread\minted@intempfile}{}}}% {\global\boolfalse{minted@canexec}% \minted@error{minted Python executable is version \minted@executable@version, but version \minted@executable@minversion+ is required}}} @@ -3825,7 +3826,6 @@ \def\minted@iffasthighlightmode@buffertempfile@iv{% \begingroup \setcounter{minted@tmpcodebufferlength}{0}% - \newread\minted@intempfile \openin\minted@intempfile=\minted@inputfilepath \endlinechar=-1% \let\do\@makeother\FVExtraDoSpecials diff --git a/macros/latex/contrib/minted/minted.pdf b/macros/latex/contrib/minted/minted.pdf Binary files differindex 9e94c21fc0..e620517ae0 100644 --- a/macros/latex/contrib/minted/minted.pdf +++ b/macros/latex/contrib/minted/minted.pdf diff --git a/macros/latex/contrib/reptheorem/reptheorem.pdf b/macros/latex/contrib/reptheorem/reptheorem-doc.pdf Binary files differindex 55b369d620..9e6568af57 100644 --- a/macros/latex/contrib/reptheorem/reptheorem.pdf +++ b/macros/latex/contrib/reptheorem/reptheorem-doc.pdf diff --git a/macros/latex/contrib/reptheorem/reptheorem.dtx b/macros/latex/contrib/reptheorem/reptheorem.dtx index e26daf2f5a..47a9492322 100644 --- a/macros/latex/contrib/reptheorem/reptheorem.dtx +++ b/macros/latex/contrib/reptheorem/reptheorem.dtx @@ -3,7 +3,7 @@ % Copyright (c) 2024- Jesse Straat % % This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3 +% 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 % https://www.latex-project.org/lppl.txt @@ -89,7 +89,7 @@ License: [LPPL1.3c](https://www.latex-project.org/lppl.txt) \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: reptheorem 2024-09-22 v1.2} +\Msg{* Package: reptheorem 2024-10-07 v1.3} \Msg{************************************************************************} \keepsilent @@ -100,7 +100,7 @@ License: [LPPL1.3c](https://www.latex-project.org/lppl.txt) Copyright (c) 2024- Jesse Straat This work may be distributed and/or modified under the -conditions of the LaTeX Project Public License, either version 1.3 +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 https://www.latex-project.org/lppl.txt @@ -214,7 +214,7 @@ colorlinks, %^^A % \tableofcontents %^^A -%\changes{v1.0}{2024-03-27}{First public release} +%\changes{v1.0}{2024/03/27}{First public release} %^^A %^^A %^^A @@ -352,7 +352,7 @@ colorlinks, % \section{Source code} % \begin{macrocode} %<*package> -\ProvidesPackage{reptheorem}[2024-09-22 v1.2 Reptheorem package] +\ProvidesPackage{reptheorem}[2024-10-07 v1.3 Reptheorem package] % \end{macrocode} % \begin{macro}{\theoremfile} % Using |\theoremfile| will output all saved theorems into an output file. @@ -384,7 +384,7 @@ colorlinks, % \end{macrocode} % \end{macro} % \begin{environment}{makethm} -% \changes{v1.1}{2024/05/03}{Now saves theorem environment type, breaking backwards compatibility} +% \changes{v1.1}{2024/05/03}{Now saves theorem environment type, breaking backwards compatibility.} % \changes{v1.2}{2024/09/21}{Environment end moved to fix vertical spacing.} % \changes{v1.2}{2024/09/22}{Theorem name is only saved if it exists.} % \changes{v1.2}{2024/09/22}{Renamed theorem output variable to be unique for each theorem.} @@ -435,8 +435,10 @@ colorlinks, % \end{macrocode} % \end{environment} % \begin{macro}{\repthm} -% \changes{v1.1}{2024/05/03}{Now saves theorem environment type, breaking backwards compatibility} +% \changes{v1.1}{2024/05/03}{Now saves theorem environment type, breaking backwards compatibility.} % \changes{v1.2}{2024/09/22}{Fixed bug where theorems got a name even if undefined.} +% \changes{v1.3}{2024/10/07}{Added hyperref named destination compatibility by setting counter to very low value} +% \changes{v1.3}{2024/10/07}{Changed thetheorem to csname to fix compatibility with theorem types not called ``theorem''.} % To repeat a theorem, use the |\repthm| command. % \begin{macrocode} \newcounter{old@counter} @@ -453,7 +455,8 @@ colorlinks, % % Save theorem counter so we don't increase it \setcounter{old@counter}{\value{\@@thmtype}} - \def\thetheorem{\ref{#1}} + \setcounter{\@@thmtype}{-900} + \expandafter\def\csname the\@@thmtype\endcsname{\ref{#1}} \let\@@theoremnotdefined\relax % \ifcsname thm@#1\endcsname% Check if theorem is even defined diff --git a/macros/latex/contrib/reptheorem/reptheorem.ins b/macros/latex/contrib/reptheorem/reptheorem.ins index cf6d514b27..a13a70f683 100644 --- a/macros/latex/contrib/reptheorem/reptheorem.ins +++ b/macros/latex/contrib/reptheorem/reptheorem.ins @@ -9,7 +9,7 @@ %% Copyright (c) 2024- Jesse Straat %% %% This work may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 +%% 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 %% https://www.latex-project.org/lppl.txt @@ -27,7 +27,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: reptheorem 2024-09-22 v1.2} +\Msg{* Package: reptheorem 2024-10-07 v1.3} \Msg{************************************************************************} \keepsilent @@ -38,7 +38,7 @@ Copyright (c) 2024- Jesse Straat This work may be distributed and/or modified under the -conditions of the LaTeX Project Public License, either version 1.3 +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 https://www.latex-project.org/lppl.txt diff --git a/macros/latex/contrib/suanpan-l3/suanpan-l3.pdf b/macros/latex/contrib/suanpan-l3/suanpan-l3.pdf Binary files differindex f47e8edc2f..88c05cd4d6 100644 --- a/macros/latex/contrib/suanpan-l3/suanpan-l3.pdf +++ b/macros/latex/contrib/suanpan-l3/suanpan-l3.pdf diff --git a/macros/latex/contrib/suanpan-l3/suanpan-l3.sty b/macros/latex/contrib/suanpan-l3/suanpan-l3.sty index ac30c79d74..bbe133bcd7 100644 --- a/macros/latex/contrib/suanpan-l3/suanpan-l3.sty +++ b/macros/latex/contrib/suanpan-l3/suanpan-l3.sty @@ -16,8 +16,10 @@ % \ProvidesExplPackage{suanpan-l3}{2024-09-04}{v1.2.0} % 添加\lab横梁文字标记命令 % \ProvidesExplPackage{suanpan-l3}{2024-09-05}{v1.2.1} % 将草稿模式所有算珠改为圆冒 % % 直线并取消所有高光特效 -\ProvidesExplPackage{suanpan-l3}{2024-09-07}{v1.2.2} % 为珠高、珠宽、档杆宽度和 - % 边框宽度添加设置选项 +% \ProvidesExplPackage{suanpan-l3}{2024-09-07}{v1.2.2} % 为珠高、珠宽、档杆宽度和 +% % 边框宽度添加设置选项 +\ProvidesExplPackage{suanpan-l3}{2024-09-07}{v1.2.3} % 将算珠高光改为ball类型, + % 并添加高光位置(角度)选项。 {draw suanpan(abacus) with LaTeX3} \RequirePackage{l3keys2e} @@ -25,6 +27,21 @@ \RequirePackage{l3draw} \RequirePackage {tikz} +% Expl3中载入tikz宏包库的补丁 +\ExplSyntaxOff +\patchcmd +{\pgfutil@InputIfFileExists} + {\input #1} + {% + \@pushfilename + \xdef\@currname{#1}% + \input #1 % + \@popfilename + } + {}{} +\ExplSyntaxOn +% 添加tikz宏包的库 +\usetikzlibrary{shadings} \cs_new:Npn \__suanpan_error:n { \msg_error:nn { suanpan(abacus) } } @@ -162,6 +179,7 @@ \tl_new:N \l__suanpan_bid_fill_color_tl \tl_new:N \l__suanpan_scale_tl \tl_new:N \l__suanpan_mark_font_tl +\tl_new:N \l__suanpan_bid_spot_angle_tl % 档位最大值 \int_new:N \l__suanpan_rod_max_int @@ -454,11 +472,13 @@ innerfill .initial:n = black, % 横梁标记字符格式 - font .code:n = {% - \tl_gset:Nn \l__suanpan_mark_font_tl {#1} - }, + font .tl_set:N = \l__suanpan_mark_font_tl, font .initial:n = \bfseries\Large, + % 算珠高光点位置(角度) + bidspot .tl_set:N = \l__suanpan_bid_spot_angle_tl, + bidspot .initial:n = 0, + unknown .code:n = { \msg_error:nn { suanpan } { unknown-option } } } @@ -486,9 +506,9 @@ { \l__suanpan_bid_d_half_dim - \l__suanpan_bid_draw_h_half_dim } \tikzset{bid/.style = {% 内珠高光填充样式 - inner~color = innerfillcolor!30, - outer~color = innerfillcolor, - draw = innerdrawcolor, + shading = ball, + ball~color = innerfillcolor, + shading~angle = \l__suanpan_bid_spot_angle_tl, line~width = \l__suanpan_bid_linewidth_dim, rounded~corners = \l__suanpan_bid_arc_dim, }, @@ -528,9 +548,9 @@ { \l__suanpan_bid_d_half_dim - \l__suanpan_bid_draw_h_half_dim } \tikzset{bid/.style ={ - inner~color = outerfillcolor!30, - outer~color = outerfillcolor, - draw = outerdrawcolor, + shading = ball, + ball~color = outerfillcolor, + shading~angle = \l__suanpan_bid_spot_angle_tl, line~width = \l__suanpan_bid_linewidth_dim, rounded~corners = \l__suanpan_bid_arc_dim, }, @@ -572,7 +592,12 @@ \dim_set:Nn \l_tmpa_dim { \l__suanpan_bid_d_half_dim - \l__suanpan_bid_draw_h_half_dim } - \tikzset{bid/.style ={ + \tikzset{bid/.style~args = { #1/#2 }{ + draw = #1, + shading = ball, + ball~color = #2, + shading~angle = 0, + shading~angle = \l__suanpan_bid_spot_angle_tl, line~width = \l__suanpan_bid_linewidth_dim, rounded~corners = \l__suanpan_bid_arc_dim, }, @@ -594,10 +619,7 @@ \end{tikzpicture} }{ \begin{tikzpicture} - \shadedraw[draw = #1, - inner~color=#2!30, - outer~color=#2, - bid]% + \shadedraw[bid=#1/#2] ( -\l__suanpan_bid_d_half_dim, \l__suanpan_bid_lower_dim) rectangle ( \l__suanpan_bid_d_half_dim, \l__suanpan_bid_upper_dim); @@ -778,8 +800,9 @@ \bool_if:NT \l__suanpan_support_unit_bool { \shade[% - inner~color=black!40, - outer~color=black!80, + shading = ball, + ball~color = black, + shading~angle = \l__suanpan_bid_spot_angle_tl, ] (0pt, 0pt) circle [radius = \l__suanpan_frame_unit_r_dim]; } diff --git a/macros/latex/contrib/suanpan-l3/suanpan-l3.tex b/macros/latex/contrib/suanpan-l3/suanpan-l3.tex index 89cb17784d..e411d2bdd0 100644 --- a/macros/latex/contrib/suanpan-l3/suanpan-l3.tex +++ b/macros/latex/contrib/suanpan-l3/suanpan-l3.tex @@ -124,7 +124,7 @@ { \__codedoc_cmd:no {#1} { #2 } } \ExplSyntaxOff -\def\vers{\texttt{v1.2.2} } +\def\vers{\texttt{v1.2.3} } \changes{v1.0.0}{2024/08/20}{first version.} @@ -810,6 +810,33 @@ \end{suanpan} \end{SideBySideExample} +\changes{v1.2.3}{2024/09/10}{change bid's highlight to shading=ball + and add bidspot option to set the angle + of shading.} + +\subsection{高光位置(角度)} + +\begin{option}{ opt = bidspot, desc = {= \meta{高光位置}}, init=0 } + 设置算珠高光点的位置,用角度表示,逆时针为正。 +\end{option} + +\begin{SideBySideExample}[frame=single,numbers=left,% + xrightmargin=.45\linewidth,gobble=2] + \centering + \suanpanset{scale = 0.65, bidspot = 180} + \begin{suanpan} + \rods{0, 0, 7, 11, 8, 19} + \bid{1}{1}{brown5} + \bid{2}{5}{brown5} + \bid{3}{6}{red5} + \bid{4}{7}{red5} + \bid{4}{8}{azure5} + \bid{4}{9}{yellow5} + \bid{5}{10}{violet5} + \bid{6}{4,5,6,11}{teal4}[magenta5] + \end{suanpan} +\end{SideBySideExample} + \bigskip \changes{v1.1.1}{2024/08/30}{add English documentation.} @@ -1474,6 +1501,29 @@ The ``|=true|'' in the \marg{option}|=true| for Boolean types can be omitted. \end{suanpan} \end{SideBySideExample} +\subsection{highlight pos/angle} + +\begin{option}{ opt = bidspot, desc = {= \meta{bidspot}}, init=0 } + The bid's highlight angle. +\end{option} + +\begin{SideBySideExample}[frame=single,numbers=left,% + xrightmargin=.45\linewidth,gobble=2] + \centering + \suanpanset{scale = 0.65, bidspot = 180} + \begin{suanpan} + \rods{0, 0, 7, 11, 8, 19} + \bid{1}{1}{brown5} + \bid{2}{5}{brown5} + \bid{3}{6}{red5} + \bid{4}{7}{red5} + \bid{4}{8}{azure5} + \bid{4}{9}{yellow5} + \bid{5}{10}{violet5} + \bid{6}{4,5,6,11}{teal4}[magenta5] + \end{suanpan} +\end{SideBySideExample} + \end{documentation} \end{document} |