[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: guard spacefactor setting from math mode issue #643 (#694) (4523aeb3)

GitHub noreply at github.com
Sat Oct 16 19:58:50 CEST 2021


Repository : https://github.com/latex3/latex2e
On branch  : develop
Link       : https://github.com/latex3/latex2e/commit/4523aeb37b7bcb66bbb2adccf2769233ccb314d7

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

commit 4523aeb37b7bcb66bbb2adccf2769233ccb314d7
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Sat Oct 16 18:58:50 2021 +0100

    guard spacefactor setting from math mode issue #643 (#694)
    
    * guard spacefactor setting from math mode issue #643
    
    * eol
    
    * ltnews for issue #643


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

4523aeb37b7bcb66bbb2adccf2769233ccb314d7
 base/changes.txt               |  5 +++++
 base/doc/ltnews34.tex          | 17 +++++++++++++++++
 base/ltoutenc.dtx              |  5 +++--
 base/testfiles/github-0643.lvt | 19 +++++++++++++++++++
 base/testfiles/github-0643.tlg | 18 ++++++++++++++++++
 5 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index c58b70a6..ffe95f87 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -5,6 +5,11 @@ 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.
 ================================================================================
+
+2021-10-16  David Carlisle  <David.Carlisle at latex-project.org>
+
+	* ltoutenc.dtx: guard spacefactor setting in accents gh/643
+
 2021-10-15  Marcel Krüger  <Marcel.Krueger at latex-project.org>
 
 	* ltluatex.dtx:
diff --git a/base/doc/ltnews34.tex b/base/doc/ltnews34.tex
index 5191de89..3489ca7a 100644
--- a/base/doc/ltnews34.tex
+++ b/base/doc/ltnews34.tex
@@ -581,6 +581,23 @@ package files that are defining \cs{@currentlabel} to set
 \githubissue{300, 687}
 
 
+\subsection{Better Error handling of text accents in Math}
+If you use a text accent such as \verb|\^| in math mode instead of the
+math accent \verb|\hat|, then  \LaTeX\ gives a warning,
+then usually a \TeX\ primitive error message is produced by the \verb|\accent| command.
+If the accent and base would form a composite character in text mode,
+(often the case with Unicode engines) then  typically  you will get
+a warning such as\\
+\verb|Missing character:|\\
+\verb|     There is no á (U+00E1) in font cmmi10!|\\
+With \TeX\ implementations from 2020 onwards this warning can be
+converted to an error by setting \verb|\tracinglostchars| to 3. We
+strongly recommend this especially for Unicode engines where missing
+characters are common as no font supports the full Unicode range.
+
+%
+\githubissue{643}
+
 \subsection{???}
 
 %
diff --git a/base/ltoutenc.dtx b/base/ltoutenc.dtx
index 68782d69..61ea3818 100644
--- a/base/ltoutenc.dtx
+++ b/base/ltoutenc.dtx
@@ -44,7 +44,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltoutenc.dtx}
-             [2021/10/13 v2.0w LaTeX Kernel (font encodings)]
+             [2021/10/16 v2.0x LaTeX Kernel (font encodings)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltoutenc.dtx}
@@ -845,10 +845,11 @@
 %    We also ignore \cs{ignorespaces} which has the same issue and may
 %    show up as part of \cs{normalfont} if that is used.
 % \changes{v2.0m}{2019/12/18}{Avoid code that breaks \cs{accent}}
+% \changes{v2.0x}{2021/10/16}{Dont set \cs{spacefactor in math mode gh/643}}
 %    \begin{macrocode}
    \let\maybe at load@fontshape\relax
    \let\ignorespaces\relax
-   \accent#1 #2\egroup\spacefactor\accent at spacefactor}
+   \accent#1 #2\egroup\ifmmode\else\spacefactor\accent at spacefactor\fi}
 %    \end{macrocode}
 %
 %
diff --git a/base/testfiles/github-0643.lvt b/base/testfiles/github-0643.lvt
new file mode 100644
index 00000000..5e8320b3
--- /dev/null
+++ b/base/testfiles/github-0643.lvt
@@ -0,0 +1,19 @@
+\documentclass{article}
+\input{test2e}
+\tracinglostchars=3
+
+\begin{document}
+
+% should not get spacefactor error
+\START
+x  \'{a} y
+
+\[
+x  \'{a} y
+\textellipsis
+\]
+
+
+$a \small b$
+
+\end{document}
diff --git a/base/testfiles/github-0643.tlg b/base/testfiles/github-0643.tlg
new file mode 100644
index 00000000..a5547e15
--- /dev/null
+++ b/base/testfiles/github-0643.tlg
@@ -0,0 +1,18 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <7> on input line ....
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <5> on input line ....
+LaTeX Warning: Command \' invalid in math mode on input line ....
+! Please use \mathaccent for accents in math mode.
+\add at accent ... \let \ignorespaces \relax \accent 
+                                                  #1 #2\egroup \ifmmode \els...
+l. ...x  \'{a}
+              y
+I'm changing \accent to \mathaccent here; wish me luck.
+(Accents are not the same in formulas as they are in text.)
+LaTeX Warning: Command \textellipsis invalid in math mode on input line ...
+LaTeX Font Warning: Command \small invalid in math mode on input line ....
+[1
+] (github-0643.aux)





More information about the latex3-commits mailing list.