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{bibtopic}
287 \TestPackage{bicaption}
290 \TestPackage{booktabs}
291 \TestPackage{braille}
292 \TestPackage{breakurl}
293 \TestPackage{CJKutf8}
296 \TestPackage{chemgreek}
297 \TestPackage{chicago}
298 \TestPackage{color} % this one should be there if graphics.sty is there.
299 \TestPackage{covington}
300 \TestPackage{csquotes}
301 \TestPackage[koi8-r.def]{cyrillic}
302 \TestPackage{dvipost}
303 \TestPackage{endnotes}
304 \TestPackage{enumitem}
305 \TestPackage{environ} % required by tcolorbox
307 \TestPackage{eso-pic}
308 \TestPackage{fancybox}
309 \TestPackage{fancyhdr}
310 \TestPackage{filehook}
311 \TestPackage{fixltx2e}
314 \TestPackage{fontspec}
315 \TestPackage{footmisc}
318 \TestPackage{geometry}
319 \TestPackage{graphicx}
320 \TestPackage[iso-8859-7.def]{greek-inputenc}
321 \TestPackage{harvard}
323 \TestPackage{hyperref}
324 \TestPackage{hyphenat}
327 \TestPackage[japanese.ldf]{japanese}
328 \TestPackage{jurabib}
330 \TestPackage{lettrine}
331 \TestPackage{listings}
332 \TestPackage[lithuanian.ldf]{lithuanian}
333 \TestPackage{longtable}
334 \TestPackage{luainputenc}
335 \TestPackage{mathdots}
336 \TestPackage{mathrsfs}
337 \TestPackage{mathtools}
339 \TestPackage[mongolian.ldf]{mongolian}
341 \TestPackage{multirow}
344 \TestPackage{nicefrac}
345 \TestPackage{nomencl}
346 \TestPackage{paralist}
347 \TestPackage{pdfcolmk}
348 \TestPackage{polyglossia}
349 \TestPackage{pdfcomment}
350 \TestPackage{pdfpages}
351 \TestPackage{pgf} % required by tcolorbox
352 \TestPackage{prettyref}
353 \TestPackage{preview}
354 \TestPackage{refstyle}
355 \TestPackage{rotating}
356 \TestPackage{rotfloat}
357 \TestPackage{sciposter}
358 \TestPackage{sectionbox}
359 \TestPackage[serbianc.ldf]{serbianc}
360 \TestPackage{setspace}
361 \TestPackage{slashed}
363 \TestPackage{splitidx}
364 \TestPackage{stackrel}
365 \TestPackage{stmaryrd}
367 \TestPackage{subscript}
369 \TestPackage{tcolorbox}
370 \TestPackage{textcomp}
371 \TestPackage{thswitch}
372 \TestPackage[turkmen.ldf]{turkmen}
374 \TestPackage{undertilde}
375 \TestPackage{unicode-math}
378 \TestPackage{varioref}
379 \TestPackage{varwidth}
380 \TestPackage[vietnamese.ldf]{vietnamese}
381 \TestPackage{wallpaper}
382 \TestPackage{wrapfig}
385 \TestPackage[xetex.def]{xetex-def}
386 \TestPackage{xkeyval}
388 % Packages used by LyX's documentation files
389 \TestPackage{arydshln}
392 \TestPackage{caption}
393 \TestPackage{colortbl}
394 \TestPackage{diagbox}
395 \TestPackage{etoolbox} % required by polyglossia and tcolorbox
396 \TestPackage{eurosym}
398 \TestPackage{makecmds} % required by polyglossia
399 \TestPackage{marginnote}
400 \TestPackage{picinpar}
402 \TestPackage{sidecap}
403 \TestPackage{upgreek}
405 % psnfss is in fact the name of a set of style files, among which
406 % times.sty. If times.sty is here, we will assume that everything is fine.
407 \TestPackage[times.sty]{psnfss}
408 % test the following fonts in case they are not in all versions of psnfss
410 \TestPackage{bookman}
411 \TestPackage{chancery}
412 \TestPackage{charter}
413 \TestPackage{courier}
415 \TestPackage{mathpazo}
416 \TestPackage{mathpple}
417 \TestPackage{mathptm}
418 \TestPackage{mathptmx}
419 \TestPackage{newcent}
422 % Other font packages
425 \TestPackage{biolinum-type1}
426 %\TestFont[glic1000]{cbgreek}% for Greek % suported by LyX but too large to force downloading
427 \TestPackage{ccfonts}
428 \TestFont[ccr10]{concrete} % required by ccfonts
429 \TestFont[eorm10]{ecc} % required by ccfonts
430 \TestPackage[ot1ccr.fd]{concmath} % required by ccfonts
431 \TestPackage{cmbright}
433 \TestPackage{eulervm}
435 \TestPackage{fourier}
436 \TestPackage{garamondx}
437 \TestFont[zgmr8r]{garamondx-fonts}
441 \TestPackage{libertine}
442 \TestPackage{fontaxes} % required by libertine
443 \TestPackage{libertine-type1}
444 \TestPackage{libertineMono-type1}
445 \TestPackage{lmodern}
446 \TestPackage{luximono}
447 \TestPackage{mathdesign}% for Roman fonts
451 \TestPackage{MinionPro}
452 \TestFont[rzmnr]{minion2newtx}
453 \TestPackage{newtxmath}
454 \TestPackage[binhex.tex]{binhex} % required by newtxmath
455 \TestFont[psyr]{symbol}
456 \TestPackage{tgadventor}
457 \TestPackage{tgbonum}
458 \TestPackage{tgchorus}
459 \TestPackage{tgcursor}
460 \TestPackage{tgheros}
461 \TestPackage{tgpagella}
462 \TestPackage{tgschola}
463 \TestPackage{tgtermes}
464 \TestFont[ugmr8r]{ugm}
465 \TestFont[uopr8r]{urwclassico}
469 \TestPackage{txfonts}% For the txtt monospaced font
470 % symbol packages supported by LyX for items and the special character dialog
471 % see the unicodesymbols file
475 \TestPackage{marvosym}
476 \TestPackage{pmboxdraw}
477 \TestPackage{textgreek}
478 \TestPackage{tfrupee}
479 \TestFont[wasy10]{wasy}
480 \TestPackage{wasysym}
481 % These packages are disabled in the unicodesymbols file
483 %\TestPackage{txfonts}% But see above!
484 %\TestPackage{pxfonts}
485 %\TestPackage{mathabx}
486 %\TestPackage{mathdesign}% But see above!
489 % The list of layout files has been put in this file here by the
494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
495 %%%%% END ACTUAL CONFIGURATION INSPECTION CODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%
496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
498 % End of the LaTeX job
499 \immediate\closeout\layouts
500 \immediate\closeout\vars
501 \immediate\closeout\packages
502 \typeout{\prefix Inspection done.}
503 \typeout{\prefix Read the file doc/LaTeXConfig.lyx for more information.}
505 % Get the real \end command, that has been hidden by LaTeX