[latex3-commits] [latex3/latex2e] develop: Detail interaction of trailing optional args. and \inputlineno (9cce659a)

github at latex-project.org github at latex-project.org
Fri May 19 09:28:29 CEST 2023


Repository : https://github.com/latex3/latex2e
On branch  : develop
Link       : https://github.com/latex3/latex2e/commit/9cce659abafafe4a372a70788bee8e1a2ca97734

>---------------------------------------------------------------

commit 9cce659abafafe4a372a70788bee8e1a2ca97734
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri May 19 08:28:29 2023 +0100

    Detail interaction of trailing optional args. and \inputlineno


>---------------------------------------------------------------

9cce659abafafe4a372a70788bee8e1a2ca97734
 base/changes.txt      | 6 ++++++
 base/doc/usrguide.tex | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/base/changes.txt b/base/changes.txt
index 6aac0a58..34075d2d 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -5,6 +5,12 @@ It is provided for convenience only.  It therefore makes no claims to
 completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 ================================================================================
+2023-05-97  Joseph Wright  <Joseph.Wright at latex-project.org>
+
+	* usrguide.tex (section Creating document commands and environments)
+	  Add details of result of trailing optional arguments on
+	  \inputlineno
+	
 2023-05-12  Ulrike Fischer <Ulrike.Fischer at latex-project.org>
 
 	* ltxref.dtx
diff --git a/base/doc/usrguide.tex b/base/doc/usrguide.tex
index 8028b53c..67100dbb 100644
--- a/base/doc/usrguide.tex
+++ b/base/doc/usrguide.tex
@@ -340,6 +340,12 @@ in \pkg{amsmath} environments, which in the terms here would be defined as
 \NewDocumentCommand\\{!s !o}{ ... }
 \end{verbatim}
 
+Also notable when using optional arguments in the last position is that \TeX{}
+will necessarily look ahead for the argument opening token. This means that
+the value of |\inputlineno| will be `out by one' if such a trailing optional
+argument is \emph{not} present and the command ends a line; it will be one
+greater than the line number containing the last mandatory argument.
+
 \subsection{`Embellishments'}
 \label{sec:cmd:embellishment}
 





More information about the latex3-commits mailing list.