Typo
[latex2e.git] / latex2e-20151001 / support / test2e.tex
blob1045c081802fc6646467121172c2d5ef9b652917
1 % \iffalse meta-comment
3 % Copyright (C) 1992-1994 by David Carlisle, Frank Mittelbach.
4 % All rights reserved.
5 %
6 % This file is part of the validate package.
7 %
8 % IMPORTANT NOTICE:
9 %
10 % You are not allowed to change this file. In case of error
11 % write to the email address mentioned in the file readme.val.
13 % \fi
14 % test2e.tex
15 %%%%%%%%%%%
17 % David Carlisle
18 % Version 0.0, 28 May 1992
19 % Version 0.1, 18 Jun 1992 FMi small updates
20 % Version 1.0a, 28 Jun 1992 FMi small updates for distribution
21 % Version 1.0b, 1993/12/08 DPC update for LaTeX2e
22 % Version 1.0e, 1994/05/19 add config file.
23 % Version 1.0f, 1994/05/19 drop \errorstopmode from \loggingoutput
24 % Version 1.0g, 2015/09/11 luatex support
26 % \def\fileversion{v1.0g}
27 % \def\filedate{2015/09/11}
29 % This file should not be used as a package or class file,
30 % it should be \input.
32 % The scope of this \makeatletter will then be the rest of the
33 % document. Put TeX into scroll mode, and stop it showing the
34 % implementation details of macros in error messages.
36 \makeatletter
37 \scrollmode
38 \errorcontextlines=-1
40 % Use the same \showbox settings as 2.09, unless they are changed in
41 % the test file. (2e sets these to -1)
42 \showboxbreadth=5
43 \showboxdepth=3
46 % drop \errorstopmode from \logginoutput so that testing doesn't stop
47 % for \showoutput
48 \gdef\loggingoutput{\tracingoutput\@ne
49 \showboxbreadth\maxdimen\showboxdepth\maxdimen}
52 % Start the test, after the optional \documentclass (or \documentstyle)
53 % \begin{document} commands with \START. All lines in the .log file
54 % before this will be ignored. It also prints a docstrip-style
55 % character table in the .tlg file so the .tlg file can easily be
56 % checked for email translations.
58 \def\START{\typeout{START-TEST-LOG^^J^^J%
59 This is a generated file for the LaTeX2e validation system.%
60 ^^J^^JDon't change this file in any respect.%
61 ^^J^^J\CTable^^J}}
63 \begingroup
64 \catcode`\^^\=0
65 \catcode`\^^A=\catcode`\%
66 ^^\catcode`^^\ =11
67 ^^\catcode`^^\%=11
68 ^^\catcode`^^\#=11
69 ^^\catcode`^^\~=11
70 ^^\endlinechar=`^^\^^J
71 ^^\catcode`^^\\=11^^A
72 ^^\gdef^^\CTable{
73 %% \CharacterTable
74 %% {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
75 %% Lower-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
76 %% Digits \0\1\2\3\4\5\6\7\8\9
77 %% Exclamation \! Double quote \" Hash (number) \#
78 %% Dollar \$ Percent \% Ampersand \&
79 %% Acute accent \' Left paren \( Right paren \)
80 %% Asterisk \* Plus \+ Comma \,
81 %% Minus \- Point \. Solidus \/
82 %% Colon \: Semicolon \; Less than \<
83 %% Equals \= Greater than \> Question mark \?
84 %% Commercial at \@ Left bracket \[ Backslash \\
85 %% Right bracket \] Circumflex \^ Underscore \_
86 %% Grave accent \` Left brace \{ Vertical bar \|
87 %% Right brace \} Tilde \~}
89 }^^A
90 ^^\endgroup{}%
92 % The test should end with
93 % \END or \end{document}
95 \let\@@@end\@@end
96 %\let\@ED=\enddocument
97 \def\END{\typeout{END-TEST-LOG}\@@@end}
98 \let\@@end\END
101 % After the \START should come declarations of the format and style
102 % options being used.
104 \def\FORMAT#1{\typeout{Format: #1}%
105 \def\@tempa{#1}\ifx\@tempa\@EJ\else
106 \OMIT\@warning{Declared format #1,^^JActual format \@EJ}\TIMO\fi}
108 % The old version got this information from everyjob,
109 % but that does not work with LaTeX2e as \everyjob is cleared.
110 \edef\@EJ{\fmtname <\fmtversion>}
112 % Some author info:
113 \def\AUTHOR#1{\typeout{Author: #1}}
114 \def\ADDRESS#1{\typeout{Address: #1}}
116 % Not all packages declare themselves to the log file, and we can not
117 % rely on TeX`s output as it includes full path names, and does not
118 % include version numbers etc. So for each package included give a
119 % declaration like: \PACKAGES{array v2.0d}
121 \def\STYLE#1{\typeout{Main Style: #1}}%
122 \def\STYLEOPTIONS#1{\typeout{Style Options: #1}}
125 % If The class or package is loaded with options, you may
126 % specify the options in the \CLASS (\PACKAGE) declaration. eg:
128 % \CLASS[german,a4page]{article v2.0 1994/01/02}
129 % \PACKAGE{ifthen v2.2 1993/11/12}
130 % \PACKAGE[dvips]{graphics v 3.8 1994/02/02}
132 \def\CLASS{\@ifnextchar[\OPTCLASS\XCLASS}
133 \def\OPTCLASS[#1]#2{%
134 \typeout{Main Class: #2^^J\@spaces Options: #1}}
135 \def\XCLASS#1{%
136 \typeout{Main Class: #1}}
138 \def\PACKAGE{\@ifnextchar[\OPTPACKAGE\XPACKAGE}
139 \def\OPTPACKAGE[#1]#2{%
140 \typeout{Package: #2^^J\@spaces Options: #1}}
141 \def\XPACKAGE#1{%
142 \typeout{Package: #1}}
146 % LaTeX2e always uses NFSS2 so new test files need not use
147 % \FONTSELECTION but it is retained for compatibility for test files
148 % written for 209/NFSS1.
150 \def\FONTSELECTION#1{%
151 \OMIT\@@warning{\noexpand\FONTSELECTION obsolete.^^J%
152 LaTeX2e always uses NFSS2}\TIMO
153 \typeout{Font Selection: #1}}
157 % Surround commands which produce irrelevant lines in the .log file by
158 % \OMIT
159 % \TIMO
161 \def\OMIT{\typeout{OMIT}}
162 \def\TIMO{\typeout{TIMO}}
164 % After the above declarations, and before the main tests, you may
165 % optionally `declare' all the commands in the `module' that you are
166 % about to test. These commands will be registered as defined,
167 % undefined or relaxed (ie \let to \relax). You may wish to declare
168 % commands not currently implemented, so that if they are added at a
169 % later stage, the test will fail, reminding someone to document the
170 % fact that the user interface has changed. So if you are testing
171 % array and tabular environments, you may wish do declare
172 % \extrarowheight. This is undefined in the curent latex, but would
173 % become defined if Mittelbach's array.sty was incorporated into
174 % latex.tex.
176 \def\declare@command#1{%
177 \ifx#1\@undefined\typeout{Undefined \string#1}\else
178 \ifx#1\relax\typeout{Relaxed \space\space\string#1}\else
179 \typeout{Defined \space\space\string#1}\fi\fi}
182 % To allow testing of possible changes, we allow extra code to be read
183 % in before the test starts. The necessary code should be placed in a
184 % file test2e.cfg.
186 \OMIT
187 \InputIfFileExists{test2e.cfg}
188 {\typeout{^^J***^^Jtest2e.cfg in operation^^J***^^J}}{}
189 \TIMO
191 % Arrange that duplicate fonts share internal font id
192 % so they are shown with the same csname in luatex
193 % to match (pdf)tex and xetex.
194 \ifx\directlua\undefined\else
195 \directlua{
196 local original_fontloader=font.read_tfm
197 if (luatexbase==nil) then
198 callback.register('define_font',latexDefineFont)
199 else
200 if(luatexbase.in_callback==nil) then
201 error('update luatexbase')
202 else
203 local cbl=luatexbase.callback_descriptions('define_font')
204 if(cbl[1]\string~=nil) then
205 original_fontloader=luatexbase.remove_from_callback('define_font',cbl[1])
209 function latexDefineFont(n,s,i)
210 local f = nil
211 for ii,vv in font.each() do
212 if (n == vv.name) then
213 if(vv.size ==
214 (s > 0 and s
216 (- s * vv.designsize) / 1000)) then
217 f=ii
218 % debugging (not to log, so not affect tlg)
219 else
220 print('Font callback: ' .. n .. ' ' .. s ..
221 ' ' .. vv.size ..
222 ' ' .. vv.designsize ..
223 ' ' .. (s > 0 and s or (- s * vv.designsize) / 1000))
227 return f or original_fontloader(n,s,i)
229 if (luatexbase==nil) then
230 callback.register('define_font',latexDefineFont)
231 else
232 luatexbase.add_to_callback('define_font',latexDefineFont,"latexDefineFont")
237 \endinput