[latex3-commits] [latex2e-public] r1444 - new code for composites with undeclared accent
noreply at latex-project.org
noreply at latex-project.org
Wed Apr 5 22:20:27 CEST 2017
Author: carlisle
Date: 2017-04-05 22:20:26 +0200 (Wed, 05 Apr 2017)
New Revision: 1444
Added:
trunk/base/testfiles/tlb-textcomposite-001-2016.lvt
trunk/base/testfiles/tlb-textcomposite-001-2016.tlg
trunk/base/testfiles/tlb-textcomposite-001.lvt
trunk/base/testfiles/tlb-textcomposite-001.tlg
Modified:
trunk/base/changes.txt
trunk/base/ltoutenc.dtx
Log:
new code for composites with undeclared accent
Modified: trunk/base/changes.txt
===================================================================
--- trunk/base/changes.txt 2017-04-04 16:35:33 UTC (rev 1443)
+++ trunk/base/changes.txt 2017-04-05 20:20:26 UTC (rev 1444)
@@ -9,6 +9,13 @@
#########################
+2017-04-05 David Carlisle <latex-bugs at latex-project.org>
+
+ * ltoutenc.dtx: If a composite is declared with an undeclared
+ comand, declare it first as an encoding specific command that
+ generates an error. This allows the declared composite to
+ work as expected.
+
2017-03-29 David Carlisle <latex-bugs at latex-project.org>
* ltboxes.dtx: reset \lineskiplimit to \normallineskiplimit
Modified: trunk/base/ltoutenc.dtx
===================================================================
--- trunk/base/ltoutenc.dtx 2017-04-04 16:35:33 UTC (rev 1443)
+++ trunk/base/ltoutenc.dtx 2017-04-05 20:20:26 UTC (rev 1444)
@@ -38,7 +38,7 @@
%<TU>\ProvidesFile{tuenc.def}
%<package>\ProvidesPackage{fontenc}
%<TS1sty>\ProvidesPackage{textcomp}
-%<OT1|T1|OMS|OML|OT4|TU|package|TS1sty> [2017/02/24 v2.0h
+%<OT1|T1|OMS|OML|OT4|TU|package|TS1sty> [2017/04/05 v2.0i
%<OT1|T1|OMS|OML|OT4|TS1|TU> Standard LaTeX file]
%<package|TS1sty> Standard LaTeX package]
%
@@ -859,6 +859,8 @@
% removal of check for one argument-command}
% \changes{v2.0h}{2017/02/24}{%
% add check whether the accent command is defined for this encoding}
+% \changes{v2.0i}{2017/04/05}{%
+% Declare accent command if not already declared when declaring a composite.}
% \begin{macro}{\DeclareTextComposite}
% \changes{v1.7l}{1995/06/09}{Rewrote \cs{DeclareTextComposite} to
% define the composite as a no-argument command rather than a
@@ -880,11 +882,18 @@
% previous definition of |\T1\foo|. Finally, we define |\\T1\foo-a|
% to expand to |bar|.
% \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2017/04/15}{\DeclareTextCompositeCommand}
+%<latexrelease> {test for undeclared accent}%
+%<*2ekernel|latexrelease>
\def\DeclareTextCompositeCommand#1#2#3#4{%
\expandafter\let\expandafter\reserved at a\csname#2\string#1\endcsname
\ifx\reserved at a\relax
- \@latex at error{\string#1 not declared in encoding #2}\@eha
- \else
+ \DeclareTextCommand#1{#2}{%
+ \@latex at error{\string#1 undeclared in encoding #2}\@eha}%
+ \@latex at info{Composite with undeclared \string#1 in encoding #2}%
+ \expandafter\let\expandafter\reserved at a\csname#2\string#1\endcsname
+ \fi
\expandafter\expandafter\expandafter\ifx
\expandafter\@car\reserved at a\relax\relax\@nil \@text at composite \else
\edef\reserved at b##1{%
@@ -898,7 +907,30 @@
\fi
\expandafter\def\csname\expandafter\string\csname
#2\endcsname\string#1-\string#3\@empty\endcsname{#4}%
- \fi}
+ }
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}{\DeclareTextCompositeCommand}
+%<latexrelease> {test for undeclared accent}%
+%<latexrelease>\def\DeclareTextCompositeCommand#1#2#3#4{%
+%<latexrelease> \expandafter\let\expandafter\reserved at a
+%<latexrelease> \csname#2\string#1\endcsname
+%<latexrelease> \expandafter\expandafter\expandafter\ifx
+%<latexrelease> \expandafter\@car\reserved at a\relax\relax\@nil
+%<latexrelease> \@text at composite \else
+%<latexrelease> \edef\reserved at b##1{%
+%<latexrelease> \def\expandafter\noexpand
+%<latexrelease> \csname#2\string#1\endcsname####1{%
+%<latexrelease> \noexpand\@text at composite
+%<latexrelease> \expandafter\noexpand\csname#2\string#1\endcsname
+%<latexrelease> ####1\noexpand\@empty\noexpand\@text at composite
+%<latexrelease> {##1}}}%
+%<latexrelease> \expandafter\reserved at b\expandafter{\reserved at a{##1}}%
+%<latexrelease> \fi
+%<latexrelease> \expandafter\def\csname\expandafter\string\csname
+%<latexrelease> #2\endcsname\string#1-\string#3\@empty\endcsname{#4}}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
% \end{macrocode}
%
% \begin{macrocode}
@@ -2787,7 +2819,7 @@
% \end{macrocode}
%
% Wrapper around |\DeclareTextCompositeCommand| that uses the declared
-% composite if it exists in the current font or fals back to the default
+% composite if it exists in the current font or falls back to the default
% definition for the TU accent if not.
% \begin{macrocode}
{
Added: trunk/base/testfiles/tlb-textcomposite-001-2016.lvt
===================================================================
--- trunk/base/testfiles/tlb-textcomposite-001-2016.lvt (rev 0)
+++ trunk/base/testfiles/tlb-textcomposite-001-2016.lvt 2017-04-05 20:20:26 UTC (rev 1444)
@@ -0,0 +1,21 @@
+\RequirePackage[2016/01/01]{latexrelease}
+\documentclass{article}
+\usepackage[T1]{fontenc}
+
+% testing declaring composite with undeclared accent
+% (or accent declared later).
+% Silently failed in releases before 2017-04-15
+
+\input{test2e}
+\START
+\DeclareTextComposite{\tstA}{T1}{x}{`Y}
+
+\OMIT
+\begin{document}
+
+\TIMO
+
+% First should work, giving Y second is an error but gives f
+\sbox0{\tstA{x} \tstA{f}}\showbox0
+
+\END
Added: trunk/base/testfiles/tlb-textcomposite-001-2016.tlg
===================================================================
--- trunk/base/testfiles/tlb-textcomposite-001-2016.tlg (rev 0)
+++ trunk/base/testfiles/tlb-textcomposite-001-2016.tlg 2017-04-05 20:20:26 UTC (rev 1444)
@@ -0,0 +1,29 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+! Undefined control sequence.
+<argument> \tstA
+ {x} \tstA {f}
+l. ...\sbox0{\tstA{x} \tstA{f}}
+ \showbox0
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \tstA {x} \tstA
+ {f}
+l. ...\sbox0{\tstA{x} \tstA{f}}
+ \showbox0
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+> \box0=
+\hbox(6.8872+0.0)x11.66382
+.\T1/cmr/m/n/10 x
+.\glue 3.33252 plus 1.66626 minus 1.11084
+.\T1/cmr/m/n/10 f
+! OK.
+l. ...\sbox0{\tstA{x} \tstA{f}}\showbox0
Added: trunk/base/testfiles/tlb-textcomposite-001.lvt
===================================================================
--- trunk/base/testfiles/tlb-textcomposite-001.lvt (rev 0)
+++ trunk/base/testfiles/tlb-textcomposite-001.lvt 2017-04-05 20:20:26 UTC (rev 1444)
@@ -0,0 +1,20 @@
+\documentclass{article}
+\usepackage[T1]{fontenc}
+
+% testing declaring composite with undeclared accent
+% (or accent declared later).
+% Silently failed in releases before 2017-04-15
+
+\input{test2e}
+\START
+\DeclareTextComposite{\tstA}{T1}{x}{`Y}
+
+\OMIT
+\begin{document}
+
+\TIMO
+
+% First should work, giving Y second is an error but gives f
+\sbox0{\tstA{x} \tstA{f}}\showbox0
+
+\END
Added: trunk/base/testfiles/tlb-textcomposite-001.tlg
===================================================================
--- trunk/base/testfiles/tlb-textcomposite-001.tlg (rev 0)
+++ trunk/base/testfiles/tlb-textcomposite-001.tlg 2017-04-05 20:20:26 UTC (rev 1444)
@@ -0,0 +1,19 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+LaTeX Info: Composite with undeclared \tstA in encoding T1 on input line ....
+! LaTeX Error: \tstA undeclared in encoding T1.
+See the LaTeX manual or LaTeX Companion for explanation.
+Type H <return> for immediate help.
+ ...
+l. ...\sbox0{\tstA{x} \tstA{f}}
+ \showbox0
+Your command was ignored.
+Type I <command> <return> to replace it with another command,
+or <return> to continue without it.
+> \box0=
+\hbox(6.8872+0.0)x13.8855
+.\T1/cmr/m/n/10 Y
+.\glue 3.33252 plus 1.66458 minus 1.11194
+.\T1/cmr/m/n/10 f
+! OK.
+l. ...\sbox0{\tstA{x} \tstA{f}}\showbox0
More information about the latex3-commits
mailing list