1 % This is chkconfig.ltx, a script which tries to autodetect and
2 % document your LaTeX configuration.
3 % Author: Jean-Marc Lasgouttes (Jean-Marc.Lasgouttes@inria.fr)
4 % with minimal changes by Asger Alstrup (alstrup@diku.dk).
6 % This script should only be run from the configure script to update
7 % the files textclass.lst and doc/LaTeXConfig.lyx
9 % This script is in fact a complete rewrite of the original chkconfig
10 % script. Expect bugs.
12 %%% If you want to add new packages/document classes to be recognized,
13 %%% read the explanation that follow and jump to the section 'Actual
14 %%% inspection code' below. You do not need to understand the ugly
15 %%% LaTeX code below to help improving chkconfig.ltx :-)
17 %%% If you want to add the new package <name>, all you need most of
18 %%% the times is a two-steps work:
19 %%% 1- Add the command \TestPackage{<name>}. The syntax is:
20 %%% \TestPackage[<file>]{<name>}, which tests whether <name>.sty
21 %%% (or <file>, if this optional parameter is provided) exists.
22 %%% 2- Add a description for <name> in doc/LaTeXConfig.lyx,
23 %%% containing in particular a line like
24 %%% Found: [InsetInfo]
25 %%% where [InsetInfo] is obtained by entering in the minibuffer (Alt+X)
26 %%% info-insert package <name>
27 %%% This inset will automatically display a boxed "yes" or "no"
28 %%% depending on the availability of the package.
30 %%% Since \TestPackage does not find font metric (tfm) files, there's an
31 %%% additional test \TestFont[<file>]{<name>} for this purpose.
33 %%% For document classes, things are even simpler, since you do not
34 %%% need to edit this file. Just put your layout file in some place
35 %%% where LyX can find it and add if you wish a description in
36 %%% LaTeXConfig.lyx, as described above but using
37 %%% "info-insert textclass <name>" instead of "info-insert package <name>".
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 %%%%%%%%%%%%%%%%%%%%%%% Initialization part (skip) %%%%%%%%%%%%%%%%%%%%%
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43 % we do not want to stop on errors
44 \nonstopmode\makeatletter
46 %%% Some useful macros.
47 % Several commands are defined to test for packages:
48 % \AddLayout{<layout>} adds an entry for <layout> in textclass.lst
49 % \AddVariable{<name>}{<value>} creates a new variable chk_<name>,
50 % and gives it the value <value>.
51 % \TestDocClass{<name>}{<command>} if layout <name> has not already
52 % been tested for, execute <command>. Note that you will
53 % probably not need to use this directly, since the configure
54 % script generates the needed macro calls automatically.
55 % \TestPackage[<file>]{<name>} tests whether <name>.sty (or <file>,
56 % if it is provided) exists.
57 % \TestFont[<file>]{<name>} test whether <name>.tfm (or <file>.tfm,
58 % if provided) exists.
59 % These three commands call \AddVariable to give value 'yes' or 'no' to
60 % the variable chk_<name>.
63 \newcommand{\prefix}{+} % the character used by grep to filter 'good' output
65 \newcommand{\AddLayout}[5][\default]{
67 \@ifundefined{category@#2}{%
68 \immediate\write\layouts{"#2" "#1" "#3" "#4" "#5" ""}%
70 \immediate\write\layouts{"#2" "#1" "#3" "#4" "#5" "\@nameuse{category@#2}"}%
75 \newcommand{\AddVariable}[2]{
76 \immediate\write\vars{chk_#1='#2'}}
78 \newcommand{\AddPackage}[1]{
79 \immediate\write\packages{#1}}
81 % Tests whether an item is present
82 % Syntax: \TestItem[<file>]{<name>}{<type>}{<ext>}{<iftrue>}{<iffalse>}
85 \newcommand{\TestItem}[6][\default]{
88 \message{^^J\prefix checking for #3 #2 [#1]...}
89 \let\firstelement\relax
90 \let\missingelements\empty
92 \@for\file:=\files\do{
93 \ifx\firstelement\relax
94 \edef\firstelement{\file}
96 \@expandtwoargs\in@{.}{\file}
100 \def\myfile{\file.#4}
102 \IfFileExists{\myfile}
106 \ifx\missingelements\empty
107 \edef\missingelements{\myfile}
109 \edef\missingelements{\missingelements,\myfile}
115 \AddVariable{#2}{yes}
123 % Adapted from ltxcheck.tex
124 \newcommand{\TestFont}[2][\default]{
129 \message{^^J\prefix checking for font #2 [#1]...}
136 \AddVariable{#2}{yes}
140 \newcommand{\TestPackage}[2][\default]{
141 \TestItem[#1]{#2}{package}{sty}{\AddPackage{#2}}{}}
143 \newcommand{\TestDocClass}[2]{
144 \def\layoutname{#1} % remember the name of the layout file
145 \@ifundefined{layout@#1}
146 {#2 % execute the command
147 \global\@namedef{layout@#1}{}}
148 {} % we have already tried this one.
151 \newcommand{\DeclareLaTeXClass}[2][\default]{
152 \TestItem[#1]{\layoutname}{document class}{cls}
153 {\AddLayout[\firstelement]{\layoutname}{#2}{true}{\missingelements}}
154 {\AddLayout[\firstelement]{\layoutname}{#2}{false}{\missingelements}}
157 \newcommand{\DeclareCategory}[2]{
158 \@ifundefined{category@#1}
159 {\global\@namedef{category@#1}{#2}}%
160 {}% we have already defined this one.
163 % Only for compatibility. Will be removed later.
164 \let\DeclareSGMLClass=\DeclareDocBookClass
166 \newcommand{\DeclareDocBookClass}[2][\default]{
167 \message{^^J\prefix checking for docbook\space\space class \layoutname... }
168 \@ifundefined{hasdocbook}
170 \AddLayout[#1]{\layoutname}{#2}{false}{docbook}}
172 \AddLayout[#1]{\layoutname}{#2}{true}{}}
175 % Stolen from article.cls
176 \newcommand{\today}{\ifcase\month\or
177 January\or February\or March\or April\or May\or June\or
178 July\or August\or September\or October\or November\or December\fi
179 \space\number\day, \number\year}
181 % Initializes the files
182 \typeout{\prefix Inspecting your LaTeX configuration.}
183 \newwrite{\layouts} \immediate\openout \layouts = textclass.lst.tmp
184 \newwrite{\vars} \immediate\openout \vars = chkconfig.vars
185 \newwrite{\packages} \immediate\openout \packages = packages.lst.tmp
187 \immediate\write\layouts{%
188 # This file declares layouts and their associated definition files.^^J%
189 # It has been automatically generated by configure^^J%
190 # Use "Tools/Reconfigure" if you need to update it after a^^J%
191 # configuration change. Run ./configure manually to update the^^J%
192 # system wide version of this file.}
194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
195 %%%%% ACTUAL CONFIGURATION INSPECTION CODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
198 %%% Add any new package or document class here.
200 %%% First, we want the day on which the test has been run.
201 \AddVariable{date}{\today}
203 %%% Then, the version of LaTeX we are using
204 \message{^^J\prefix checking for LaTeX version... \fmtversion}
205 \AddVariable{fmtversion}{\fmtversion}
207 %%% And now, the list of available languages
208 % The trick is to know that \the\everyjob contains something like
209 % \typeout{LaTeX2e <2001/06/01>}
210 % \typeout{Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, nohyphenation, loaded.}
211 % All we have to do is to extract the list from there:
212 % (1) concatenate all the messages that are displayed everytime the
213 % format is loaded. The is done by redefining locally \typeout to
214 % append its argument to the macro \mesg.
216 {\def\typeout#1{\xdef\mesg{\mesg #1}}
219 % (2) strip the useless parts from \mesg. This uses the fact that TeX
220 % allows to define macros with parameters delimited by arbitrary text.
221 \def\platexname{pLaTeX2e}
222 \ifx\pfmtname\platexname
225 \def\strip#1patterns for #2, loaded.#3\endmark{\def\langs{#2}}
226 \expandafter\strip\mesg\endmark
229 % (3) handle the result
230 \message{^^J\prefix checking for available hyphenation patterns... \langs}
231 \AddVariable{languages}{\langs}
233 %%% Check for ec fonts. Most of this code has been shamelessely stolen
234 %%% from the file ltxcheck.tex in the LaTeX distribution. In particular,
235 %%% don't ask me how the macro \ecrm works...
241 {\expandafter\string\csname ecrm\endcsname}%
242 {\expandafter\expandafter\expandafter
243 \string\csname T1/cmr/m/n\endcsname}}%
247 \message{^^J\prefix checking for default encoding (this may take a long time)^^J}
248 \font\test=ecrm1000\relax
251 \message{^^J\prefix\prefix checking for ec fonts... no^^J}
253 \AddVariable{fontenc}{default}
255 \message{^^J\prefix\space\space checking for ec fonts... yes^^J}
256 \message{^^J\prefix\space\space checking for ec support in LaTeX format...}
261 \AddVariable{fontenc}{T1}
262 \message{^^J\prefix\space\space default encoding will be set to T1^^J}
265 \AddVariable{fontenc}{default}
271 \TestPackage{a0poster}
272 \TestPackage{accents}
273 \TestPackage{achicago}
274 \TestPackage{algorithm}
275 \TestPackage{algorithm2e}
276 \TestPackage{amsmath}
277 \TestPackage{amstext}
278 \TestPackage{apacite}
279 \TestPackage{apalike}
280 \TestPackage[arabic.ldf]{arabi}
283 \TestPackage{authordate1-4}
285 \TestPackage{beamerposter}
286 \TestPackage{biblatex}
287 \TestPackage{bibtopic}
288 \TestPackage{bicaption}
291 \TestPackage{booktabs}
292 \TestPackage{braille}
293 \TestPackage{breakurl}
294 \TestPackage{CJKutf8}
297 \TestPackage{chapterbib}
298 \TestPackage{chemgreek}
299 \TestPackage{chicago}
300 \TestPackage{color} % this one should be there if graphics.sty is there.
301 \TestPackage{covington}
302 \TestPackage{csquotes}
303 \TestPackage[koi8-r.def]{cyrillic}
304 \TestPackage{dvipost}
305 \TestPackage{endnotes}
306 \TestPackage{enumitem}
307 \TestPackage{environ} % required by tcolorbox
309 \TestPackage{eso-pic}
310 \TestPackage{fancybox}
311 \TestPackage{fancyhdr}
312 \TestPackage{filehook}
313 \TestPackage{fixltx2e}
316 \TestPackage{fontspec}
317 \TestPackage{footmisc}
320 \TestPackage{geometry}
321 \TestPackage{graphicx}
322 \TestPackage[iso-8859-7.def]{greek-inputenc}
323 \TestPackage{harvard}
325 \TestPackage{hyperref}
326 \TestPackage{hyphenat}
329 \TestPackage[japanese.ldf]{japanese}
330 \TestPackage{jurabib}
332 \TestPackage{lettrine}
333 \TestPackage{listings}
334 \TestPackage[lithuanian.ldf]{lithuanian}
335 \TestPackage{longtable}
336 \TestPackage{luainputenc}
337 \TestPackage{mathdots}
338 \TestPackage{mathrsfs}
339 \TestPackage{mathtools}
341 \TestPackage[mongolian.ldf]{mongolian}
343 \TestPackage{multirow}
346 \TestPackage{nicefrac}
347 \TestPackage{nomencl}
348 \TestPackage{paralist}
349 \TestPackage{pdfcolmk}
350 \TestPackage{polyglossia}
351 \TestPackage{pdfcomment}
352 \TestPackage{pdfpages}
353 \TestPackage{pgf} % required by tcolorbox
354 \TestPackage{prettyref}
355 \TestPackage{preview}
356 \TestPackage{refstyle}
357 \TestPackage{rotating}
358 \TestPackage{rotfloat}
359 \TestPackage{sciposter}
360 \TestPackage{sectionbox}
361 \TestPackage[serbianc.ldf]{serbianc}
362 \TestPackage{setspace}
363 \TestPackage{slashed}
365 \TestPackage{splitidx}
366 \TestPackage{stackrel}
367 \TestPackage{stmaryrd}
369 \TestPackage{subscript}
371 \TestPackage{tcolorbox}
372 \TestPackage{textcomp}
373 \TestPackage{thswitch}
374 \TestPackage[turkmen.ldf]{turkmen}
376 \TestPackage{undertilde}
377 \TestPackage{unicode-math}
380 \TestPackage{varioref}
381 \TestPackage{varwidth}
382 \TestPackage[vietnamese.ldf]{vietnamese}
383 \TestPackage{wallpaper}
384 \TestPackage{wrapfig}
387 \TestPackage[xetex.def]{xetex-def}
388 \TestPackage{xkeyval}
390 % Packages used by LyX's documentation files
391 \TestPackage{arydshln}
394 \TestPackage{caption}
395 \TestPackage{colortbl}
396 \TestPackage{diagbox}
397 \TestPackage{etoolbox} % required by polyglossia and tcolorbox
398 \TestPackage{eurosym}
400 \TestPackage{makecmds} % required by polyglossia
401 \TestPackage{marginnote}
402 \TestPackage{picinpar}
404 \TestPackage{sidecap}
405 \TestPackage{upgreek}
407 % psnfss is in fact the name of a set of style files, among which
408 % times.sty. If times.sty is here, we will assume that everything is fine.
409 \TestPackage[times.sty]{psnfss}
410 % test the following fonts in case they are not in all versions of psnfss
412 \TestPackage{bookman}
413 \TestPackage{chancery}
414 \TestPackage{charter}
415 \TestPackage{cochineal}
416 \TestPackage{courier}
417 \TestPackage{crimson}
419 \TestPackage{mathpazo}
420 \TestPackage{mathpple}
421 \TestPackage{mathptm}
422 \TestPackage{mathptmx}
423 \TestPackage{newcent}
426 % Other font packages
429 \TestPackage{biolinum-type1}
430 %\TestFont[glic1000]{cbgreek}% for Greek % suported by LyX but too large to force downloading
431 \TestPackage{ccfonts}
432 \TestFont[ccr10]{concrete} % required by ccfonts
433 \TestFont[eorm10]{ecc} % required by ccfonts
434 \TestPackage[ot1ccr.fd]{concmath} % required by ccfonts
435 \TestPackage{cmbright}
437 \TestPackage{eulervm}
439 \TestPackage{fourier}
440 \TestPackage{garamondx}
441 \TestFont[zgmr8r]{garamondx-fonts}
445 \TestPackage{libertine}
446 \TestPackage{fontaxes} % required by libertine
447 \TestPackage{libertine-type1}
448 \TestPackage{libertineMono-type1}
449 \TestPackage{lmodern}
450 \TestPackage{luximono}
451 \TestPackage{mathdesign}% for Roman fonts
455 \TestPackage{MinionPro}
456 \TestFont[rzmnr]{minion2newtx}
457 \TestPackage{newtxmath}
458 \TestPackage[binhex.tex]{binhex} % required by newtxmath
459 \TestFont[psyr]{symbol}
460 \TestPackage{tgadventor}
461 \TestPackage{tgbonum}
462 \TestPackage{tgchorus}
463 \TestPackage{tgcursor}
464 \TestPackage{tgheros}
465 \TestPackage{tgpagella}
466 \TestPackage{tgschola}
467 \TestPackage{tgtermes}
468 \TestFont[ugmr8r]{ugm}
469 \TestFont[uopr8r]{urwclassico}
473 \TestPackage{txfonts}% For the txtt monospaced font
474 % symbol packages supported by LyX for items and the special character dialog
475 % see the unicodesymbols file
479 \TestPackage{marvosym}
480 \TestPackage{pmboxdraw}
481 \TestPackage{textgreek}
482 \TestPackage{tfrupee}
483 \TestFont[wasy10]{wasy}
484 \TestPackage{wasysym}
485 % These packages are disabled in the unicodesymbols file
487 %\TestPackage{txfonts}% But see above!
488 %\TestPackage{pxfonts}
489 %\TestPackage{mathabx}
490 %\TestPackage{mathdesign}% But see above!
493 % The list of layout files has been put in this file here by the
497 \input{chkciteengines}
499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
500 %%%%% END ACTUAL CONFIGURATION INSPECTION CODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%
501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
503 % End of the LaTeX job
504 \immediate\closeout\layouts
505 \immediate\closeout\vars
506 \immediate\closeout\packages
507 \typeout{\prefix Inspection done.}
508 \typeout{\prefix Read the file doc/LaTeXConfig.lyx for more information.}
510 % Get the real \end command, that has been hidden by LaTeX