]> git.lyx.org Git - lyx.git/blob - lib/chkconfig.ltx
ANNOUNCE updates.
[lyx.git] / lib / chkconfig.ltx
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).
5 %
6 % This script should only be run from the configure script to update
7 % the files textclass.lst and doc/LaTeXConfig.lyx
8 %
9 % This script is in fact a complete rewrite of the original chkconfig
10 % script. Expect bugs.
11
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 :-)
16 %%%
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.
29 %%%
30 %%% Since \TestPackage does not find font metric (tfm) files, there's an
31 %%% additional test \TestFont[<file>]{<name>} for this purpose.
32 %%%
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>".
38
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 %%%%%%%%%%%%%%%%%%%%%%% Initialization part (skip) %%%%%%%%%%%%%%%%%%%%%
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42
43 % we do not want to stop on errors
44 \nonstopmode\makeatletter
45
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>.
61 %%%
62
63 \newcommand{\prefix}{+} % the character used by grep to filter 'good' output
64
65 \newcommand{\AddLayout}[5][\default]{
66   \def\default{#2}
67   \@ifundefined{category@#2}{%
68        \immediate\write\layouts{"#2"   "#1"   "#3"   "#4"   "#5"   ""}%
69    }{%
70        \immediate\write\layouts{"#2"   "#1"   "#3"   "#4"   "#5"   "\@nameuse{category@#2}"}%
71    }
72 }
73        
74
75 \newcommand{\AddVariable}[2]{
76   \immediate\write\vars{chk_#1='#2'}}
77
78 \newcommand{\AddPackage}[1]{
79   \immediate\write\packages{#1}}
80
81 % Tests whether an item is present
82 % Syntax: \TestItem[<file>]{<name>}{<type>}{<ext>}{<iftrue>}{<iffalse>}
83 \newif\ifexists
84
85 \newcommand{\TestItem}[6][\default]{
86   \def\default{#2}
87   \def\files{#1}
88   \message{^^J\prefix checking for #3 #2 [#1]...}
89   \let\firstelement\relax
90   \let\missingelements\empty
91   \existstrue
92   \@for\file:=\files\do{
93     \ifx\firstelement\relax
94        \edef\firstelement{\file}
95     \fi
96     \@expandtwoargs\in@{.}{\file}
97     \ifin@
98       \def\myfile{\file}
99     \else
100       \def\myfile{\file.#4}
101     \fi
102     \IfFileExists{\myfile}
103       {}
104       {
105         \existsfalse
106         \ifx\missingelements\empty
107           \edef\missingelements{\myfile}
108         \else
109           \edef\missingelements{\missingelements,\myfile}
110         \fi
111       }
112   }
113   \ifexists
114     \message{yes^^J}
115     \AddVariable{#2}{yes}
116     #5
117   \else
118     \message{no^^J}
119     \AddVariable{#2}{no}
120     #6
121   \fi}
122
123 % Adapted from ltxcheck.tex
124 \newcommand{\TestFont}[2][\default]{
125   \def\default{#2}
126   \batchmode
127   \font\test=#1\relax
128   \nonstopmode
129   \message{^^J\prefix checking for font #2 [#1]...}
130   \ifx\test\nullfont
131     \message{no^^J}
132     \AddVariable{#2}{no}
133     \@tempswatrue
134   \else
135     \message{yes^^J}
136     \AddVariable{#2}{yes}
137     \AddPackage{#2}
138   \fi}
139
140 \newcommand{\TestPackage}[2][\default]{
141   \TestItem[#1]{#2}{package}{sty}{\AddPackage{#2}}{}}
142
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.
149 }
150
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}}
155 }
156
157 \newcommand{\DeclareCategory}[2]{
158    \@ifundefined{category@#1}
159      {\global\@namedef{category@#1}{#2}}%
160      {}% we have already defined this one.
161 }
162
163 % Only for compatibility. Will be removed later.
164 \let\DeclareSGMLClass=\DeclareDocBookClass
165
166 \newcommand{\DeclareDocBookClass}[2][\default]{
167   \message{^^J\prefix checking for docbook\space\space class \layoutname... }
168   \@ifundefined{hasdocbook}
169     {\message{no^^J}
170      \AddLayout[#1]{\layoutname}{#2}{false}{docbook}}
171     {\message{yes^^J}
172      \AddLayout[#1]{\layoutname}{#2}{true}{}}
173 }
174
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}
180
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
186
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.}
193
194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
195 %%%%% ACTUAL CONFIGURATION INSPECTION CODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
197
198 %%% Add any new package or document class here.
199
200 %%% First, we want the day on which the test has been run.
201 \AddVariable{date}{\today}
202
203 %%% Then, the version of LaTeX we are using
204 \message{^^J\prefix checking for LaTeX version... \fmtversion}
205 \AddVariable{fmtversion}{\fmtversion}
206
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.
215 \def\mesg{}
216 {\def\typeout#1{\xdef\mesg{\mesg #1}}
217  \the\everyjob}
218
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
223   \def\langs{japanese}
224 \else
225   \def\strip#1patterns for #2, loaded.#3\endmark{\def\langs{#2}}
226   \expandafter\strip\mesg\endmark
227 \fi
228
229 % (3) handle the result
230 \message{^^J\prefix checking for available hyphenation patterns... \langs}
231 \AddVariable{languages}{\langs}
232
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...
236 \def\ecrm{%
237   \begingroup
238     \escapechar-1
239     \xdef\reserved@a{%
240       \noexpand\in@
241         {\expandafter\string\csname ecrm\endcsname}%
242         {\expandafter\expandafter\expandafter
243            \string\csname T1/cmr/m/n\endcsname}}%
244   \endgroup
245   \reserved@a}
246
247 \message{^^J\prefix checking for default encoding (this may take a long time)^^J}
248 \font\test=ecrm1000\relax
249
250 \ifx\test\nullfont
251   \message{^^J\prefix\prefix checking for ec fonts... no^^J}
252   \AddVariable{ec}{no}
253   \AddVariable{fontenc}{default}
254 \else
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...}
257   \ecrm
258   \ifin@
259     \message{yes^^J}
260     \AddPackage{ec}
261     \AddVariable{fontenc}{T1}
262     \message{^^J\prefix\space\space default encoding will be set to T1^^J}
263   \else
264     \message{no^^J}
265     \AddVariable{fontenc}{default}
266   \fi
267 \fi
268
269
270 %%% Packages
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}
281 \TestPackage{array}
282 \TestPackage{astron}
283 \TestPackage{authordate1-4}
284 \TestPackage{babel}
285 \TestPackage{beamerposter}
286 \TestPackage{biblatex}
287 \TestPackage{bibtopic}
288 \TestPackage{bicaption}
289 \TestPackage{bidi}
290 \TestPackage{bm}
291 \TestPackage{booktabs}
292 \TestPackage{braille}
293 \TestPackage{breakurl}
294 \TestPackage{CJKutf8}
295 \TestPackage{calc}
296 \TestPackage{cancel}
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
308 \TestPackage{esint}
309 \TestPackage{eso-pic}
310 \TestPackage{fancybox}
311 \TestPackage{fancyhdr}
312 \TestPackage{filehook}
313 \TestPackage{fixltx2e}
314 \TestPackage{fix-cm}
315 \TestPackage{float}
316 \TestPackage{fontspec}
317 \TestPackage{footmisc}
318 \TestPackage{footnote}
319 \TestPackage{forest}
320 \TestPackage{framed}
321 \TestPackage{geometry}
322 \TestPackage{graphicx}
323 \TestPackage[iso-8859-7.def]{greek-inputenc}
324 \TestPackage{harvard}
325 \TestPackage{hhline}
326 \TestPackage{hyperref}
327 \TestPackage{hyphenat}
328 \TestPackage{iftex}
329 \TestPackage{ifthen}
330 \TestPackage[japanese.ldf]{japanese}
331 \TestPackage{jurabib}
332 \TestPackage{latex8}
333 \TestPackage{lettrine}
334 \TestPackage{listings}
335 \TestPackage[lithuanian.ldf]{lithuanian}
336 \TestPackage{longtable}
337 \TestPackage{lscape}
338 \TestPackage{luainputenc}
339 \TestPackage{mathdots}
340 \TestPackage{mathrsfs}
341 \TestPackage{mathtools}
342 \TestPackage{mhchem}
343 \TestPackage[mongolian.ldf]{mongolian}
344 \TestPackage{mslapa}
345 \TestPackage{multirow}
346 \TestPackage{named}
347 \TestPackage{natbib}
348 \TestPackage{nicefrac}
349 \TestPackage{nomencl}
350 \TestPackage{paralist}
351 \TestPackage{pdfcolmk}
352 \TestPackage{pdflscape}
353 \TestPackage{polyglossia}
354 \TestPackage{pdfcomment}
355 \TestPackage{pdfpages}
356 \TestPackage{pgf} % required by tcolorbox
357 \TestPackage{prettyref}
358 \TestPackage{preview}
359 \TestPackage{refstyle}
360 \TestPackage{rotating}
361 \TestPackage{rotfloat}
362 \TestPackage{sciposter}
363 \TestPackage{sectionbox}
364 \TestPackage[serbianc.ldf]{serbianc}
365 \TestPackage{setspace}
366 \TestPackage{slashed}
367 \TestPackage{soul}
368 \TestPackage{splitidx}
369 \TestPackage{stackrel}
370 \TestPackage{stmaryrd}
371 \TestPackage{subfig}
372 \TestPackage{subscript}
373 \TestPackage{Sweave}
374 \TestPackage{tablefootnote}
375 \TestPackage{tcolorbox}
376 \TestPackage{textcomp}
377 \TestPackage{thswitch}
378 \TestPackage[turkmen.ldf]{turkmen}
379 \TestPackage{ulem}
380 \TestPackage{undertilde}
381 \TestPackage{unicode-math}
382 \TestPackage{units}
383 \TestPackage{url}
384 \TestPackage{varioref}
385 \TestPackage{varwidth}
386 \TestPackage{wallpaper}
387 \TestPackage{wrapfig}
388 \TestPackage{xargs}
389 \TestPackage{xcolor}
390 \TestPackage[xetex.def]{xetex-def}
391 \TestPackage{xkeyval}
392
393 % Packages used by LyX's documentation files
394 \TestPackage{arydshln}
395 \TestPackage{braket}
396 \TestPackage{cancel}
397 \TestPackage{caption}
398 \TestPackage{colortbl}
399 \TestPackage{diagbox}
400 \TestPackage{etoolbox} % required by polyglossia and tcolorbox
401 \TestPackage{eurosym}
402 \TestPackage{fp}
403 \TestPackage{makecmds} % required by polyglossia
404 \TestPackage{marginnote}
405 \TestPackage{picinpar}
406 \TestPackage{pict2e}
407 \TestPackage{sidecap}
408 \TestPackage{upgreek}
409
410 % psnfss is in fact the name of a set of style files, among which
411 % times.sty. If times.sty is here, we will assume that everything is fine.
412 \TestPackage[times.sty]{psnfss}
413 % test the following fonts in case they are not in all versions of psnfss
414 \TestPackage{avant}
415 \TestPackage{bookman}
416 \TestPackage{chancery}
417 \TestPackage{charter}
418 \TestPackage{cochineal}
419 \TestPackage{courier}
420 \TestPackage{crimson}
421 \TestPackage{helvet}
422 \TestPackage{mathpazo}
423 \TestPackage{mathpple}
424 \TestPackage{mathptm}
425 \TestPackage{mathptmx}
426 \TestPackage{newcent}
427 \TestPackage{pifont}
428 \TestPackage{utopia}
429 % Other font packages
430 \TestPackage{ae}
431 \TestPackage{bera}
432 \TestPackage{biolinum}
433 \TestPackage{biolinum-type1}
434 %\TestFont[glic1000]{cbgreek}% for Greek % suported by LyX but too large to force downloading
435 \TestPackage{ccfonts}
436 \TestFont[ccr10]{concrete} % required by ccfonts
437 \TestFont[eorm10]{ecc} % required by ccfonts
438 \TestPackage[ot1ccr.fd]{concmath} % required by ccfonts
439 \TestPackage{cmbright}
440 \TestPackage{eco}
441 \TestPackage{eulervm}
442 \TestPackage{feyn}
443 \TestPackage{fourier}
444 \TestPackage{garamondx}
445 \TestFont[zgmr8r]{garamondx-fonts}
446 \TestPackage{iwona}
447 \TestPackage{kurier}
448 \TestPackage{lh-lcy}
449 \TestPackage{fontaxes} % required by libertine
450 \TestPackage{libertine}
451 \TestPackage{libertine-type1}
452 \TestPackage{libertineMono-type1}
453 \TestPackage{libertineMono}
454 \TestPackage{libertineRoman}
455 \TestPackage{lmodern}
456 \TestPackage{luximono}
457 \TestPackage{mathdesign}% for Roman fonts
458 \TestPackage{mdbch}
459 \TestPackage{mdput}
460 \TestPackage{mdugm}
461 \TestPackage{MinionPro}
462 \TestFont[rzmnr]{minion2newtx}
463 \TestPackage{newtxmath}
464 \TestPackage{noto}
465 \TestPackage[binhex.tex]{binhex} % required by newtxmath
466 \TestFont[psyr]{symbol}
467 \TestPackage{tgadventor}
468 \TestPackage{tgbonum}
469 \TestPackage{tgchorus}
470 \TestPackage{tgcursor}
471 \TestPackage{tgheros}
472 \TestPackage{tgpagella}
473 \TestPackage{tgschola}
474 \TestPackage{tgtermes}
475 \TestFont[ugmr8r]{ugm}
476 \TestFont[uopr8r]{urwclassico}
477 \TestPackage{tipa}
478 \TestPackage{tipx}
479 \TestPackage{tone}
480 \TestPackage{txfonts}% For the txtt monospaced font
481 % symbol packages supported by LyX for items and the special character dialog
482 % see the unicodesymbols file
483 \TestPackage{ascii}
484 \TestPackage{bbding}
485 \TestPackage{ifsym}
486 \TestPackage{marvosym}
487 \TestPackage{pmboxdraw}
488 \TestPackage{textgreek}
489 \TestPackage{tfrupee}
490 \TestFont[wasy10]{wasy}
491 \TestPackage{wasysym}
492 % These packages are disabled in the unicodesymbols file
493 % see comment there
494 %\TestPackage{txfonts}% But see above!
495 %\TestPackage{pxfonts}
496 %\TestPackage{mathabx}
497 %\TestPackage{mathdesign}% But see above!
498
499 %%% Document classes
500 % The list of layout files has been put in this file here by the
501 % configure script.
502 \input{chklayouts}
503 \input{chkmodules}
504 \input{chkciteengines}
505
506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
507 %%%%% END ACTUAL CONFIGURATION INSPECTION CODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%
508 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
509
510 % End of the LaTeX job
511 \immediate\closeout\layouts
512 \immediate\closeout\vars
513 \immediate\closeout\packages
514 \typeout{\prefix Inspection done.}
515 \typeout{\prefix Read the file doc/LaTeXConfig.lyx for more information.}
516
517 % Get the real \end command, that has been hidden by LaTeX
518 \@@end