Raw File
test2e.tex
% \iffalse meta-comment
%
% Copyright (C) 1992-2022 by David Carlisle, Frank Mittelbach.  
% All rights reserved.
% 
% This file is part of the validate package.
% 
% IMPORTANT NOTICE:
% 
% You are not allowed to change this file.  In case of error
% write to the email address mentioned in the file readme.val.
% 
% \fi
%                  test2e.tex
                   %%%%%%%%%%%

% David Carlisle
% Version 0.0,  28 May 1992
% Version 0.1,  18 Jun 1992 FMi small updates
% Version 1.0a, 28 Jun 1992 FMi small updates for distribution
% Version 1.0b, 1993/12/08  DPC update for LaTeX2e
% Version 1.0e, 1994/05/19 add config file.
% Version 1.0f, 1994/05/19 drop \errorstopmode from \loggingoutput
% Version 1.0g, 2015/09/11 luatex support
% Version 1.0h, 2018/09/27 added \SHOWFILE
% Version 1.0i, 2022/11/06 prevent release data from showing up

% \def\fileversion{v1.0i}
% \def\filedate{2022/11/06}

% This file should not be used as a package or class file, 
% it should be \input.

% The scope of this \makeatletter will then be the rest of the
% document.  Put TeX into scroll mode, and stop it showing the
% implementation details of macros in error messages.
%
\makeatletter
\scrollmode
\errorcontextlines=-1

% Use the same \showbox settings as 2.09, unless they are changed in 
% the test file. (2e sets these to -1)
\showboxbreadth=\maxdimen
\showboxdepth=\maxdimen


% drop \errorstopmode from \logginoutput so that testing doesn't stop
% for \showoutput
\gdef\loggingoutput{\tracingoutput\@ne
    \showboxbreadth\maxdimen\showboxdepth\maxdimen}


% Start the test, after the optional \documentclass (or \documentstyle)
% \begin{document} commands with \START.  All lines in the .log file
% before this will be ignored. It also prints a docstrip-style
% character table in the .tlg file so the .tlg file can easily be
% checked for email translations.
%
\def\START{\typeout{START-TEST-LOG^^J^^J%
   This is a generated file for the LaTeX2e validation system.%
^^J^^JDon't change this file in any respect.%
^^J}}

% If you still need a Character table, use \typeout\{^^J\CTable^^J}

\begingroup
\catcode`\^^\=0
\catcode`\^^A=\catcode`\%
^^\catcode`^^\ =11
^^\catcode`^^\%=11
^^\catcode`^^\#=11
^^\catcode`^^\~=11
^^\endlinechar=`^^\^^J
^^\catcode`^^\\=11^^A
^^\gdef^^\CTable{
%% \CharacterTable
%%  {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
%%   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
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
}^^A
^^\endgroup{}%

% The test should end with
% \END or \end{document}
%
\let\@@@end\@@end
%\let\@ED=\enddocument
\def\END{\typeout{END-TEST-LOG}\@@@end}
\let\@@end\END


% After the \START should come declarations of the format and style
% options being used.
%
\def\FORMAT#1{\typeout{Format: #1}%
  \def\@tempa{#1}\ifx\@tempa\@EJ\else
   \OMIT\@warning{Declared format #1,^^JActual format \@EJ}\TIMO\fi}

% The old version got this information from everyjob, 
% but that does not work with LaTeX2e as \everyjob is cleared.
\edef\@EJ{\fmtname <\fmtversion>}

% Some author info:
\def\AUTHOR#1{\typeout{Author: #1}}
\def\ADDRESS#1{\typeout{Address: #1}}

% Not all packages declare themselves to the log file, and we can not
% rely on TeX`s output as it includes full path names, and does not
% include version numbers etc.  So for each package included give a
% declaration like: \PACKAGES{array v2.0d}
%
\def\STYLE#1{\typeout{Main Style: #1}}%
\def\STYLEOPTIONS#1{\typeout{Style Options: #1}}


% If The class or package is loaded with options, you may
% specify the options in the \CLASS (\PACKAGE) declaration. eg:
%
% \CLASS[german,a4page]{article v2.0 1994/01/02}
% \PACKAGE{ifthen v2.2 1993/11/12}
% \PACKAGE[dvips]{graphics v 3.8 1994/02/02}
%
\def\CLASS{\@ifnextchar[\OPTCLASS\XCLASS}
\def\OPTCLASS[#1]#2{%
  \typeout{Main Class: #2^^J\@spaces Options: #1}}
\def\XCLASS#1{%
  \typeout{Main Class: #1}}

\def\PACKAGE{\@ifnextchar[\OPTPACKAGE\XPACKAGE}
\def\OPTPACKAGE[#1]#2{%
  \typeout{Package: #2^^J\@spaces Options: #1}}
\def\XPACKAGE#1{%
  \typeout{Package: #1}}



% LaTeX2e always uses NFSS2 so new test files need not use 
% \FONTSELECTION but it is retained for compatibility for test files
% written for 209/NFSS1.
%
\def\FONTSELECTION#1{%
  \OMIT\@@warning{\noexpand\FONTSELECTION obsolete.^^J%
                 LaTeX2e always uses NFSS2}\TIMO
  \typeout{Font Selection: #1}}



% Surround commands which produce irrelevant lines in the .log file by
% \OMIT
% \TIMO
%
\def\OMIT{\typeout{OMIT}}
\def\TIMO{\typeout{TIMO}}


% Load a file (e.g. \jobname.toc) into the .log file with the usual special
% characters rendered harmless
%
% \SHOWFILE{\jobname.aux}
%

\begingroup       % within the scope of this groups each line needs to end in % !
\catcode`\^^M\active %
\gdef\SHOWFILE#1{%
     \typeout{-------- #1 (start) ---------}% 
\IfFileExists{#1}%
  {\begingroup %
     \catcode`\^^M\active %
     \edef^^M{^\string^M^^J}%
     \everyeof{\noexpand}%
     \obeyspaces %
     \@sanitize %
     \message{\@@input #1 }%
   \endgroup }%
  {\message{Not found}}%
     \typeout{-------- #1 (end) -----------}% 
}%
\endgroup




% After the above declarations, and before the main tests, you may
% optionally `declare' all the commands in the `module' that you are
% about to test. These commands will be registered as defined,
% undefined or relaxed (ie \let to \relax). You may wish to declare
% commands not currently implemented, so that if they are added at a
% later stage, the test will fail, reminding someone to document the
% fact that the user interface has changed. So if you are testing
% array and tabular environments, you may wish do declare
% \extrarowheight. This is undefined in the curent latex, but would
% become defined if Mittelbach's array.sty was incorporated into
% latex.tex.
%
\def\declare@command#1{%
  \ifx#1\@undefined\typeout{Undefined \string#1}\else
  \ifx#1\relax\typeout{Relaxed \space\space\string#1}\else
         \typeout{Defined \space\space\string#1}\fi\fi}


% To allow testing of possible changes, we allow extra code to be read
% in before the test starts. The necessary code should be placed in a
% file test2e.cfg.
%
\OMIT
\InputIfFileExists{test2e.cfg}
      {\typeout{^^J***^^Jtest2e.cfg in operation^^J***^^J}}{}
\TIMO

% Arrange that duplicate fonts share internal font id
% so they are shown with the same csname in luatex
% to match (pdf)tex and xetex.

% disable this for now on development builds of luatex
\ifx\directlua\undefined\else
%\ifnum\luatexversion<108
\directlua{
local function fonteach_next(max, f)
      repeat
        f = f + 1
        if f > max then return end
      until font.frozen(f) \string~= nil
      return f, font.getfont(f) or font.fonts[f]
    end
    font.latexeach = function() return fonteach_next, font.max(), 0 end

local original_fontloader=font.read_tfm
if (luatexbase==nil) then
  callback.register('define_font',latexDefineFont)
else
  if(luatexbase.in_callback==nil) then
    error('update luatexbase')
  else
    local cbl=luatexbase.callback_descriptions('define_font')
    if(cbl[1]\string~=nil) then
      original_fontloader=luatexbase.remove_from_callback('define_font',cbl[1])
    end
  end
end

function latexDefineFont(n,s,i)
  local f = nil
  for ii,vv in font.latexeach() do
    if (n == vv.name) then
      if(vv.size == 
        (s > 0 and s
          or 
        (- s * vv.designsize) / 1000)) then
        f=ii
% debugging (not to log, so not affect tlg)
      else
       print('Font callback: ' .. n .. ' ' .. s .. 
' ' .. vv.size ..
' ' .. vv.designsize ..
' ' .. (s > 0 and s or (- s * vv.designsize) / 1000))
      end
    end
  end
  return f or original_fontloader(n,s,i)
end
if (luatexbase==nil) then
  callback.register('define_font',latexDefineFont)
else
  luatexbase.add_to_callback('define_font',latexDefineFont,"latexDefineFont")
end
}
%\fi
\directlua{require'fixup_mathaxis'}%
\fi

% Load the map file early so it does not appear in the log.
\ifdefined\pdfoutput
  \ifnum\pdfoutput>0 %
    \pdfmapfile{pdftex.map}%
  \fi
\else
  \ifdefined\outputmode
  \ifnum\outputmode>0 %
    \pdfextension mapfile{pdftex.map}%
  \fi
  \fi
\fi

% Suppress dvips headers
\def\AtBeginDvi#1{}
% Gymnastics needed to remove l3backend from shipout/firstpage:
% If shipout/firstpage is nonempty, an extra box and kern are
% added to the shipout box, and since \RemoveFromHook no longer
% removes code added in the future, we need to delay the removal
% to "shipout/before".  We also need to redirect error messages
% because in some tests, the "l3backend" chunk is not added.
% The "voids" rule is no good here because "shipout/firstpage"
% being nonempty is enough to add the extra box and kern to the
% output.
\ExplSyntaxOn
\AddToHook{shipout/before}
  {
    \group_begin:
    \msg_redirect_name:nnn { hooks } { cannot-remove } { none }
    \RemoveFromHook{shipout/firstpage}[l3backend]
    \group_end:
  }
\ExplSyntaxOff
% Load expl3 backend if necessary
\ifx\@nodocument\relax
  \expandafter\@gobbletwo
\fi
  \RequirePackage{expl3}

%
% We don't want release information showing up in \end{document}
% because that would change over and over again.
% We therefore drop that information from the hook (should also
% happen in the standard regression test when running a LaTeX
% format). By using a voids relation we can reactivate the code in
% a test by dropping "the testmode" label.
%
\AddToHook{enddocument/info}[kernel/testmode]{}
\DeclareHookRule{enddocument/info}{kernel/testmode}{voids}{kernel/release}



\endinput
back to top