diff options
author | Norbert Preining <norbert@preining.info> | 2023-07-25 03:01:17 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-07-25 03:01:17 +0000 |
commit | be53973de38a7aa9a3a0a8c70fd92bdf893c1a35 (patch) | |
tree | 50d18c7e399afeaa37df77a57667580ba93fea0a /macros | |
parent | 19444d4440a66200b03e05b567996375d0404a46 (diff) |
CTAN sync 202307250301
Diffstat (limited to 'macros')
24 files changed, 1097 insertions, 531 deletions
diff --git a/macros/latex/contrib/crefthe/crefthe-doc.pdf b/macros/latex/contrib/crefthe/crefthe-doc.pdf Binary files differindex 8731eb2d97..e943eabdfc 100644 --- a/macros/latex/contrib/crefthe/crefthe-doc.pdf +++ b/macros/latex/contrib/crefthe/crefthe-doc.pdf diff --git a/macros/latex/contrib/crefthe/crefthe-doc.tex b/macros/latex/contrib/crefthe/crefthe-doc.tex index 904cb5eee7..36baa45df6 100644 --- a/macros/latex/contrib/crefthe/crefthe-doc.tex +++ b/macros/latex/contrib/crefthe/crefthe-doc.tex @@ -49,6 +49,7 @@ crefthe,crefthename, Crefthe,Crefthename, crefthevariantname,Crefthevariantname, + setcrefname,setCrefname, namecrefthe,namecrefsthe, nameCrefthe,nameCrefsthe, crefthemark, @@ -118,10 +119,11 @@ \begin{document} \def\PackageVersion{2023/07/23} +\def\PackageSubVersion{a} \title{\crefthepackage{}\\\smallskip\itshape Cross referencing with proper definite articles} \author{Jinwen XU} -\thanks{Corresponding to: \texttt{\crefthepackage{} \PackageVersion}} +\thanks{Corresponding to: \texttt{\crefthepackage{} \PackageVersion\PackageSubVersion}} \date{\TheDate{\PackageVersion}[only-year-month], in Beijing} \maketitle @@ -242,7 +244,7 @@ which would result in (provided that you have done \lstinline|\selectlanguage{fr Voilà ! -\section{What about German} +\section{For language with declensions} In German, there are four declensions: nominative (\texttt{Nominativ}), genitive (\texttt{Genitiv}), dative (\texttt{Dativ}) and accusative (\texttt{Akkusativ}), making the previously presented mechanism insufficient. For such situation, we introduce the command \lstinline|\crefthevariantname| to specify the referencing name for the correspond environment. Below is an example of usage: @@ -258,7 +260,10 @@ In German, there are four declensions: nominative (\texttt{Nominativ}), genitive \end{code} \begin{tip} - The first line in the configuration is the default set of names when no variant is specified. It is recommended, though not required. + \begin{itemize} + \item The first line in the configuration is the default set of names when no variant is specified. It is recommended, though not required. + \item There is also an equivalent but shorter name \lstinline|\setcrefname| for this command. + \end{itemize} \end{tip} After this, you may refer to a theorem via @@ -280,25 +285,31 @@ Article contractions are by default enabled for German, but if you don't want th \section{Using abbreviation form} -There is another usage of \lstinline|\crefthevariantname|: setting the abbreviation form. This allows you to use both the full form and the abbreviation form in the same document. For example, you may set +There is another usage of \lstinline|\crefthevariantname| (or equivalently, \lstinline|\setcrefname|): setting the abbreviation form. This allows you to use both the full form and the abbreviation form within the same document. For example, you may set \begin{code} -\crefthevariantname{theorem} +\setcrefname{theorem} { {theorem}{theorems} , abbr. = {th.}{ths.} } \end{code} -Then, when referencing, you can use the command option \commandoption{abbr.} to enable the abbreviation form: +Then, when referencing, you can use the command option \commandoption{abbr.} to enable abbreviation: \begin{code} \crefthe[(*\commandoption{abbr.}*)]{(*\meta{label}*)} \end{code} +\begin{tip}[Attention] + Please note that \commandoption{abbr.} has more priority than the option(s) for specifying declensions. This means that when \commandoption{abbr.} is enabled, the declensions are simply ignored. +\end{tip} + \section{Regarding the upper and lower cases} -As in \textsf{cleveref}, these commands have corresponding uppercased version: \lstinline|\Crefthename|,\linebreak \lstinline|\Crefthe|, \lstinline|\nameCrefthe| and \lstinline|\nameCrefsthe|, similar to \lstinline|\Crefname|, \lstinline|\Cref|, \lstinline|\nameCref|\linebreak and \lstinline|\nameCrefs|, reserved for using at the beginning of a sentence. For languages with declensions, such as German, there is also a \lstinline|\Crefthevariantname|, whose usage is similar to the \lstinline|\crefthevariantname| introduced above. +As in \textsf{cleveref}, these commands have corresponding uppercased version: \lstinline|\Crefthename|,\linebreak \lstinline|\Crefthe|, \lstinline|\nameCrefthe| and \lstinline|\nameCrefsthe|, similar to \lstinline|\Crefname|, \lstinline|\Cref|, \lstinline|\nameCref|\linebreak and \lstinline|\nameCrefs|, reserved for using at the beginning of a sentence. + +For languages with declensions, such as German, there is also a \lstinline|\Crefthevariantname| (or equivalently, \lstinline|\setCrefname|), corresponding to the above \lstinline|\crefthevariantname|. \lstinline|\Crefthe| (and the name-only relatives) can handle case changing automatically: for example, with \lstinline|\Crefthe[À]{thm1,thm2,prop3}|, you will get something like @@ -332,7 +343,6 @@ There is another case. For example, if you wish to say \textquote{ce théorème} But then of course you shall need to write the word \textquote{Ce/Cet/Cette} (these are all different forms of \textquote{This} in French) by yourself --- and if you later decide to change the type of the environment to which this \meta{label} refers, don't forget to change this word accordingly. -\pagebreak \section{For writing multi-language documents} To place hyperlinks at the correct place, \lstinline|\crefthename| touches the corresponding format macro \lstinline|\crefformat| internally, which makes the format language-dependent. If you are writing multi-language documents, you may consider putting \lstinline|\crefthename| inside your language configuration so as to reset it each time you select a new language. @@ -368,8 +378,7 @@ There are so many people I wish to express my gratitude to during the developmen \end{itemize} -% \clearpage - +\bigskip \section{Known issues} \begin{itemize} \item \crefthepackage{} currently works for French, German, Italian, Portuguese (European and Brazilian) and Spanish --- certainly more languages would be added to this list in the future. diff --git a/macros/latex/contrib/crefthe/crefthe.sty b/macros/latex/contrib/crefthe/crefthe.sty index 4097b0aefc..4f7b382e74 100644 --- a/macros/latex/contrib/crefthe/crefthe.sty +++ b/macros/latex/contrib/crefthe/crefthe.sty @@ -12,7 +12,7 @@ \NeedsTeXFormat{LaTeX2e}[2022-06-01] \ProvidesExplPackage {crefthe} - {2023/07/23} {} + {2023/07/23a} {} {Cross referencing with proper definite articles} \keys_define:nn { crefthe } @@ -93,36 +93,53 @@ \__crefthe_cref_general:NNNnnN \c_false_bool #1 #2 { #3 } { #4 } \crefthe_nameCrefs_original:w } -\keys_define:nn { crefthe-setting } +\keys_define:nn { crefthe-command } { , noun .code:n = { \RenewDocumentCommand \crefthemark { m } {} } , variant .tl_set:N = \l__crefthe_variant_tl - % , nom .meta:n = { variant = Nominativ } - % , nom. .meta:n = { variant = Nominativ } - % , Nom .meta:n = { variant = Nominativ } - % , Nom. .meta:n = { variant = Nominativ } - % , gen .meta:n = { variant = Genitiv } - % , gen. .meta:n = { variant = Genitiv } - % , Gen .meta:n = { variant = Genitiv } - % , Gen. .meta:n = { variant = Genitiv } - % , dat .meta:n = { variant = Dativ } - % , dat. .meta:n = { variant = Dativ } - % , Dat .meta:n = { variant = Dativ } - % , Dat. .meta:n = { variant = Dativ } - % , akk .meta:n = { variant = Akkusativ } - % , akk. .meta:n = { variant = Akkusativ } - % , Akk .meta:n = { variant = Akkusativ } - % , Akk. .meta:n = { variant = Akkusativ } - - % , unknown .code:n = { - % \bool_gset_true:N \g__crefthe_has_prep_bool - % \tl_set:No \l__crefthe_prep_tl { \l_keys_key_tl } - % } + , abbr .bool_set:N = \l__crefthe_abbr_bool + , abbr. .bool_set:N = \l__crefthe_abbr_bool , unknown .code:n = {} } +\clist_const:Nn \c__crefthe_command_known_keys_clist { noun, abbr, abbr. } + +\cs_new:Nn \__crefthe_command_key_parser:n + { + \bool_set_false:N \l__crefthe_variant_matched_bool + \clist_if_in:NnF \c__crefthe_command_known_keys_clist { #1 } + { + \str_if_eq:VnT \languagename { ngerman } + { + \str_case:nnT { #1 } + { + { nom } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } } + { nom. } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } } + { Nom } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } } + { Nom. } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } } + { gen } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv } } + { gen. } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv } } + { Gen } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv } } + { Gen. } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv } } + { dat } { \tl_set:Nn \l__crefthe_variant_tl { Dativ } } + { dat. } { \tl_set:Nn \l__crefthe_variant_tl { Dativ } } + { Dat } { \tl_set:Nn \l__crefthe_variant_tl { Dativ } } + { Dat. } { \tl_set:Nn \l__crefthe_variant_tl { Dativ } } + { akk } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } } + { akk. } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } } + { Akk } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } } + { Akk. } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } } + } { \bool_set_true:N \l__crefthe_variant_matched_bool } + } + \bool_if:NF \l__crefthe_variant_matched_bool + { + \bool_gset_true:N \g__crefthe_has_prep_bool + \tl_set:Nn \l__crefthe_prep_tl { #1 } + } + } + } \bool_new:N \l__crefthe_variant_matched_bool \cs_new_protected:Nn \__crefthe_cref_general:NNNnnN @@ -136,50 +153,16 @@ \group_begin: \tl_set:Nn \l__crefthe_variant_tl {} + \bool_set_false:N \l__crefthe_abbr_bool + \bool_gset_false:N \g__crefthe_has_prep_bool \tl_set:Nn \l__crefthe_prep_tl {} - \keys_set:nn { crefthe-setting } { #4 } + \keys_set:nn { crefthe-command } { #4 } + % Below is for getting the preposition + \keyval_parse:NNn \__crefthe_command_key_parser:n \use_none:nn { #4 } - % This should actually be part of the keys parsing - \clist_map_inline:nn { #4 } - { - \bool_set_false:N \l__crefthe_variant_matched_bool - \str_if_in:nnF { ##1 } { = } - {% for keys without values - \str_case:nnT { ##1 } - { - { abbr } { \tl_set:Nn \l__crefthe_variant_tl { abbr. } } - { abbr. } { \tl_set:Nn \l__crefthe_variant_tl { abbr. } } - } { \bool_set_true:N \l__crefthe_variant_matched_bool } - \str_if_eq:VnT \languagename { ngerman } - { - \str_case:nnT { ##1 } - { - { nom } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } } - { nom. } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } } - { Nom } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } } - { Nom. } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } } - { gen } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv } } - { gen. } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv } } - { Gen } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv } } - { Gen. } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv } } - { dat } { \tl_set:Nn \l__crefthe_variant_tl { Dativ } } - { dat. } { \tl_set:Nn \l__crefthe_variant_tl { Dativ } } - { Dat } { \tl_set:Nn \l__crefthe_variant_tl { Dativ } } - { Dat. } { \tl_set:Nn \l__crefthe_variant_tl { Dativ } } - { akk } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } } - { akk. } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } } - { Akk } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } } - { Akk. } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } } - } { \bool_set_true:N \l__crefthe_variant_matched_bool } - } - \bool_if:NF \l__crefthe_variant_matched_bool - { - \tl_set:Nn \l__crefthe_prep_tl { ##1 } - } - } - } + \bool_if:NT \l__crefthe_abbr_bool { \tl_set:Nn \l__crefthe_variant_tl { abbr. } } \bool_if:NTF #2 { \tl_set:No \l__crefthe_prep_once_tl { \l__crefthe_prep_tl } } @@ -286,6 +269,9 @@ \crefthe_pass_variant_to:n { \Crefthename { #1 } } } +\NewCommandCopy \setcrefname \crefthevariantname +\NewCommandCopy \setCrefname \Crefthevariantname + \tl_new:N \l__crefthe_variant_noun_singular_tl \tl_new:N \l__crefthe_variant_noun_plural_tl \tl_new:N \l__crefthe_variant_article_singular_tl @@ -326,7 +312,7 @@ \cs_new_protected:Npn \__crefthe_parse_variant_default:n #1 { \bool_set_true:N \l__crefthe_variant_default_bool - \__crefthe_variant_parser:w #1 \q_stop + \__crefthe_variant_parser:w #1 {} {} \q_stop \tl_set:Nx \l__crefthe_variant_default_article_singular_tl { \tl_item:Nn \l__crefthe_parsed_tl { 1 } } \tl_set:Nx \l__crefthe_variant_default_noun_singular_tl @@ -338,7 +324,7 @@ } \cs_new_protected:Npn \__crefthe_parse_variant_value:nn #1#2 { - \__crefthe_variant_parser:w #2 \q_stop + \__crefthe_variant_parser:w #2 {} {} \q_stop \tl_put_right:Nx \l__crefthe_variant_article_singular_tl { { \tl_to_str:n { #1 } } { \tl_item:Nn \l__crefthe_parsed_tl { 1 } } } \tl_put_right:Nx \l__crefthe_variant_noun_singular_tl @@ -509,7 +495,10 @@ { De~les } { Des } } -\bool_if:NF \l__crefthe_disable_contractions_for_german_bool +\bool_if:NTF \l__crefthe_disable_contractions_for_german_bool + { + \tl_const:Nn \c_crefthe_contraction_rule_ngerman_tl {} + } { \tl_const:Nn \c_crefthe_contraction_rule_ngerman_tl { diff --git a/macros/latex/contrib/lastpage/README b/macros/latex/contrib/lastpage/README index 57a301f013..a22d2498f1 100644 --- a/macros/latex/contrib/lastpage/README +++ b/macros/latex/contrib/lastpage/README @@ -1,4 +1,4 @@ -README for lastpage package, 2023-04-12, v2.0b +README for lastpage package, 2023-07-24, v2.0c TABLE OF CONTENTS @@ -21,11 +21,10 @@ This LaTeX package puts the label LastPage at the end of the document into the .aux file, allowing the user to refer to the last page of a document. This might be particularly useful in places like headers or footers. - -When more than one page numbering scheme is used, or the -fnsymbol page numbering scheme is used, or another package +When more than one page numbering scheme is used, or another package has output after this package, or the number of pages instead of the last page's name is needed, or the page -numbers exeed a certain range, there might be problems, +numbers exceed a certain range, there might be problems, which can be solved by using the pageslts package instead [which needs updating to current LaTeX-format and therefore might fail]. diff --git a/macros/latex/contrib/lastpage/lastpage-example.pdf b/macros/latex/contrib/lastpage/lastpage-example.pdf Binary files differindex d3826c7544..547293f401 100644 --- a/macros/latex/contrib/lastpage/lastpage-example.pdf +++ b/macros/latex/contrib/lastpage/lastpage-example.pdf diff --git a/macros/latex/contrib/lastpage/lastpage.dtx b/macros/latex/contrib/lastpage/lastpage.dtx index cff2874020..ce1a71ad79 100644 --- a/macros/latex/contrib/lastpage/lastpage.dtx +++ b/macros/latex/contrib/lastpage/lastpage.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % File: lastpage.dtx -% Version: 2023-04-12 v2.0b +% Version: 2023-07-24 v2.0c % Info: Refers to last page's name % % Copyright © 2010 - 2023 by @@ -65,7 +65,7 @@ \input docstrip.tex \Msg{**********************************************************************} \Msg{* Installation *} -\Msg{* Package: lastpage 2023-04-12 v2.0b Refers to last page's name (HMM)*} +\Msg{* Package: lastpage 2023-07-24 v2.0c Refers to last page's name (HMM)*} \Msg{**********************************************************************} \keepsilent @@ -77,7 +77,7 @@ This is a generated file. Project: lastpage -Version: 2023-04-12 v2.0b +Version: 2023-07-24 v2.0c Info: Refers to last page's name Copyright (C) 2010 - 2023 by @@ -184,8 +184,8 @@ In memoriam %<*driver> \NeedsTeXFormat{LaTeX2e}[2022-11-01] \ProvidesFile{lastpage.drv}% - [2023-04-12 v2.0b Refers to last page's name (HMM)] -\documentclass{ltxdoc}[2022/06/22]% v2.1i Standard LaTeX documentation class + [2023-07-24 v2.0c Refers to last page's name (HMM)] +\documentclass{ltxdoc}[2023/03/28]% v2.1j Standard LaTeX documentation class \usepackage{holtxdoc}[2019/12/09]% v0.30 Private additional ltxdoc support (HO) \hypersetup{% pdfsubject={Refers to last page's name (HMM; JPG)},% @@ -230,26 +230,26 @@ In memoriam % }%^^A % \expandafter\endgroup\x % -% \DoNotIndex{\@auxout,\@evenfoot,\@firstofone,\@ifl@t@r,\@ifpackagelater,\@ifpackageloaded} -% \DoNotIndex{\@ifundefined,\@mainaux,\@number,\@oddfoot} +% \DoNotIndex{\@auxout,\@evenfoot,\@firstofone,\@firstoftwo,\@ifl@t@r,\@ifpackagelater,\@ifpackageloaded} +% \DoNotIndex{\@ifundefined,\@kernel@reserved@label@data,\@mainaux,\@number,\@oddfoot} % \DoNotIndex{\addtocounter,\AddToHook,\arabic,\begin} -% \DoNotIndex{\bigskip,\clearpage,\csname,\documentclass,\empty,\end,\endcsname} +% \DoNotIndex{\bigskip,\clearpage,\csname,\documentclass,\EdefUnescapeString,\empty,\end,\endcsname} % \DoNotIndex{\enddocument,\ExplSyntaxOff,\ExplSyntaxOn,\fmtversion} % \DoNotIndex{\g,\gdef,\here,\hfil,\Hy@temp,\Hy@unicodefalse} -% \DoNotIndex{\hypersetup,\if@filesw,\ifHy@hypertexnames,\ifHy@pageanchor,\ifHy@plainpages} -% \DoNotIndex{\ifnum,\IfPackageAtLeastTF,\IfPackageLoadedTF,\ifx,\immediate,\input} +% \DoNotIndex{\hypersetup,\if@filesw,\if@nobreak,\ifHy@hypertexnames,\ifHy@pageanchor,\ifHy@plainpages} +% \DoNotIndex{\ifnum,\IfPackageAtLeastTF,\IfPackageLoadedTF,\ifvmode,\ifx,\immediate,\input} % \DoNotIndex{\label,\lastpage,\lastpage-example.tex,\lastpage.dtx,\lastpage.sty,\lastpagee.sty} % \DoNotIndex{\lastpageclassic.sty,\lastpagemodern.sty,\LaTeX,\listfiles} -% \DoNotIndex{\makeatletter,\makeatother,\markboth,\message,\MessageBreak} -% \DoNotIndex{\NeedsTeXFormat,\newcommand,\newline,\newpage} +% \DoNotIndex{\makeatletter,\makeatother,\markboth,\mbox,\message,\MessageBreak} +% \DoNotIndex{\NeedsTeXFormat,\newcommand,\newline,\newpage,\nobreak} % \DoNotIndex{\noindent,\normalsize,\numexpr,\origenddocument,\PackageError} -% \DoNotIndex{\PackageWarning,\pagenumbering,\pageref,\pdfstringdef,\ProvidesPackage} +% \DoNotIndex{\PackageWarning,\pagenumbering,\pageref,\pdfstringdef,\protect,\ProvidesPackage} % \DoNotIndex{\qquad,\RequirePackage,\section,\slshape,\smallskip,\space,\test,\textbf} % \DoNotIndex{\textit,\textquotedblleft,\textquotedblright,\textsf,\texttt,\the,\thepage} % \DoNotIndex{\today,\upshape,\url,\usepackage,\value,\verb,\write} % % \title{The \xpackage{lastpage} package} -% \date{2023-04-12 v2.0b} +% \date{2023-07-24 v2.0c} % \author{H.-Martin Münch\\\xemail{Martin.Muench at Uni-Bonn.de}\\ % invented by Jeffrey P. Goldberg\\\xemail{jeffrey+news at goldmark.org}} % @@ -259,18 +259,18 @@ In memoriam % \noindent This \LaTeX{} package puts the label \texttt{LastPage} % at the end of the document into the \xfile{.aux} file, % allowing the user to refer to the last page of a document. -% This might be particularly useful in places like headers or footers.~--\\ -% While this package allows for things like\\ +% This might be particularly useful in places like headers or footers.~--\newline +% While this package allows for things like\newline % \hbox{\textquotedblleft Page} \hbox{|\thepage{}|} of |\pageref{LastPage}|\textquotedblright{} % to get \textquotedblleft Page 7 of 9\textquotedblright{} or % \textquotedblleft Page VII of IX\textquotedblright, % the \emph{number} of pages is nowadays available via |\@abspage@last| from the kernel, % but when more than one page numbering scheme is used -% (for example pages I~to X and then 1~to 10, thus number of pages -% \hbox{\textquotedblleft 20\textquotedblright ,} but name of the last page -% \hbox{\textquotedblleft 10\textquotedblright ),} -% or when or the fnsymbol page numbering scheme is used, or another package -% has output after this package, or the page numbers exceed a certain range, +% (for example pages I~to X and then 1~to 10, +% thus number of pages \hbox{\textquotedblleft 20\textquotedblright ,} +% but name of the last page \hbox{\textquotedblleft 10\textquotedblright ),} +% or another package has output after this package, +% or the page numbers exceed a certain range, % there might be problems, which can be solved by using the % \xpackage{pageslts} package instead. % \end{abstract} @@ -289,9 +289,9 @@ In memoriam % package is \textquotedblleft advertised\textquotedblright. The current version % 2015/12/21 v1.2f of that package has not yet been updated to the new hook mechanism. % In special cases (for example }|\pagenumbering{fnsymbol}|\textbf{) the current version -% of that package combined with a current \LaTeX-format fails. Together with about -% 80~other packages (small to large, public as well as private, some probably obsolete) -% it is in the update queue.} +% of that package combined with a current \LaTeX-format fails. Together with a lot of +% other packages (small to large, public as well as private, some probably obsolete) +% it is in my update queue.} % % \newpage % @@ -322,7 +322,7 @@ In memoriam % |\usepackage{lastpage}| % \end{quote} % \noindent in the preamble of your source file -% (or |\input{lastpage.sty}| if |\usepackage| is unknown).\\ +% (or |\input{lastpage.sty}| if |\usepackage| is unknown). % % \indent For example for various draft forms it is desirable to have a % page reference to the last page, so that e.\,g. page footers can @@ -342,14 +342,12 @@ In memoriam % \renewcommand{\@oddfoot}{\@evenfoot} % \makeatother %\end{verbatim} -% \noindent creates footers like\\ -% -% \textquotedblleft\mbox{\textsl{DRAFT \today}\hspace{1cm}page 7 of 9}\textquotedblright\\ -% -% \noindent in the compiled document (cf.~the \texttt{lastpage-example} file).\\ +% \noindent creates footers like\smallbreak +% \textquotedblleft\mbox{\textsl{DRAFT \today}\hspace{1cm}page 7 of 9}\textquotedblright\smallbreak +% \noindent in the compiled document (cf.~the \texttt{lastpage-example} file).\newline % If the \xpackage{hyperref} package is used, the references are hyperlinked % to their aims. If these hyperlinks shall be suppressed, |\pageref*{...}| -% instead of |\pageref{...}| can be used.\\ +% instead of |\pageref{...}| can be used.\bigbreak % % The \xpackage{lastpage} package does not provide the words % \textquotedblleft page\textquotedblright{} or \textquotedblleft of\textquotedblright{}, @@ -359,11 +357,12 @@ In memoriam % redefining this.) If you want to change \textquotedblleft page\textquotedblright{} or % \textquotedblleft of\textquotedblright{} (e.\,g. to another language), you therefore % have got to look in the used class/package(s)/preamble instead of in the -% \xpackage{lastpage} package.\\ +% \xpackage{lastpage} package.\bigbreak % % If the total \emph{number} of pages of a document is needed, % the kernel already gives this by |\makeatletter\@abspage@last\makeatother| % (needs at least two compiler runs). +% \newpage % % \section{Some \textsc{Warnings}\label{sec:warn}} % \subsection{\texttt{\textbackslash AtEndDocument}\label{ssec:aed}} @@ -371,12 +370,11 @@ In memoriam % version of the lastpage package, requiring \LaTeX -format 2022-11-01 % or newer. Instead |\AddToHook{enddocument/afterlastpage}| is used % and the problem does not arise.} -% % \bigskip % % \pkg{lastpageclassic.sty} uses |\AtEndDocument| and % \pkg{lastpage209.sty} redefines \linebreak |\enddocument|. -% The last two cases are problematic:\\ +% The last two cases are problematic:\newline % The output of a \LaTeXe{} run is not independent of the order % in which the packages are loaded. It is often the case that the same % formats for which one must put tables and figure at the end, @@ -388,9 +386,9 @@ In memoriam % to assume that no material will follow what they put into % |\AtEndDocument|. Therefore a message, which begins with % \texttt{AED}, is included in every usage of |\AtEndDocument|. -% \xpackage{lastpage} uses |\AtEndDocument{|\ldots|\clearpage|\ldots|}|, thus\\ +% \xpackage{lastpage} uses |\AtEndDocument{|\ldots|\clearpage|\ldots|}|, thus\newline %|\usepackage{lastpage}|\ldots|\AtEndDocument{|\textit{something}|}| -% will place \textit{something} after the |\clearpage|. To place it earlier, use\\ +% will place \textit{something} after the |\clearpage|. To place it earlier, use\newline % |\AtEndDocument{|\textit{something}|}|\ldots|\usepackage{lastpage}|. % If the \textit{something} is not known before |\usepackage{lastpage}|, % you can use for example @@ -429,7 +427,7 @@ In memoriam % to the (not so) last page, exclusive of the floats at the end, % then load in the reverse order. Independent from the order of % \xpackage{lastpage} and \xpackage{endfloat}, you will still need -% a version of \xpackage{endfloat} later than 2.0 from 1992.\\ +% a version of \xpackage{endfloat} later than 2.0 from 1992. % % Other \LaTeX2.09{} (!) packages also seem to like to redefine % |\enddocument|. In addition to the old \xpackage{endfloat}, @@ -442,7 +440,7 @@ In memoriam % and not the \textit{number} of the page is given. For example, % \texttt{Alph} page numbering scheme and $10$ pages will give \texttt{J} instead of 10, % \texttt{Roman} page numbering scheme and $10$ pages will give \texttt{X} instead of 10, -% and so on.\\ +% and so on.\newline % \indent (The \xpackage{pageslts} package puts |\lastpageref{LastPages}| % (with \textbf{s} at the end) at your disposal for remediation.) % @@ -459,7 +457,7 @@ In memoriam % (even if \texttt{arabic} is the page numbering scheme of that page). % For example, for a document with VI+36 pages, it gives % \textquotedblleft 36\textquotedblright{} as reference to the last page. -% While this is correct, the total number of pages is $42$.\\ +% While this is correct, the total number of pages is $42$.\newline % If the total \emph{number} of pages of a document is needed, % the kernel already gives this by |\makeatletter\@abspage@last\makeatother|. % The \xpackage{pageslts} package puts |\lastpageref{LastPages}| @@ -472,7 +470,7 @@ In memoriam % When the page number was manipulated by |\addtocounter{page}{...}| or % |\setcounter{page}{...}|, \texttt{LastPage} does not give the total % \textbf{number} of pages (even if \texttt{arabic} is the page numbering -% scheme of that page).\\ +% scheme of that page).\newline % The \xpackage{pageslts} package puts |\lastpageref{LastPages}| % (with \textbf{s} at the end) at your disposal for remediation: % \texttt{LastPages} ignores page number manipulation. Also |\@abspage@last| @@ -482,7 +480,7 @@ In memoriam % At a page numbering change the page number is reset to one. % Therefore \texttt{LastPage} does not give the total \textbf{number} of pages % (even if \texttt{arabic} is the page numbering scheme of that page). -% Furthermore, now two pages have the same name.\\ +% Furthermore, now two pages have the same name.\newline % The \xpackage{pageslts} package does not only put % |\lastpageref{LastPages}| (with \textbf{s} at the end) at your disposal % for remediation: \texttt{LastPages} also ignores page number manipulation. @@ -492,11 +490,11 @@ In memoriam % \subsection{Last pages of different page numbering schemes} % |\pageref{LastPage}| refers to the (maybe not so) last page of the last % page numbering scheme. References to the respective last page of the other -% page numbering schemes are not provided.\\ +% page numbering schemes are not provided.\newline % The \xpackage{pageslts} package does this with labels % \texttt{pagesLTS.<numbering scheme>}, where \texttt{<numbering scheme>} is % e.\,g. arabic, roman, Roman, alph, or Alph.\linebreak -% For fnsymbol please use |\lastpageref{pagesLTS.fnsymbol}| instead of\\ +% For fnsymbol please use |\lastpageref{pagesLTS.fnsymbol}| instead of\newline % |\pageref{pagesLTS.fnsymbol}|. % % \subsection{Current page} @@ -505,31 +503,20 @@ In memoriam % current total/absolute page number e.\,g. with a second % page numbering scheme, |\addtocounter{page}{...}|, or |\setcounter{page}{...}|, % and it will not be an arabic number at all, -% if the current page numbering scheme is not arabic.\\ +% if the current page numbering scheme is not arabic.\newline % The \xpackage{pageslts} package provides the command % |\theCurrentPage| and for the current number of pages in the current -% page numbering scheme\\ +% page numbering scheme\newline % |\theCurrentPageLocal|. The kernel already provides the % number of pages, which have been shipped out, as |\the\ReadonlyShipoutCounter|. % The current page is always |ReadonlyShipoutCounter +1|. % % \subsection{First page} % There is no special label at the first page. -% (This is the \textbf{last}\textsf{page} package, after all.)\\ +% (This is the \textbf{last}\textsf{page} package, after all.)\newline % The \xpackage{pageslts} package creates a label \texttt{pagesLTS.0} % at the first page of the document. % -% \subsection{Using the \xpackage{fnsymbol} page numbering scheme\label{ss:fnsymbol}} -% \indent Using the \texttt{fnsymbol} page numbering scheme can result in problems!\\ -% When the page, where |\pageref{lastpage}| points at, is in \texttt{fnsymbol} -% page numbering scheme, this package might screw up -- -% and quite totally for that, especially when used together with \emph{very old} -% versions of the \xpackage{hyperref} package (e.\,g. \xpackage{hyperref} v6.80x -% as of 2010/04/17). When testing with version v6.83m as of 2012/11/06 everything -% seemed to worked fine, but this might not always be the case.\\ -% The \xpackage{pageslts} package with |\lastpageref{lastpage}| and -% appropriate package options should cope even with this case. -% % \subsection{Page counter overflow\label{ss:overflow}} % \indent \textquotedblleft The ranges of supported counter values are more or less % restricted. Only \cs{arabic} can be used with any counter value \TeX{} supports. @@ -552,31 +539,32 @@ In memoriam % \texttt{MAX} = \texttt{2147483647} % \end{quote} % \textquotedblright{} (\textsc{Heiko Oberdiek}: -% The \xpackage{alphalph} package, 2010/04/18, v2.3, first table, p.~2).\\ +% The \xpackage{alphalph} package, 2010/04/18, v2.3, first table, p.~2). % -% \noindent When \textit{any} page is out of that range, there will be a counter overflow.\\ +% \noindent When \textit{any} page is out of that range, there will be a counter overflow.\newline % \xpackage{lastpage} probably is not the right package to be asked % to correct this anyway, but the \xpackage{pageslts} package % (with appropriate options) can do this. % % \subsection{Other packages manipulating \texttt{\textbackslash lastpage@putlabel}} -% The \xpackage{hyperref} package redefines the |\lastpage@putlabel| command, -% and the \xpackage{revtex4} class redefines the |\lastpage@putlabel| command, -% and the \xpackage{hyperref} package redefines the |\lastpage@putlabel| command, -% if the \xpackage{revtex4} class is used, and the \xpackage{pageslts} package +% The \xpackage{hyperref} package redefined the |\lastpage@putlabel| command, +% and the \xpackage{revtex4} class still redefines the |\lastpage@putlabel| command, +% and the \xpackage{hyperref} package redefined the |\lastpage@putlabel| command, +% if the \xpackage{revtex4} class was used, and the \xpackage{pageslts} package % \textquotedblleft kills\textquotedblright{} the |\lastpage@putlabel| command, -% because that package uses more advanced labels.\\ +% because that package uses more advanced labels.\newline % In my humble opinion it would be preferably if one package (the original one, % i.\,e. \xpackage{lastpage}) would do the job right, all others packages would % check for the version of that package, and if an old version is found, % an error (or at least a warning) message about the use of an outdated % package is given, and \textit{then} as % \textquotedblleft last aid\textquotedblright{} the command of the outdated -% package is redefined.\\ +% package is redefined.\newline % Therefore here none of the definitions or commands of the other packages % is altered, but |\lastpage@putlabel| was replaced by |\lastpage@putl@bel|. % Because |\lastpage@putlabel| is no longer called, now there should not be any % double definitions of the \texttt{lastpage} label. +% \newpage % % \section{Alternatives\label{sec:Alternatives}} % There are similar packages, which do (or do not) similar things (or even more). @@ -598,26 +586,24 @@ In memoriam % \xpackage{lastpage} package, but it became obvious that a replacement was % needed to accomplish what the \xpackage{pageslts} package does. For backward % compatibility, a label named |LastPage| is provided. -% Thus |\usepackage{lastpage}| can be replaced by\\ -% |\usepackage[pagecontinue=false,alphMult=0,AlphMulti=0,|\\ -% | fnsymbolmult=false,romanMult=false,RomanMulti=false]{pageslts}|,\\ +% Thus |\usepackage{lastpage}| can be replaced by\newline +% |\usepackage[pagecontinue=false,alphMult=0,AlphMulti=0,|\newline +% | fnsymbolmult=false,romanMult=false,RomanMulti=false]{pageslts}|,\newline % if the behaviour of the \xpackage{lastpage} package should be simulated. -% The default options are\\ -% |\usepackage[pagecontinue=true,alphMult=ab,AlphMulti=AB,|\\ -% |fnsymbolmult=true,romanMult=true,RomanMulti=true]{pageslts}|.\\ +% The default options are\newline +% |\usepackage[pagecontinue=true,alphMult=ab,AlphMulti=AB,|\newline +% |fnsymbolmult=true,romanMult=true,RomanMulti=true]{pageslts}|.\newline % Benefits of \xpackage{pageslts} package (with appropriate options) are: % \begin{description} -% \item[+] Labels \texttt{LastPage} (|\AtEndDocument|) and\\ -% \texttt{VeryLastPage} (|\AfterLastShipout|),\\ +% \item[+] Labels \texttt{LastPage} (|\AtEndDocument|) and\newline +% \texttt{VeryLastPage} (|\AfterLastShipout|),\newline % allowing the user to refer to the (very) last page of a document. % \item[+] For example, when more than one page numbering scheme is used, % the label \texttt{LastPage}\textbf{s} gives the total \textit{number} of pages. -% \item[+] At the last page of each page numbering -% scheme a label\\ -% \texttt{pagesLTS.<numbering scheme>} is -% placed, where \texttt{<numbering scheme>} is e.\,g. -% arabic, roman, Roman, alph, or Alph. For fnsymbol -% please use |\lastpageref{pagesLTS.fnsymbol}| instead of\\ +% \item[+] At the last page of each page numbering scheme a label\newline +% \texttt{pagesLTS.<numbering scheme>} is placed, where +% \texttt{<numbering scheme>} is e.\,g. arabic, roman, Roman, alph, or Alph. +% For fnsymbol please use |\lastpageref{pagesLTS.fnsymbol}| instead of\newline % |\pageref{pagesLTS.fnsymbol}|. % \item[+] When the same numbering scheme is used twice, the page numbers % are either reset to one or continued automatically, depending on the option @@ -646,7 +632,7 @@ In memoriam % \DescribeMacro{totpages}\vspace{-\baselineskip} % \begin{description} % \item[-] The \xpackage{totpages} package provides a \texttt{totpages} label similar to -% \texttt{LastPages}\\ +% \texttt{LastPages}\newline % |\AtEndDocument| (instead of |\AfterLastShipout|, as done by \xpackage{pageslts}). % The \xpackage{totpages} package additionally computes the number of paper sheets % needed to (double) print the document (with one, two, three,\ldots{} pages on @@ -661,12 +647,12 @@ In memoriam % \item[-] \textquotedblleft There is a package \xpackage{nofm.sty} available, % but some versions of it are defective, and most don't work with \xpackage{fancyhdr} % because they take over the complete page layout.\textquotedblright (\textsc{Piet van % -% Oostrum}: Page layout in \LaTeX{}, March~2, 2004, section~16; fancyhdr.pdf)\\ -% \xpackage{nofm} as of 1991/02/25 (without version number), available at\\ +% Oostrum}: Page layout in \LaTeX{}, March~2, 2004, section~16; fancyhdr.pdf)\newline +% \xpackage{nofm} as of 1991/02/25 (without version number), available at\newline % \href{https://mirror.ctan.org/obsolete/macros/latex209/contrib/misc/nofm.sty}{% % https://mirror.ctan.org/obsolete/macros/latex209/contrib/misc/nofm.sty}, \linebreak % does not work with e.\,g. \xpackage{hyperref}, redefines |\enddocument| -% as well as |\@oddhead|, |\@evenhead|, |\@oddfoot|, and |\@evenfoot|.\\ +% as well as |\@oddhead|, |\@evenhead|, |\@oddfoot|, and |\@evenfoot|.\newline % If you know the (CTAN) location of a \textbf{working}~(!) version, % please send an e-mail to the \xpackage{lastpage} maintainer, thanks! % \end{description} @@ -729,10 +715,9 @@ In memoriam % \bigskip % % \noindent (You programmed or found another alternative, -% which is available at \url{CTAN.org}?\\ +% which is available at \url{CTAN.org}?\newline % OK, send an e-mail to me with the name, location at \url{CTAN.org}, -% and a short notice, and I will probably include it in the list above.)\\ -% +% and a short notice, and I will probably include it in the list above.) % \smallskip % % \noindent About how to get those packages, please see subsection~\ref{ss:Downloads}. @@ -741,21 +726,19 @@ In memoriam % % \begin{macrocode} %<*example> -\documentclass[british]{article}[2022/07/02]% v1.4n Standard LaTeX document class +\documentclass[british]{article}[2023/05/17]% v1.4n Standard LaTeX document class \makeatletter \@ifl@t@r\fmtversion{2022/11/01}{% \AddToHook{enddocument/afterlastpage}[lastpage]{% \message{^^JLaTeX Info: Executing hook `enddocument/afterlastpage'.}}% }{\AtEndDocument{\message{^^JLaTeX Info: Executing hook `AtEndDocument'.}}% } -\makeatother -\usepackage[draft]{showkeys}[2022/04/12]% v3.18 Show cite and label keys (DPC, MH) +\usepackage[draft]{showkeys}[2023/05/11]% v3.19 Show cite and label keys (DPC, MH) %% Use final instead of draft to hide the keys. %% -\usepackage{hyperref}[2023-02-07]% v7.00v Hypertext links for LaTeX +\usepackage[pdfpagelabels=true,hyperindex=false]{hyperref}[2023-07-08]% v7.01b +%% Hypertext links for LaTeX \hypersetup{extension=pdf,% plainpages=false,% - pdfpagelabels=true,% - hyperindex=false,% pdflang={en},% pdftitle={lastpage package example},% pdfauthor={H.-Martin Muench},% @@ -765,13 +748,8 @@ In memoriam pdfstartview=Fit,% pdfpagelayout=SinglePage% } -%% If hyperref is not used, the url package -%% https://ctan.org/pkg/url -%% must be loaded for the \url used in this example: -%% \usepackage{url} -%% or just use \let\url\texttt for the one used url. -\usepackage{lastpage}[2023-04-12]% v2.0b -\makeatletter +\@ifpackageloaded{hyperref}{}{\usepackage{url}[2013/09/16]}% v3.4 +\usepackage{lastpage}[2023-07-24]% v2.0c \renewcommand{\@evenfoot}{% \normalsize\slshape \today\hfil \upshape % page \thepage{} of \pageref{LastPage}} @@ -783,7 +761,7 @@ In memoriam \section*{Example for lastpage} \markboth{Example for lastpage}{Example for lastpage} This example demonstrates the use of package\newline -\textsf{lastpage}, v2.0b as of 2023-04-12 (HMM; JPG).\newline +\textsf{lastpage}, v2.0c as of 2023-07-24 (HMM; JPG).\newline The package takes no options.\newline For more details please see the documentation!\newline @@ -808,7 +786,7 @@ trademark owner. There is no intention of infringement; the usage is to the benefit of the trademark owner.\newline \textbf{Tip}: Use \textit{logical page numbers} -for the display of the pdf (in Adobe Acrobat Reader 2022.003.20322: +for the display of the pdf (in Adobe Acrobat Reader 2023.003.20244: Edit $>$ Preferences $>$ Page Display $>$ Page Content and Information: Use logical page numbers)!\newline @@ -863,16 +841,17 @@ The code does not generally work even without hyperref. \end{quote} \noindent does work, because \verb|\lastpage@lastpage| contains the name -of the page, example:\newline -\verb|Page \thepage{} is page \makeatletter\lastpage@lastpage\makeatother.|% -\newline +of the page, \mbox{example:} +\begin{verbatim} +Page \thepage{} is (not) page \makeatletter\lastpage@lastpage\makeatother. +\end{verbatim} prints:\newline -Page \thepage{} is page \makeatletter\lastpage@lastpage\makeatother.% +Page \thepage{} is (not) page \makeatletter\lastpage@lastpage\makeatother. \newline This can be broken for example by \verb|\pagenumbering{fnsymbol}|. \newpage -\noindent The page (\verb|\thepage|): \thepage \newline +\noindent The page (\verb|\thepage|): \thepage\newline Last page's name (LastPage): \pageref{LastPage} \bigskip @@ -907,8 +886,8 @@ Last page's name (LastPage): \pageref{LastPage} \bigskip To see the content of the \texttt{enddocument/afterlastpage}-hook -(for a recent \LaTeX-format!) use -\verb|\ShowHook{enddocument/afterlastpage}|.% without the \verb||, of course! +(for a recent \LaTeX-format!) use % without the \verb||, of course! +\verb|\ShowHook{enddocument/afterlastpage}|. \end{document} %</example> % \end{macrocode} @@ -919,7 +898,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \DescribeMacro{lastpage.sty} % We first need to determine whether we are on \TeX~2.09 or \LaTeX2e.\newline % (That line, which is too long for the documentation, reads:\newline -% |\def\loadlastpage{\ProvidesPackage{lastpage}[2023/04/12 v2.0b lastpage:|\linebreak +% |\def\loadlastpage{\ProvidesPackage{lastpage}[2023/07/24 v2.0c lastpage:|\linebreak % | 2.09 or 2e? (HMM)]\relax\RequirePackage{lastpage2e}}|.) % % \begin{macrocode} @@ -927,7 +906,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook %% Part of the "lastpage" package %% loads either lastpage2.09.sty for TeX 2.09 or lastpage2e.sty for LaTeX 2e %% with code from https://groups.google.com/g/comp.text.tex/c/-Qmhj1ZI4xM -\def\loadlastpage{\ProvidesPackage{lastpage}[2023/04/12 v2.0b lastpage: 2.09 or 2e? (HMM)]\relax\RequirePackage{lastpage2e}} +\def\loadlastpage{\ProvidesPackage{lastpage}[2023/07/24 v2.0c lastpage: 2.09 or 2e? (HMM)]\relax\RequirePackage{lastpage2e}} \begingroup \expandafter \ifx \csname documentclass\endcsname\relax \endgroup \expandafter \input{lastpage209.sty} \else \endgroup \expandafter \loadlastpage @@ -943,8 +922,8 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook %% Part of the "lastpage" package %% FOR LaTeX 2.09 ONLY - FOR LaTeX 2e USE lastpage2e.sty %% This is lastpage209.sty invented by Jeffrey P. Goldberg, -%% after Piet van Oostrum: Page layout in LaTeX, March 2, 2004, section 16; fancyhdr.pdf; -%% lastpage209.sty maintained by H.-Martin Muench. +%% after Piet van Oostrum: Page layout in LaTeX, March 2, 2004, section 16; +%% fancyhdr.pdf; lastpage209.sty maintained by H.-Martin Muench. \let\origenddocument=\enddocument% \def\enddocument{\clearpage% {\addtocounter{page}{-1}% @@ -957,7 +936,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{macrocode} % % \DescribeMacro{lastpage2e.sty} -% If |\documentclass| is known, we are in \LaTeXe{} - but which one? +% If |\documentclass| is known, we are in \LaTeXe{} -- but which one? % For modern versions with \eTeX{} and hook management etc. % we load version \pkg{lastpagemodern.sty}, otherwise % \pkg{lastpageclassic.sty}. We start off by checking that we are @@ -967,7 +946,8 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook %<*lastpage2e> %% Part of the "lastpage" package \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{lastpage2e}[2023/04/12 v2.0b Decide which 2e lastpage version to use (HMM)] +\ProvidesPackage{lastpage2e}[2023/07/24 v2.0c % + Decide which 2e lastpage version to use (HMM)] \@ifl@t@r\fmtversion{2022/11/01}{\RequirePackage{lastpagemodern}}{% \RequirePackage{lastpageclassic}} \message{^^J} @@ -981,8 +961,10 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook %<*lastpageclassic> %% Part of the "lastpage" package \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{lastpageclassic}[2023/04/12 v2.0b Refers to last page's name (HMM; JPG)] -%% allows for things like "Page \thepage{} of \pageref{LastPage}" to get "Page 7 of 9" +\ProvidesPackage{lastpageclassic}[2023/07/24 v2.0c % + Refers to last page's name (HMM; JPG)] +%% allows for things like "Page \thepage{} of \pageref{LastPage}" +%% to get "Page 7 of 9" % \end{macrocode} % @@ -1018,7 +1000,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \indent |\AtBeginDocument| we give a waring about ancient versions of the \pkg{endfloat} package. % Then it is checked whether various packages are loaded. % (|\@ifpackageloaded| cannot be used later than |\AtBeginDocument|.) -% If this is the case,\\ +% If this is the case,\newline % |\lastpage@<package abbreviation>| is defined as \texttt{1} % (otherwise it stays~\texttt{0}). % @@ -1043,24 +1025,22 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{macrocode} % % |\lastpage@putlabel|, used by older versions of this package, -% is redefined e.\,g. by \xpackage{revtex}, \xpackage{hyperref}, -% \xpackage{frenchle}, and \xpackage{PPRcorners}. +% is redefined e.\,g. by \xpackage{revtex}, \xpackage{frenchle}, +% \xpackage{PPRcorners}, and old versions of \xpackage{hyperref}. % While now |\lastpage@putl@bel| is used instead, \xpackage{revtex} -% or \xpackage{hyperref} could also define a label \texttt{LastPage}, +% could also define a label \texttt{LastPage}, % which then would be multiply defined. (Which is no big issue, % if it is associated with the same page.) Therefore we define % % \begin{macrocode} \gdef\lastpage@putlabel{\relax}% -% \end{macrocode} -% -% Because |\lastpage@putlabel| might be (re)defined later, depending on the order -% in which the packages are loaded, we will do this again |\AtEndDocument|. -% -% \begin{macrocode} } % \end{macrocode} +% +% \noindent Because |\lastpage@putlabel| might be (re)defined later, +% depending on the order in which the packages are loaded, +% we will do this again |\AtEndDocument|. % \end{macro} % % \begin{macro}{\lastpage@putl@bel} @@ -1070,13 +1050,13 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook \newcommand{\lastpage@putl@bel}{% % \end{macrocode} % -% |\AtBeginDocument| it is checked whether the \xpackage{hyperref} package is loaded,\\ -% |\@ifpackageloaded{hyperref}{\gdef\lastpage@hyper{1}}{}|.\\ -% |\@ifpackageloaded| cannot be used later than |\AtBeginDocument|.\\ +% |\AtBeginDocument| it is checked whether the \xpackage{hyperref} package is loaded,\newline +% |\@ifpackageloaded{hyperref}{\gdef\lastpage@hyper{1}}{}|.\newline +% |\@ifpackageloaded| cannot be used later than |\AtBeginDocument|.\newline % User \textsc{Sebastian Bank} found and reported (Thanks!) a~case, when this check is not -% sufficient. Using a class with\\ -% |\usepackage{lastpage}|\\ -% |\AtBeginDocument{\usepackage{hyperref}}|\\ +% sufficient. Using a class with\newline +% |\usepackage{lastpage}|\newline +% |\AtBeginDocument{\usepackage{hyperref}}|\newline % leads to failed detection of the \xpackage{hyperref} package, because % |\AtBeginDocument| \textit{first} the check for \xpackage{hyperref} is performed, % and \textit{then} \xpackage{hyperref} is loaded. As mentioned above, @@ -1105,7 +1085,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook \else% % \end{macrocode} % -% Otherwise the label is set:\\ +% Otherwise the label is set:\newline % We have got to distinguish whether \xpackage{hyperref} has been loaded or not: % % \begin{macrocode} @@ -1173,8 +1153,8 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % the write out, we need to do an |\immediate| write into the \xfile{aux} file. % % \begin{macrocode} -%% The following code is from the hyperref package %% -%% 2010/04/17 v6.80x; newer versions are available. %% +%% with code from \Hy@EveryPageAnchor of the hyperref package, +%% 2010/04/17 v6.80x; newer versions are available \let\@number\@firstofone% \ifHy@pageanchor% \ifHy@hypertexnames% @@ -1182,23 +1162,16 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook \def\Hy@temp{\arabic{page}}% \else% \Hy@unicodefalse% -%% Code not from hyperref package: %% -%% The following lines are taken from the pageslts package, %% -%% which in turn got them from the hyperref package and %% -%% modified them. %% -%% Without the modification, after the first shipout "PD1" %% -%% is inserted each time |\pdfstringdef\Hy@temp{\thepage}| %% -%% is executed. %% \ifnum \value{page}=1\relax% % \end{macrocode} % % We do not count the pages ourselves, and so they could have been changed by -% e.\,g. |\pagenumbering{...}|, |\addtocounter{page}{...}|,\\ +% e.\,g. |\pagenumbering{...}|, |\addtocounter{page}{...}|,\newline % |\setcounter{page}{...}|. Thus the page might have the number one % while not being the first page at all. Using the \xpackage{everyshi} % package would help, but this package should not require other packages. % The \xpackage{pageslts} package does a better handling, but requires -% some other packages.\\ +% some other packages.\newline % We will make a mistake here at most once: % % \begin{macrocode} @@ -1206,18 +1179,11 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook \def\Hy@temp{\thepage}% \gdef\lastpage@firstpage{0}% \else% -%% Code from hyperref package again: %% \pdfstringdef\Hy@temp{\thepage}% -%% End of code from the hyperref package. %% \fi% -%% The pageslts package would even check for fnsymbol page %% -%% numbering scheme and adapt the code correspondingly. %% \else% -%% Code from hyperref package again: %% \pdfstringdef\Hy@temp{\thepage}% -%% Code from pageslts package again: %% \fi% -%% Code from hyperref package again: %% \fi% \else% \def\Hy@temp{\the\Hy@pagecounter}% @@ -1227,7 +1193,6 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook \string\newlabel{LastPage}{{}{\thepage}{}{% \ifHy@pageanchor page.\Hy@temp\fi}{}}% }% -%% End of code from the hyperref package. %% % \end{macrocode} % % We also save the values, so that we can later (next rerun) check, @@ -1241,7 +1206,6 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook \immediate\write\@auxout{\string\gdef\string\lastpage@lastpageHy{}}% \fi% % \end{macrocode} -% \pagebreak % % After the writeout we restore the page number again, % since there might be other things still to be done. @@ -1253,6 +1217,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{macrocode} % \end{macro} +% \newpage % % \begin{macro}{\lastpage@putlabelNR} % \indent The \xpackage{nameref} package redefines |\label| to have five arguments @@ -1317,7 +1282,6 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{macrocode} % \end{macro} -% \pagebreak % % \begin{macro}{\lastpage@fileswtestHy} % \indent When the \xpackage{hyperref} package has been loaded, @@ -1333,7 +1297,6 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook \lastpage@fileswtest{\empty}{\lastpage@lastpageHy}% \fi% } - % \end{macrocode} % \end{macro} % @@ -1343,6 +1306,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % whether it is still unchanged, which is OK for the first run only. % % \begin{macrocode} + \AtEndDocument{% \ifx\lastpage@LTS\lastpage@one% \else% @@ -1411,7 +1375,8 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook %<*lastpagemodern> %% Part of the "lastpage" package \NeedsTeXFormat{LaTeX2e}[2022-11-01] -\ProvidesPackage{lastpagemodern}[2023-04-12 v2.0b Refers to last page's name (HMM; JPG)] +\ProvidesPackage{lastpagemodern}[2023-07-24 v2.0c % + Refers to last page's name (HMM; JPG)] %% allows for things like "Page \thepage{} of \pageref{LastPage}" %% to get "Page 7 of 9" or "Page VII of IX"; %% the NUMBER of pages is available via \@abspage@last, but with pages @@ -1439,46 +1404,47 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{macrocode} % % \DescribeMacro{\AddToHook\{begindocument/end\}} -% \indent At |begindocument/end| we give a warning about ancient versions -% of the \pkg{endfloat} package. -% -% \begin{macrocode} -\AddToHook{begindocument/end}{% - \IfPackageLoadedTF{endfloat}{% - \IfPackageAtLeastTF{endfloat}{1994/06/01}{\relax}{% - \PackageError{lastpage}{% - Incompatibility with outdated version of endfloat package}{% - lastpage is not fully compatible with a version\MessageBreak% - before 2.1 of the endfloat package,\MessageBreak% - because those versions redefined\MessageBreak% - the \string\enddocument\space command.}% - }}{}% -% \end{macrocode} -% -% |\lastpage@putlabel|, used by older versions of this package, -% is redefined e.\,g. by \xpackage{revtex}, \xpackage{hyperref}, -% \xpackage{frenchle}, and \xpackage{PPRcorners}. +% \indent |\lastpage@putlabel|, used by older versions of this package, +% is redefined e.\,g. by \xpackage{revtex}, \xpackage{frenchle}, +% \xpackage{PPRcorners}, and old versions of \xpackage{hyperref}. % While now |\lastpage@putl@bel| is used instead, \xpackage{revtex} -% or \xpackage{hyperref} could also define a label \texttt{LastPage}, +% could also define a label \texttt{LastPage}, % which then would be multiply defined. (Which is no big issue, % if it is associated with the same page.) Therefore we define % % \begin{macrocode} - \gdef\lastpage@putlabel{\relax}% +\AddToHook{begindocument/end}{\gdef\lastpage@putlabel{\relax}} + % \end{macrocode} % % Because |\lastpage@putlabel| might be (re)defined later, depending on the order % in which the packages are loaded, we will do this again at the end of the document. % +% \begin{macro}{\protected@iwrite} +% \indent We need an |\immediate\protected@write|. Just |\immediate\write| had led to errors, +% for example when pakets like \pkg{babel-greek} re-defined |\roman|\ % +% (thanks to Ulrike Fischer for the report). +% % \begin{macrocode} +%% From https://tex.stackexchange.com/a/542425 with thanks to +%% Prof. Enrico Gregorio +\long\def\protected@iwrite#1#2#3{% + \begingroup% + #2% + \let\protect\@unexpandable@protect% + \edef\reserved@a{\immediate\write#1{#3}}% + \reserved@a% + \endgroup% + \if@nobreak\ifvmode\nobreak\fi\fi% } % \end{macrocode} +% \end{macro} % % \begin{macro}{\lastpage@putl@bel} % \indent This command does the writing of the label. -% If the \xpackage{pageslts} package is used, this \xpackage{lastpage} package is -% not needed at all. The \xpackage{LastPage} label would even be defined twice. +% If the \xpackage{pageslts} package is used, this \xpackage{lastpage} package +% is not needed at all. The \xpackage{LastPage} label would even be defined twice. % Thus, if \xpackage{pageslts} is used, here nothing is done. % % \begin{macrocode} @@ -1486,175 +1452,117 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook \IfPackageLoadedTF{pageslts}{\relax}{% % \end{macrocode} % -% Otherwise the label is set:\\ -% We have got to distinguish whether \xpackage{hyperref} has been loaded or not: -% -% \begin{macrocode} - \IfPackageLoadedTF{hyperref}{\lastpage@putlabelhyper}{% -% \end{macrocode} -% -% and also need to treat documents with \xpackage{nameref} differently: -% -% \begin{macrocode} - \IfPackageLoadedTF{nameref}{\lastpage@putlabelNR}{% -% \end{macrocode} +% \noindent Otherwise the label is set:\newpage % -% When those packages have not been loaded, we just write the -% simple label into the \xfile{aux} file (and store the value of the page): +% \noindent If the \xpackage{hyperref} package is used, but page-anchors are disabled, +% the hyperlinking will not work. % % \begin{macrocode} - \begingroup% - \addtocounter{page}{-1}% - \immediate\write\@auxout{\string\newlabel{LastPage}{{}{\thepage}}}% - \immediate\write\@auxout{\string\xdef\string\lastpage@lastpage{\thepage}}% - \immediate\write\@auxout{\string\gdef\string\lastpage@lastpageHy{}}% - \addtocounter{page}{+1}% - \endgroup% - }% - }% - }% - } - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\lastpage@putlabelhyper}% -% \indent When \xpackage{hyperref} has been loaded, the label is set with the -% |\lastpage@putlabelhyper| command. If the \xpackage{hyperref} package is used, -% but page-anchors are disabled, the hyperlinking will not work. -% -% \begin{macrocode} -\newcommand{\lastpage@putlabelhyper}{% - \ifHy@pageanchor% - \else% - \PackageError{lastpage}{hyperref option pageanchor disabled}{% - The \string\pageref{LastPage} link does not work\MessageBreak% - using hyperref with disabled option `pageanchor'.\MessageBreak% - }% - \fi% + \IfPackageLoadedTF{hyperref}{\ifHy@pageanchor\else% + \PackageError{lastpage}{hyperref option pageanchor disabled}{% + The \string\pageref{LastPage} link does not work\MessageBreak% + using hyperref with disabled option `pageanchor'.\MessageBreak% + }\fi}{}% + \begingroup% % \end{macrocode} % -% Since the page has been put out, we are on the page \textit{after} that page. +% \noindent Since the page has been put out, we are on the page \textit{after} that page. % We therefore subtract one from the page counter. (For the compiler, % this is equal to |\advance\c@page\m@ne|, but for human readers of the code % it is probably easier to understand.) % % \begin{macrocode} - \begingroup% - \addtocounter{page}{-1}% + \addtocounter{page}{-1}% % \end{macrocode} % -% Simply using |\label| for \texttt{LastPage} would not work, +% \noindent Simply using |\label| for \texttt{LastPage} would not work, % because labels wait for the output routines to work, and there -% may be no more invocations of the output routines. To force -% the write out, we need to do an |\immediate| write into the \xfile{aux} file. -% -% \begin{macrocode} -%% The following code is from the hyperref package %% -%% 2010/04/17 v6.80x; newer versions are available. %% - \let\@number\@firstofone% - \ifHy@pageanchor% - \ifHy@hypertexnames% - \ifHy@plainpages% - \def\Hy@temp{\arabic{page}}% - \else% - \Hy@unicodefalse% -%% Code not from hyperref package: %% -%% The following lines are taken from the pageslts package, %% -%% which in turn got them from the hyperref package and %% -%% modified them. %% -%% Without the modification, after the first shipout "PD1" %% -%% is inserted each time |\pdfstringdef\Hy@temp{\thepage}| %% -%% is executed. %% - \ifnum \value{page}=1\relax% -% \end{macrocode} -% -% We do not count the pages ourselves, and so they could have been changed by -% e.\,g. |\pagenumbering{...}|, |\addtocounter{page}{...}|,\\ -% |\setcounter{page}{...}|. Thus the page might have the number one -% while not being the first page at all. Using the (obsolete) \xpackage{everyshi} -% package would help, but this package should not require other packages. -% The \xpackage{pageslts} package does a better handling, but requires -% some other packages.\\ -% We will make a mistake here at most once: +% may be no more invocations of the output routines. +% To force the write out, we need to do an |\immediate| protected write +% into the \xfile{aux} file. % % \begin{macrocode} - \ifx \lastpage@firstpage\lastpage@one\relax% - \def\Hy@temp{\thepage}% - \gdef\lastpage@firstpage{0}% + \IfPackageLoadedTF{hyperref}{% + % with code from \Hy@EveryPageAnchor of the hyperref package, + % 2023-07-08 v7.01b + \ifHy@pageanchor% + \ifHy@hypertexnames% + \ifHy@plainpages% + \def\Hy@temp{\the\c@page}% + \def\Hy@TempPageAnchor{\hyper@@anchor{page.\the\c@page}}% + \Hy@PageAnchorSlidesPlain% \else% -%% Code from hyperref package again: %% - \pdfstringdef\Hy@temp{\thepage}% -%% End of code from the hyperref package. %% - \fi% -%% The pageslts package would even check for fnsymbol page %% -%% numbering scheme and adapt the code correspondingly. %% + % No \begingroup, because we are in a group anyway. + \let\@number\@firstofone% + \Hy@unicodefalse% + \Hy@PageAnchorSlide% + \pdfstringdef\@the@H@page{\thepage}% + % No \endgroup, because we are in a group anyway. + \EdefUnescapeString\@the@H@page{\@the@H@page}% + \def\Hy@TempPageAnchor{\hyper@@anchor{page.\@the@H@page}}% + \def\Hy@temp{\@the@H@page}% + \fi% \else% -%% Code from hyperref package again: %% - \pdfstringdef\Hy@temp{\thepage}% -%% Code from pageslts package again: %% + % NOT! \Hy@GlobalStepCount\Hy@pagecounter + \def\Hy@TempPageAnchor{\hyper@@anchor{page.\the\Hy@pagecounter}}% + \def\Hy@temp{\the\Hy@pagecounter}% \fi% -%% Code from hyperref package again: %% \fi% - \else% - \def\Hy@temp{\the\Hy@pagecounter}% - \fi% - \fi% - \immediate\write\@auxout{% - \string\newlabel{LastPage}{{}{\thepage}{}{% - \ifHy@pageanchor page.\Hy@temp\fi}{}}% - }% -%% End of code from the hyperref package. %% + }{}% + \IfFormatAtLeastTF{2023/06/01}{% % \end{macrocode} % -% We also save the values, so that we can later (next rerun) check, -% whether they have been saved in the \xfile{aux} file. +% \noindent The |\label| command has been extended, see \LaTeX{} News Issue~37, +% June~2023 (\LaTeX{} release 2023-06-01), +% \url{https://www.latex-project.org/news/latex2e-news/ltnews37.pdf}. % % \begin{macrocode} - \immediate\write\@auxout{\string\xdef\string\lastpage@lastpage{\thepage}}% - \ifHy@pageanchor% - \immediate\write\@auxout{\string\xdef\string\lastpage@lastpageHy{\Hy@temp}}% - \else% - \immediate\write\@auxout{\string\gdef\string\lastpage@lastpageHy{}}% - \fi% + \protected@iwrite\@auxout{}{\string\newlabel{LastPage}{% + {\@currentlabel}% + {\IfPackageLoadedTF{hyperref}{\string\begingroup% + \string\pdfstringdefDisableCommands{\string\let% + \string\TextOrMath\string\@firstoftwo}\thepage% + \string\endgroup% + }{\thepage}}% + {\@currentlabelname}% + {\IfPackageLoadedTF{hyperref}{\ifHy@pageanchor page.\Hy@temp\fi% + }{\@currentHref}}% + {\@kernel@reserved@label@data}}}% + }{\IfPackageLoadedTF{hyperref}{\protected@iwrite\@auxout{}{% + \string\newlabel{LastPage}{{}{\thepage}{}{% + \ifHy@pageanchor page.\Hy@temp\fi}{}}}% + }{\IfPackageLoadedTF{nameref}{\protected@iwrite\@auxout{}{% + \string\newlabel{LastPage}{{}{\thepage}{}{}{}}}% + }{\protected@iwrite\@auxout{}{\string\newlabel{LastPage}{% + {}{\thepage}}}% + }% + }% + }% % \end{macrocode} % -% After the writeout we restore the page number again, -% since there might be other things still to be done. +% \noindent We also save the values, so that we can later (next rerun) check, +% whether they have been saved in the \xfile{aux} file. % % \begin{macrocode} - \addtocounter{page}{+1}% - \endgroup% - } - + \protected@iwrite\@auxout{}{\string\gdef\string\lastpage@lastpage{\thepage}}% + \gdef\lastpage@Hy{\IfPackageLoadedTF{hyperref}{\ifHy@pageanchor\Hy@temp\fi}{}}% + \protected@iwrite\@auxout{}{\string\gdef\string\lastpage@lastpageHy{\lastpage@Hy}}% % \end{macrocode} -% \end{macro} % -% \begin{macro}{\lastpage@putlabelNR} -% \indent The \xpackage{nameref} package redefines |\label| to have five arguments -% instead of two, therefore -% \newline -% |\newlabel{LastPage}{{}{\thepage}{}{}{}}| -% instead of\newline -% |\newlabel{LastPage}{{}{\thepage}}| must be used: +% \noindent After the writeout we restore the page number again, +% since there might be other things still to be done. % % \begin{macrocode} -\newcommand{\lastpage@putlabelNR}{% - \begingroup% - \addtocounter{page}{-1}% - \immediate\write\@auxout{\string\newlabel{LastPage}{{}{\thepage}{}{}{}}}% - \immediate\write\@auxout{\string\xdef\string\lastpage@lastpage{\thepage}}% - \immediate\write\@auxout{\string\gdef\string\lastpage@lastpageHy{}}% - \addtocounter{page}{+1}% - \endgroup% + \addtocounter{page}{+1}% + \endgroup% + }% } % \end{macrocode} % \end{macro} -% \pagebreak % % \begin{macro}{\lastpage@fileswtest} -% \indent Later it will be determined whether it is allowed to write +% \indent \hspace*{2em}Later it will be determined whether it is allowed to write % to the \xfile{aux} file. If it was \emph{not} allowed, it is checked % whether the label was already set via the \xfile{aux} file in some % earlier compilation run. (There are packages where the document @@ -1694,9 +1602,10 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{macrocode} % \end{macro} +% \newpage % % \begin{macro}{\lastpage@fileswtestHy} -% \indent When the \xpackage{hyperref} package has been loaded, +% \indent \hspace*{2em}When the \xpackage{hyperref} package has been loaded, % |\lastpage@lastpageHy| must be tested additionally. (And a % |\newcommand| is needed, because |\ifHy@pageanchor| is not even % defined when \xpackage{hyperref} has not been loaded.) @@ -1730,7 +1639,6 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook }% \gdef\lastpage@putlabel{\relax}% % \end{macrocode} -% \pagebreak % % It is checked whether writing to files is allowed % (otherwise, only an error message is issued and nothing is done). @@ -1739,8 +1647,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook \if@filesw% % \end{macrocode} % -% We put in a |\message| to show, in what order things (which were called) -% are done. +% We put in a |\message| to show, in what order things (which were called) are done. % % \begin{macrocode} \message{^^Jenddocument/afterlastpage: lastpage setting LastPage.^^J}% @@ -1768,19 +1675,19 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook } %</lastpagemodern> % \end{macrocode} -% \pagebreak +% \newpage % % \section{Installation} % \subsection{Downloads\label{ss:Downloads}} % Everything is available at \url{https://www.ctan.org}, -% but may need additional packages themselves.\\ +% but may need additional packages themselves. % % \DescribeMacro{lastpage.dtx} % For unpacking the |lastpage.dtx| file and constructing the documentation it is required: % \begin{description} % \item[-] \TeX Format \LaTeXe{}: \url{https://www.CTAN.org} % -% \item[-] document class \xclass{ltxdoc}, 2022/06/22, v2.1i, +% \item[-] document class \xclass{ltxdoc}, 2023/03/28, v2.1j, % \url{https://ctan.org/pkg/ltxdoc} % % \item[-] package \xpackage{holtxdoc}, 2019/12/09, v0.30, @@ -1793,7 +1700,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \begin{description} % \item[-] \TeX, \url{https://www.CTAN.org} % -% \item[-] package \xpackage{lastpage}, 2023-04-12, v2.0b, +% \item[-] package \xpackage{lastpage}, 2023-07-24, v2.0c, % \url{https://ctan.org/pkg/lastpage} % \end{description} % @@ -1803,10 +1710,10 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \begin{description} % \item[-] \TeX-format \LaTeX{}, v2.09 % -% \item[-] package \xpackage{lastpage209}, 2023-04-12, v2.0b, +% \item[-] package \xpackage{lastpage209}, 2023-07-24, v2.0c, % \url{https://ctan.org/pkg/lastpage} % \end{description} -% and does not work with \xpackage{hyperref}, which needs \LaTeX2e{}.\\ +% and does not work with \xpackage{hyperref}, which needs \LaTeX2e{}. % % \DescribeMacro{lastpage2e.sty} % The |lastpage2e.sty| for \LaTeXe{} (i.\,e. each document using @@ -1815,7 +1722,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \item[-] \TeX-format \LaTeXe{} 1994/12/01 or newer, % \url{https://www.CTAN.org} % -% \item[-] package \xpackage{lastpage}, 2023-04-12, v2.0b, +% \item[-] package \xpackage{lastpage}, 2023-07-24, v2.0c, % \url{https://ctan.org/pkg/lastpage} % \end{description} % @@ -1823,15 +1730,15 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % The |lastpageclassic.sty| for \LaTeXe{} (i.\,e. each document using % the \xpackage{lastpageclassic} package) requires: % \begin{description} -% \item[-] \TeX-format \LaTeXe{} between 1994/12/01 and 2022/11/01,\\ +% \item[-] \TeX-format \LaTeXe{} between 1994/12/01 and 2022/11/01,\newline % \url{https://www.CTAN.org} % -% \item[-] package \xpackage{lastpage}, 2023-04-12, v2.0b, +% \item[-] package \xpackage{lastpage}, 2023-07-24, v2.0c, % \url{https://ctan.org/pkg/lastpage} % \end{description} % and can use % \begin{description} -% \item[-] package \xpackage{hyperref}, 2023-02-07, v7.00v, +% \item[-] package \xpackage{hyperref}, 2023-07-08, v7.01b, % \url{https://ctan.org/pkg/hyperref} % \end{description} % @@ -1839,15 +1746,15 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % The |lastpagemodern.sty| for \LaTeXe{} (i.\,e. each document using % the \xpackage{lastpagemodern} package) requires: % \begin{description} -% \item[-] \TeX-format \LaTeXe{} 2022-11-01 or newer, +% \item[-] \TeX-format \LaTeXe{} 2022-11-01, better yet 2023-06-01 or newer, % \url{https://www.CTAN.org} % -% \item[-] package \xpackage{lastpage}, 2023-04-12, v2.0b, +% \item[-] package \xpackage{lastpage}, 2023-07-24, v2.0c, % \url{https://ctan.org/pkg/lastpage} % \end{description} % and can use % \begin{description} -% \item[-] package \xpackage{hyperref}, 2023-02-07, v7.00v, +% \item[-] package \xpackage{hyperref}, 2023-07-08, v7.01b, % \url{https://ctan.org/pkg/hyperref} % \end{description} % @@ -1855,21 +1762,21 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % The |lastpage-example.tex| requires the same file as all % documents using the \xpackage{lastpage} package, i.\,e. % \begin{description} -% \item[-] package \xpackage{lastpage}, 2023-04-12, v2.0b, -% \url{https://ctan.org/pkg/lastpage}\\ +% \item[-] package \xpackage{lastpage}, 2023-07-24, v2.0c, +% \url{https://ctan.org/pkg/lastpage}\newline % (Well, it is the example file for this package, and because you are reading the % documentation for the \xpackage{lastpage} package, it can be assumed that you already % have some version of it -- is it the current one?) % \end{description} % and additionally: % \begin{description} -% \item[-] class \xpackage{article}, 2022/07/02, v1.4n, from \xpackage{classes}: +% \item[-] class \xpackage{article}, 2023-05-17, v1.4n, from \xpackage{classes}: % \url{https://ctan.org/pkg/classes} % -% \item[-] package \xpackage{showkeys}, 2022/04/12, v3.18, +% \item[-] package \xpackage{showkeys}, 2023-05-11, v3.19, % \url{https://ctan.org/pkg/showkeys} % -% \item[-] package \xpackage{hyperref}, 2023-02-07, v7.00v, +% \item[-] package \xpackage{hyperref}, 2023-07-08, v7.01b, % \url{https://ctan.org/pkg/hyperref} % \end{description} % @@ -1890,7 +1797,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \xpackage{fancyheadings}), but because they were mentioned, also they are listed % here: % \begin{description} -% \item[-] package \xpackage{fancyhdr}, 2022/11/09, v4.1, +% \item[-] package \xpackage{fancyhdr}, 2022-11-09, v4.1, % \url{https://ctan.org/pkg/fancyhdr} % % \item[-] package \xpackage{nccfancyhdr}, 2004/12/07, v1.1, @@ -1910,8 +1817,8 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \item[-] package \xpackage{pageslts}, 2015/12/21, v1.2f, % \url{https://ctan.org/pkg/pageslts} % -% \item[-] package \xpackage{papermas}, 2011/08/22, v1.0h; the \xpackage{papermas} -% package can be considered as kind of add-on to the \xpackage{pageslts} package.\\ +% \item[-] package \xpackage{papermas}, 2023-04-12, v1.1a; the \xpackage{papermas} +% package can be considered as kind of add-on to the \xpackage{pageslts} package.\newline % \url{https://ctan.org/pkg/papermas} % % \item[-] package \xpackage{count1to}, 2009/05/24, v2.1, @@ -1933,7 +1840,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \item[-] package \xpackage{zref}, 2022-04-07, v2.34, % \url{https://ctan.org/pkg/zref} % -% \item[-] class \xpackage{memoir}, 2022-11-17, 3.7.19, +% \item[-] class \xpackage{memoir}, 2022-11-17, v3.7.19, % \url{https://ctan.org/pkg/memoir}. % \end{description} % @@ -1942,25 +1849,24 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \DescribeMacro{zref} % All packages of the `oberdiek' bundle % (especially \xpackage{holtxdoc} and \xpackage{zref}) -% are also available in a TDS compliant ZIP archive:\\ -% \url{https://mirror.ctan.org/install/macros/latex/contrib/oberdiek.tds.zip}.\\ +% are also available in a TDS compliant ZIP archive:\newline +% \url{https://mirror.ctan.org/install/macros/latex/contrib/oberdiek.tds.zip}.\newline % It is probably best to download and use this, because the packages in there -% are quite probably both recent and compatible among themselves.\\ +% are quite probably both recent and compatible among themselves.\par % % \DescribeMacro{hyperref} % \noindent \xpackage{hyperref} is not included in that bundle and needs to be -% downloaded separately,\\ -% \url{https://mirror.ctan.org/install/macros/latex/contrib/hyperref.tds.zip}.\\ +% downloaded separately,\newline +% \url{https://mirror.ctan.org/install/macros/latex/contrib/hyperref.tds.zip}.\par % % \DescribeMacro{Münch} -% A hyperlinked list of my (other) packages can be found at\\ +% A hyperlinked list of my (other) packages can be found at\newline % \url{https://ctan.org/author/muench-hm}. -% \pagebreak % % \subsection{Package, unpacking TDS} % \paragraph{Package.} This package is available on \url{https://www.CTAN.org}. % \begin{description} -% \item[\url{https://mirror.ctan.org/macros/latex/contrib/lastpage/lastpage.dtx}]\hspace*{0.1cm} \\ +% \item[\url{https://mirror.ctan.org/macros/latex/contrib/lastpage/lastpage.dtx}]\hspace*{0.1cm} \newline % The source file. % \item[\url{https://mirror.ctan.org/macros/latex/contrib/lastpage/lastpage.pdf}]\hspace*{0.1cm} \\ % The documentation. @@ -1997,7 +1903,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \verb|tex lastpage.dtx| % \end{quote} % -% About generating the documentation see paragraph~\ref{GenDoc} below.\\ +% \noindent About generating the documentation see paragraph~\ref{GenDoc} below.\par % % \paragraph{TDS.} Now the different files must be moved into % the different directories in your installation TDS tree @@ -2123,10 +2029,10 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{quote} % % \subsection{Compiling the example} -% The example file, \textsf{lastpage-example.tex}, can be compiled via\\ -% \indent |latex lastpage-example.tex|\\ -% or (recommended)\\ -% \indent |pdflatex lastpage-example.tex|\\ +% The example file, \textsf{lastpage-example.tex}, can be compiled via\newline +% \indent |latex lastpage-example.tex|\newline +% or (recommended)\newline +% \indent |pdflatex lastpage-example.tex|\newline % and will need at least two compiler runs to get all references right. % % \section{Acknowledgements} @@ -2139,13 +2045,11 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % I know about creating a file in \xfile{dtx} format, OK, say it: copying), % and the \Newsgroup{comp.text.tex} and \Newsgroup{de.comp.text.tex} % newsgroups for their help in all things \TeX{}. Thanks for bug reports -% to \textsc{Ulrike Fischer}, \textsc{Sebastian Bank}, \textsc{James Hedges}, +% to \textsc{Ulrike Fischer} (twice), \textsc{Sebastian Bank}, \textsc{James Hedges}, % \textsc{Mikhail Titov}, \textsc{Micha\l{} Herman}, and \textsc{Matteo Gamboz}. % Thanks to \textsc{Sven Siegmund} for pointing out a necessary further % explanation in the documentation. % -% \pagebreak -% % \phantomsection % \begin{History}\label{History} % \begin{Version}{1994/06/17 v0.99a} @@ -2155,9 +2059,9 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \item Last version number created by \textsc{Jeffrey P. Goldberg}. % \end{Version} % \begin{Version}{1994/07/20 v0.1b (again)} -% \item Documentation updated by \textsc{Jeffrey P. Goldberg}.\\ +% \item Documentation updated by \textsc{Jeffrey P. Goldberg}.\newline % The main source code of the \xpackage{lastpage} package 1994/07/20, -% v0.1b, was:\\ +% v0.1b, was: % \begin{verbatim} % \NeedsTeXFormat{LaTeX2e}[1994/06/01] % \ProvidesPackage{lastpage}[1994/07/20 v0.1b @@ -2171,11 +2075,9 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \clearpage\lastpage@putlabel}% % \endinput % \end{verbatim} -% and then the \xpackage{hyperref} package and the \xpackage{revtex4} -% class even redefine\\ -% |\lastpage@putlabel| (at least \xpackage{hyperref} version -% 2012/11/06, v6.83m, and -% REV\TeX{}4 version 2010/07/25, v4.1r, still did this). +% and then the \xpackage{hyperref} package (2012/11/06, v6.83m) +% even redefined |\lastpage@putlabel|; the \xpackage{REV\TeX{}4} +% class 2022-06-05, v4.2f, still does this. % \end{Version} % \begin{Version}{2010/02/18 v1.1} % \item Proposed |LastPages| label by \textsc{H.-Martin Münch} @@ -2189,8 +2091,8 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \xpackage{fancyhdr} package at all. % \item Included \textsf{lastpage209.sty} for \LaTeX2.09{}. % \item Replacement of |\filedate|, |-version|, |-name|,\ldots{} because -% of \LaTeX{}~bug 2705:\\ -% Synopsis: Possible problem with |\fileversion| and |\filedate|\\ +% of \LaTeX{}~bug 2705:\newline +% Synopsis: Possible problem with |\fileversion| and |\filedate|\newline % \url{https://www.latex-project.org/cgi-bin/ltxbugs2html?category=LaTeX&responsible=anyone&state=anything&keyword=lastpage&pr=latex/2705} % \item Example |lastpage-example.tex|. % \item Alternatives listing (section \ref{sec:Alternatives}). @@ -2218,7 +2120,8 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % |\AtBeginDocument|, when placing the \texttt{lastpage} label it is also % checked for the |\hyperref| command, in case \xpackage{hyperref} was not % loaded at |\begin{document}| yet. (Bug reported by \textsc{Sebastian Bank}, -% thanks!) [lastpagemodern.sty just uses |\IfPackageLoadedTF{hyperref}|.] +% thanks!)\newline +% [\pkg{lastpagemodern.sty} just uses |\IfPackageLoadedTF{hyperref}|.] % \item Changed the |\unit| definition (got rid of an old |\rm|). [Removed in v2.0a.] % \item Changed |\lastpage@puthyperlabel| to |\lastpage@putlabelhyper| analogous to % |\pagesLTS@putlabelhyper| of the \xpackage{pageslts} package. @@ -2229,8 +2132,8 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \begin{Version}{2010/08/25 v1.2d} % \item Bug fix: also \xpackage{tcilatex} defines the |\hyperref| command, % therefore for \xpackage{hyperref} package detection this had to be -% changed to |\Hy@Warning|. -% [lastpagemodern just uses |\IfPackageLoadedTF{hyperref}|.] +% changed to |\Hy@Warning|.\newline +% [\pkg{lastpagemodern.sty} just uses |\IfPackageLoadedTF{hyperref}|.] % \end{Version} % \begin{Version}{2010/09/12 v1.2e} % \item \textsc{James Hedges} pointed out, that there was no instruction in the @@ -2241,7 +2144,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \item Updated to version 2010/09/13 v6.81n of the \xpackage{hyperref} package. % \item New version of REV\TeX{}4\ 2010/07/25, v4.1r, old problem. % \item New version of \xpackage{pagesLTS} package, 2010/09/22, v1.1k. -% \item Moved the package from \texttt{.../latex/muench/lastpage/...} to\\ +% \item Moved the package from \texttt{.../latex/muench/lastpage/...} to\newline % \texttt{.../latex/lastpage/...}. % \end{Version} % \begin{Version}{2011/02/01 v1.2g} @@ -2270,11 +2173,12 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % to the \xfile{aux} file. (Bug reported by \textsc{Mikhail Titov}.) % \end{Version} % \begin{Version}{2011/09/01 v1.2k} -% \item Fixed |\thepage{}| to |\thepage{} |, where there should be a space. -% \item New version of the \xpackage{hyperref} package, 2011/08/19, v6.82h, but -% still problem with links to pages with +% \item Fixed |\thepage{}| to \mbox{|\thepage{}|\textvisiblespace,} +% where there should be a space. +% \item New version of the \xpackage{hyperref} package, 2011/08/19, v6.82h, +% but still problem with links to pages with % page-\textquotedblleft number\textquotedblright{} in \texttt{fnsymbol} -% pagenumbering scheme. [Seems to be fixed since v6.83m as of 2012/11/06.] +% pagenumbering scheme. [Fixed since v6.83m as of 2012/11/06.] % \item Documentation update about \textquotedblleft No write access to the % \xfile{aux} file\textquotedblright . % \item New version of \xpackage{regstats} package available. @@ -2289,7 +2193,8 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % instead of two, therefore |\newlabel{LastPage}{{}{\thepage}{}{}{}}| instead of % |\newlabel{LastPage}{{}{\thepage}}| must be used. % (Bug reported at \url{https://tex.stackexchange.com/q/95541}, -% thanks to \textsc{Micha\l{} Herman}!) Fixed. +% thanks to \textsc{Micha\l{} Herman}!) Fixed.\newline +% [Since \LaTeX{} release 2023-06-01 five arguments are standard.] % \end{Version} % \begin{Version}{2015/03/29 v1.2m} % \item Updated to \TeX{} Live 2014 (for compiling the documentation and example). @@ -2306,7 +2211,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \item Removed |\unit|. % \item \pkg{lastpage} should now determine automatically, whether to load % its \TeX~2.09 version, classic \LaTeX2e-version, or modern version -% with \eTeX, hook-management etc. +% with \eTeX, hook{-}man\-age\-ment etc. % \item Converted to UTF-8. % \item Updated to \LaTeX{} format 2022-11-01. % \item Extensive updates to the documentation (manual \& README) and to the example. @@ -2314,6 +2219,15 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \begin{Version}{2023-04-12 v2.0b} % \item Bug fix: What should have been |}}{}| was |}{}}|. Thanks to \textsc{Matteo Gamboz}! % \end{Version} +% \begin{Version}{2023-07-24 v2.0c} +% \item Since \LaTeX{} release 2023-06-01 labels have always five arguments. +% \item Removed the incompatibility warning regarding \pkg{endfloat} +% before 1994-06-01~(!) from \pkg{lastpagemodern.sty}. +% \item Replaced |\immediate\write| by a form of (pseudo-code!) |\immediate\protected@write|. +% (Thanks to \textsc{Ulrike Fischer} for the error report and solution!) +% \item Update of the |\lastpage@putl@bel| code to \pkg{hyperref} 2023-07-08, v7.01b, +% which now allows fnsymbol as page numbering scheme. +% \end{Version} % \end{History} % \bigskip % diff --git a/macros/latex/contrib/lastpage/lastpage.pdf b/macros/latex/contrib/lastpage/lastpage.pdf Binary files differindex 67a493ada8..064afaac10 100644 --- a/macros/latex/contrib/lastpage/lastpage.pdf +++ b/macros/latex/contrib/lastpage/lastpage.pdf diff --git a/macros/latex/contrib/msu-thesis/README.md b/macros/latex/contrib/msu-thesis/README.md index 56f4db4020..4dc2b87132 100644 --- a/macros/latex/contrib/msu-thesis/README.md +++ b/macros/latex/contrib/msu-thesis/README.md @@ -1,4 +1,4 @@ -# MSU Thesis Class Version 4.1d 2023/07/19 +# MSU Thesis Class Version 4.1e 2023/07/24 Copyright 2011-2023 by Alan Munn <amunn@msu.edu> diff --git a/macros/latex/contrib/msu-thesis/docs/msu-thesis.tex b/macros/latex/contrib/msu-thesis/docs/msu-thesis.tex index 8e3b79c000..986a5f3849 100644 --- a/macros/latex/contrib/msu-thesis/docs/msu-thesis.tex +++ b/macros/latex/contrib/msu-thesis/docs/msu-thesis.tex @@ -2,8 +2,8 @@ \documentclass[11pt]{article} -\def\msuversion{4.1d} -\def\msudate{2023/07/29} +\def\msuversion{4.1e} +\def\msudate{2023/07/24} \title{\textbf{Using the MSU Thesis Class}} \author{\textbf{Alan Munn}\\Department of Linguistics, Languages, and Cultures\\Michigan State University\\\texttt{\href{mailto:amunn@msu.edu}{amunn@msu.edu}}} \date{Version \msuversion\\\msudate} @@ -447,7 +447,7 @@ problems over the years: Irina Agafonova, Ali Al-jiboory, Abubakr Ayesh, Julian Nathan Brugnone, Dmitriy Bryndin, Greg Christian, Kyle Crayne, Ciaron Hamilton, Matt Husband, Changkuk Jung, Claire Kopenhafer, Adam Liter, Vanessa Maldonado, Ben Miller, William Muir, Eureka Pai, Alicia Parrish, Neil ver Planck, Taha Posos, Nick Rekuski, Giacomo Romanini, William Sands, Adam -Soliman, Erik Stitt, Eremey Valetov, Matthew Vincent, Michael Wojcik, Stephen Yowono, Ali +Soliman, Mookyong Son, Erik Stitt, Eremey Valetov, Matthew Vincent, Michael Wojcik, Stephen Yowono, Ali Zare, and Yisu Zhou. A special thank you to Non Thongprong who graciously provided a copy of his entire thesis which allowed me to debug some especially subtle spacing inconsistencies. diff --git a/macros/latex/contrib/msu-thesis/msu-thesis.cls b/macros/latex/contrib/msu-thesis/msu-thesis.cls index 63be1bba6e..20a8f5dbfa 100644 --- a/macros/latex/contrib/msu-thesis/msu-thesis.cls +++ b/macros/latex/contrib/msu-thesis/msu-thesis.cls @@ -186,11 +186,12 @@ % after chapter titles. % Version 4.1c 2023/06/27 Removed spacing after chapter titles (again) % Version 4.1d 2023/07/19 Fixed per chapter bibliography TOC page number bug +% Version 4.1e 2023/07/24 Fixed per chapter appendices TOC bug; % % Report bugs/problems/questions to <amunn@msu.edu> % -\def\msu@version{4.1d} -\def\msu@date{2023/07/19} +\def\msu@version{4.1e} +\def\msu@date{2023/07/24} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{msu-thesis}[\msu@date\space Michigan State University Thesis Class version \msu@version] \newif\ifmsu@dissertation\msu@dissertationtrue % added v2.7 boolean for \msu@thesistype @@ -496,8 +497,7 @@ \renewcommand\cftchapterpagefont{\msu@tocfont} \renewcommand*{\cftappendixname}{APPENDIX\space} \renewcommand\cftchapteraftersnum{\msutocdelim} - \addtocounter{tocdepth}{-1} - + \ifthenelse{\value{msutocdepth}=0}{\addtocounter{tocdepth}{-1}}{} } % This code resets the TOC back to normal section spacing if appendices have been used @@ -748,7 +748,7 @@ {\@ppsaveapp\@pprestoresec\anappendixfalse\cftinserthook{toc}{CHAPAPPR}} % reset aded 2022/04/16 \renewenvironment{appendices}% - {\msu@singleappendixfalse\msu@apppage\ifmsu@chapterapp\cftinserthook{toc}{APPENDICES}\fi\setcounter{tocdepth}{\value{msutocdepth}} + {\msu@singleappendixfalse\msu@apppage\ifmsu@chapterapp\cftinserthook{toc}{APPENDICES}\fi\addtocontents{toc}{\setcounter{tocdepth}{0}} \@resets@pp\anappendixtrue}% {\@ppsaveapp\@pprestoresec\anappendixfalse\cftinserthook{toc}{CHAPAPPR}} % reset added 2022/04/16 diff --git a/macros/latex/contrib/msu-thesis/msu-thesis.pdf b/macros/latex/contrib/msu-thesis/msu-thesis.pdf Binary files differindex 56dc927666..cbbdb81a7e 100644 --- a/macros/latex/contrib/msu-thesis/msu-thesis.pdf +++ b/macros/latex/contrib/msu-thesis/msu-thesis.pdf diff --git a/macros/latex/contrib/msu-thesis/samples/MSU-thesis-chapterbib-testfile.pdf b/macros/latex/contrib/msu-thesis/samples/MSU-thesis-chapterbib-testfile.pdf Binary files differindex bdf72ecd2b..eb4c5638ae 100644 --- a/macros/latex/contrib/msu-thesis/samples/MSU-thesis-chapterbib-testfile.pdf +++ b/macros/latex/contrib/msu-thesis/samples/MSU-thesis-chapterbib-testfile.pdf diff --git a/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.pdf b/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.pdf Binary files differindex bf9c3552e6..2178d829da 100644 --- a/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.pdf +++ b/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.pdf diff --git a/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.tex b/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.tex index 2fd5730da7..bd67ccb091 100644 --- a/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.tex +++ b/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.tex @@ -43,7 +43,7 @@ \renewcommand*{\cftlistingaftersnum}{\msucaptiondelim} \usepackage[bookmarksopenlevel=2,bookmarks=true]{hyperref} % not needed but here for testing -\setcounter{msutocdepth}{0} % default is 1; this puts only chapters in the TOC +\setcounter{msutocdepth}{1} % default is 1; this puts only chapters in the TOC \begin{document} diff --git a/macros/latex/contrib/qrbill/DEPENDS.txt b/macros/latex/contrib/qrbill/DEPENDS.txt new file mode 100644 index 0000000000..01d6da3071 --- /dev/null +++ b/macros/latex/contrib/qrbill/DEPENDS.txt @@ -0,0 +1,9 @@ +expl3 +koma-script +qrcode +l3packages +scrbase +graphicx +numprint + +soft fontspec # custom fonts possible with all compilers
\ No newline at end of file diff --git a/macros/latex/contrib/qrbill/README.md b/macros/latex/contrib/qrbill/README.md index 3888da81b2..37c9bd8a19 100644 --- a/macros/latex/contrib/qrbill/README.md +++ b/macros/latex/contrib/qrbill/README.md @@ -4,13 +4,17 @@ Copyright (C) Marei Peischl (peiTeX) <marei@peitex.de>, 2020–2023 This work is part of a collaborative project of Marei Peischl (peiTeX) and Alex Antener (foobar LLC). -qrbill 2023/02/28 v2.00 +qrbill 2023/07/24 v2.01 *************************************************************************** This material is subject to the LaTeX Project Public License version 1.3c or later. See http://www.latex-project.org/lppl.txt for details. + The included qrbill-qrencode.lua file is subject to a 3-clause BSD license + Copyright (c) 2012-2020, Patrick Gundlach (SPEEDATA GMBH) and contributors, + see https://github.com/speedata/luaqrcode. All rights reserved. + *************************************************************************** ## Provided files @@ -28,6 +32,7 @@ The files as well as the demo files * qrbill-standalone-demo.tex * qrbill-letter-demo.tex +* qrbill-epc-demo.tex can be created from the qrbill.dtx by processing the qrbill.ins-file. ## Installation Notes @@ -81,4 +86,11 @@ For further information on l3build and other options please have a look at the c * v1.07 (2022-10-20) - fix utf8 encoding für qrmode=package * v2.00 (2023-02-28) - - add luaqrcode to qrbill
\ No newline at end of file + - add luaqrcode to qrbill + * v2.01 (2023-07-24) + - add full epc qrcode example + - improve documentation + - disable hyperlink if `qrmode=package` and hyperref is loaded + - support icons with epc qrcodes + - fix icon alignment for `qrmode=lua` + - update luaqrcode library diff --git a/macros/latex/contrib/qrbill/qrbill-latexluaqrcode.lua b/macros/latex/contrib/qrbill/qrbill-latexluaqrcode.lua index b1c31c2c64..80d8828279 100644 --- a/macros/latex/contrib/qrbill/qrbill-latexluaqrcode.lua +++ b/macros/latex/contrib/qrbill/qrbill-latexluaqrcode.lua @@ -1,4 +1,4 @@ -qrencode = require("qrencode.lua") +qrencode = require("qrbill-qrencode.lua") function printQRcode(codestring) local ok, tab = qrencode.qrcode(codestring, 2) diff --git a/macros/latex/contrib/qrbill/qrbill.dtx b/macros/latex/contrib/qrbill/qrbill.dtx index c7739d81d3..4455b15575 100644 --- a/macros/latex/contrib/qrbill/qrbill.dtx +++ b/macros/latex/contrib/qrbill/qrbill.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Copyright (C) 2020–2023 by Marei Peischl (peiTeX) <marei@peitex.de> % @@ -30,7 +30,7 @@ % https://github.com/peitex/qrbill % Please use the issue tracker for feedback! % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \fi % \iffalse @@ -54,7 +54,7 @@ % \fi % \iffalse %<*driver> -\ProvidesFile{qrbill.dtx}[2023/02/28 v2.00 \ create QR-bills based on the Swiss standard] +\ProvidesFile{qrbill.dtx}[2023/07/24 v2.01 \ create QR-bills based on the Swiss standard] \documentclass[english, parskip=half-]{scrartcl} \usepackage{iftex} \ifPDFTeX @@ -76,6 +76,12 @@ \inputminted[autogobble, escapeinside=||,tabsize=4]{latex}{minted.doc.out} } +\newenvironment{doccode*}{ + \VerbatimEnvironment + \begin{VerbatimOut}[tabsize=4]{minted.doc.out}} + {\end{VerbatimOut} + \inputminted[autogobble, escapeinside=||,tabsize=4]{latex}{minted.doc.out} +} \usepackage{babel} \usepackage[babel]{csquotes} @@ -161,6 +167,9 @@ \usepackage{qrbill} +\usepackage{geometry} +\geometry{left=4cm} + \usepackage[hidelinks]{hyperref} \begin{document} @@ -186,9 +195,7 @@ % % By means of the \LaTeX{} framework, the qrbill can simply be integrated into existing accounting environments and automated billing systems. % \iffalse -% \begin{macrocode} -%<*qrbill.sty> -% \end{macrocode} +%<*package> % \fi % \section{Example of use} % The easies way to use the qrbill package is to create a bill with the standalone documentclass: @@ -214,8 +221,9 @@ % \end{document} % \end{doccode} % -% \DescribeMacro{\QRbill}\oarg{Data Setup} +% \DescribeMacro{\QRbill}\sarg\oarg{Data Setup} % The macro \latexinline{\QRbill} creates a box of 210\,mm${}\times{}$105\,mm size. It will include a qrbill as described in the design guide \cite{qrbill-design} and insert all available data. +% The starred version (\latexinline{\QRbill*}) is only creating the QRcode without additional visible data. This is not necessarry for the swiss standard, but allows the usage with other QRcode schemes like the EPC QR codes (see section \ref{sec:epc}). % % There is also an example in the appendix showing all data fields (see appendix \ref{standalone-complete} on page \pageref{standalone-complete}). % @@ -287,10 +295,16 @@ % \changes{v2.00}{2023/02/28}{qrencode.lua now is part of the qrbill package} % With Version 2.0 the package supports usage of the the luaqrcode library \cite{luaqrcode}. This can be enabled by using the \latexinline{qmode=lua} option. % -% \item[qrscheme (Name of a custom QRbill scheme) (swiss)] -% Loads the definitions for the QRcode and the BillingInformation. Currently only the -% swiss qrbill scheme is available, but one can define own variants based on this file. -% Users can copy the file swiss.qrbill-cfg.tex as an example. +% \changes{v2.01}{2023/07/24}{add qrsize option} +% \item[qrsize (length) (46mm)] +% Allows to change the size of the created QRcoode. +% The default setting is chosen to match the swiss QRbills. +% +% \item[qrscheme (Name of a QRbill scheme e.g. swiss or epc) (swiss)] +% Loads the definitions for the QRcode and the BillingInformation. +% Currently only the swiss qrbill scheme (\latexinline{qrscheme=swiss}) and EPC QRcodes (\latexinline{qrscheme=epc}) are available, but one can define own variants based on this file. +% Users can copy the file swiss.qrbill-cfg.tex as a template. +% The package will look for a file named “\textlangle value of the qrscheme option\textrangle.qrbill-cfg.tex” to load the scheme. % % \changes{v1.02}{2020/08/25}{add referenceseparator option} % \item[referenceseparator (tokenlist) (\textbackslash,)] @@ -404,14 +418,14 @@ % \end{center} % To set an address of type \enquote{K} one can use they option key \latexinline{debtor} or \latexinline{creditor}. Type \enquote{S} can be achieved using the starred variant (\latexinline{debtor*}/\latexinline{creditor*}). % -% \begin{minipage}{.5\linewidth} +% \begin{minipage}{.4\linewidth} % \begin{doccode} % creditor={Name\\ % Street Nr.\\ % PostalCode City\\ % CountryCode}, % \end{doccode} -% \end{minipage}% +% \end{minipage}\hfill % \begin{minipage}{.5\linewidth} % \begin{doccode} % creditor*={Name\\ @@ -479,42 +493,53 @@ % \par\medskip % Data fields to automatically create the BillingInfo string. The key in parentheses indicates the prefix to be used to construct the string.\par % \ExplSyntaxOn -% \prop_map_inline:Nn \g__qrbill_billing_info_prop {#2~(#1)\\} +% \prop_map_inline:Nn \g__qrbill_billing_info_prop {#2~(#1)\\}\strut % \ExplSyntaxOff -% % \section{Setup for EPC QR codes} +% \label{sec:epc} % EPC QR codes can be used for SEPA credit transfer (SCT). % They do not include any data about the debtor or tax information. % Therefore they may only be used with the starred variant of \latexinline{\QRbill*} or the user has to provide additional data interfaces. +% +% To use this kind of QRcodes with qrbill one has to select the corresponding \latexinline{qrscheme}: +% \begin{doccode} +% \usepackage[qrscheme=epc]{qrbill} +% \end{doccode} % \subsection{Preconfigured data} % \changes{v1.04}{2022/07/01}{Add basic support for EPC QR codes} % The epc qrscheme provided by this package preset the following data: % \begin{doccode} % \SetupQrBill{ -% QRType=BCD, -% Version=002, -% CodingType=1,% UTF-8, 2 would be ISO -% Trailer=SCT, -% } +% QRType=BCD, +% Version=002, +% CodingType=1,% UTF-8, 2 would be ISO +% Trailer=SCT, +% } % \end{doccode} % These fields are required to use these values for the current version of the EPC QR code. % % \subsection{Required data} -% The data fields required by the EPC QRcode can be set directly. A full example for an easy EPC qrcode would be -% \begin{doccode} -% \QRbill*[ -% BIC=BYLADEM1GLS, -% Account=DE68430609671013251700, -% Name=peiTeX, -% Amount=EUR123.42, -% Message={Invoice 2022:1337, customer 1337} -% ] -% \end{doccode} +% The data fields required by the EPC QRcode can be set directly. A full example for an easy EPC qrcode can be found in appendix \ref{sec:example-epc}. +% +% \subsection{Overview over all data fields} +% \label{sec:epc-data-complete} +% \changes{v2.01}{2023/07/24}{Add overview over all epc qrcode data fields} +% Data fields which are used in the QRcode:\par +% \begingroup +% \ExplSyntaxOn +% \file_get:nnN {epc.qrbill-cfg.tex} {\char_set_catcode_comment:N \% } \l_tmpa_tl +% \let\endinput\relax +% \l_tmpa_tl +% \seq_use:Nn \g__qrbill_qrscheme_seq {\\} +% \ExplSyntaxOff +% \par\medskip +% The DTA field is completly optional and can be used to encode the reason for the transfer. +% \endgroup % \iffalse % \section{Implementation} -% \begin{macrocode} +% \begin{doccode*} \RequirePackage{expl3} -\ProvidesExplPackage{qrbill}{2023/02/28}{2.00}{ +\ProvidesExplPackage{qrbill}{2023/07/24}{2.01}{ Template for QR-bills based on the Swiss Payment Standards } \RequirePackage{iftex} @@ -536,14 +561,21 @@ exists~for~backwards~compatibility~and~will~be~removed. } +\tl_new:N \g__qrbill_qrscheme_tl + \keys_define:nn {qrbill} { font .choices:nn = {Frutiger, Arial, Helvetica, Liberation Sans} { \tl_gset_eq:NN \g__qrbill_font_tl \l_keys_choice_tl }, font .initial:n = Liberation Sans, font / custom .code:n = {\tl_gclear:N \g__qrbill_font_tl}, - qrscheme .tl_gset:N = \g__qrbill_qrscheme_tl, + qrscheme .choice:, + qrscheme / epc .code:n = \tl_gset:Nn \g__qrbill_qrscheme_tl {epc}\tl_gclear:N \g__qrbill_font_tl, + qrscheme / unknown .code:n = \tl_gset:Nn \g__qrbill_qrscheme_tl { + #1}, qrscheme .initial:n = swiss, + qrsize .dim_gset:N = \g_qrbill_QRcode_dim, + qrsize .initial:n = 46mm, creditorprefix .tl_gset:N = \g__qrbill_creditorprefix_tl, creditorprefix .initial:n = CR-, debtorprefix .tl_gset:N = \g__qrbill_debtorprefix_tl, @@ -687,8 +719,6 @@ \RequirePackage{anyfontsize} } -\dim_new:N \g_qrbill_QRcode_dim -\dim_gset:Nn \g_qrbill_QRcode_dim {46mm} \bool_if:NT \g__qrbill_luamode_bool { \lua_load_module:n {qrbill-latexluaqrcode} @@ -697,22 +727,36 @@ \cs_set_protected:Npn \qrbill_qrcode_black: {\rule{\l__qrbill_QRblocksize_dim}{\l__qrbill_QRblocksize_dim}} \cs_set_protected:Npn \qrbill_qrcode_white: {\rule{\l__qrbill_QRblocksize_dim}{0pt}\rule{0pt}{\l__qrbill_QRblocksize_dim}} \cs_new:Nn \qrbill_parse_QRcode:n { - \lua_now:e { - num, string = printQRcode("\lua_escape:n {#1}") - } + \__qrbill_setup_lua_qrcode:x {#1} \dim_set:Nn \l__qrbill_QRblocksize_dim {\g_qrbill_QRcode_dim/\lua_now:n {tex.print(num)}} \let\qrblack\qrbill_qrcode_black: \let\qrwhite\qrbill_qrcode_white: \def\qrnewline{\\[\dimexpr-\baselineskip+\l__qrbill_QRblocksize_dim]} - \noindent\parbox{\g_qrbill_QRcode_dim}{ - \lua_now:n {tex.sprint(string)} +% \end{doccode*} +% \changes{v2.01}{2023/07/24}{fix icon alignment for qrmode=lua} +% \begin{doccode*} + \raisebox{\dimexpr\depth-\l__qrbill_QRblocksize_dim}[\dimexpr\height+\depth-\l__qrbill_QRblocksize_dim][0pt]{ + \noindent\parbox{\g_qrbill_QRcode_dim}{ + \lua_now:n {tex.sprint(string)} + \hss + } } } + + \cs_new:Nn \__qrbill_setup_lua_qrcode:n { + \lua_now:e { + num, string = printQRcode("\lua_escape:n {#1}") + } + } + + \cs_generate_variant:Nn \__qrbill_setup_lua_qrcode:n {x} } -% \end{macrocode} + + +% \end{doccode*} % \changes{v1.07}{2022/10/20}{patch the qrcode package to work with utf-8 strings} -% \begin{macrocode} +% \begin{doccode*} \bool_if:NF \g__qrbill_luamode_bool { \usepackage{qrcode} @@ -765,7 +809,10 @@ \cs_set_eq:NN \qr@encode@binary \__qrbill_encode_unicode_binary:n \raisebox{\depth}{ \__qrbill_enable_unicode_qrcode_patch: - \qrcode[height= \g_qrbill_QRcode_dim]{#1} +% \end{doccode*} +% \changes{v2.01}{2023/07/24}{Disable hyperlink for qrcode in case hyperref is loaded} +% \begin{doccode*} + \qrcode[nolink,height= \g_qrbill_QRcode_dim]{#1} } } @@ -1033,7 +1080,19 @@ \IfBooleanTF {#1} { \qrcode_setup_QRcode: - \qrbill_parse_QRcode:V \l_qrbill_data_str + \leavevmode\qrbill_parse_QRcode:V \l_qrbill_data_str +% \end{doccode*} +% \changes{v2.01}{2023/07/24}{Add icon support for epc qrcodes} +% \begin{doccode*} + \tl_if_empty:NF \g_qrbill_icon_tl { + \llap{\hbox_to_wd:nn {\g_qrbill_QRcode_dim} { + \hfill + \raisebox{\dimexpr-.5\height+.5\g_qrbill_QRcode_dim}[0pt][0pt]{ + \includegraphics[width=\g_qrbill_iconwidth_dim]{\g_qrbill_icon_tl} + } + \hfill + }} + } }{ \qrbill_bill_create: } @@ -1300,9 +1359,8 @@ \input{\g__qrbill_qrscheme_tl.qrbill-cfg} -% \end{macrocode} -% \begin{macrocode} -%</qrbill.sty> +% \end{doccode*} +%</package> % \section{The file swiss.qrbill-cfg.tex as a custom qrbill scheme} %<*swiss.qrbill-cfg.tex> \qrbillsetup{ @@ -1387,18 +1445,16 @@ invoicedate=\QRbillParseDate{\the\year}{\the\month}{\the\day}, vatdate=\QRbillParseDate{\the\year}{\the\month}{\the\day} } -% \end{macrocode} +% \end{doccode*} % \iffalse -% \begin{macrocode} %</swiss.qrbill-cfg.tex> -% \end{macrocode} -% \section{The file epc.qrbill-cfg.tex as a custom qrbill scheme} +% \section{The file epc.qrbill-cfg.tex as additional qrbill scheme} % This scheme supports much less variables in contrast to the swiss scheme. % Therefore the \latexinline{\QRbill} macro has to be used as the starred variant or additional variables have to be provided by the user. %<*epc.qrbill-cfg.tex> -% \end{macrocode} +% \end{doccode*} % \fi -% \begin{macrocode} +% \begin{doccode*} \SetQrScheme{ QRType, Version, @@ -1421,7 +1477,7 @@ Trailer=SCT, } %</epc.qrbill-cfg.tex> -% \end{macrocode} +% \end{doccode*} % \fi % % \PrintChanges @@ -1436,11 +1492,9 @@ % \changes{v1.03}{2021/05/07}{set sep-iban and sep-reference in examples} % \label{standalone-complete} % \iffalse -% \begin{macrocode} %<*qrbill-standalone-demo.tex> -% \end{macrocode} % \fi -% \begin{macrocode} +% \begin{doccode*} % !TeX program=lualatex \documentclass{standalone} \usepackage[nswissgerman]{babel} @@ -1480,15 +1534,14 @@ ] \end{document} -% \end{macrocode} +% \end{doccode*} % \iffalse -% \begin{macrocode} %</qrbill-standalone-demo.tex> %<*qrbill-letter-demo.tex> -% \end{macrocode} % \fi % \section{qrbill scrletter example} -% \begin{macrocode} +% \label{sec:example-qrbill-letter} +% \begin{doccode*} % !TeX Program=lualatex \documentclass[foldmarks=b]{scrletter} \usepackage[ @@ -1552,12 +1605,33 @@ Text \end{letter} \end{document} -% \end{macrocode} -% +% \end{doccode*} % \iffalse -% \begin{macrocode} %</qrbill-letter-demo.tex> -% \end{macrocode} +%<*qrbill-epc-demo.tex> +% \fi +% \section{Example for EPC qrcode} +% \label{sec:example-epc} +% \changes{v2.01}{2023/07/24}{edd epc qrcode example document} +% \begin{doccode*} +\documentclass{article} +\usepackage[qrscheme=epc]{qrbill} + +\begin{document} + +\QRbill*[ + BIC=BYLADEM1GLS, + Account=DE68430609671013251700, + Name=peiTeX, + Amount=EUR1 .42, + Message={Invoice 2022:1337, customer 1337} +] + +\end{document} +% \end{doccode*} +% \iffalse +%\endinput +%</qrbill-epc-demo.tex> % \fi %\Finale \endinput diff --git a/macros/latex/contrib/qrbill/qrbill.ins b/macros/latex/contrib/qrbill/qrbill.ins index 1fe8b6669e..23e4ef8ed5 100644 --- a/macros/latex/contrib/qrbill/qrbill.ins +++ b/macros/latex/contrib/qrbill/qrbill.ins @@ -24,7 +24,8 @@ This work consists of the files qrbill.dtx and qrbill.ins, qrbill-vocab.csv and the derived files qrbill.sty, swiss.qrbill-cfg.tex, epc.qrbill-cfg.tex, -qrbill-letter-demo.tex, qrbill-standalone-demo.tex. +qrbill-letter-demo.tex, qrbill-standalone-demo.tex, +and qrbill-epc-demo.tex. The development repository can be found at https://github.com/peitex/qrbill @@ -52,6 +53,9 @@ Please use the issue tracker for feedback! \file{qrbill-standalone-demo.tex}{ \from{qrbill.dtx}{qrbill-standalone-demo.tex} } + \file{qrbill-epc-demo.tex}{ + \from{qrbill.dtx}{qrbill-epc-demo.tex} + } } \endbatchfile diff --git a/macros/latex/contrib/qrbill/qrbill.pdf b/macros/latex/contrib/qrbill/qrbill.pdf Binary files differindex 1125e6cddc..e73d98218b 100644 --- a/macros/latex/contrib/qrbill/qrbill.pdf +++ b/macros/latex/contrib/qrbill/qrbill.pdf diff --git a/macros/luatex/latex/luanumint/README.txt b/macros/luatex/latex/luanumint/README.txt new file mode 100644 index 0000000000..808a1c0f83 --- /dev/null +++ b/macros/luatex/latex/luanumint/README.txt @@ -0,0 +1,14 @@ +# Introduction +The luanumint package is developed using Lua to find the numerical integration of real-valued functions of a real variable over closed and bounded intervals. The package provides commands to find numerical integration using the mid-point, trapezoidal, and Simpson's one-third and three-eighth rules. The loadstring command is used to load and evaluate functions at different points in the mathematics environment of Lua. The package also provides commands to find numerical integration with step-by-step calculations. The package's commands have an optional argument to round off the numbers to the desired number of decimal places. The breqn package is loaded to display and align step-by-step calculations properly. Advanced users can customize the code to achieve the desired formatting of step-by-step computations. The package can assist in creating various problems on numerical integration with their solutions. The results obtained using different methods of numerical integration can be compared. It can save users' efforts of doing computations involving numerical integration in external software and copying them inside LaTeX documents. + +# License +The luanumint package is released under the LaTeX Project Public License v1.3c or later. +The complete license text is available at http://www.latex-project.org/lppl.txt. +It is developed in Lua. +Lua is available as a certified open-source software. +Its license is simple and liberal, which is compatible with GPL. + +#Installation and Inclusion +The installation of luanumint package is similar to plain latex package, where the .sty file is in LaTeX directory of texmf tree. +The package can be included with \usepackage{luanumint} command in the preamble of the LaTeX document. +The TeX file is to be compiled using the LuaLaTeX engine.
\ No newline at end of file diff --git a/macros/luatex/latex/luanumint/luanumint.pdf b/macros/luatex/latex/luanumint/luanumint.pdf Binary files differnew file mode 100644 index 0000000000..fec3d14c07 --- /dev/null +++ b/macros/luatex/latex/luanumint/luanumint.pdf diff --git a/macros/luatex/latex/luanumint/luanumint.sty b/macros/luatex/latex/luanumint/luanumint.sty new file mode 100644 index 0000000000..aca4de0215 --- /dev/null +++ b/macros/luatex/latex/luanumint/luanumint.sty @@ -0,0 +1,301 @@ +% The luanumint package +% version 1.0 +% Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt. +%Authors: Chetan Shirore and Ajit Kumar + +\ProvidesPackage{luanumint}[1.0] +\RequirePackage{luacode,breqn,xkeyval} +\begin{luacode*} +function checksign(x) + if x >=0 then + return ' + ' + else + return '' + end +end + +function mathrnd(num, numDecimalPlaces) + local mult = 10^(numDecimalPlaces or 0) + return math.floor(num * mult + 0.5) / mult +end + +function luamidpt (f,a,b,n,trun) + local trun = trun or 4 + local h = (b - a) / n + local sum = 0 + local var = a + h/2 + for i = 1, n do + sum = sum + f(var) + var = var + h + end + return mathrnd(sum*h,trun) +end + +function luamidptSteps (f,a,b,n,nm,trun) + local trun = trun or 4 + local nm = nm or "f" + local h = (b - a) / n + local sum = 0 + local var = a + (h/2) + local str = " = "..mathrnd(h,trun)..'\\left[' + local otstr = mathrnd(h,trun)..'\\left(' + for i = 1, n do + if i>=1 and i<=n-1 then + sum = sum + mathrnd(f(var),trun) + str = str ..nm.."("..mathrnd(var,trun)..") + " + otstr = otstr ..mathrnd(f(var),trun)..checksign(f(var+h),trun) + end + if i== n then + sum = sum + mathrnd(f(var),trun) + str = str ..nm.."("..var..")" + otstr = otstr ..mathrnd(f(var),trun) + end + var = var + h + end + return str .."\\right] \\\\ = "..otstr.."\\right) \\\\ = "..mathrnd(sum*mathrnd(h,trun),trun) +end + +function luatrapz (f,a,b,n,trun) + local trun = trun or 4 + local h = (b - a) / n + local sum = 0 + local var = a + for i = 1, n+1 do + if i== 1 or i == n+1 then + sum = sum + f(var) + else + sum = sum + 2*f(var) + end + var = var + h + end + return mathrnd(sum*h/2,trun) +end + +function luatrapzsteps (f,a,b,n,nm,trun) + local trun = trun or 4 + local nm = nm or "f" + local h = (b - a) / n + local sum = 0 + local var = a + local str = " = "..mathrnd(h/2,trun)..'\\left[' + local otstr = mathrnd(h/2,trun)..'\\left(' + for i = 0, n do + if i== 0 then + sum = sum + mathrnd(f(var),trun) + str = str ..nm.."("..var..") +" + otstr = otstr ..mathrnd(f(var),trun)..checksign(f(var+h),trun) + end + if i>=1 and i<=n-1 then + sum = sum + mathrnd(2*f(var),trun) + str = str .."2"..nm.."("..mathrnd(var,trun)..") + " + otstr = otstr ..mathrnd(2*f(var),trun)..checksign(f(var+h),trun) + end + if i== n then + sum = sum + mathrnd(f(var),trun) + str = str ..nm.."("..var..")" + otstr = otstr ..mathrnd(f(var),trun) + end + var = var + h + end + return str .."\\right] \\\\ = "..otstr.."\\right) \\\\ = "..mathrnd(sum*mathrnd(h/2,trun),trun) +end + +function luasimpsononethird (f,a,b,n,trun) + if (not(n % 2 == 0)) then error("Number of subintervals should be even.") end + local trun = trun or 4 + local h = (b - a) / n + local sum = 0 + local var = a + for i = 0, n do + if i== 0 or i ==n then + sum = sum + f(var) + end + if i>=1 and i<=n-1 and (i % 2 == 0) then + sum = sum + 2*f(var) + end + if i>=1 and i<=n-1 and (not(i % 2 == 0)) then + sum = sum + 4*f(var) + end + var = var + h + end + return mathrnd(sum*h/3,trun) +end + +function luasimpsononethirdsteps (f,a,b,n,nm,trun) + if (not(n % 2 == 0)) then error("Number of subintervals should be even.") end + local trun = trun or 4 + local nm = nm or "f" + local h = (b - a) / n + local sum = 0 + local var = a + local str = " = "..mathrnd(h/3,trun)..'\\left[' + local otstr = mathrnd(h/3,trun)..'\\left(' + for i = 0, n do + if i== 0 then + sum = sum + mathrnd(f(var),trun) + str = str ..nm.."("..var..") +" + otstr = otstr ..mathrnd(f(var),trun)..checksign(f(var+h),trun) + end + if i>=1 and i<=n-1 and (i % 2 == 0) then + sum = sum + mathrnd(2*f(var),trun) + str = str .."2"..nm.."("..mathrnd(var,trun)..") + " + otstr = otstr ..mathrnd(2*f(var),trun)..checksign(f(var+h),trun) + end + if i>=1 and i<=n-1 and (not(i % 2 == 0)) then + sum = sum + mathrnd(4*f(var),trun) + str = str.."4"..nm.."("..mathrnd(var,trun)..") + " + otstr = otstr ..mathrnd(4*f(var),trun)..checksign(f(var+h),trun) + end + if i== n then + sum = sum + mathrnd(f(var),trun) + str = str ..nm.."("..var..")" + otstr = otstr ..mathrnd(f(var),trun) + end + var = var + h + end + return str .."\\right] \\\\ = "..otstr.."\\right) \\\\ = "..mathrnd(sum*mathrnd(h/3,trun),trun) +end + +function luasimpsonthreight (f,a,b,n,trun) + if (not(n % 3 == 0)) then error("No. of sub-intervals should be multiple of 3.") end + local trun = trun or 4 + local h = (b - a) / n + local sum = 0 + local var = a + + for i = 0, n do + if i== 0 or i ==n then + sum = sum + f(var) + end + if i>=1 and i<=n-1 and (i % 3 == 0) then + sum = sum + 2*f(var) + end + if i>=1 and i<=n-1 and (not(i % 3 == 0)) then + sum = sum + 3*f(var) + end + var = var + h + end + return mathrnd(sum*3*h/8,trun) +end + +function luasimpsonthreightsteps (f,a,b,n,nm,trun) + if (not(n % 3 == 0)) then error("No. of sub-intervals should be multip.") end + local trun = trun or 4 + local nm = nm or "f" + local h = (b - a) / n + local sum = 0 + local var = a + local str = " = "..mathrnd(3*h/8,trun)..'\\left[' + local otstr = mathrnd(3*h/8,trun)..'\\left(' + for i = 0, n do + if i== 0 then + sum = sum + mathrnd(f(var),trun) + str = str ..nm.."("..var..") +" + otstr = otstr ..mathrnd(f(var),trun)..checksign(f(var+h),trun) + end + if i>=1 and i<=n-1 and (i % 3 == 0) then + sum = sum + mathrnd(2*f(var),trun) + str = str .."2"..nm.."("..mathrnd(var,trun)..") + " + otstr = otstr ..mathrnd(2*f(var),trun)..checksign(f(var+h),trun) + end + if i>=1 and i<=n-1 and (not(i % 3 == 0)) then + sum = sum + mathrnd(3*f(var),trun) + str = str.."3"..nm.."("..mathrnd(var,trun)..") + " + otstr = otstr ..mathrnd(3*f(var),trun)..checksign(f(var+h),trun) + end + if i== n then + sum = sum + mathrnd(f(var),trun) + str = str ..nm.."("..var..")" + otstr = otstr ..mathrnd(f(var),trun) + end + var = var + h + end + return str .."\\right] \\\\ = "..otstr.."\\right) \\\\ = "..mathrnd(sum*mathrnd(3*h/8,trun),trun) +end +\end{luacode*} + +% ========= KEY DEFINITIONS ========= +\define@key{someop}{a}{\def\mop@one{#1}}% +\define@key{someop}{b}{\def\mop@two{#1}}% +\define@key{someop}{n}{\def\mop@three{#1}}% +\define@key{someop}{func}{\def\mop@four{#1}}% +\define@key{someop}{trun}{\def\mop@five{#1}}% +% ========= KEY DEFAULTS ========= +\setkeys{someop}{a=0}% +\setkeys{someop}{b=1}% +\setkeys{someop}{n=6}% +\setkeys{someop}{func=f}% +\setkeys{someop}{trun=4}% +% ========= Defining Command ========= +\newcommand{\luaMidpt}[2][]{{% +\setkeys{someop}{#1}% +\directlua{% +tempsubexp = "("..\luastring{#2}..")" +local f = load("return function(x) return " ..tempsubexp.. "end",nil,"t",math)() +tex.print(luamidpt(f,\mop@one,\mop@two,\mop@three,\mop@five)) +}% +}% +}% + +\newcommand{\luaMidptSteps}[2][]{\begingroup% +\setkeys{someop}{#1}% +\directlua{% + +tempsubexp = "("..\luastring{#2}..")" +local f = load("return function(x) return " ..tempsubexp.. "end",nil,"t",math)() tex.sprint(luamidptSteps(f,\mop@one,\mop@two,\mop@three,'\mop@four',\mop@five)) +}% +\endgroup}% + +\newcommand{\luaTrapz}[2][]{{% +\setkeys{someop}{#1}% +\directlua{% +tempsubexp = "("..\luastring{#2}..")" +local f = load("return function(x) return " ..tempsubexp.. "end",nil,"t",math)() +tex.print(luatrapz(f,\mop@one,\mop@two,\mop@three,\mop@five)) +}% +}% +}% + +\newcommand{\luaTrapzSteps}[2][]{\begingroup% +\setkeys{someop}{#1}% +\directlua{% +tempsubexp = "("..\luastring{#2}..")" +local f = load("return function(x) return " ..tempsubexp.. "end",nil,"t",math)() tex.sprint(luatrapzsteps(f,\mop@one,\mop@two,\mop@three,'\mop@four',\mop@five)) +}% +\endgroup}% + +\newcommand{\luaSimpsonOneThird}[2][]{{% +\setkeys{someop}{#1}% +\directlua{% +tempsubexp = "("..\luastring{#2}..")" +local f = load("return function(x) return " ..tempsubexp.. "end",nil,"t",math)() tex.print(luasimpsononethird(f,\mop@one,\mop@two,\mop@three,\mop@five)) +}% +}% +}% + +\newcommand{\luaSimpsonOneThirdSteps}[2][]{\begingroup% +\setkeys{someop}{#1}% +\directlua{% +tempsubexp = "("..\luastring{#2}..")" +local f = load("return function(x) return " ..tempsubexp.. "end",nil,"t",math)() tex.sprint(luasimpsononethirdsteps(f,\mop@one,\mop@two,\mop@three,'\mop@four',\mop@five)) +}% +\endgroup}% + + +\newcommand{\luaSimpsonThreeEighth}[2][]{{% +\setkeys{someop}{#1}% +\directlua{% +tempsubexp = "("..\luastring{#2}..")" +local f = load("return function(x) return " ..tempsubexp.. "end",nil,"t",math)() tex.print(luasimpsonthreight(f,\mop@one,\mop@two,\mop@three,\mop@five)) +}% +}% +}% + +\newcommand{\luaSimpsonThreeEighthSteps}[2][]{\begingroup% +\setkeys{someop}{#1}% +\directlua{% +tempsubexp = "("..\luastring{#2}..")" +local f = load("return function(x) return " ..tempsubexp.. "end",nil,"t",math)() tex.sprint(luasimpsonthreightsteps(f,\mop@one,\mop@two,\mop@three,'\mop@four',\mop@five)) +}% +\endgroup}% +\endinput
\ No newline at end of file diff --git a/macros/luatex/latex/luanumint/luanumint.tex b/macros/luatex/latex/luanumint/luanumint.tex new file mode 100644 index 0000000000..db90d53b30 --- /dev/null +++ b/macros/luatex/latex/luanumint/luanumint.tex @@ -0,0 +1,241 @@ +\documentclass{article} +\usepackage{float,listings,color,parskip,booktabs,longtable,array,hyperref,luanumint,amsmath,amssymb} +\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry} +\hypersetup{colorlinks,urlcolor=blue} +\lstset{frame=none, + language=[LaTeX]{TeX}, + aboveskip=3mm, + belowskip=3mm, + showstringspaces=false, + columns=flexible, + basicstyle={\ttfamily}, + numbers=none, + numberstyle=\tiny\color{gray}, + stringstyle=\color{mauve}, + breaklines=true, + breakatwhitespace=true, + tabsize=1 +} +\usepackage{microtype,graphicx,amsmath,amssymb,float} +\begin{document} +\title{The luanumint package in LaTeX} +\author{Chetan Shirore\thanks{Email id: mathsbeauty@gmail.com} \space and Ajit Kumar} +\maketitle + +\section{Introduction} +The \verb|luanumint| package is developed using Lua to find the numerical integration of real-valued functions of a real variable over closed and bounded intervals. The package provides commands to find numerical integration using the mid-point, trapezoidal, and Simpson's one-third and three-eighth rules. The \verb|loadstring| command is used to load and evaluate functions at different points in the mathematics environment of Lua. The package also provides commands to find numerical integration with step-by-step calculations. The package's commands have an optional argument to round off the numbers to the desired number of decimal places. The \verb|breqn| package is loaded to display and align step-by-step calculations properly. Advanced users can customize the code to achieve the desired formatting of step-by-step computations. The package can assist in creating various problems on numerical integration with their solutions. The results obtained using different methods of numerical integration can be compared. It can save users' efforts of doing computations involving numerical integration in external software and copying them inside LaTeX documents. + +\section{Installation and License} +The installation of \verb|luanumint| package is similar to plain latex package, where the \texttt{.sty} file is in LaTeX directory of texmf tree. The package can be included with \verb|\usepackage{luanumint}| command in the preamble of the LaTeX document. A TeX file is to be compiled using the LuaLaTeX engine. + +The \verb|luanumint| package is released under the LaTeX Project Public License v1.3c or later. The complete license text is available at \url{http://www.latex-project.org/lppl.txt}. It is developed in Lua. Lua is available as a certified open-source software. Its license is simple and liberal, which is compatible with GPL. + +\section{Rules for numerical integration} +Let \(f\) be a real-valued function of a real variable which is Riemann-integrable over the closed and bounded interval \([a,b]\). The rules of numerical integration are used to calculate an approximate value of the integral \(\int\limits_{a}^{b}f(x)dx\). + +Let \(n\) denote a number of subintervals of equal length of the closed and bounded interval \([a,b]\) corresponding to a partition \( P=\{a=x_0,x_1,x_2…,x_n=b\} \) of \([a,b]\). The points of a partition \(P\) are equally spaced with distance \(h = \frac{b-a}{n}\). The following are some commonly used rules for numerical integration. +\begin{itemize} +\item \textbf{The Mid-point rule:} +\[\int\limits_{a}^{b}f(x)dx \approx h \big[ f(m_1)+ f(m_2)+\cdots+ f(m_{n-1})+f(m_n)\big]\] +where \(m_i = \frac{x_{i-1}+x_i}{2}\) for \(i=1, 2,\ldots,n\). +\item \textbf{The Trapezoidal rule:} +\[\int\limits_{a}^{b}f(x)dx \approx \frac{h}{2}\big[f(x_0)+2\, f(x_1)+2\, f(x_2)+\cdots+2\, f(x_{n-1})+f(x_n)\big] \] +\item \textbf{The Simpson's one-third rule:} +\[\int\limits_{a}^{b}f(x)dx \approx \frac{h}{3}\big[f(x_0)+4\,f(x_1)+2\,f(x_2)+4\,f(x_3)+2\,f(x_4)+\cdots+2\,f(x_{n-2})+4\,f(x_{n-1})+f(x_n)\big] \] +The number of subintervals \(n\) should be an even number. +\item \textbf{The Simpson's three-eighth rule:} +\begin{dmath*}\int\limits_{a}^{b}f(x)dx \approx \frac{3h}{8} \big[f(x_0)+3\,f(x_1)+3\,f(x_2)+2\,f(x_3)+3\,f(x_4)+3\,f(x_5)+2\,f(x_6)+\cdots+2\,f(x_{n-3})+3\,f(x_{n-2})+3\,f(x_{n-1})+f(x_n)\big] \end{dmath*} +The number of subintervals \(n\) should be a multiple of \(3\). +\end{itemize} + +\section{Commands in the luanumint package} +Table \ref{tbl:cmdluanum} lists commands in the \verb|luanumint| package with their description. + +\begin{center} +\begin{longtable}{lm{10cm}} +\toprule +\multicolumn{1}{l}{\textcolor{blue}{Command}} & \multicolumn{1}{c}{\textcolor{blue}{Description}} \\ +\toprule +\begin{lstlisting}[caption={[]}] +\luaMidpt +\end{lstlisting} + & Evaluates the integral using the Mid-point rule. \\ +\midrule +\begin{lstlisting}[caption={[]}] +\luaMidptSteps +\end{lstlisting} + & Evaluates the integral using the Mid-point rule and provides steps involved in calculations. \\ +\midrule +\begin{lstlisting}[caption={[]}] +\luaTrapz +\end{lstlisting} + & Evaluates the integral using the Trapezoidal rule. \\ +\midrule +\begin{lstlisting}[caption={[]}] +\luaTrapzSteps +\end{lstlisting} + & Evaluates the integral using the Trapezoidal rule and provides steps involved in calculations. \\ +\midrule +\begin{lstlisting}[caption={[]}] +\luaSimpsonOneThird +\end{lstlisting} + & Evaluates the integral using the Simpson's one-third rule. \\ +\midrule +\begin{lstlisting}[caption={[]}] +\luaSimpsonOneThirdSteps +\end{lstlisting} + & Evaluates the integral using the Simpson's rule and provides steps involved in calculations. \\ +\midrule +\begin{lstlisting}[caption={[]}] +\luaSimpsonThreeEighth +\end{lstlisting} + & Evaluates the integral using the Simpson's three-eighth rule. \\ +\midrule +\begin{lstlisting}[caption={[]}] +\luaSimpsonThreeEighthSteps +\end{lstlisting} + & Evaluates the integral using the Simpson's three-eighth rule and provides steps involved in calculations. \\ +\bottomrule \\ +\caption{Commands in the luanumint package} +\label{tbl:cmdluanum} +\end{longtable} +\end{center} + +Each command has one compulsory argument: a function which is to be integrated. Also, each command has a common set of optional parameters. Table \ref{tbl:optluanum} lists these optional parameters with their description. +\begin{center} +\begin{longtable}{lm{11.3cm}} +\toprule +\multicolumn{1}{l}{\textcolor{blue}{Optional Parameter}} & \multicolumn{1}{c}{\textcolor{blue}{Description}} \\ +\toprule +\begin{lstlisting}[caption={[]}] +a +\end{lstlisting} + & Specifies the left end-point of the interval over which the integration is performed. The default value of \verb|a| is \(0 \). \\ +\midrule +\begin{lstlisting}[caption={[]}] +b +\end{lstlisting} + & Specifies the right-point of the interval over which the integration is performed. The default value of \verb|b| is \(1 \).\\ +\midrule +\begin{lstlisting}[caption={[]}] +n +\end{lstlisting} + & Specifies the number of subintervals used in calculating sums using different rules of numerical integration. The default value of \verb|n| is \(6 \).\\ +\midrule +\begin{lstlisting}[caption={[]}] +func +\end{lstlisting} + & Specifies the label for a function which is to be integrated. The default value of \verb|func| is \(f \). \\ + \midrule +\begin{lstlisting}[caption={[]}] +trun +\end{lstlisting} + & Specifies the number of decimal places to which the computations are to be truncated. The default value of \verb|trun| is \(4 \). \\ +\bottomrule \\ +\caption{Optional parameters in commands of the package} +\label{tbl:optluanum} +\end{longtable} +\end{center} + +\section{Illustrations of commands in the luanumint package} +Table \ref{tbl:illluanumint} illustrates some commands in the \verb|luanumint| package. +\begin{center} +\begin{longtable}{m{10.8cm}l} +\toprule +\multicolumn{1}{l}{\textcolor{blue}{LaTeX input}} & \multicolumn{1}{c}{\textcolor{blue}{Result}} \\ +\toprule +\begin{lstlisting}[caption={[]}] +$\int_{1}^{3}\sqrt{9+sin(x)} dx=\luaMidpt[a=1,b=3,n=4]{sqrt(9+sin(x))}$ +\end{lstlisting} & $\int_{1}^{3}\sqrt{9+\sin(x)} dx=\luaMidpt[a=1,b=3,n=4]{sqrt(9+sin(x))}$ \\ \midrule +\begin{lstlisting}[caption={[]}] +$\int_{1}^{2}\cos(x)dx=\luaTrapz[a=1,b=2,n=5]{cos(x)}$ +\end{lstlisting} & $\int_{1}^{2}\cos(x) dx=\luaTrapz[a=1,b=2,n=5]{cos(x)}$ \\ \midrule +\begin{lstlisting}[caption={[]}] +$\int_{0}^{1}\sin(x+1) dx=\luaSimpsonOneThird[a=0,b=1,n=4,trun=6]{sin(x+1)}$ +\end{lstlisting} & $\int_{0}^{1}\sin(x+1) dx=\luaSimpsonOneThird[a=0,b=1,n=4,trun=6]{sin(x+1)}$\\ \midrule +\begin{lstlisting}[caption={[]}] +$\int_{0}^{3}\sin(x) dx=\luaSimpsonThreeEighth[a=0,b=3,trun=6]{sin(x)}$ +\end{lstlisting} & $\int_{0}^{3}\sin(x) dx=\luaSimpsonThreeEighth[a=0,b=3,trun=6]{sqrt(x^3+1)}$\\ \bottomrule \\ +\caption{Illustrations of commands in the luanumint package} +\label{tbl:illluanumint} +\end{longtable} +\end{center} + +Listing \ref{code:luamidpt} generates the output shown in Table \ref{tbl:luamidpt}. +\begin{lstlisting}[label={code:luamidpt}, caption={The luaMidptSteps command}] +\begin{dmath*} +\int_{1}^{3}\sqrt{9+sin(x)} dx +\luaMidptSteps[a=1,b=3,n=4,trun=6]{sqrt(9+sin(x))} +\end{dmath*} +\end{lstlisting} + +\begin{table}[H] +\centering +\begin{dmath*} +\int_{1}^{3}\sqrt{9+sin(x)} dx +\luaMidptSteps[a=1,b=3,n=4,trun=6]{sqrt(9+sin(x))} +\end{dmath*} +\caption{The luaMidptSteps command} +\label{tbl:luamidpt} +\end{table} + +Listing \ref{code:luatrapz} generates the output shown in Table \ref{tbl:luatrapz}. + +\begin{lstlisting}[label={code:luatrapz}, caption={The luaTrapzSteps command}] +\begin{dmath*} +\int_{0}^{1}\sqrt{1+\sin^4(x)}dx +\luaTrapzSteps[a=0,b=1,n=5,trun=6]{sqrt(1+(sin(x))^4)} +\end{dmath*} +\end{lstlisting} + +\begin{table}[H] +\centering +\begin{dmath*} +\int_{0}^{1}\sqrt{1+\sin^4(x)}dx +\luaTrapzSteps[a=0,b=1,n=5,trun=6]{sqrt(1+(sin(x))^4)} +\end{dmath*} +\caption{The luaTrapzSteps command} +\label{tbl:luatrapz} +\end{table} + +Listing \ref{code:luasimpone} generates the output shown in Table \ref{tbl:luasimpone}. + +\begin{lstlisting}[label={code:luasimpone}, caption={The luaSimpsonOnethirdSteps command}] +\begin{dmath*} +\int_{0}^{1}\sin(x+1) dx +\luaSimpsonOneThirdSteps[a=0,b=1,n=4,trun=6]{sin(x+1)} +\end{dmath*} +\end{lstlisting} + +\begin{table}[H] +\centering +\begin{dmath*} +\int_{0}^{1}\sin(x+1) dx +\luaSimpsonOneThirdSteps[a=0,b=1,n=4,trun=6]{sin(x+1)} +\end{dmath*} +\caption{The luaSimpsonOnethirdSteps command} +\label{tbl:luasimpone} +\end{table} + +Listing \ref{code:luasimpthree} generates the output shown in Table \ref{tbl:luasimpthree}. + +\begin{lstlisting}[label={code:luasimpthree}, caption={The luaSimpsonThreeEightSteps command}] +\begin{dmath*} +\int_{0}^{3}\sqrt{x^3+1} dx +\luaSimpsonThreeEighthSteps[a=0,b=3,n=9,trun=6,func=h]{sqrt(x^3+1)} +\end{dmath*} +\end{lstlisting} + +\begin{table}[H] +\centering +\begin{dmath*} +\int_{0}^{3}\sqrt{x^3+1} dx +\luaSimpsonThreeEighthSteps[a=0,b=3,n=9,trun=6,func=h]{sqrt(x^3+1)} +\end{dmath*} +\caption{The luaSimpsonThreeEightSteps command} +\label{tbl:luasimpthree} +\end{table} + +\section{Known issues and limitations} +The package uses no external library supporting arbitrary precision arithmetic. The \verb|luanumint| package can handle big and small numbers within the range of Lua that it supports. Lua does not have an inbuilt function to round off numbers to the desired number of decimal places. The package uses some user-defined function to round off calculations in commands that facilitate step-by-step calculations. The round-off error may occur while dealing with big and small numbers, and it may cause slight deviations in the results. +\end{document} |