texlive[67918] Master/texmf-dist: xpunctuate (13aug23)

commits+karl at tug.org commits+karl at tug.org
Sun Aug 13 21:57:45 CEST 2023


Revision: 67918
          http://tug.org/svn/texlive?view=revision&revision=67918
Author:   karl
Date:     2023-08-13 21:57:44 +0200 (Sun, 13 Aug 2023)
Log Message:
-----------
xpunctuate (13aug23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/source/latex/xpunctuate/xpunctuate.dtx
    trunk/Master/texmf-dist/source/latex/xpunctuate/xpunctuate.ins
    trunk/Master/texmf-dist/tex/latex/xpunctuate/xpunctuate.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/xpunctuate/README.md
    trunk/Master/texmf-dist/doc/latex/xpunctuate/xpunctuate-doc.pdf

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/latex/xpunctuate/README
    trunk/Master/texmf-dist/doc/latex/xpunctuate/xpunctuate.pdf

Deleted: trunk/Master/texmf-dist/doc/latex/xpunctuate/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xpunctuate/README	2023-08-13 17:34:54 UTC (rev 67917)
+++ trunk/Master/texmf-dist/doc/latex/xpunctuate/README	2023-08-13 19:57:44 UTC (rev 67918)
@@ -1,21 +0,0 @@
-           --------------------------------------------------------
-           |  xpunctuate: a package to add punctuation, e.g. to   |
-           |              abbreviations, as and when necessary    |
-           |              (along the lines of xspace).            |
-           |                                                      |
-           |    Philip G. Ratcliffe - version 1.0 (2012/05/23)    |
-           --------------------------------------------------------
-
-* Copy xpunctuate.sty to one of your TeX input directories.
-
-* LaTeX xpunctuate.dtx for usage instructions and documentation.
-
-This is the first public release of the "xpunctuate" package; it defines 
-commands for typesetting, e.g., abbreviations where the trailing period may 
-clash with a sentence terminator.  More precisely it avoids the natural 
-problem of definitions such as \def\etc{\emph{etc}.}, which may then cause
-double periods if used at the end of sentences, such as ... cats, dogs \etc. 
-It also deals with optional commas, which again may be rendered unnecessary by
-the presence of a following sentence terminator. 
-
-Change history: v1.0 first official release.
\ No newline at end of file

Added: trunk/Master/texmf-dist/doc/latex/xpunctuate/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xpunctuate/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xpunctuate/README.md	2023-08-13 19:57:44 UTC (rev 67918)
@@ -0,0 +1,27 @@
+           --------------------------------------------------------
+           |  xpunctuate: a package to add punctuation, e.g. to   |
+           |              abbreviations, as and when necessary    |
+           |              (along the lines of xspace).            |
+           |                                                      |
+           |    Philip G. Ratcliffe - version 2.0 (2023/08/13)    |
+           --------------------------------------------------------
+
+* LaTeX xpunctuate.ins to produce xpunctuate.sty
+
+* Copy xpunctuate.sty to one of your TeX input directories.
+
+* LaTeX xpunctuate.dtx for usage instructions and documentation.
+
+This is the first revision of the "xpunctuate" package; it defines 
+commands for typesetting, e.g., abbreviations where the trailing period may 
+clash with a sentence terminator.  More precisely it avoids the natural 
+problem of definitions such as \def\etc{\emph{etc}.}, which may then cause
+double periods if used at the end of sentences, such as ... cats, dogs \etc. 
+It also deals with optional commas, which again may be rendered unnecessary by
+the presence of a following sentence terminator. 
+
+Change history: 
+v2.0 overhauled all user commands, introduced \NewDocumentCommand,
+     added \xspaceafter.
+v1.0 first official release.
+


Property changes on: trunk/Master/texmf-dist/doc/latex/xpunctuate/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xpunctuate/xpunctuate-doc.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/xpunctuate/xpunctuate-doc.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xpunctuate/xpunctuate-doc.pdf	2023-08-13 17:34:54 UTC (rev 67917)
+++ trunk/Master/texmf-dist/doc/latex/xpunctuate/xpunctuate-doc.pdf	2023-08-13 19:57:44 UTC (rev 67918)

Property changes on: trunk/Master/texmf-dist/doc/latex/xpunctuate/xpunctuate-doc.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/latex/xpunctuate/xpunctuate.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/xpunctuate/xpunctuate.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/xpunctuate/xpunctuate.dtx	2023-08-13 17:34:54 UTC (rev 67917)
+++ trunk/Master/texmf-dist/source/latex/xpunctuate/xpunctuate.dtx	2023-08-13 19:57:44 UTC (rev 67918)
@@ -1,31 +1,53 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 2012 by Philip G. Ratcliffe <philip.ratcliffe at uninsubria.it>
+% File: xpunctuate.dtx
 %
-% This file may be distributed and/or modified under the conditions of
-% the LaTeX Project Public License, either version 1.2 of this license
-% or (at your option) any later version. The latest version of this
-% license is in:
+% Copyright (C) 2023 by Philip G. Ratcliffe <philip.ratcliffe at uninsubria.it>
 %
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version.
+% The latest version of this license is in the file
+%
 %    http://www.latex-project.org/lppl.txt
 %
-% and version 1.2 or later is part of all distributions of LaTeX
-% version 1999/12/01 or later.
+% This file is part of the "xpunctuate package" (the Work in LPPL)
+% and all files in that package must be distributed together.
 %
+% The released version of this package is available from CTAN.
+%
+% This package has the LPPL maintenance status "maintained".
+%
+% The current maintainer of this package is Philip G. Ratcliffe.
+%
+% This work consists of the files xpunctuate.dtx and xpunctuate.ins
+% and the derived file xpunctuate.sty.
+%
 % \fi
 %
 % \iffalse
 %
-%<package>\NeedsTeXFormat{LaTeX2e}[1995/12/01]
+%<package>\NeedsTeXFormat{LaTeX2e}[2020/10/01]
 %<package>\ProvidesPackage{xpunctuate}
-%<package>   [2012/05/21 v1.0 trailing punctuation package (PGR)]
+%<package>  [2023/08/13 v2.0 punctuation after command names (PGR)]
 %
 %<*driver>
-\documentclass{ltxdoc}
+\documentclass[british]{ltxdoc}
 \usepackage{xpunctuate}
+%
+\NewDocElement[macrolike=false]{Generic}{generic}
+\renewcommand\thefootnote{\color{red}{\emph{\alph{footnote}}}}
+\newenvironment{codelist}
+  {\begin{list}{}{\setlength\leftmargin{3em}}\item[]}{\end{list}}
+\newcommand\eg{\xperiodafter{\emph{e}.\emph{g}}}
+\newcommand\ie{\xperiodafter{\emph{i}.\emph{e}}}
+%
 \CodelineIndex
 \EnableCrossrefs
 \RecordChanges
+\DoNotIndex{\def,\let,\futurelet}
+\DoNotIndex{\if,\else,\fi,\ifx,\fi,\iftrue,\fi,\iffalse,\fi}
+\DoNotIndex{\the,\csname,\endcsname,\expandafter,\noexpand,\protect}
 %
 \begin{document}
   \DocInput{xpunctuate.dtx}
@@ -33,7 +55,7 @@
 %</driver>
 % \fi
 %
-% \CheckSum{144}
+% \CheckSum{154}
 %
 % \CharacterTable
 %  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -51,157 +73,258 @@
 %   Grave accent  \`     Left brace    \{     Vertical bar  \|
 %   Right brace   \}     Tilde         \~}
 %
-%
 % \changes{v1.0}{2012/05/21}{first public release}
+% \changes{v2.0}{2023/08/13}{general upgrade}
 %
 % \GetFileInfo{xpunctuate.sty}
 %
 % \DoNotIndex{\CodelineIndex,\EnableCrossrefs,\RecordChanges}
 %
-% \title{
-%   The \textsf{xpunctuate}\relax
-%   \thanks{
-%     This file has version number \fileversion, and revision date \filedate.}
-%   \space
-%   package for \LaTeX2e
-% }
-% \author{
-%   Philip G. Ratcliffe\thanks{E-mail: \textsf{philip.ratcliffe at uninsubria.it}}
-% \\
-%   Dipartimento di Scienze e Alta Tecnologia
-% \\
-%   Universit\`{a} degli Studi dell'Insubria---Como
-% }
+% \title{The \texttt{xpunctuate} package for \LaTeX2e
+% \\[1ex] \small (\fileversion, last revision \filedate)}
 %
+% \author{Philip G. Ratcliffe
+% \\[1ex] \small \textsf{philip.ratcliffe at uninsubria.it}
+% \\[2ex] \small Dipartimento di Scienza e Alta Tecnologia
+% \\ \small Universit\`a degli Studi dell'Insubria---Como
+% \\ \small and
+% \\ \small Istituto Nazionale di Fisica Nucleare
+% \\ \small Sezione di Milano Bicocca}
+%
 % \date{}
 %
 % \maketitle
 %
 % \begin{abstract}
-% This package affords the user or package writer post-macro punctuation
-% insertion, \emph{i.e.}, beyond (but similar to) that of the |xspace| package.
-% Three new commands are defined: |\xperiod|, |\xcomma| and |\xperiodcomma|,
-% which, following a similar procedure to the standard |\xspace| macro, are
-% designed to insert the relevant punctuation \emph{if and only if} necessary.
+% The |xpunctuate| package provides package writers and ordinary users with
+% automatic post-macro punctuation insertion, \ie beyond (but similar to) that
+% of the |xspace| package, which is required here. Three new macros are
+% defined: |\xperiod|, |\xcomma| and |\xperiodcomma|, designed to insert the
+% required punctuation marks \emph{if and only if} necessary, following a
+% similar procedure to the |xspace| package. A further four macros
+% (|\xspaceafter|, |\xperiodafter|, |\xcommaafter| and |\xperiodcommaafter|)
+% are constructed to avoid the small superfluous space after possible font
+% changes (such as |\emph|) that involve the correction |\/|, which would
+% otherwise be hidden.
 % \end{abstract}
 %
 % \section{Introduction}
 %
-% The present package is mainly intended for package writers and provides
-% additional post-macro punctuation insertion, similar to that of the |xspace|
-% package. Three new commands are defined: |\xperiod|, |\xcomma| and
-% |\xperiodcomma|, which, in an analogous fashion to the standard |\xspace|
-% macro, insert the relevant punctuation where necessary.
+% The present package is mainly intended for package writers, but may also
+% serve the ordinary user; it provides additional post-macro punctuation
+% insertion, similar to that of the |xspace| package. Three new macros are
+% defined: |\xperiod|, |\xcomma| and |\xperiodcomma|, which, in an analogous
+% fashion to the standard |\xspace| macro, insert any relevant punctuation
+% where necessary. Four additional macros, of the form |\x|\dots|after|, avoid
+% the small superfluous space due to the following period or comma being
+% isolated from a preceding~|\/|.
 %
-% \section{Usage}
+% \section{Package call}
 %
-% The package is loaded via a standard package call: |\usepackage{xpunctuate}|.
-% There are at present no user options.
+% \DescribeGeneric{package call}
+% The package is loaded via a standard call:
+% \begin{codelist}
+% |\usepackage{xpunctuate}|
+% \end{codelist}
 %
-% \subsection{User commands}
+% \subsection{User options}
 %
-% The package defines three user commands, each having two variants.
+% \DescribeGeneric{user options}
+% There are at present \emph{no} user options.
 %
+% \subsection{User macros}
+%
+% Three user macros are defined, each having a pre-punctuation space-correcting
+% variant, plus a similar extension of the |\xspace| macro.
+%
 % \DescribeMacro{\xperiod}
 % The purpose of this macro is to insert a period if not found as the
 % successive \LaTeX\ input token. Typical use will be in defining
-% abbreviations, where there may or may not be a following ``accidental''
-% sentence-terminating period. The definition of |\xperiod| is such that if it
-% is followed by a period, then this is considered as a sentence terminator and
-% the appropriate trailing space is inserted. However, when no explicit period
-% follows, the occurrence is assumed to be mid-sentence and therefore normal
-% inter-word spacing is used.
+% abbreviations, where there may or may not be a following \emph{accidental}
+% sentence-terminating full stop. If \emph{no} explicit period follows, one is
+% inserted, the occurrence is assumed to be mid-sentence and therefore normal
+% inter-word spacing is applied. However, if it \emph{is} followed by a period,
+% then this is considered to be a sentence terminator, it is left as is with no
+% further insertions and the appropriate trailing space will then naturally
+% ensue.
 %
+% After defining |\newcommand{\gb}{G.B\xperiod}|, the command |\gb| will
+% determine when to insert a period after itself and when not, with also the
+% correct mid-sentence or end-of-sentence spacing as required. Thus, the input
+% \newcommand{\gb}{G.B\@\xperiod}
+% \begin{codelist}
+% |\gb is a very nice place to live.\\|\\
+% |I live in \gb. It is a small island off the coast of France|\\
+% |\gb\footnote{The small island off the coast of France.}|\\
+% |is a very nice place to live.|
+% \end{codelist}
+% results in the output
+% \begin{codelist}
+% \gb is a very nice place to live.\\
+% I live in \gb. It is a small island off the coast of France.\\
+% \gb\footnote{The small island off the coast of France.}
+% is a very nice place to live.
+% \end{codelist}
+%
 % \DescribeMacro{\xcomma}
-% The purpose of this macro is to insert a comma if not found as the next
-% token. Typical use will be following an object such as ``\emph{e.g.}'', which
-% according to certain standard style manuals should be followed by a comma.
-% This command has no special spacing behaviour.
+% This macro similarly inserts a comma if not found as the next token. A
+% typical application might be following an abbreviation such as `eg' (\ie when
+% used \emph{without} periods), which according to different standard style
+% manuals should or should not be followed by a comma. It has no special
+% spacing behaviour.
 %
 % \DescribeMacro{\xperiodcomma}
-% The purpose of this macro is to insert a period \emph{and} comma if not found
-% as the next input tokens. Typical use will be, as above, following an object
-% such as ``\emph{e.g.}'', which, according to certain style manuals, should be
-% followed by a comma, but may also occur fortuitously immediately preceding an
-% explicit sentence-closing period, the correct trailing space of which would
-% then be inserted.
+% This macro inserts a period \emph{and} a comma if not found as the next input
+% tokens. Typical use will be, as above, for abbreviations such as `e.g.'\ (\ie
+% \emph{with} periods) when they should be followed by a comma, but may also
+% occur fortuitously immediately preceding an explicit sentence-closing period
+% or indeed an explicit comma, the correct trailing space of which would then
+% ensue. Note that this action \emph{cannot} be reproduced via successive use
+% of the single macros, \ie the combination |\xperiod\xcomma|.
 %
+% \DescribeMacro{\xspaceafter}
 % \DescribeMacro{\xperiodafter}
 % \DescribeMacro{\xcommaafter}
 % \DescribeMacro{\xperiodcommaafter}
-% These variants are similar to the above macros except that they take the word
-% or words to be punctuated as an argument; this avoids incorrect spacing
-% adjustment when the word is, for example, |\emph|'asised.
+% The variants |\x|\dots|after| are similar to the above except that they take
+% the object word or phrase to be spaced or punctuated as an argument; the
+% slight incorrect spacing adjustment between the word and following period or
+% comma is thus avoided when, for example, the word is |\emph|'asised. Other
+% punctuation marks do \emph{not} suffer from this problem.
 %
-% Note that the action of |\xperiodcommaafter| may also obtained by suitably
-% nesting |\xperiodafter| and |\xcommaafter| though this has not been
-% thoroughly tested; it is thus included for safety and backward compatibility.
+% Note that although the action of |\xperiodcommaafter| may also be obtained
+% via suitable nesting of |\xperiodafter| and |\xcommaafter|, this combination
+% has not been thoroughly tested; the compound macro is thus included for both
+% safety and backwards compatibility.
 %
-% The following are examples of possible usage:\\[2ex]
-% |\DeclareRobustCommand\etal{\xperiodafter{\emph{et al}}}| \\
-% |\DeclareRobustCommand\eg{e.g\xperiodcomma}| \\
-% |\DeclareRobustCommand\eg{\xcommaafter{\xperiodafter{\emph{e.g}}}}|
+% In the case of the macros that guarantee a trailing period (\emph{with} or
+% \emph{without} a comma), if the final letter of the word or phrase is a
+% capital (\eg `Ph.D.'), to guarantee the correct end-of-sentence trailing
+% spacing, it should be immediately followed by an explicit |\@|. That is, the
+% definition should be of the form
+% \begin{codelist}
+% |\newcommand\PhD{Ph.D\@\xperiod}|\\[-0.67ex]
+% \hspace*{-\leftmargin}\, or\\[-0.67ex]
+% |\newcommand\PhD{\xperiodafter{Ph.D\@}}|
+% \end{codelist}
+% N.B. If the ending capital letter or letters are \eg |\emph|'asised, the |\@|
+% should be placed \emph{inside} the |\emph|'asis:\footnote{It is for this
+% reason that it \emph{cannot} be incorporated directly into the |xpunctuate|
+% macros.}
+% \begin{codelist}
+% |\newcommand\PhD{\emph{Ph}.\emph{D\@}\xperiod}|\\[-0.67ex]
+% \hspace*{-\leftmargin}\, or\\[-0.67ex]
+% |\newcommand\PhD{\xperiodafter{\emph{Ph}.\emph{D\@}}}|
+% \end{codelist}
 %
+% The following are various other examples of possible usage:
+% \begin{codelist}
+% |\newcommand\etc{etc\xperiod}|\\
+% |\newcommand\eg{i.e\xperiodcomma}|\\
+% |\newcommand\etal{\xperiodafter{\emph{et al}}}|\\
+% |\newcommand\ie{\xperiodcommaafter{\emph{e}.\emph{g}}}|
+% \end{codelist}
+% Note how the closing period in the above is \emph{not} explicitly present,
+% being inserted by the relevant macro as and when necessary, with too the 
+% correct spacing.
+%
 % \subsection{Caveats}
 %
-% No particular care should be necessary in using the commands defined by this
-% package. However, trailing punctuation hidden inside macro definitions may
-% not be correctly interpreted.
+% \begin{generic}{caveats}
+% No specific care should be necessary when employing the macros defined here;
+% in particular, they are all \emph{robust}. However, trailing punctuation
+% hidden inside or by other macro definitions may not always be correctly
+% interpreted. Moreover, the known limitations of |\xspace| remain.
+% \end{generic}
 %
 % \subsection{External package requirements}
 %
-% The |xspace| package is required and is loaded automatically.
+% \begin{generic}{xspace}
+% The |xspace| package is required and is loaded automatically. Note that, in
+% the \emph{absence} of |\xspace|, the necessary presence of explicit trailing
+% backslashes for correct spacing following command strings, would frustrate
+% the functionality of all the macros defined here.\footnote{Users who shun the
+% use of |xspace| will probably not appreciate the present package either.}
+% \end{generic}
 %
 % \subsection{Package conflicts}
 %
+% \begin{generic}{conflicts}
 % There are no known conflicts with any standard \LaTeX2e\ packages.
+% \end{generic}
 %
 % \StopEventually{\PrintChanges\PrintIndex}
 %
 % \section{Implementation}
 %
-% \subsection{External package requirements}
-%
-% Load the |xspace| package for automatic trailing space:
+% \subsection{External packages}
+% \begin{generic}{packages}
+% First, load the |xspace| package, for automatic trailing-space insertion:
 %    \begin{macrocode}
 \RequirePackage{xspace}
 %    \end{macrocode}
+% \changes{v2.0}{2023/08/13}{useful \texttt{xspace} exceptions added}
+% \begin{generic}{exceptions}
+% and add some useful extra |xspace| exceptions relevant to the present
+% package.
+%    \begin{macrocode}
+\xspaceaddexceptions{\xcomma\xperiod\xperiodcomma}
+%    \end{macrocode}
+% \end{generic}
+% \end{generic}
 %
 % \subsection{User commands}
 %
+% \changes{v2.0}{2023/08/13}{revamped all macros}
+% \begin{macro}{\xspaceafter}
+% \changes{v2.0}{2023/08/13}{macro added}
+% This macro takes one argument, which it prints as is. It then inserts
+% |\xspace| immediately after, but nothing if followed by a comma or period.
+%    \begin{macrocode}
+\NewDocumentCommand\xspaceafter{}{\xpnct at aux\xspace at aux}
+%    \end{macrocode}
+% The correct spacing between the argument and any following comma or period is
+% thus maintained in the case of, say, an |\emph|'asised argument. The
+% necessity arises as the presence of |\xspace| `hides' any following
+% punctuation from a possible |\/| spacing-correction command.
+% \end{macro}
+%
 % \begin{macro}{\xperiod}
 % The following macro inserts a period if this is not found to be the next
-% character. It may thus be used to construct common abbreviations (such as
-% ``\emph{etc}.'').
+% character.
 %    \begin{macrocode}
-\DeclareRobustCommand\xperiod{\xprd at Set{}}
+\NewDocumentCommand\xperiod{}{\xpnct at aux\xperiod at aux{}}
 %    \end{macrocode}
+% It may thus be used to construct common abbreviations (such as `etc.').
 % \end{macro}
 %
 % \begin{macro}{\xperiodafter}
-% This macro takes one argument and places a period after it if this is not
-% found to be the next character. The correct spacing between the word and
-% period is thus maintained in the case of, say, |\emph|.
+% This macro takes one argument and inserts a period after it if this is not
+% found to be the next character.
 %    \begin{macrocode}
-\DeclareRobustCommand\xperiodafter[1]{\xprd at Set{#1}}
+\NewDocumentCommand\xperiodafter{}{\xpnct at aux\xperiod at aux}
 %    \end{macrocode}
+% The correct spacing between the argument and period is again thus maintained
+% in the case of, say, |\emph|, as in often \emph{italicised} abbreviations
+% (such as `\emph{etc}.').
 % \end{macro}
 %
 % \begin{macro}{\xcomma}
 % The following macro inserts a comma if this is not found to be the next
-% character. Thus, it may be used to construct common abbreviations and
-% expressions that should normally be followed by a comma (such as
-% ``\emph{e.g.}'').
+% character.
 %    \begin{macrocode}
-\DeclareRobustCommand\xcomma{\xcmm at Set{}}
+\NewDocumentCommand\xcomma{}{\xpnct at aux\xcomma at aux{}}
 %    \end{macrocode}
+% It may thus be used to construct those common abbreviations (without periods)
+% that might normally be followed by a comma, such as `eg' or `ie' according to
+% standard American-English usage.
 % \end{macro}
 %
 % \begin{macro}{\xcommaafter}
-% The following macro takes one argument and places a comma after it if this is
-% not found to be the next character. 
+% The following macro takes one argument and inserts a comma after it if this
+% is not found to be the next character.
 %    \begin{macrocode}
-\DeclareRobustCommand\xcommaafter[1]{\xcmm at Set{#1}}
+\NewDocumentCommand\xcommaafter{}{\xpnct at aux\xcomma at aux}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -209,116 +332,135 @@
 % The following macro first adds a period and then a comma if these are not
 % found to be the next characters.
 %    \begin{macrocode}
-\DeclareRobustCommand\xperiodcomma{\xpcm at Set{}}
+\NewDocumentCommand\xperiodcomma{}{\xpnct at aux\xperiodcomma at aux{}}
 %    \end{macrocode}
-% It may thus be used to construct common abbreviations that should normally be
-% followed by a comma (such as ``\emph{e.g.}''). The comma is inserted if only
-% and if the following character does not imply the end of a period. Here, of
-% course, there is no problem of spacing either preceding or following the
-% period. If only a period is found this is treated as an end-of-sentence and
-% the spacing is handled accordingly.
+% It may thus be used to construct those common abbreviations that might
+% normally be followed by a comma (such as `e.g.,'), the comma being inserted
+% \emph{if and only if} there is no following explicit sentence-ending period.
+% Here, there is of course no problem of spacing either preceding or following
+% the period. If only a period is found, it is treated as an end-of-sentence
+% and the correct spacing will ensue accordingly. A following period--comma
+% combination, if found, will be left as is.
 % \end{macro}
 %
 % \begin{macro}{\xperiodcommaafter}
-% This macro takes one argument and places a period and a comma after it if
-% these are not found to be the next characters:
+% This macro takes one argument and inserts a period and/or a comma after it if
+% these are not found to be the next characters.
 %    \begin{macrocode}
-\DeclareRobustCommand\xperiodcommaafter[1]{\xpcm at Set{#1}}
+\NewDocumentCommand\xperiodcommaafter{}{\xpnct at aux\xperiodcomma at aux}
 %    \end{macrocode}
+% It may thus be used to construct those common \emph{italicised} abbreviations
+% that should normally be followed by a comma (such as `\eg,').
 % \end{macro}
 %
 % \subsection{Internal macros}
 %
-% \begin{macro}{\xprd at Set}
-% The setup for |\xperiod| and |\xperiodafter| is performed by the following
-% auxiliary macro:
+% \begin{macro}{\xpnct at tok}
+% A token register is defined to store a possible object word or phrase:
 %    \begin{macrocode}
-\newcommand\xprd at Set[1]{\def\xprd at Obj{#1}\futurelet\xprd at Nxt\xprd at Fin}
+\newtoks\xpnct at tok
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\xprd at Fin}
-% The testing and final output for |\xperiod| and |\xperiodafter| is made by
-% the following auxiliary macro:
+% \begin{macro}{\xpnct at aux}
+% The general setup and call to the final output macros for the above user
+% commands is handled by the following auxiliary macro:
 %    \begin{macrocode}
-\newcommand\xprd at Fin{%
-  \ifx\xprd at Nxt.\relax
-    \let\xprd at Out\xprd at Obj
-  \else
-    \def\xprd at Out{\xprd at Obj.\@\xspace}%
-  \fi
-  \xprd at Out
-}
+\def\xpnct at aux#1#2{%
+  \xpnct at tok{#2}%
+  \futurelet\xpnct at nxt#1}
 %    \end{macrocode}
-% Note the insertion of ``|\@|'' following the period when this last is not
-% found; this avoids the standard default end-of-sentence spacing, assuming the
-% occurrence in such a case to be mid-sentence.
 % \end{macro}
+% Note that all the user commands defined earlier terminate by inserting an
+% |\xspace| \emph{if} and \emph{only if} the required punctuation has actually
+% been inserted by the macro.
 %
-% \begin{macro}{\xcmm at Set}
-% The setup for |\xcomma| and |\xcommaafter| is performed by the following
-% auxiliary macro:
+% \begin{macro}{\xspace at aux}
+% Testing and output for |\xspaceafter| are performed by the following macro:
 %    \begin{macrocode}
-\newcommand\xcmm at Set[1]{\def\xcmm at Obj{#1}\futurelet\xcmm at Nxt\xcmm at Fin}
+\def\xspace at aux{%
+  \ifx\xpnct at nxt,\else
+  \ifx\xpnct at nxt.\else
+    \xpnct at tok\expandafter{\the\xpnct at tok\xspace}%
+  \fi\fi
+  \the\xpnct at tok}
 %    \end{macrocode}
+% Only periods and commas need be excluded, as the spacing is correct for all
+% other punctuation marks.
 % \end{macro}
 %
-% \begin{macro}{\xcmm at Fin}
-% The testing and final output for |\xcomma| and |\xcommaafter| is made by the
-% following auxiliary macro (shamelessly copied from an \emph{old} |xspace| and
-% hacked):
+% \begin{macro}{\xperiod at aux}
+% Testing and output for |\xperiod| and |\xperiodafter| are performed by this
+% macro:
 %    \begin{macrocode}
-\newcommand\xcmm at Fin{%
-  \let\xcmm at Out\xcmm at Obj
-  \ifx\xcmm at Nxt\bgroup\else
-  \ifx\xcmm at Nxt\egroup\else
-  \ifx\xcmm at Nxt\/\else
-  \ifx\xcmm at Nxt~\else
-  \ifx\xcmm at Nxt.\else
-  \ifx\xcmm at Nxt!\else
-  \ifx\xcmm at Nxt,\else
-  \ifx\xcmm at Nxt:\else
-  \ifx\xcmm at Nxt;\else
-  \ifx\xcmm at Nxt?\else
-  \ifx\xcmm at Nxt/\else
-  \ifx\xcmm at Nxt'\else
-  \ifx\xcmm at Nxt)\else
-  \ifx\xcmm at Nxt]\else
-  \ifx\xcmm at Nxt-\else
-    \def\xcmm at Out{\xcmm at Obj,\xspace}%
-  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
-  \xcmm at Out
-}
+\def\xperiod at aux{%
+  \ifx\xpnct at nxt.\else
+    \xpnct at tok\expandafter{\the\xpnct at tok.\@\xspace}%
+  \fi
+  \the\xpnct at tok}
 %    \end{macrocode}
-% Note that there are fewer options than in the |xspace| package, for obvious
-% reasons.
+% The approach adopted is to treat an explicit following period as an
+% end-of-sentence full stop; the trailing space is then handled accordingly.
+% However, when an explicit period is \emph{not} found), the placement of |\@|
+% immediately after the inserted period thus avoids standard end-of-sentence
+% spacing, assuming such an occurrence to be mid-sentence (as for
+% abbreviations). If, in contrast, an explicit period \emph{is} found, it is
+% retained as is and will thus generate the correct end-of-sentence spacing.
 % \end{macro}
 %
-% \begin{macro}{\xpcm at Set}
-% The setup for |\xperiodcomma| and |\xperiodcommaafter| is performed by the
-% following auxiliary macro:
+% \begin{macro}{\xcomma at aux}
+% Testing and output for |\xcomma| and |\xcommaafter| are performed by the
+% following macro (shamelessly copied from an \emph{old} |xspace.sty| and
+% suitably hacked):
 %    \begin{macrocode}
-\newcommand\xpcm at Set[1]{\def\xpcm at Obj{#1}\futurelet\xpcm at Nxt\xpcm at Fin}
+\def\xcomma at aux{%
+  \ifx\xpnct at nxt.\else
+  \ifx\xpnct at nxt,\else
+  \ifx\xpnct at nxt:\else
+  \ifx\xpnct at nxt;\else
+  \ifx\xpnct at nxt!\else
+  \ifx\xpnct at nxt?\else
+  \ifx\xpnct at nxt/\else
+  \ifx\xpnct at nxt-\else
+  \ifx\xpnct at nxt'\else
+  \ifx\xpnct at nxt)\else
+  \ifx\xpnct at nxt]\else
+  \ifx\xpnct at nxt\}\else
+  \ifx\xpnct at nxt\egroup\else
+  \ifx\xpnct at nxt\/\else
+    \xpnct at tok\expandafter{\the\xpnct at tok,\xspace}%
+  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+  \the\xpnct at tok}
 %    \end{macrocode}
+% Note that certain of the default exceptions set by the |xspace| package are
+% missing here, for obvious reasons.
 % \end{macro}
 %
-% \begin{macro}{\xpcm at Fin}
-% The testing and final output for |\xperiodcomma| and |\xperiodcommaafter| is
-% made by the following auxiliary macro:
+% \begin{macro}{\xperiodcomma at aux}
+% Testing and output for |\xperiodcomma| and |\xperiodcommaafter| are performed
+% by the following:
 %    \begin{macrocode}
-\newcommand\xpcm at Fin{%
-  \ifx\xpcm at Nxt.\relax
-    \let\xpcm at Out\xpcm at Obj
-  \else
-    \def\xpcm at Out{\xpcm at Obj.\xcomma}%
+\def\xperiodcomma at aux{%
+  \ifx\xpnct at nxt.\else
+    \xpnct at tok\expandafter{\the\xpnct at tok.\@\xcomma}%
   \fi
-  \xpcm at Out
-}
+  \the\xpnct at tok}
 %    \end{macrocode}
-% The choice made is that if only a following period is found, then it is
-% treated as an end-of-sentence and the trailing space is handled accordingly.
+% The presence or absence of an explicit following period is again taken to
+% imply an end-of- or mid-sentence respectively, unless followed by an explicit
+% comma, other closing punctuation or brackets say, when it will be assumed
+% mid-sentence. Note, moreover, that |\@| is \emph{still} necessary here as the
+% period may not necessarily be immediately followed by a comma, \eg if it is
+% followed by a closing bracket or quotation marks.
 % \end{macro}
 %
+% \begin{macro}{\endinput}
+% Finally, explicitly terminate the package input here.
+%    \begin{macrocode}
+\endinput
+%    \end{macrocode}
+% \end{macro}
+%
 % \Finale
 %
 \endinput

Modified: trunk/Master/texmf-dist/source/latex/xpunctuate/xpunctuate.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/xpunctuate/xpunctuate.ins	2023-08-13 17:34:54 UTC (rev 67917)
+++ trunk/Master/texmf-dist/source/latex/xpunctuate/xpunctuate.ins	2023-08-13 19:57:44 UTC (rev 67918)
@@ -1,51 +1,60 @@
-%%
-%% Copyright (C) 2012 by Philip G. Ratcliffe <philip.ratcliffe at uninsubria.it>
-%%
-%% This file may be distributed and/or modified under the conditions of
-%% the LaTeX Project Public License, either version 1.2 of this license
-%% or (at your option) any later version.  The latest version of this
-%% license is in:
-%%
-%%    http://www.latex-project.org/lppl.txt
-%%
-%% and version 1.2 or later is part of all distributions of LaTeX
-%% version 1999/12/01 or later.
-%%
+\iffalse meta-comment
+
+File: xpunctuate.ins
+
+Copyright (C) 2023 Philip G. Ratcliffe <philip.ratcliffe at uninsubria.it>
+
+It may be distributed and/or modified under the conditions of the
+LaTeX Project Public License (LPPL), either version 1.3c of this
+license or (at your option) any later version.  The latest version
+of this license is in the file
+
+   http://www.latex-project.org/lppl.txt
+
+This file is part of the "xpunctuate package" (the Work in LPPL)
+and all files in that package must be distributed together.
+
+The released version of this package is available from CTAN.
+
+\fi
+
 \input docstrip
 \keepsilent
 \usedir{tex/latex/xpunctuate}
 \preamble
 
-Copyright (C) 2012 by Philip G. Ratcliffe <philip.ratcliffe at uninsubria.it>
+Copyright (C) 2023 Philip G. Ratcliffe <philip.ratcliffe at uninsubria.it>
 
-This file may be distributed and/or modified under the conditions of
-the LaTeX Project Public License, either version 1.2 of this license
-or (at your option) any later version.  The latest version of this
-license is in:
+It may be distributed and/or modified under the conditions of the
+LaTeX Project Public License (LPPL), either version 1.3c of this
+license or (at your option) any later version.  The latest version
+of this license is in the file
 
    http://www.latex-project.org/lppl.txt
 
-and version 1.2 or later is part of all distributions of LaTeX
-version 1999/12/01 or later.
+This file is part of the "xpunctuate package" (the Work in LPPL)
+and all files in that package must be distributed together.
 
+The released version of this package is available from CTAN.
+
 \endpreamble
 
 \generateFile{xpunctuate.sty}{n}{\from{xpunctuate.dtx}{package}}
 
-\ifToplevel{
+\ifToplevel{%
 \Msg{*************************************************************}
 \Msg{*}
 \Msg{* To finish the installation, move the following file into a}
 \Msg{* directory searched by TeX:}
 \Msg{*}
-\Msg{* \space\space xpunctuate.sty }
+\Msg{* \space\space xpunctuate.sty}
 \Msg{*}
 \Msg{* To produce the documentation, run xpunctuate.dtx through LaTeX.}
 \Msg{* To produce a documentation index, run makeindex like this:}
-\Msg{*   \space\space makeindex -s gind.ist xpunctuate}
+\Msg{* \space\space makeindex -s gind.ist xpunctuate}
 \Msg{* To produce a history of changes, run makeindex like this:}
-\Msg{*   \space\space makeindex -s gglo.ist -o xpunctuate.gls xpunctuate.glo}
-\Msg{* Finally, run `xpunctuate.dtx' through LaTeX again.}
+\Msg{* \space\space makeindex -s gglo.ist -o xpunctuate.gls xpunctuate.glo}
+\Msg{* Finally, run 'xpunctuate.dtx' through LaTeX again.}
 \Msg{*}
 \Msg{* Happy LaTeXing}
 \Msg{*************************************************************}
@@ -53,4 +62,4 @@
 
 \endbatchfile
 %%
-%% End of file `xpunctuate.ins'.
\ No newline at end of file
+%% End of file 'xpunctuate.ins'. 
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/latex/xpunctuate/xpunctuate.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/xpunctuate/xpunctuate.sty	2023-08-13 17:34:54 UTC (rev 67917)
+++ trunk/Master/texmf-dist/tex/latex/xpunctuate/xpunctuate.sty	2023-08-13 19:57:44 UTC (rev 67918)
@@ -6,68 +6,70 @@
 %%
 %% xpunctuate.dtx  (with options: `package')
 %% 
-%% Copyright (C) 2012 by Philip G. Ratcliffe <philip.ratcliffe at uninsubria.it>
+%% Copyright (C) 2023 Philip G. Ratcliffe <philip.ratcliffe at uninsubria.it>
 %% 
-%% This file may be distributed and/or modified under the conditions of
-%% the LaTeX Project Public License, either version 1.2 of this license
-%% or (at your option) any later version.  The latest version of this
-%% license is in:
+%% It may be distributed and/or modified under the conditions of the
+%% LaTeX Project Public License (LPPL), either version 1.3c of this
+%% license or (at your option) any later version.  The latest version
+%% of this license is in the file
 %% 
 %%    http://www.latex-project.org/lppl.txt
 %% 
-%% and version 1.2 or later is part of all distributions of LaTeX
-%% version 1999/12/01 or later.
+%% This file is part of the "xpunctuate package" (the Work in LPPL)
+%% and all files in that package must be distributed together.
 %% 
-\NeedsTeXFormat{LaTeX2e}[1995/12/01]
+%% The released version of this package is available from CTAN.
+%% 
+\NeedsTeXFormat{LaTeX2e}[2020/10/01]
 \ProvidesPackage{xpunctuate}
-   [2012/05/21 v1.0 trailing punctuation package (PGR)]
+  [2023/08/13 v2.0 punctuation after command names (PGR)]
 \RequirePackage{xspace}
-\DeclareRobustCommand\xperiod{\xprd at Set{}}
-\DeclareRobustCommand\xperiodafter[1]{\xprd at Set{#1}}
-\DeclareRobustCommand\xcomma{\xcmm at Set{}}
-\DeclareRobustCommand\xcommaafter[1]{\xcmm at Set{#1}}
-\DeclareRobustCommand\xperiodcomma{\xpcm at Set{}}
-\DeclareRobustCommand\xperiodcommaafter[1]{\xpcm at Set{#1}}
-\newcommand\xprd at Set[1]{\def\xprd at Obj{#1}\futurelet\xprd at Nxt\xprd at Fin}
-\newcommand\xprd at Fin{%
-  \ifx\xprd at Nxt.\relax
-    \let\xprd at Out\xprd at Obj
-  \else
-    \def\xprd at Out{\xprd at Obj.\@\xspace}%
+\xspaceaddexceptions{\xcomma\xperiod\xperiodcomma}
+\NewDocumentCommand\xspaceafter{}{\xpnct at aux\xspace at aux}
+\NewDocumentCommand\xperiod{}{\xpnct at aux\xperiod at aux{}}
+\NewDocumentCommand\xperiodafter{}{\xpnct at aux\xperiod at aux}
+\NewDocumentCommand\xcomma{}{\xpnct at aux\xcomma at aux{}}
+\NewDocumentCommand\xcommaafter{}{\xpnct at aux\xcomma at aux}
+\NewDocumentCommand\xperiodcomma{}{\xpnct at aux\xperiodcomma at aux{}}
+\NewDocumentCommand\xperiodcommaafter{}{\xpnct at aux\xperiodcomma at aux}
+\newtoks\xpnct at tok
+\def\xpnct at aux#1#2{%
+  \xpnct at tok{#2}%
+  \futurelet\xpnct at nxt#1}
+\def\xspace at aux{%
+  \ifx\xpnct at nxt,\else
+  \ifx\xpnct at nxt.\else
+    \xpnct at tok\expandafter{\the\xpnct at tok\xspace}%
+  \fi\fi
+  \the\xpnct at tok}
+\def\xperiod at aux{%
+  \ifx\xpnct at nxt.\else
+    \xpnct at tok\expandafter{\the\xpnct at tok.\@\xspace}%
   \fi
-  \xprd at Out
-}
-\newcommand\xcmm at Set[1]{\def\xcmm at Obj{#1}\futurelet\xcmm at Nxt\xcmm at Fin}
-\newcommand\xcmm at Fin{%
-  \let\xcmm at Out\xcmm at Obj
-  \ifx\xcmm at Nxt\bgroup\else
-  \ifx\xcmm at Nxt\egroup\else
-  \ifx\xcmm at Nxt\/\else
-  \ifx\xcmm at Nxt~\else
-  \ifx\xcmm at Nxt.\else
-  \ifx\xcmm at Nxt!\else
-  \ifx\xcmm at Nxt,\else
-  \ifx\xcmm at Nxt:\else
-  \ifx\xcmm at Nxt;\else
-  \ifx\xcmm at Nxt?\else
-  \ifx\xcmm at Nxt/\else
-  \ifx\xcmm at Nxt'\else
-  \ifx\xcmm at Nxt)\else
-  \ifx\xcmm at Nxt]\else
-  \ifx\xcmm at Nxt-\else
-    \def\xcmm at Out{\xcmm at Obj,\xspace}%
-  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
-  \xcmm at Out
-}
-\newcommand\xpcm at Set[1]{\def\xpcm at Obj{#1}\futurelet\xpcm at Nxt\xpcm at Fin}
-\newcommand\xpcm at Fin{%
-  \ifx\xpcm at Nxt.\relax
-    \let\xpcm at Out\xpcm at Obj
-  \else
-    \def\xpcm at Out{\xpcm at Obj.\xcomma}%
+  \the\xpnct at tok}
+\def\xcomma at aux{%
+  \ifx\xpnct at nxt.\else
+  \ifx\xpnct at nxt,\else
+  \ifx\xpnct at nxt:\else
+  \ifx\xpnct at nxt;\else
+  \ifx\xpnct at nxt!\else
+  \ifx\xpnct at nxt?\else
+  \ifx\xpnct at nxt/\else
+  \ifx\xpnct at nxt-\else
+  \ifx\xpnct at nxt'\else
+  \ifx\xpnct at nxt)\else
+  \ifx\xpnct at nxt]\else
+  \ifx\xpnct at nxt\}\else
+  \ifx\xpnct at nxt\egroup\else
+  \ifx\xpnct at nxt\/\else
+    \xpnct at tok\expandafter{\the\xpnct at tok,\xspace}%
+  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+  \the\xpnct at tok}
+\def\xperiodcomma at aux{%
+  \ifx\xpnct at nxt.\else
+    \xpnct at tok\expandafter{\the\xpnct at tok.\@\xcomma}%
   \fi
-  \xpcm at Out
-}
+  \the\xpnct at tok}
 \endinput
 %%
 %% End of file `xpunctuate.sty'.



More information about the tex-live-commits mailing list.