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 % Tests whether an package is present in a specific version (or newer)
124 % Syntax: \TestPackageVersion{<name>}{<yyyy/mm/dd>}
125 % Note: This requires the package to be loaded first
127 \newcommand{\TestPackageVersion}[2]{
128 \message{^^J\prefix checking for package #1 at least as of #2...}
129 \IfFileExists{#1.sty}
131 \@ifpackagelater{#1}{#2}{\existstrue}{\existsfalse}
138 \AddVariable{#1}{yes}
146 % Test for the LaTeX version
147 \newcommand{\TestLaTeXVersion}[1]{
148 \message{^^J\prefix checking for LaTeX version at least as of #1...}
149 \@ifl@t@r\fmtversion{#1}{\existstrue}{\existsfalse}
152 \AddVariable{#1}{yes}
153 \AddPackage{LaTeX-#1}
160 % Adapted from ltxcheck.tex
161 \newcommand{\TestFont}[2][\default]{
166 \message{^^J\prefix checking for font #2 [#1]...}
173 \AddVariable{#2}{yes}
177 \newcommand{\TestPackage}[2][\default]{
178 \TestItem[#1]{#2}{package}{sty}{\AddPackage{#2}}{}}
180 \newcommand{\TestDocClass}[2]{
181 \def\layoutname{#1} % remember the name of the layout file
182 \@ifundefined{layout@#1}
183 {#2 % execute the command
184 \global\@namedef{layout@#1}{}}
185 {} % we have already tried this one.
188 \newcommand{\DeclareLaTeXClass}[2][\default]{
189 \TestItem[#1]{\layoutname}{document class}{cls}
190 {\AddLayout[\firstelement]{\layoutname}{#2}{true}{\missingelements}}
191 {\AddLayout[\firstelement]{\layoutname}{#2}{false}{\missingelements}}
194 \newcommand{\DeclareCategory}[2]{
195 \@ifundefined{category@#1}
196 {\global\@namedef{category@#1}{#2}}%
197 {}% we have already defined this one.
200 % Stolen from article.cls
201 \newcommand{\today}{\ifcase\month\or
202 January\or February\or March\or April\or May\or June\or
203 July\or August\or September\or October\or November\or December\fi
204 \space\number\day, \number\year}
206 % Initializes the files
207 \typeout{\prefix Inspecting your LaTeX configuration.}
208 \newwrite{\layouts} \immediate\openout \layouts = textclass.lst.tmp
209 \newwrite{\vars} \immediate\openout \vars = chkconfig.vars
210 \newwrite{\packages} \immediate\openout \packages = packages.lst.tmp
212 \immediate\write\layouts{%
213 # This file declares layouts and their associated definition files.^^J%
214 # It has been automatically generated by configure^^J%
215 # Use "Tools/Reconfigure" if you need to update it after a^^J%
216 # configuration change. Run ./configure manually to update the^^J%
217 # system wide version of this file.}
219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
220 %%%%% ACTUAL CONFIGURATION INSPECTION CODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223 %%% Add any new package or document class here.
225 %%% First, we want the day on which the test has been run.
226 \AddVariable{date}{\today}
228 %%% Then, the version of LaTeX we are using
229 \message{^^J\prefix checking for LaTeX version... \fmtversion}
230 \AddVariable{fmtversion}{\fmtversion}
233 % This one introduces path encoding changes
234 \TestLaTeXVersion{2019/10/01}
235 % This introduces all math and text spaces
236 % previously only available via amsmath
237 \TestLaTeXVersion{2020/10/01}
239 %%% And now, the list of available languages
240 % The trick is to know that \the\everyjob contains something like
241 % \typeout{LaTeX2e <2001/06/01>}
242 % \typeout{Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, nohyphenation, loaded.}
243 % All we have to do is to extract the list from there:
244 % (1) concatenate all the messages that are displayed everytime the
245 % format is loaded. The is done by redefining locally \typeout to
246 % append its argument to the macro \mesg.
248 {\def\typeout#1{\xdef\mesg{\mesg #1}}
251 % (2) strip the useless parts from \mesg. This uses the fact that TeX
252 % allows to define macros with parameters delimited by arbitrary text.
253 \def\platexname{pLaTeX2e}
254 \ifx\pfmtname\platexname
257 \def\strip#1patterns for #2, loaded.#3\endmark{\def\langs{#2}}
258 \expandafter\strip\mesg\endmark
261 % (3) handle the result
262 % FIXME: As of 2016, babel does not print out the loaded hyphenation patterns to
263 % the log anymore, so this discontinues to work. For possible workarounds
264 % (with babel), see https://tex.stackexchange.com/questions/330085/
265 % Leaving this activated for the time being, since it probably still
266 % works with older distributions.
267 \message{^^J\prefix checking for available hyphenation patterns... \langs}
268 \AddVariable{languages}{\langs}
270 %%% Check for ec fonts. Most of this code has been shamelessely stolen
271 %%% from the file ltxcheck.tex in the LaTeX distribution. In particular,
272 %%% don't ask me how the macro \ecrm works...
278 {\expandafter\string\csname ecrm\endcsname}%
279 {\expandafter\expandafter\expandafter
280 \string\csname T1/cmr/m/n\endcsname}}%
284 \message{^^J\prefix checking for default encoding (this may take a long time)^^J}
285 \font\test=ecrm1000\relax
288 \message{^^J\prefix\prefix checking for ec fonts... no^^J}
290 \AddVariable{fontenc}{default}
292 \message{^^J\prefix\space\space checking for ec fonts... yes^^J}
293 \message{^^J\prefix\space\space checking for ec support in LaTeX format...}
298 \AddVariable{fontenc}{T1}
299 \message{^^J\prefix\space\space default encoding will be set to T1^^J}
302 \AddVariable{fontenc}{default}
308 \TestPackage{a0poster}
309 \TestPackage{accents}
310 \TestPackage{achicago}
311 \TestPackage{afterpage}
312 \TestPackage{algorithm}
313 \TestPackage{algorithm2e}
314 \TestPackage{amsmath}
315 \TestPackage{amstext}
316 \TestPackage{apacite}
317 \TestPackage{apalike}
318 \TestPackage[arabic.ldf]{arabi}
321 \TestPackage{authordate1-4}
323 \TestPackage{beamerposter}
324 \TestPackage{biblatex}
325 \TestPackage{biblatex-chicago}
326 \TestPackage{bibtopic}
327 \TestPackage{bicaption}
330 \TestPackage{booktabs}
331 \TestPackage{braille}
332 \TestPackage{breakurl}
336 \TestPackage{changebar}
337 \TestPackage{chapterbib}
338 \TestPackage{chemgreek}
339 \TestPackage{chessboard}
340 \TestPackage{chessfss}
341 \TestPackage{chicago}
342 \TestPackage{color} % this one should be there if graphics.sty is there.
343 \TestPackage{covington}
344 \TestPackage{cprotect}
345 \TestPackage{csquotes}
347 \TestPackage[koi8-r.def]{cyrillic}
348 \TestPackage{endnotes}
350 \TestPackage{enumitem}
351 \TestPackage{environ} % required by tcolorbox
353 \TestPackage{eso-pic}
354 \TestPackage{fancybox}
355 \TestPackage{fancyhdr}
356 \TestPackage{filehook}
357 \TestPackage{fixltx2e}
360 \TestPackage{fontspec}
361 \TestPackage{footmisc}
362 \TestPackage{footnote}
363 \TestPackage{footnotehyper}
366 \TestPackage{geometry}
367 \TestPackage{graphicx}
368 \TestPackage[iso-8859-7.def]{greek-inputenc}
369 \TestPackage{harvard}
371 \TestPackage{hyperref}
372 \TestPackage{hyphenat}
375 \TestPackage[japanese.ldf]{japanese}
376 \TestPackage{jurabib}
377 \TestPackage{l3experimental} % required by various packages
378 \TestPackage{l3kernel} % required by various packages
379 \TestPackage{l3packages} % required by various packages
381 \TestPackage{lettrine}
382 \TestPackage{listings}
383 \TestPackage[lithuanian.ldf]{lithuanian}
384 \TestPackage{longtable}
386 \TestPackage{luainputenc}
387 \TestPackage{mathdots}
388 \TestPackage{mathrsfs}
389 \TestPackage{mathtools}
391 \TestPackage[mongolian.ldf]{mongolian}
393 \TestPackage{multirow}
396 \TestPackage{nicefrac}
397 \TestPackage{nomencl}
398 \TestPackage{paralist}
399 \TestPackage{parskip}
400 \TestPackage{pdfcolmk}
401 \TestPackage{pdflscape}
402 \TestPackage{polyglossia}
403 \TestPackage{pdfcomment}
404 \TestPackage{pdfpages}
405 \TestPackage{pgf} % required by tcolorbox
407 \TestPackage{prettyref}
408 \TestPackage{preview}
409 \TestPackage{refstyle}
410 \TestPackage{rotating}
411 \TestPackage{rotfloat}
412 \TestPackage{sciposter}
413 \TestPackage{sectionbox}
414 \TestPackage[serbianc.ldf]{serbianc}
415 \TestPackage{setspace}
416 \TestPackage{slashed}
418 \TestPackage{splitidx}
419 \TestPackage{stackrel}
420 \TestPackage{stmaryrd}
422 \TestPackage{subscript}
424 \TestPackage{tablefootnote}
425 \TestPackage{tabularx}
426 \TestPackage{tcolorbox}
427 \TestPackage{textcomp}
428 \TestPackage{thswitch}
430 \TestPackage[turkmen.ldf]{turkmen}
432 \TestPackage{undertilde}
433 \TestPackage{unicode-math}
436 \TestPackage{varioref}
437 \TestPackage{varwidth}
438 \TestPackage{wallpaper}
439 \TestPackage{wrapfig}
442 \TestPackage[xetex.def]{xetex-def}
443 \TestPackage{xkeyval}
444 \TestPackage{xltabular}
445 \TestPackage{xskak} % required by chessboard
447 % Packages used by LyX's documentation files
448 \TestPackage{arydshln}
451 \TestPackage{caption}
452 \TestPackage{colortbl}
453 \TestPackage{diagbox}
454 \TestPackage{etoolbox} % required by polyglossia and tcolorbox
455 \TestPackage{eurosym}
457 \TestPackage{makecmds} % required by polyglossia
458 \TestPackage{marginnote}
459 \TestPackage{picinpar}
461 \TestPackage{sidecap}
462 \TestPackage{upgreek}
464 % psnfss is in fact the name of a set of style files, among which
465 % times.sty. If times.sty is here, we will assume that everything is fine.
466 \TestPackage[times.sty]{psnfss}
467 % test the following fonts in case they are not in all versions of psnfss
469 \TestPackage{bookman}
470 \TestPackage{chancery}
471 \TestPackage{charter}
472 \TestPackage{cochineal}
473 \TestPackage{courier}
474 \TestPackage{crimson}
475 \TestPackage{CrimsonPro}
477 \TestPackage{mathpazo}
478 \TestPackage{mathpple}
479 \TestPackage{mathptm}
480 \TestPackage{mathptmx}
481 \TestPackage{newcent}
484 % Other font packages
487 \TestPackage{biolinum}
488 \TestPackage{biolinum-type1}
489 %\TestFont[glic1000]{cbgreek}% for Greek % suported by LyX but too large to force downloading
490 \TestPackage{cantarell}
491 \TestPackage{ccfonts}
493 \TestFont[ccr10]{concrete} % required by ccfonts
494 \TestFont[eorm10]{ecc} % required by ccfonts
495 \TestPackage[ot1ccr.fd]{concmath} % required by ccfonts
496 \TestPackage{cmbright}
497 \TestPackage{DejaVuSans}
498 \TestPackage{DejaVuSansCondensed}
499 \TestPackage{DejaVuSansMono}
500 \TestPackage{DejaVuSerif}
501 \TestPackage{DejaVuSerifCondensed}
503 \TestPackage{eulervm}
505 \TestPackage{fourier}
506 \TestPackage{FiraMono}
507 \TestPackage{FiraSans}
508 \TestPackage{garamondx}
509 \TestPackage{plex-serif}
510 \TestPackage{plex-sans}
511 \TestPackage{plex-mono}
512 \TestPackage{sourceserifpro}
513 \TestPackage{sourcesanspro}
514 \TestPackage{sourcecodepro}
515 \TestFont[zgmr8r]{garamondx-fonts}
519 \TestPackage{fontaxes} % required by libertine
520 \TestPackage{libertine}
521 \TestPackage{libertine-type1}
522 \TestPackage{libertineMono-type1}
523 \TestPackage{libertineMono}
524 \TestPackage{libertineRoman}
525 \TestPackage{libertinus}
526 \TestPackage{libertinust1math}
527 \TestPackage{lmodern}
528 \TestPackage{luximono}
529 \TestPackage{mathdesign}% for Roman fonts
533 \TestPackage{menukeys}
534 \TestPackage{MinionPro}
535 \TestFont[rzmnr]{minion2newtx}
536 \TestPackage{newtxmath}
537 \TestPackage[binhex.tex]{binhex} % required by newtxmath
539 \TestPackage{noto-serif}
540 \TestPackage{noto-sans}
541 \TestPackage{noto-mono}
542 \TestPackage{paratype}
543 \TestFont[psyr]{symbol}
544 \TestPackage{tgadventor}
545 \TestPackage{tgbonum}
546 \TestPackage{tgchorus}
547 \TestPackage{tgcursor}
548 \TestPackage{tgheros}
549 \TestPackage{tgpagella}
550 \TestPackage{tgschola}
551 \TestPackage{tgtermes}
552 \TestFont[ugmr8r]{ugm}
553 \TestFont[uopr8r]{urwclassico}
557 \TestPackage{txfonts}% For the txtt monospaced font
558 \TestPackage{XCharter}
559 % symbol packages supported by LyX for items and the special character dialog
560 % see the unicodesymbols file
564 \TestPackage{marvosym}
565 \TestPackage{pmboxdraw}
566 \TestPackage{textgreek}
567 \TestPackage{tfrupee}
568 \TestFont[wasy10]{wasy}
569 \TestPackage{wasysym}
570 % These packages are disabled in the unicodesymbols file
572 %\TestPackage{txfonts}% But see above!
573 %\TestPackage{pxfonts}
574 %\TestPackage{mathabx}
575 %\TestPackage{mathdesign}% But see above!
577 %%% Specific package versions
578 % This only works if the package has been loaded before
579 \IfFileExists{babel.sty}{\RequirePackage{babel}}{}
580 \TestPackageVersion{babel}{2017/11/03}
583 % The list of layout files has been put in this file here by the
587 \input{chkciteengines}
589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
590 %%%%% END ACTUAL CONFIGURATION INSPECTION CODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%
591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
593 % End of the LaTeX job
594 \immediate\closeout\layouts
595 \immediate\closeout\vars
596 \immediate\closeout\packages
597 \typeout{\prefix Inspection done.}
598 \typeout{\prefix Read the file doc/LaTeXConfig.lyx for more information.}
600 % Get the real \end command, that has been hidden by LaTeX