tl2017 luatex discretionaries
[latex2e.git] / latex2e-20170101 / support / test2e.tex
blobf45bd57434da6fd38f6f7987f4562c1eb7663793
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=\maxdimen
43 \showboxdepth=\maxdimen
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}}
63 % If you still need a Character table, use \typeout\{^^J\CTable^^J}
65 \begingroup
66 \catcode`\^^\=0
67 \catcode`\^^A=\catcode`\%
68 ^^\catcode`^^\ =11
69 ^^\catcode`^^\%=11
70 ^^\catcode`^^\#=11
71 ^^\catcode`^^\~=11
72 ^^\endlinechar=`^^\^^J
73 ^^\catcode`^^\\=11^^A
74 ^^\gdef^^\CTable{
75 %% \CharacterTable
76 %% {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
77 %% 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
78 %% Digits \0\1\2\3\4\5\6\7\8\9
79 %% Exclamation \! Double quote \" Hash (number) \#
80 %% Dollar \$ Percent \% Ampersand \&
81 %% Acute accent \' Left paren \( Right paren \)
82 %% Asterisk \* Plus \+ Comma \,
83 %% Minus \- Point \. Solidus \/
84 %% Colon \: Semicolon \; Less than \<
85 %% Equals \= Greater than \> Question mark \?
86 %% Commercial at \@ Left bracket \[ Backslash \\
87 %% Right bracket \] Circumflex \^ Underscore \_
88 %% Grave accent \` Left brace \{ Vertical bar \|
89 %% Right brace \} Tilde \~}
91 }^^A
92 ^^\endgroup{}%
94 % The test should end with
95 % \END or \end{document}
97 \let\@@@end\@@end
98 %\let\@ED=\enddocument
99 \def\END{\typeout{END-TEST-LOG}\@@@end}
100 \let\@@end\END
103 % After the \START should come declarations of the format and style
104 % options being used.
106 \def\FORMAT#1{\typeout{Format: #1}%
107 \def\@tempa{#1}\ifx\@tempa\@EJ\else
108 \OMIT\@warning{Declared format #1,^^JActual format \@EJ}\TIMO\fi}
110 % The old version got this information from everyjob,
111 % but that does not work with LaTeX2e as \everyjob is cleared.
112 \edef\@EJ{\fmtname <\fmtversion>}
114 % Some author info:
115 \def\AUTHOR#1{\typeout{Author: #1}}
116 \def\ADDRESS#1{\typeout{Address: #1}}
118 % Not all packages declare themselves to the log file, and we can not
119 % rely on TeX`s output as it includes full path names, and does not
120 % include version numbers etc. So for each package included give a
121 % declaration like: \PACKAGES{array v2.0d}
123 \def\STYLE#1{\typeout{Main Style: #1}}%
124 \def\STYLEOPTIONS#1{\typeout{Style Options: #1}}
127 % If The class or package is loaded with options, you may
128 % specify the options in the \CLASS (\PACKAGE) declaration. eg:
130 % \CLASS[german,a4page]{article v2.0 1994/01/02}
131 % \PACKAGE{ifthen v2.2 1993/11/12}
132 % \PACKAGE[dvips]{graphics v 3.8 1994/02/02}
134 \def\CLASS{\@ifnextchar[\OPTCLASS\XCLASS}
135 \def\OPTCLASS[#1]#2{%
136 \typeout{Main Class: #2^^J\@spaces Options: #1}}
137 \def\XCLASS#1{%
138 \typeout{Main Class: #1}}
140 \def\PACKAGE{\@ifnextchar[\OPTPACKAGE\XPACKAGE}
141 \def\OPTPACKAGE[#1]#2{%
142 \typeout{Package: #2^^J\@spaces Options: #1}}
143 \def\XPACKAGE#1{%
144 \typeout{Package: #1}}
148 % LaTeX2e always uses NFSS2 so new test files need not use
149 % \FONTSELECTION but it is retained for compatibility for test files
150 % written for 209/NFSS1.
152 \def\FONTSELECTION#1{%
153 \OMIT\@@warning{\noexpand\FONTSELECTION obsolete.^^J%
154 LaTeX2e always uses NFSS2}\TIMO
155 \typeout{Font Selection: #1}}
159 % Surround commands which produce irrelevant lines in the .log file by
160 % \OMIT
161 % \TIMO
163 \def\OMIT{\typeout{OMIT}}
164 \def\TIMO{\typeout{TIMO}}
166 % After the above declarations, and before the main tests, you may
167 % optionally `declare' all the commands in the `module' that you are
168 % about to test. These commands will be registered as defined,
169 % undefined or relaxed (ie \let to \relax). You may wish to declare
170 % commands not currently implemented, so that if they are added at a
171 % later stage, the test will fail, reminding someone to document the
172 % fact that the user interface has changed. So if you are testing
173 % array and tabular environments, you may wish do declare
174 % \extrarowheight. This is undefined in the curent latex, but would
175 % become defined if Mittelbach's array.sty was incorporated into
176 % latex.tex.
178 \def\declare@command#1{%
179 \ifx#1\@undefined\typeout{Undefined \string#1}\else
180 \ifx#1\relax\typeout{Relaxed \space\space\string#1}\else
181 \typeout{Defined \space\space\string#1}\fi\fi}
184 % To allow testing of possible changes, we allow extra code to be read
185 % in before the test starts. The necessary code should be placed in a
186 % file test2e.cfg.
188 \OMIT
189 \InputIfFileExists{test2e.cfg}
190 {\typeout{^^J***^^Jtest2e.cfg in operation^^J***^^J}}{}
191 \TIMO
193 % Arrange that duplicate fonts share internal font id
194 % so they are shown with the same csname in luatex
195 % to match (pdf)tex and xetex.
196 \ifx\directlua\undefined\else
197 \directlua{
198 local original_fontloader=font.read_tfm
199 if (luatexbase==nil) then
200 callback.register('define_font',latexDefineFont)
201 else
202 if(luatexbase.in_callback==nil) then
203 error('update luatexbase')
204 else
205 local cbl=luatexbase.callback_descriptions('define_font')
206 if(cbl[1]\string~=nil) then
207 original_fontloader=luatexbase.remove_from_callback('define_font',cbl[1])
211 function latexDefineFont(n,s,i)
212 local f = nil
213 for ii,vv in font.each() do
214 if (n == vv.name) then
215 if(vv.size ==
216 (s > 0 and s
218 (- s * vv.designsize) / 1000)) then
219 f=ii
220 % debugging (not to log, so not affect tlg)
221 else
222 print('Font callback: ' .. n .. ' ' .. s ..
223 ' ' .. vv.size ..
224 ' ' .. vv.designsize ..
225 ' ' .. (s > 0 and s or (- s * vv.designsize) / 1000))
229 return f or original_fontloader(n,s,i)
231 if (luatexbase==nil) then
232 callback.register('define_font',latexDefineFont)
233 else
234 luatexbase.add_to_callback('define_font',latexDefineFont,"latexDefineFont")
239 % Load the map file early so it does not appear in the log.
240 \ifdefined\pdfoutput
241 \ifnum\pdfoutput>0 %
242 \pdfmapfile{pdftex.map}%
244 \else
245 \ifdefined\outputmode
246 \ifnum\outputmode>0 %
247 \pdfextension mapfile{pdftex.map}%
252 \endinput