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 % Only for compatibility. Will be removed later.
201 \let\DeclareSGMLClass=\DeclareDocBookClass
203 \newcommand{\DeclareDocBookClass}[2][\default]{
204 \message{^^J\prefix checking for docbook\space\space class \layoutname... }
205 \@ifundefined{hasdocbook}
207 \AddLayout[#1]{\layoutname}{#2}{false}{docbook}}
209 \AddLayout[#1]{\layoutname}{#2}{true}{}}
212 % Stolen from article.cls
213 \newcommand{\today}{\ifcase\month\or
214 January\or February\or March\or April\or May\or June\or
215 July\or August\or September\or October\or November\or December\fi
216 \space\number\day, \number\year}
218 % Initializes the files
219 \typeout{\prefix Inspecting your LaTeX configuration.}
220 \newwrite{\layouts} \immediate\openout \layouts = textclass.lst.tmp
221 \newwrite{\vars} \immediate\openout \vars = chkconfig.vars
222 \newwrite{\packages} \immediate\openout \packages = packages.lst.tmp
224 \immediate\write\layouts{%
225 # This file declares layouts and their associated definition files.^^J%
226 # It has been automatically generated by configure^^J%
227 # Use "Tools/Reconfigure" if you need to update it after a^^J%
228 # configuration change. Run ./configure manually to update the^^J%
229 # system wide version of this file.}
231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
232 %%%%% ACTUAL CONFIGURATION INSPECTION CODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
235 %%% Add any new package or document class here.
237 %%% First, we want the day on which the test has been run.
238 \AddVariable{date}{\today}
240 %%% Then, the version of LaTeX we are using
241 \message{^^J\prefix checking for LaTeX version... \fmtversion}
242 \AddVariable{fmtversion}{\fmtversion}
245 % This one introduces path encoding changes
246 \TestLaTeXVersion{2019/10/01}
248 %%% And now, the list of available languages
249 % The trick is to know that \the\everyjob contains something like
250 % \typeout{LaTeX2e <2001/06/01>}
251 % \typeout{Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, nohyphenation, loaded.}
252 % All we have to do is to extract the list from there:
253 % (1) concatenate all the messages that are displayed everytime the
254 % format is loaded. The is done by redefining locally \typeout to
255 % append its argument to the macro \mesg.
257 {\def\typeout#1{\xdef\mesg{\mesg #1}}
260 % (2) strip the useless parts from \mesg. This uses the fact that TeX
261 % allows to define macros with parameters delimited by arbitrary text.
262 \def\platexname{pLaTeX2e}
263 \ifx\pfmtname\platexname
266 \def\strip#1patterns for #2, loaded.#3\endmark{\def\langs{#2}}
267 \expandafter\strip\mesg\endmark
270 % (3) handle the result
271 % FIXME: As of 2016, babel does not print out the loaded hyphenation patterns to
272 % the log anymore, so this discontinues to work. For possible workarounds
273 % (with babel), see https://tex.stackexchange.com/questions/330085/
274 % Leaving this activated for the time being, since it probably still
275 % works with older distributions.
276 \message{^^J\prefix checking for available hyphenation patterns... \langs}
277 \AddVariable{languages}{\langs}
279 %%% Check for ec fonts. Most of this code has been shamelessely stolen
280 %%% from the file ltxcheck.tex in the LaTeX distribution. In particular,
281 %%% don't ask me how the macro \ecrm works...
287 {\expandafter\string\csname ecrm\endcsname}%
288 {\expandafter\expandafter\expandafter
289 \string\csname T1/cmr/m/n\endcsname}}%
293 \message{^^J\prefix checking for default encoding (this may take a long time)^^J}
294 \font\test=ecrm1000\relax
297 \message{^^J\prefix\prefix checking for ec fonts... no^^J}
299 \AddVariable{fontenc}{default}
301 \message{^^J\prefix\space\space checking for ec fonts... yes^^J}
302 \message{^^J\prefix\space\space checking for ec support in LaTeX format...}
307 \AddVariable{fontenc}{T1}
308 \message{^^J\prefix\space\space default encoding will be set to T1^^J}
311 \AddVariable{fontenc}{default}
317 \TestPackage{a0poster}
318 \TestPackage{accents}
319 \TestPackage{achicago}
320 \TestPackage{afterpage}
321 \TestPackage{algorithm}
322 \TestPackage{algorithm2e}
323 \TestPackage{amsmath}
324 \TestPackage{amstext}
325 \TestPackage{apacite}
326 \TestPackage{apalike}
327 \TestPackage[arabic.ldf]{arabi}
330 \TestPackage{authordate1-4}
332 \TestPackage{beamerposter}
333 \TestPackage{biblatex}
334 \TestPackage{biblatex-chicago}
335 \TestPackage{bibtopic}
336 \TestPackage{bicaption}
339 \TestPackage{booktabs}
340 \TestPackage{braille}
341 \TestPackage{breakurl}
345 \TestPackage{changebar}
346 \TestPackage{chapterbib}
347 \TestPackage{chemgreek}
348 \TestPackage{chessboard}
349 \TestPackage{chessfss}
350 \TestPackage{chicago}
351 \TestPackage{color} % this one should be there if graphics.sty is there.
352 \TestPackage{covington}
353 \TestPackage{cprotect}
354 \TestPackage{csquotes}
356 \TestPackage[koi8-r.def]{cyrillic}
357 \TestPackage{endnotes}
359 \TestPackage{enumitem}
360 \TestPackage{environ} % required by tcolorbox
362 \TestPackage{eso-pic}
363 \TestPackage{fancybox}
364 \TestPackage{fancyhdr}
365 \TestPackage{filehook}
366 \TestPackage{fixltx2e}
369 \TestPackage{fontspec}
370 \TestPackage{footmisc}
371 \TestPackage{footnote}
372 \TestPackage{footnotehyper}
375 \TestPackage{geometry}
376 \TestPackage{graphicx}
377 \TestPackage[iso-8859-7.def]{greek-inputenc}
378 \TestPackage{harvard}
380 \TestPackage{hyperref}
381 \TestPackage{hyphenat}
384 \TestPackage[japanese.ldf]{japanese}
385 \TestPackage{jurabib}
386 \TestPackage{l3experimental} % required by various packages
387 \TestPackage{l3kernel} % required by various packages
388 \TestPackage{l3packages} % required by various packages
390 \TestPackage{lettrine}
391 \TestPackage{listings}
392 \TestPackage[lithuanian.ldf]{lithuanian}
393 \TestPackage{longtable}
395 \TestPackage{luainputenc}
396 \TestPackage{mathdots}
397 \TestPackage{mathrsfs}
398 \TestPackage{mathtools}
400 \TestPackage[mongolian.ldf]{mongolian}
402 \TestPackage{multirow}
405 \TestPackage{nicefrac}
406 \TestPackage{nomencl}
407 \TestPackage{paralist}
408 \TestPackage{pdfcolmk}
409 \TestPackage{pdflscape}
410 \TestPackage{polyglossia}
411 \TestPackage{pdfcomment}
412 \TestPackage{pdfpages}
413 \TestPackage{pgf} % required by tcolorbox
415 \TestPackage{prettyref}
416 \TestPackage{preview}
417 \TestPackage{refstyle}
418 \TestPackage{rotating}
419 \TestPackage{rotfloat}
420 \TestPackage{sciposter}
421 \TestPackage{sectionbox}
422 \TestPackage[serbianc.ldf]{serbianc}
423 \TestPackage{setspace}
424 \TestPackage{slashed}
426 \TestPackage{splitidx}
427 \TestPackage{stackrel}
428 \TestPackage{stmaryrd}
430 \TestPackage{subscript}
432 \TestPackage{tablefootnote}
433 \TestPackage{tabularx}
434 \TestPackage{tcolorbox}
435 \TestPackage{textcomp}
436 \TestPackage{thswitch}
438 \TestPackage[turkmen.ldf]{turkmen}
440 \TestPackage{undertilde}
441 \TestPackage{unicode-math}
444 \TestPackage{varioref}
445 \TestPackage{varwidth}
446 \TestPackage{wallpaper}
447 \TestPackage{wrapfig}
450 \TestPackage[xetex.def]{xetex-def}
451 \TestPackage{xkeyval}
452 \TestPackage{xltabular}
453 \TestPackage{xskak} % required by chessboard
455 % Packages used by LyX's documentation files
456 \TestPackage{arydshln}
459 \TestPackage{caption}
460 \TestPackage{colortbl}
461 \TestPackage{diagbox}
462 \TestPackage{etoolbox} % required by polyglossia and tcolorbox
463 \TestPackage{eurosym}
465 \TestPackage{makecmds} % required by polyglossia
466 \TestPackage{marginnote}
467 \TestPackage{picinpar}
469 \TestPackage{sidecap}
470 \TestPackage{upgreek}
472 % psnfss is in fact the name of a set of style files, among which
473 % times.sty. If times.sty is here, we will assume that everything is fine.
474 \TestPackage[times.sty]{psnfss}
475 % test the following fonts in case they are not in all versions of psnfss
477 \TestPackage{bookman}
478 \TestPackage{chancery}
479 \TestPackage{charter}
480 \TestPackage{cochineal}
481 \TestPackage{courier}
482 \TestPackage{crimson}
483 \TestPackage{CrimsonPro}
485 \TestPackage{mathpazo}
486 \TestPackage{mathpple}
487 \TestPackage{mathptm}
488 \TestPackage{mathptmx}
489 \TestPackage{newcent}
492 % Other font packages
495 \TestPackage{biolinum}
496 \TestPackage{biolinum-type1}
497 %\TestFont[glic1000]{cbgreek}% for Greek % suported by LyX but too large to force downloading
498 \TestPackage{cantarell}
499 \TestPackage{ccfonts}
501 \TestFont[ccr10]{concrete} % required by ccfonts
502 \TestFont[eorm10]{ecc} % required by ccfonts
503 \TestPackage[ot1ccr.fd]{concmath} % required by ccfonts
504 \TestPackage{cmbright}
505 \TestPackage{DejaVuSans}
506 \TestPackage{DejaVuSansCondensed}
507 \TestPackage{DejaVuSansMono}
508 \TestPackage{DejaVuSerif}
509 \TestPackage{DejaVuSerifCondensed}
511 \TestPackage{eulervm}
513 \TestPackage{fourier}
514 \TestPackage{FiraMono}
515 \TestPackage{FiraSans}
516 \TestPackage{garamondx}
517 \TestPackage{plex-serif}
518 \TestPackage{plex-sans}
519 \TestPackage{plex-mono}
520 \TestPackage{sourceserifpro}
521 \TestPackage{sourcesanspro}
522 \TestPackage{sourcecodepro}
523 \TestFont[zgmr8r]{garamondx-fonts}
527 \TestPackage{fontaxes} % required by libertine
528 \TestPackage{libertine}
529 \TestPackage{libertine-type1}
530 \TestPackage{libertineMono-type1}
531 \TestPackage{libertineMono}
532 \TestPackage{libertineRoman}
533 \TestPackage{lmodern}
534 \TestPackage{luximono}
535 \TestPackage{mathdesign}% for Roman fonts
539 \TestPackage{menukeys}
540 \TestPackage{MinionPro}
541 \TestFont[rzmnr]{minion2newtx}
542 \TestPackage{newtxmath}
543 \TestPackage[binhex.tex]{binhex} % required by newtxmath
545 \TestPackage{noto-serif}
546 \TestPackage{noto-sans}
547 \TestPackage{noto-mono}
548 \TestPackage{paratype}
549 \TestFont[psyr]{symbol}
550 \TestPackage{tgadventor}
551 \TestPackage{tgbonum}
552 \TestPackage{tgchorus}
553 \TestPackage{tgcursor}
554 \TestPackage{tgheros}
555 \TestPackage{tgpagella}
556 \TestPackage{tgschola}
557 \TestPackage{tgtermes}
558 \TestFont[ugmr8r]{ugm}
559 \TestFont[uopr8r]{urwclassico}
563 \TestPackage{txfonts}% For the txtt monospaced font
564 \TestPackage{XCharter}
565 % symbol packages supported by LyX for items and the special character dialog
566 % see the unicodesymbols file
570 \TestPackage{marvosym}
571 \TestPackage{pmboxdraw}
572 \TestPackage{textgreek}
573 \TestPackage{tfrupee}
574 \TestFont[wasy10]{wasy}
575 \TestPackage{wasysym}
576 % These packages are disabled in the unicodesymbols file
578 %\TestPackage{txfonts}% But see above!
579 %\TestPackage{pxfonts}
580 %\TestPackage{mathabx}
581 %\TestPackage{mathdesign}% But see above!
583 %%% Specific package versions
584 % This only works if the package has been loaded before
585 \IfFileExists{babel.sty}{\RequirePackage{babel}}{}
586 \TestPackageVersion{babel}{2017/11/03}
589 % The list of layout files has been put in this file here by the
593 \input{chkciteengines}
595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
596 %%%%% END ACTUAL CONFIGURATION INSPECTION CODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%
597 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
599 % End of the LaTeX job
600 \immediate\closeout\layouts
601 \immediate\closeout\vars
602 \immediate\closeout\packages
603 \typeout{\prefix Inspection done.}
604 \typeout{\prefix Read the file doc/LaTeXConfig.lyx for more information.}
606 % Get the real \end command, that has been hidden by LaTeX