dircheck.dtx^{∗}

David Carlisle

1995/12/11

1 L^{A}TEX System Dependant Initialisations

This file implements the semi-automatic determination of various system dependant parts of the initialisation. The actual definitions may be placed in a file texsys.cfg. Thus for operating systems for which the tests here do not result in acceptable settings, a ‘hand written’ texsys.cfg may be produced.

The macros that must be defined are:

\@currdir \@currdir⟨filename⟩⟨space⟩ should expand to a form of the filename that uniquely refers to the ‘current directory’ if this is possible. (The expansion should also end with a space.) on UNIX, this is \def\@currdir{./}. For more exotic operating systems you may want to make \@currdir a macro with arguments delimited by . and/or ⟨space⟩. If the operating system has no concept of directory structure, this macro should be defined to be empty.

\input@path If the primitive \openin searches the same directories as the primitive \input, then it is possible to tell (using \ifeof) whether a file exists before trying to input it. For systems like this, \input@path should be left undefined.

If \openin does not ‘follow’ \input then \input@path must be defined to be a list of directories to search for input files. The format for each directory is as for \@currdir, normally just a prefix is required, but it may be a macro with space-delimited argument. That is, if ⟨dir⟩ is an entry in the input path, TEX will try to load the expansion of ⟨dir⟩⟨filename⟩⟨space⟩

So either ⟨dir⟩ should be defined as a macro with argument delimited by space, or it should just expand to a directory name, including the final directory separator, so that it may be concatenated with the ⟨filename⟩. This means that for UNIX-like syntax, each ⟨dir⟩ should end with a slash, /.

\input@path should expand to a list of such directories, each in a {} group.

\filename@parse After a call of the form: \filename@parse{⟨filename⟩}, the three macros

\filename@area,\filename@base,\filename@ext should be defined to be the

‘area’ (or directory), basename and extension respectively. If there was no extension specified in ⟨filename⟩, \filename@ext should be \let to \relax (so this case may be tested with \@ifundefined{filename@ext} and, perhaps a default extension substituted).

∗this file also includes the source for texsys.cfg and ltxcheck.tex

Normally one would not need to define this macro in texsys.cfg as the automatic tests can supply parsers that work with UNIX and VMS and Macintosh syntax, as well as a basic parser that will cover many other cases. However some operating systems may need a ‘hand produced’ parser in which case it should be defined in this file.

The UNIX parser also works for most MSDOS TEX versions. Currently if the UNIX, VMS or Macintosh parser is not used, \filename@parse is defined to always return an empty area, and to split the argument into basename and extension at the first ‘.’ that occurs in the name. Parsers for other formats may be defined in texsys.cfg, in which case they will be used in preference to the default definitions.

\@TeXversion \@TeXversionis now set automatically by the initialisation tests in this file. You should not need to set it in texsys.cfg, however the following documentation is left for information. L^{A}TEX does not set this variable exactly, the automatic tests set it to: 2 for any version, v, v < 3.0 3 for any version, v, 3.0 ≤ v ≤ 3.14 ⟨undefined⟩ otherwise. However these values are accurate enough for L^{A}TEX to take appropriate action for these old TEXs.

If your TEX is older than version 3.141, then you should define \@TeXversion (using \def) to be the version number. If you do not do this^{1} , L^{A}TEX will not work around a bug in old TEX versions, and so error messages will appear in a very strange format, with ^^J appearing instead of line breaks:

! LaTeX Error: \rubbish undefined.^^J^^JSee the LaTeX manual or LaTeX Companion
 for explanation.^^JType  H <return>  for immediate help.
 ...
l.3 \renewcommand{\rubbish}
                           {}
?

However if you put \def\@TeXversion{3.14} in texsys.cfg the following format will be used:

! LaTeX Error: \rubbish undefined.
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
! .
 ...
l.3 \renewcommand{\rubbish}
                           {}
?

1Actually if you TEX is really old, version 2, L^{A}TEX can detect this, and set \@TeXversion to 2 if it is not set in the cfg file

Note that this has an extra line ! . which does not appear in error messages that use the default settings with a current version of TEX, but this should not cause any confusion we hope.

2 Initialisation

As this file is read at a very early stage, some definitions that are normally considered to be part of the format must be made here.

2.1 INITEX

1 ⟨∗dircheck⟩ 2 ⟨∗initex⟩

 3 ⟨initex⟩\ifnum\catcode`\{=1
 4 ⟨initex⟩ \errmessage
 5 ⟨initex⟩ {LaTeX must be made using an initex with no format preloaded}

6 ⟨initex⟩\fi

 7 \catcode`\{=1
 8 \catcode`\}=2
 9 \catcode`\#=6
10 \catcode`\^=7
11 \chardef\active=13
12 \catcode`\@=11
13 \countdef\count@=255
14 \let\bgroup={ \let\egroup=}
15 \ifx\@@input\@undefined\let\@@input\input\fi
16 \ifx\@@end\@undefined\let\@@end\end\fi
17 \chardef\@inputcheck0
18 \chardef\sixt@@n=16
19 \newlinechar`\^^J
20 \def\typeout{\immediate\write17}
21 \def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&%
22 \do\#\do\^\do\_\do\%\do\~}
23 \def\@makeother#1{\catcode`#1=12\relax}
24 \def\space{ }
25 \def\@tempswafalse{\let\if@tempswa\iffalse}
26 \def\@tempswatrue{\let\if@tempswa\iftrue}
27 \let\if@tempswa\iffalse
28 \def\loop#1\repeat{\def\iterate{#1\relax\expandafter\iterate\fi}%
29 \iterate \let\iterate\relax}
30 \let\repeat\fi

31 ⟨/initex⟩

2.2 Some bits of 2e

32 ⟨∗2ekernel⟩

33 \def\two@digits#1{\ifnum#1<10 0\fi\number#1}
34 \long\def\@firstoftwo#1#2{#1}

35 \long\def\@secondoftwo#1#2{#2}

This is a special version of \ProvidesFile for initex use.

36 \def\ProvidesFile#1{%
37 \begingroup
38  \catcode`\ 10 %
39  \@makeother\/%
40  \@ifnextchar[{\@providesfile{#1}}{\@providesfile{#1}[]}}
41 \def\@providesfile#1[#2]{%
42  \wlog{File: #1 #2}%
43  \@addtofilelist{ #2}%
44  \endgroup}
45 \long\def\@addtofilelist#1{}
46 \def\@empty{}
47 \catcode`\%=12
48 \def\@percentchar{%}
49 \catcode`\%=14
50 \let\@currdir\@undefined
51 \let\input@path\@undefined
52 \let\filename@parse\@undefined
\strip@prefix
53 \def\strip@prefix#1>{}

54 ⟨/2ekernel⟩

3 texsys.cfg

As mentioned above, any site specific definitions required to describe the filename handling must be entered into a file texsys.cfg. If texsys.cfg can not be located by \openin, we write a default version out. The default version only contains comments, so we do not actually input the file in that case. The automatic tests later will, hopefully, correctly define the required macros.

The tricky code below checks to see if texsys.cfg exists. If it does not, all the text in this file between START and END is copied verbatim to a new file texsys,cfg. If texsys.cfg is found, then it is simply input. This is only done when this file is being used unstripped.

55 ⟨∗docstrip⟩

56 \openin15=texsys.cfg
57 \ifeof15
58 \typeout{** Writing a default texsys.cfg}
59 \immediate\openout15=texsys.cfg
60 \begingroup
61 \catcode`\^^M\active%
62 \let^^M\par%
63 \def\reserved@a#1^^M{%
64 \def\reserved@b{#1}%
65 \ifx\reserved@b\reserved@c\endgroup\else%

66  \immediate\write15{#1}%
67  \expandafter\reserved@a\fi}%
68 \def\reserved@d#1START^^M{\let\do\@makeother\dospecials\reserved@a}%
69 \catcode`\%=12
70 \def\reserved@c{%END}
71 \reserved@d

START

3.1 texsys.cfg

This file contains the site specific definitions of the four macros

\@currdir, \input@path, \filename@parse and \@TeXversion.

As distributed it only contains comments, however this ‘empty’ file will work on many systems because of the automatic tests built into dircheck.dtx. You are allowed to edit this file to add definitions of these macros appropriate to your system.

David Carlisle 1994/11/17

The macros that must be defined are:

\@currdir \@currdir⟨filename⟩⟨space⟩ should expand to a form of the filename that uniquely refers to the ‘current directory’ if this is possible. (The expansion should also end with a space.) on UNIX, this is \def\@currdir{./}. For more exotic operating systems you may want to make \@currdir a macro with arguments delimited by . and/or ⟨space⟩. If the operating system has no concept of directory structure, this macro should be defined to be empty.

\input@path If the primitive \openin searches the same directories as the primitive \input, then it is possible to tell (using \ifeof) whether a file exists before trying to input it. For systems like this, \input@path should be left undefined.

If \openin does not ‘follow’ \input then \input@path must be defined to be a list of directories to search for input files. The format for each directory is as for \@currdir, normally just a prefix is required, but it may be a macro with space-delimited argument. That is, if ⟨dir⟩ is an entry in the input path, TEXwill try to load the expansion of

⟨dir⟩⟨filename⟩⟨space⟩

So either ⟨dir⟩ should be defined as a macro with argument delimited by space, or it should just expand to a directory name, including the final directory separator, so that it may be concatenated with the ⟨filename⟩. This means that for UNIX-like syntax, each ⟨dir⟩ should end with a slash, /. One exception to this rule is that the input path should always contain the empty directory {} as this will allow ‘full pathnames’ to be used, and the ‘current directory’ to be searched.

\input@path should expand to a list of such directories, each in a {} group.

\filename@parse After a call of the form: \filename@parse{⟨filename⟩}, the three macros

\filename@area,\filename@base,\filename@ext should be defined to be the

‘area’ (or directory), basename and extension respectively. If there was no extension specified in ⟨filename⟩, \filename@ext should be \let to \relax (so this case may be tested with \@ifundefined{filename@ext} and, perhaps a default extension substituted).

Normally one would not need to define this macro in texsys.cfg as the automatic tests can supply parsers that work with UNIX and VMS syntax, as well as a basic parser that willcover many other cases. However some operating systems may need a ‘hand produced’ parser in which case it should be defined in this file.

The UNIX parser also works for most MSDOS TEX versions. Currently if the UNIX or VMS parser is not used, \filename@parse is defined to always return an empty area, and to split the argument into basename and extension at the first ‘.’ that occurs in the name. Parsers for other formats may be defined in texsys.cfg, in which case they will be used in preference to the default definitions.

\@TeXversion You should not need to set this macro in texsys.cfg. L^{A}TEX tests to set this

automatically. See the comments in the opening section of ltdirchk.dtx.

The following sections give examples of definitions which might work on various systems. These are currently mainly untested as I only have access to a few systems, all of which do not need this file as the automatic tests work. All the code is commented out.

3.2 UNIX (web2c)

This implementation does make \openin and \input look in the same places. Acceptable settings are made by dircheck.dtx, and so this file may be empty. The definitions below are therefore just for information.

72 %\def\@currdir{./}
73 %\let\input@path\@undefined

3.3 UNIX (other)

Apparently some commercial UNIX implementations have different paths for \openin and \input. For these one could use definitions like the following (with whatever directories are used at your site): note that the directory names should end with /.

74 % \def\@currdir{./}
75 % \def\input@path{%
76 %   {/usr/local/lib/tex/inputs/distrib/}%
77 %   {/usr/local/lib/tex/inputs/contrib/}%
78 %   {/usr/local/lib/tex/inputs/local/}%
79 % }

3.4 MSDOS (emtex)

This implementation does make \openin and \input look in the same places. Acceptable settings are made by dircheck.dtx, and so this file may be empty. The definitions below are therefore just for information.

80 % \def\@currdir{./}
81 % \let\input@path\@undefined

3.5 MSDOS (other)

Some PC implementations have different paths for \openin and \input. For these one could use definitions like the following (with whatever directories are used at your site): note that the directory names should end with /. This assumes the implementation uses UNIX style / as the directory separator.

82 % \def\@currdir{./}
83 % \def\input@path{%
84 %   {c:/tex/inputs/distrib/}%
85 %   {c:/tex/inputs/contrib/}%
86 %   {c:/tex/inputs/local/}%
87 % }

3.6 VMS (???)

This implementation does make \openin and \input look in the same places. Acceptable settings are made by dircheck.dtx, and so this file may be empty. The definitions below are therefore just for information.

88 % \def\@currdir{[]}
89 % \let\input@path\@undefined

3.7 VMS (???)

Some VMS implementations have different paths for \openin and \input. For these one could use definitions like the following:

90 % \def\@currdir{[]}
91 % \def\input@path{%
92 %   {texinputs:}%
93 %   {[SOME.TEX.DIRECTORY]}%
94 % }

3.8 MACINTOSH (OzTeX 1.6)

This implementation does make \openin and \input look in the same places. Acceptable settings are made by dircheck.dtx, and so this file may be empty. The definitions below are therefore just for information.

95 % \def\@currdir{:}
96 % \let\input@path\@undefined

3.9 MACINTOSH (other)

Some Macintosh implementations have different paths for \openin and \input. For these one could use definitions like the following (with whatever folders are used on your machine): note that the directory names should end with :, and they should contain no spaces.

97 % \def\@currdir{:}
98 % \def\input@path{%

99 %   {Hard-Disk:Applications:TeX:TeX-inputs:}%
100 %   {Hard-Disk:Applications:TeX:My-inputs:}%

101 % }

3.10 FAKE EXAMPLE

This example is for an operating system that has filenames of the form <area>name For maximum compatability with macro sets, you want name.ext to be mapped

to <ext>name. and <area>name.ext to be mapped to <area.ext>name. \input

does this mapping automatically, but \openin does not, and does not look in the same places as \input. <>name is the desired ‘current directory’ syntax.

the following code would possibly work:

102 % \def\@dir#1#2 {%
103 %   \@d@r{#1}#2..\@nil}
104 % \def\@d@r#1#2.#3.#4\@nil{%
105 %   <\ifx\@dir#1\@dir\else#1\ifx\@dir#3\@dir\else.\fi\fi#3>#2 }

106 %

107 % \def\@currdir{\@dir{}}
108 % \def\input@path{%
109 %   {\@dir{area.one}}%
110 %   {\@dir{area.two}}%

111 % }

END

112 \immediate\closeout15

If texsys.cfg did exist, then input it.

113 \else
114 \typeout{** Using the existing texsys.cfg}
115 \closein15
116 \input texsys.cfg
117 \fi

118 ⟨/docstrip⟩

If the stripped version of this file is being used (in latex2e.ltx) then texsys.cfg should be there, so just input it.

119 ⟨dircheck⟩\input texsys.cfg

4 Setting \@currdir
\@currdir \IfFileExists This is a local definition of \IfFileExists. It tries to relocate texsxys.aux. If

it succeeds, then the \@currdir syntax has been determined. If all the tests fail then \@currdir will be set to \@empty, and ltxcheck will warn of this when it checks the format.

120 \begingroup
121 \count@\time
122 \divide\count@ 60
123 \count2=-\count@

124 \multiply\count2 60
125 \advance\count2 \time

\today The current date and time stamp.

126 \edef\today{%
127 \the\year/\two@digits{\the\month}/\two@digits{\the\day}:%
128  \two@digits{\the\count@}:\two@digits{\the\count2}}

Create a file texsys.aux (hopefully in the current directory), then try to locate it again.

129 \immediate\openout15=texsys.aux
130 \immediate\write15{\today^^J}
131 \immediate\closeout15 %

#1 is the file to try, #2 is what to do on success, #3 on failure.

132 \def\IfFileExists#1#2#3{%
133 \openin\@inputcheck#1 %
134 \ifeof\@inputcheck
135  #3\relax
136 \else
137  \read\@inputcheck to \reserved@a
138  \ifx\reserved@a\today
139  \typeout{#1 found}#2\relax
140  \else
141  \typeout{BAD: old file \reserved@a (should be \today)}%
142  #3\relax
143  \fi
144 \fi
145 \closein\@inputcheck}
146 \endlinechar=-1

If \@currdir has not been pre-defined in texsys.cfg then test for UNIX, VMS and Oz-TEX-Mac. syntax.

147 \ifx\@currdir\@undefined
148 \IfFileExists{./texsys.aux}{\gdef\@currdir{./}}%
149  {\IfFileExists{[]texsys.aux}{\gdef\@currdir{[]}}%
150  {\IfFileExists{:texsys.aux}{\gdef\@currdir{:}}{}}}

If it is still undefined at this point, all the above tests failed. Earlier versions interactively prompted for a definition at this point, but it seems impossible to reliably obtain information from users at this point in the installation. This version of the file produces a format with no user-interaction. Later if the format is not suitable for the system, texsys.cfg may be edited and the format re-made.

151 \ifx\@currdir\@undefined
152  \global\let\@currdir\@empty
153  \typeout{^^J***^^J%
154  No syntax for the current directory could be found^^J%
155  ***}%
156 \fi

Otherwise \@currdir was defined in texsys.cfg. In this case check that the syntax specified works on this system. (In case a complete L^{A}TEX system has been copied from one system to another.) If the test fails, give up. The installer should remove or correct the offending texsys.cfg and try again.

157 \else
158 \IfFileExists{\@currdir texsys.aux}{}{%
159  \edef\reserved@a{\errhelp{%
160  texsys.cfg specifies the current directory syntax to be^^J%
161  \meaning\@currdir^^J%
162  but this does not work on this system.^^J%
163  Remove texsys.cfg and restart.}}\reserved@a
164  \errmessage{Bad texsys.cfg file: \noexpand\@currdir}\@@end}

The version of \@currdir in texsys.cfg looks OK.

165 \fi
166 \immediate\closeout15 %
167 \endgroup
168 \typeout{^^J***^^J%
169  \noexpand\@currdir set to:
170  \expandafter\strip@prefix\meaning\@currdir.^^J%
171  ***}

Stop here if the file is being used unstripped.

172 ⟨∗docstrip⟩

173 \relax\endinput

174 ⟨/docstrip⟩

5 Setting \input@path

Earlier versions of this file attempted to automatically test whether \input@path was required, and interactively prompt for a path if necessary. This was not found to be very reliable The first-time installer of L^{A}TEX 2ε can not be expected to have enough information to supply the correct information to the prompts. Now the interaction is omitted. After the format is made the installer can attempt to run the test document ltxcheck.tex through L^{A}TEX 2ε. This will check, amongst other things, whether texsys.cfg will need to be edited and the format remade.

\input@path Now set up the \input@path.

input@path should either be undefined, or a list of directories as described in the introduction.

175 \typeout{***^^J%
176  Assuming \noexpand\openin and \noexpand\input^^J%
177  \ifx\input@path\@undefined

\input@path has not been pre-defined.

178  have the same search path.^^J%
179  \else

 \input@path has been defined in texsys.cfg.
180  have different  search paths.^^J%
181  LaTeX will use the path specified by \noexpand\input@path:^^J%
182  \fi
183  ***}

6 Filename Parsing

\filename@parse Split a filename into its components.

184 \ifx\filename@parse\@undefined
185 \def\reserved@a{./}\ifx\@currdir\reserved@a
 \filename@parse was not specified in texsys.cfg, but \@currdir looks like

UNIX…

186  \typeout{^^J***^^JDefining UNIX/DOS style filename parser.^^J***}
187  \def\filename@parse#1{%
188  \let\filename@area\@empty
189  \expandafter\filename@path#1/\\}

Search for the last /.

190  \def\filename@path#1/#2\\{%
191  \ifx\\#2\\%
192  \def\reserved@a{\filename@simple#1.\\}%
193  \else
194  \edef\filename@area{\filename@area#1/}%
195  \def\reserved@a{\filename@path#2\\}%
196  \fi
197  \reserved@a}
198 \else\def\reserved@a{[]}\ifx\@currdir\reserved@a
 \filename@parse was not specified in texsys.cfg, but \@currdir looks like

VMS…

199  \typeout{^^J***^^JDefining VMS style filename parser.^^J***}
200  \def\filename@parse#1{%
201  \let\filename@area\@empty
202  \expandafter\filename@path#1]\\}

Search for the last ].

203  \def\filename@path#1]#2\\{%
204  \ifx\\#2\\%
205  \def\reserved@a{\filename@simple#1.\\}%
206  \else
207  \edef\filename@area{\filename@area#1]}%
208  \def\reserved@a{\filename@path#2\\}%
209  \fi
210  \reserved@a}
211 \else\def\reserved@a{:}\ifx\@currdir\reserved@a

 \filename@parse was not specified in texsys.cfg, but \@currdir looks like Mac-

intosh…

212  \typeout{^^J***^^JDefining Mac style filename parser.^^J***}
213  \def\filename@parse#1{%
214  \let\filename@area\@empty
215  \expandafter\filename@path#1:\\}

Search for the last :.

216  \def\filename@path#1:#2\\{%
217  \ifx\\#2\\%
218  \def\reserved@a{\filename@simple#1.\\}%
219  \else
220  \edef\filename@area{\filename@area#1:}%
221  \def\reserved@a{\filename@path#2\\}%
222  \fi
223  \reserved@a}
224 \else

\filename@parse was not specified in texsys.cfg. So just make a simple parser that always sets \filename@area to empty.

225  \typeout{^^J***^^JDefining generic filename parser.^^J***}
226  \def\filename@parse#1{%
227  \let\filename@area\@empty
228  \expandafter\filename@simple#1.\\}
229 \fi\fi\fi

\filename@simple is used by all three versions. Finally we can split off the extension.

230 \def\filename@simple#1.#2\\{%
231  \ifx\\#2\\%
232  \let\filename@ext\relax
233  \else
234  \edef\filename@ext{\filename@dot#2\\}%
235  \fi
236  \edef\filename@base{#1}}

Remove a final dot, added earlier.

237 \def\filename@dot#1.\\{#1}
238 \else
 Otherwise, \filename@parse was specified in texsys.cfg.
239 \typeout{^^J***^^J%
240  \noexpand\filename@parse was defined in texsys.cfg:^^J%
241  \expandafter\strip@prefix\meaning\filename@parse.^^J%
242  ***}
243 \fi

7 TEX Versions

\@TeXversion TEX versions older than than 3.141 require \@TeXversion to be set. This can be determined automatically due to a trick suggested by Bernd Raichle. (Actually this will not always get the correct version number, eg TEX3.14 would be detected as TEX3, but L^{A}TEX only needs to take account of TEX’s older than 3, or between 3 and 3.14.

244 \ifx\@TeXversion\@undefined
245 \ifx\@undefined\inputlineno
246  \def\@TeXversion{2}
247 \else
248 {\catcode`\^^J=\active
249  \def\reserved@a#1#2\@@{\if#1\string^3\fi}
250  \edef\reserved@a{\expandafter\reserved@a\string^^J\@@}
251  \ifx\reserved@a\@empty\else\gdef\@TeXversion{3}\fi}
252 \fi
253 \fi

254 ⟨/dircheck⟩

8 ltxcheck.tex

After the format has been made, and article.cls moved with the other files to the ‘standard input directory’ as specified in install.l2e, the format may be checked by running the file ltxcheck.tex.

255 ⟨∗ltxcheck⟩

256 \NeedsTeXFormat{LaTeX2e}
257 \makeatletter
258 \typeout{^^J%
259 LaTeX2e installation check file^^J%
260 ===============================}

261

262 \typeout{^^J%
263 Before running this file through LaTeX2e you should have installed^^J%
264 the Standard LaTeX files in their final `system' directories.^^J%
265 This file should *not* be run in a directory that contains article.cls}
266 \def\pause{%
267 \typeout{}%
268 \message{** Hit return to continue: }%
269 \read -1  to \xxx
270 \typeout{}}
271 \typeout{^^J%
272 After certain tests, LaTeX will pause so that you can read the^^J%
273 output without it scrolling off the screen.^^J%
274 When you are ready just hit <return> and LaTeX will continue.^^J%
275 When LaTeX pauses, you will see a prompt like the one below.^^J^^J%

276 If a test fails, a message will be displayed followed by^^J%
277 an error message starting `! BAD'.^^J%
278 LaTeX will quit if you try to scroll past some error messages.}
279 \pause
280 \typeout{^^J%
281 Checking the current directory syntax^^J%
282 =====================================}
283 \newif\iftest\testfalse
284 \ifx\@currdir\@undefined
285 \typeout{^^J%
286 \noexpand\@currdir is undefined !!^^J%
287 Something is seriously wrong with the LaTeX2e initialisation.^^J%
288 Either you have corrupted files or this is a LaTeX bug.}
289 \errmessage{BAD LaTeX2e system!!}
290 \expandafter\@@end
291 \fi
292 \ifx\@currdir\@empty
293 \typeout{^^J%
294 \noexpand\@currdir is defined to be empty.^^J%
295 This means that LaTeX can not distinguish between a file^^J%
296 aaaaa.tex^^J%
297 that exists in the current directory, and  a file aaaaa.tex^^J%
298 in another directory.^^J%
299 It may be that this Operating System has no concept of `directory'^^J%
300 in which case the setting is correct. If however it is possible to^^J%
301 uniquely refer to a file then a suitable definition of
302  \noexpand\@currdir^^J%
303 should be added to texsys.cfg, and the format remade.}
304 \pause
305 \else
306 \typeout{^^J%
307 \noexpand\@currdir is defined as
308  \expandafter\strip@prefix\meaning\@currdir^^J%
309 (Testing...)}
310 \begingroup
311 \endlinechar=-1
312 \count@\time
313 \divide\count@ 60
314 \count2=-\count@
315 \multiply\count2 60
316 \advance\count2 \time
317 \edef\today{%
318 \the\year/\two@digits{\the\month}/\two@digits{\the\day}:%
319  \two@digits{\the\count@}:\two@digits{\the\count2}}
320 \immediate\openout15=ltxcheck.aux
321 \immediate\write15{\today^^J}
322 \immediate\closeout15 %

323 \openin\@inputcheck\@currdir ltxcheck.aux %
324 \ifeof\@inputcheck
325  \typeout{\@currdir ltxcheck.aux  not found}%
326 \else
327  \read\@inputcheck to \reserved@a
328  \ifx\reserved@a\today
329  \typeout{\@currdir ltxcheck.aux found}
330  \testtrue
331  \else
332  \typeout{BAD: old file \reserved@a(should be \today)}%
333  \testfalse
334  \fi
335 \fi
336 \closein\@inputcheck
337 \iftest
338  \endgroup
339  \typeout{\noexpand \@currdir OK!}
340 \else
341 \endgroup
342 \typeout{^^J%
343  The LaTeX2e installation has defined \noexpand\@currdir^^J%
344  to be \expandafter\strip@prefix\meaning\@currdir.^^J%
345  This appears to be incorrect.^^J%
346  You should add a correct definition to texsys.cfg^^J%
347  and rebuild the format.}
348 \errmessage{BAD LaTeX2e system!!}
349 \expandafter\expandafter\expandafter\@@end
350 \fi
351 \pause
352 \fi
353 \typeout{^^J%
354 Checking the filename parser^^J%
355 ============================}
356 \filename@parse{article.cls}
357 \def\reserved@a{article}
358 \testtrue
359 \ifx\filename@base\reserved@a
360 \ifx\filename@ext\@clsextension
361 \else
362  \testfalse
363 \fi
364 \else
365 \testfalse
366 \fi
367 \iftest
368 \typeout{filename parser OK!}\pause
369 \else

370 \typeout{^^J%
371  The LaTeX2e installation has defined \noexpand\filename@parse.^^J%
372  This appears to be incorrect.^^J%
373  You should remove the incorrect definition from texsys.cfg^^J%
374  and rebuild the format.}
375 \errmessage{BAD LaTeX2e system!!}
376 \expandafter\expandafter\expandafter\@@end
377 \fi

378 %

379 \typeout{^^J%
380 Checking the input path^^J%
381 =======================^^J}
382 \begingroup
383 \let\input@path\@undefined
384 \ifx\@currdir\@empty\else
385 \IfFileExists{\@currdir article.cls}
386 {\typeout{%
387  article.cls appears to be in current directory!^^J^^J%
388  If this is the case, install article.cls into a^^J%
389  `standard input directory'^^J%
390  and copy ltxcheck.tex to another directory before^^J%
391  processing with LaTeX.^^J%
392  ^^J%
393  If article.cls is not in the current directory,^^J%
394  then you need to edit texsys.cfg.^^J%
395  Read the comments in that file. If nothing else works, add:^^J%
396  \string\let\string\@currdir\string\@empty^^J}%
397  \errhelp{Move files, or edit texsys.cfg}
398  \def\ArticleClassFoundInCurrentDirectory{%
399  This file should not be run in a `standard input directory'}
400  \errmessage{BAD: \ArticleClassFoundInCurrentDirectory}}

401 {}

402 \fi
403 \endgroup
404 \IfFileExists{article.cls}
405 {\typeout{input path OK!}}
406 {\typeout{^^J%
407  LaTeX claims that article.cls is not on the system.^^J%
408  Either LaTeX has been incorrectly installed, or the
409  \noexpand\input@path^^J%
410  is incorrect. A correct definition should be added to^^J%
411  texsys.cfg, and the format remade.}
412 \pause
413 \typeout{^^J%
414  Typical definitions of \noexpand\input@path include:^^J^^J%
415  \string\let\string\input@path=\noexpand\@undefined
416  (the default definition)^^J^^J%
417  \string\def\string\input@path{\@percentchar^^J
418  {/usr/lib/tex/inputs/} {/usr/local/lib/tex/inputs/} }^^J^^J%

419  \string\def\string\input@path{\@percentchar^^J
420  {c:/tex/inputs/} {a:/} }^^J^^J%
421  \string\def\string\input@path{\@percentchar^^J
422  {tex_inputs:} {[SOMEWHERE.TEX.INPUTS]} }^^J}%
423 \pause
424 \typeout{^^J%
425  Note that \noexpand\input@path should be undefined
426  unless your^^J%
427  TeX installation does not make
428  \noexpand\openin and \noexpand\input^^J%
429  search the same directories.^^J%
430  If \noexpand\input@path is defined, entries should be^^J%
431  in the same syntax as \noexpand\@currdir^^J%
432  ie full directory names that may be concatenated with the^^J%
433  basename (note the final / and ] in the above examples).^^J%
434  Some systems may need more complicated settings.^^J%
435  See texsys.cfg for more examples.^^J%
436  ! BAD \noexpand\input@path!!}
437 \@@end}%
438 \pause
439 \typeout{^^J%
440 Checking the TeX version^^J%
441 ========================}
442 \dimen@\ifx\@TeXversion\@undefined4\else\@TeXversion\fi\p@%
443 \ifx\noboundary\relax
444 \typeout{^^J%
445  This is TeX 2. You will not be able to use all the new features^^J%
446  of LaTeX2e with such an old TeX.^^J%
447  The current version (1995/12/11) is TeX 3.14159.^^J%
448  Consider upgrading your TeX.}
449 \ifdim\dimen@<3\p@\else
450  \errhelp{Check that texsys.cfg has not defined \@TeXversion}
451  \def\OldTeX{%
452  BAD: \noexpand\@TeXversion is incorrect: \meaning\@TeXversion}
453  \errmessage{\OldTeX}
454 \fi
455 \else
456  \ifdim\dimen@>3.14\p@
457  \typeout{This appears to be a recent version of TeX!^^J%
458  If the following `lines' all appear on the same line,^^J%
459  separated by \string^\string^J %
460  then there has been an incorrect installation.}
461  \else
462  \typeout{^^J%
463  This appears to be a TeX between 3.0 and 3.14^^J%
464  but the current version (1995/12/11) is TeX 3.14159^^J%
465  consider upgrading your TeX.^^J%
466  The following `lines' will appear on the same line,^^J%
467  separated by \string^\string^J;^^J%

468  the same problem may affect other messages from LaTeX.}
469  \fi
470 \message{line1^^Jline2^^Jline3}
471 \pause
472 \fi

To check that the L^{A}TEX fonts have been installed, the well known trick of going into \batchmode, and testing for \nullfont is used. Not all fonts are tested, just a representative sample.

473 \typeout{^^J%
474 Checking fonts^^J%
475 =====================================}
476 \def\checkfont#1{%
477 \batchmode
478 \font\test=#1\relax
479 \errorstopmode
480 \ifx\test\nullfont
481  \typeout{\@spaces! BAD: #1.tfm not found!}
482  \@tempswatrue
483 \else
484  \typeout{\@spaces OK: #1.tfm found}
485 \fi}
486 \typeout{^^JChecking Standard TeX fonts...}
487 \@tempswafalse
488 \checkfont{cmr10}
489 \checkfont{cmr12}
490 \checkfont{cmmi10}
491 \if@tempswa
492 \errhelp{Obtain a complete standard TeX font distribution.}
493 \errmessage{BAD: Missing Standard Fonts}
494 \else
495 \pause
496 \fi
497 \typeout{^^JChecking LaTeX Picture Mode fonts...}
498 \@tempswafalse
499 \checkfont{lcircle10}
500 \checkfont{lcirclew10}
501 \if@tempswa
502 \@tempswafalse
503 \checkfont{circle10}
504 \checkfont{circlew10}
505 \if@tempswa
506  \typeout{^^J! BAD: You do not have the picture mode fonts:^^J%
507  lcircle10 and lcirclew10}
508 \else
509  \typeout{^^J! BAD:%
510  You have the picture mode fonts with their old names:^^J%
511  circle10 and circlew10 have been renamed to^^J%

512  lcircle10 and lcirclew10}
513 \fi
514 \errhelp{Obtain a complete standard LaTeX font distribution.}
515 \errmessage{BAD: Missing LaTeX Fonts}
516 \else
517 \pause
518 \fi
519 \typeout{^^JChecking Extra LaTeX Computer Modern fonts...}
520 \@tempswafalse
521 \checkfont{cmmib5}
522 \checkfont{cmmib7}
523 \checkfont{cmex7}
524 \if@tempswa
525 \typeout{! BAD:^^J%
526 LaTeX2e uses a few `extra' Computer Modern fonts produced by^^J%
527 The American Mathematical Society.^^J%
528 If you install The AMSFONTS font collection, then these, and other,^^J%
529 fonts will be available to LaTeX.^^J%
530 Although installing AMSFONTS is recommended, LaTeX does not require^^J%
531 The full collection; you may obtain a minimal set of extra LaTeX^^J%
532 fonts from any CTAN archive, in: tex-archive/macros/latex/fonts/}
533 \errhelp{Obtain LaTeX fonts or  the AMSFONTS collection.}
534 \errmessage{BAD: Missing LaTeX Fonts}
535 \else
536 \pause
537 \fi
538 \typeout{^^JChecking T1 encoded Computer Modern (dc) fonts...}

This command looks for the string dcr17< in the font tables for T1/cmr. If it is there, then the T1 fd files match the old dc fonts, for dc release 1.1 or earlier. If not then presumably new fd files are being used.

539 \def\dcrseventeen{%
540 \begingroup
541  \escapechar-1
542  \xdef\reserved@a{%
543  \noexpand\in@
544  {\expandafter\string\csname dcr17\endcsname<}%
545  {\expandafter\expandafter\expandafter
546  \string\csname T1/cmr/m/n\endcsname<}}%
547 \endgroup
548 \reserved@a}

Remove the “! BAD” typeout while checking for dc fonts so as not to worry sites with just the new ones.

549 \def\checkfont#1{%
550 \batchmode
551 \font\test=#1\relax
552 \errorstopmode
553 \ifx\test\nullfont

554  \typeout{\@spaces\@spaces #1.tfm not found}
555  \@tempswatrue
556 \else
557  \typeout{\@spaces OK: #1.tfm found}
558 \fi}
559 \@tempswafalse
560 \checkfont{dcr10}
561 \if@tempswa
562 \@tempswafalse
563 \checkfont{tcr1000}
564 \if@tempswa

No dc fonts at all.

565  \typeout{^^J%
566 ! BAD: No dc fonts found!!^^J%
567 LaTeX does not require the use of dc fonts^^J%
568 however they are strongly recommended.^^J%
569 The dc fonts are available in a more natural range of sizes^^J%
570 and allow better hyphenation and kerning than the^^J%
571 old fonts such as cmr10.^^J%
572 These dc fonts may be obtained from CTAN archives, in:^^J%
573 tex-archive/fonts/dc}
574 \else

No old dc fonts, but new ones installed. First check whether the latest patch has been applied.

575  \font\testdc=dcr1000
576  \testdc
577  \setbox0\hbox{-\char127}
578  \setbox2=\hbox{\char127}
579  \ifdim\wd0=\wd2
580  \typeout{^^J%
581 OK: dc fonts newer than 1.2 patch level 1.}
582  \else
583  \typeout{^^J%
584 ! BAD dc fonts 1.2 patch level 0 installed.^^J%
585 Current release (1995/12/11) is 1.2 patch level 1^^J%
586 These dc fonts may be obtained from CTAN archives, in:^^J%
587 tex-archive/fonts/dc}
588  \fi
589  \font\testdc=dcr1000
590  \testdc
591  \setbox0\hbox{-\char127}
592  \setbox2=\hbox{\char127}
593  \ifdim\wd0=\wd2
594  \typeout{^^J%
595 OK: dc fonts newer than 1.2 patch level 1}
596  \else
597  \typeout{^^J%
598 ! BAD dc fonts 1.2 patch level 0 installed.^^J%

599 Current release (1995/12/11) is 1.2 patch level 1^^J%
600 These dc fonts may be obtained from CTAN archives, in:^^J%
601 tex-archive/fonts/dc}
602  \fi

603

604  \dcrseventeen
605  \ifin@
606  \typeout{^^J%
607 The fd files for the obsolete release 1.1 of the^^J%
608 dc fonts have been loaded into the LaTeX format.^^J%
609 However, you appear to have the current release 1.2 of the dc fonts.^^J%
610 You should generate suitable fd files by running:^^J%
611 latex newdc.ins^^J%
612 and then rebuild the format by rerunning:^^J%
613 initex latex.ltx}
614  \errmessage{BAD LaTeX2e system!!}
615  \else
616  \typeout{^^J%
617  DC fonts OK!}
618  \fi
619 \fi
620 \else
621 \@tempswafalse
622 \checkfont{tcr1000}
623 \if@tempswa

Old DC fonts, but no new ones.

624  \typeout{^^J%
625 Old dc fonts found!!^^J%
626 Only the original dc fonts are on your system.^^J%
627 The latest release, 1.2, of the dc fonts introduced^^J%
628 many improvements and are strongly recommended.^^J%
629 They may be obtained from CTAN archives, in:^^J%
630 tex-archive/fonts/dc}
631  \pause
632  \dcrseventeen
633  \ifin@\else
634  \typeout{^^J%
635 The LaTeX2e installation has installed fd files for^^J%
636 release 1.2 of the dc fonts.^^J%
637 However, you appear to have only release 1.1 of these fonts.^^J%
638 You must now generate the correct fd files by running:^^J%
639 latex olddc.ins^^J%
640 and then rebuild the format by rerunning:^^J%
641 initex latex.ltx}
642  \errmessage{BAD LaTeX2e system!!}
643  \fi
644 \else

Both old and new DC fonts.

645  \font\testdc=dcr1000

646  \testdc
647  \setbox0\hbox{-\char127}
648  \setbox2=\hbox{\char127}
649  \ifdim\wd0=\wd2
650  \typeout{^^J%
651 OK: dc fonts newer than 1.2 patch level 1}
652  \else
653  \typeout{^^J%
654 ! BAD dc fonts 1.2 patch level 0 installed.^^J%
655 Current release (1995/12/11) is 1.2 patch level 1^^J%
656 These dc fonts may be obtained from CTAN archives, in:^^J%
657 tex-archive/fonts/dc}
658  \fi

659

660  \dcrseventeen
661  \ifin@
662  \typeout{^^J%
663 The fd files for the obsolete release 1.1 of the^^J%
664 dc fonts have been loaded into the LaTeX format.^^J%
665 However, you appear to have the current release 1.2 of the dcfonts.^^J%
666 You should use generate suitable fd files by running:^^J%
667 latex newdc.ins^^J%
668 and then rebuild the format by running:^^J%
669 initex latex.ltx^^J%
670 Otherwise LaTeX will always use the older fonts.}
671  \errmessage{BAD LaTeX2e system!!}
672  \else
673  \typeout{^^J%
674 DC fonts OK!.^^J%
675 (Both old and new dc font releases are installed.)}
676  \fi
677 \fi
678 \fi
679 \@@end

680 ⟨/ltxcheck⟩