]> git.lyx.org Git - lyx.git/blob - lib/chkconfig.ltx
remerge he.po
[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}[2][]{
79   \immediate\write\packages{#2 #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 % Tests whether an package is present and also adds the version to the package list
124 \newcommand{\TestPackageAddVersion}[2][\default]{
125    \def\default{#2}
126    \def\package@version{}
127    % The actual test only works after the package has been loaded
128    \IfFileExists{#1.sty}{%
129       \RequirePackage{#1}%
130       \protected@edef\package@@version{\csname ver@#1.sty\endcsname}%
131       \protected@edef\package@version{\expandafter\@parse@version\package@@version//00\@nil}%
132    }{}
133    \TestItem[#1]{#2}{package}{sty}{\AddPackage[\package@version]{#2}}{}
134 }
135
136 % Adapted from ltxcheck.tex
137 \newcommand{\TestFont}[2][\default]{
138   \def\default{#2}
139   \batchmode
140   \font\test=#1\relax
141   \nonstopmode
142   \message{^^J\prefix checking for font #2 [#1]...}
143   \ifx\test\nullfont
144     \message{no^^J}
145     \AddVariable{#2}{no}
146     \@tempswatrue
147   \else
148     \message{yes^^J}
149     \AddVariable{#2}{yes}
150     \AddPackage{#2}
151   \fi}
152
153 \newcommand{\TestPackage}[2][\default]{
154   \def\default{#2}
155   \TestItem[#1]{#2}{package}{sty}{\AddPackage{#2}}{}}
156
157 \newcommand{\TestDocClass}[2]{
158    \def\layoutname{#1}  % remember the name of the layout file
159    \@ifundefined{layout@#1}
160      {#2  % execute the command
161       \global\@namedef{layout@#1}{}}
162      {} % we have already tried this one.
163 }
164
165 \newcommand{\DeclareLaTeXClass}[2][\default]{
166   \TestItem[#1]{\layoutname}{document class}{cls}
167            {\AddLayout[\firstelement]{\layoutname}{#2}{true}{\missingelements}}
168            {\AddLayout[\firstelement]{\layoutname}{#2}{false}{\missingelements}}
169 }
170
171 \newcommand{\DeclareCategory}[2]{
172    \@ifundefined{category@#1}
173      {\global\@namedef{category@#1}{#2}}%
174      {}% we have already defined this one.
175 }
176
177 % Stolen from article.cls
178 \newcommand{\today}{\ifcase\month\or
179   January\or February\or March\or April\or May\or June\or
180   July\or August\or September\or October\or November\or December\fi
181   \space\number\day, \number\year}
182
183 % Initializes the files
184 \typeout{\prefix Inspecting your LaTeX configuration.}
185 \newwrite{\layouts} \immediate\openout \layouts = textclass.lst.tmp
186 \newwrite{\vars} \immediate\openout \vars = chkconfig.vars
187 \newwrite{\packages} \immediate\openout \packages = packages.lst.tmp
188 % Version of the packages list
189 \immediate\write\packages{!!fileformat 2}
190
191 \immediate\write\layouts{%
192 # This file declares layouts and their associated definition files.^^J%
193 # It has been automatically generated by configure^^J%
194 # Use "Tools/Reconfigure" if you need to update it after a^^J%
195 # configuration change. Run ./configure manually to update the^^J%
196 # system wide version of this file.}
197
198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
199 %%%%% ACTUAL CONFIGURATION INSPECTION CODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
201
202 %%% Add any new package or document class here.
203
204 %%% First, we want the day on which the test has been run.
205 \AddVariable{date}{\today}
206
207 %%% Then, the version of LaTeX we are using
208 \message{^^J\prefix checking for LaTeX version... \fmtversion}
209 \AddVariable{fmtversion}{\fmtversion}
210
211 %%% Store the current LaTeX version
212 \AddPackage[\expandafter\@parse@version\fmtversion//00\@nil]{LaTeX}
213
214 %%% And now, the list of available languages
215 % The trick is to know that \the\everyjob contains something like
216 %  \typeout{LaTeX2e <2001/06/01>}
217 %  \typeout{Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, nohyphenation, loaded.}
218 % All we have to do is to extract the list from there:
219 % (1) concatenate all the messages that are displayed everytime the
220 % format is loaded. The is done by redefining locally \typeout to
221 % append its argument to the macro \mesg.
222 \def\mesg{}
223 {\def\typeout#1{\xdef\mesg{\mesg #1}}
224  \the\everyjob}
225
226 % (2) strip the useless parts from \mesg. This uses the fact that TeX
227 % allows to define macros with parameters delimited by arbitrary text.
228 \def\platexname{pLaTeX2e}
229 \ifx\pfmtname\platexname
230   \def\langs{japanese}
231 \else
232   \def\strip#1patterns for #2, loaded.#3\endmark{\def\langs{#2}}
233   \expandafter\strip\mesg\endmark
234 \fi
235
236 % (3) handle the result
237 % FIXME: As of 2016, babel does not print out the loaded hyphenation patterns to
238 %        the log anymore, so this discontinues to work. For possible workarounds
239 %        (with babel), see https://tex.stackexchange.com/questions/330085/
240 %        Leaving this activated for the time being, since it probably still
241 %        works with older distributions.
242 \message{^^J\prefix checking for available hyphenation patterns... \langs}
243 \AddVariable{languages}{\langs}
244
245 %%% Check for ec fonts. Most of this code has been shamelessely stolen
246 %%% from the file ltxcheck.tex in the LaTeX distribution. In particular,
247 %%% don't ask me how the macro \ecrm works...
248 \def\ecrm{%
249   \begingroup
250     \escapechar-1
251     \xdef\reserved@a{%
252       \noexpand\in@
253         {\expandafter\string\csname ecrm\endcsname}%
254         {\expandafter\expandafter\expandafter
255            \string\csname T1/cmr/m/n\endcsname}}%
256   \endgroup
257   \reserved@a}
258
259 \message{^^J\prefix checking for default encoding (this may take a long time)^^J}
260 \font\test=ecrm1000\relax
261
262 \ifx\test\nullfont
263   \message{^^J\prefix\prefix checking for ec fonts... no^^J}
264   \AddVariable{ec}{no}
265   \AddVariable{fontenc}{default}
266 \else
267   \message{^^J\prefix\space\space checking for ec fonts... yes^^J}
268   \message{^^J\prefix\space\space checking for ec support in LaTeX format...}
269   \ecrm
270   \ifin@
271     \message{yes^^J}
272     \AddPackage{ec}
273     \AddVariable{fontenc}{T1}
274     \message{^^J\prefix\space\space default encoding will be set to T1^^J}
275   \else
276     \message{no^^J}
277     \AddVariable{fontenc}{default}
278   \fi
279 \fi
280
281
282 %%% Packages
283 \TestPackage{a0poster}
284 \TestPackage{accents}
285 \TestPackage{achicago}
286 \TestPackage{afterpage}
287 \TestPackage{algorithm}
288 \TestPackage{algorithm2e}
289 \TestPackage{amsmath}
290 \TestPackage{amstext}
291 \TestPackage{apacite}
292 \TestPackage{apalike}
293 \TestPackage[arabic.ldf]{arabi}
294 \TestPackage{array}
295 \TestPackage{astron}
296 \TestPackage{authordate1-4}
297 \TestPackageAddVersion{babel}
298 \TestPackage{beamerposter}
299 \TestPackage{biblatex}
300 \TestPackage{biblatex-chicago}
301 \TestPackage{bibtopic}
302 \TestPackage{bicaption}
303 \TestPackage{bidi}
304 \TestPackage{bm}
305 \TestPackage{booktabs}
306 \TestPackage{braille}
307 \TestPackage{breakurl}
308 \TestPackage{CJK}
309 \TestPackage{calc}
310 \TestPackage{cancel}
311 \TestPackage{changebar}
312 \TestPackage{chapterbib}
313 \TestPackage{chemgreek}
314 \TestPackage{chessboard}
315 \TestPackage{chessfss}
316 \TestPackage{chicago}
317 \TestPackage{color} % this one should be there if graphics.sty is there.
318 \TestPackage{covington}
319 \TestPackage{cprotect}
320 \TestPackage{csquotes}
321 \TestPackage{drs}
322 \TestPackage[koi8-r.def]{cyrillic}
323 \TestPackage{endnotes}
324 \TestPackage{enotez}
325 \TestPackage{enumitem}
326 \TestPackage{environ} % required by tcolorbox
327 \TestPackage{esint}
328 \TestPackage{eso-pic}
329 \TestPackage{fancybox}
330 \TestPackage{fancyhdr}
331 \TestPackage{filehook}
332 \TestPackage{fixltx2e}
333 \TestPackage{fix-cm}
334 \TestPackage{float}
335 \TestPackage{fontspec}
336 \TestPackage{footmisc}
337 \TestPackage{footnote}
338 \TestPackage{footnotehyper}
339 \TestPackage{forest}
340 \TestPackage{framed}
341 \TestPackage{geometry}
342 \TestPackage{graphicx}
343 \TestPackage[iso-8859-7.def]{greek-inputenc}
344 \TestPackage{harvard}
345 \TestPackage{hhline}
346 \TestPackageAddVersion{hyperref}
347 \TestPackage{hyphenat}
348 \TestPackage{iftex}
349 \TestPackage{ifthen}
350 \TestPackage[japanese.ldf]{japanese}
351 \TestPackage{jurabib}
352 \TestPackage{l3experimental} % required by various packages
353 \TestPackage{l3kernel} % required by various packages
354 \TestPackage{l3packages} % required by various packages
355 \TestPackage{latex8}
356 \TestPackage{lettrine}
357 \TestPackage{listings}
358 \TestPackage[lithuanian.ldf]{lithuanian}
359 \TestPackage{longtable}
360 \TestPackage{lscape}
361 \TestPackage{luainputenc}
362 \TestPackage{mathdots}
363 \TestPackage{mathrsfs}
364 \TestPackage{mathtools}
365 \TestPackage{mhchem}
366 \TestPackage[mongolian.ldf]{mongolian}
367 \TestPackage{mslapa}
368 \TestPackageAddVersion{multirow}
369 \TestPackage{named}
370 \TestPackage{natbib}
371 \TestPackage{nicefrac}
372 \TestPackage{nomencl}
373 \TestPackage{paralist}
374 \TestPackage{parskip}
375 \TestPackage{pdfcolmk}
376 \TestPackage{pdflscape}
377 \TestPackage{polyglossia}
378 \TestPackage{pdfcomment}
379 \TestPackage{pdfpages}
380 \TestPackage{pgf} % required by tcolorbox
381 \TestPackage{pict2e}
382 \TestPackage{prettyref}
383 \TestPackage{preview}
384 \TestPackage{refstyle}
385 \TestPackage{rotating}
386 \TestPackage{rotfloat}
387 \TestPackage{sciposter}
388 \TestPackage{sectionbox}
389 \TestPackage[serbianc.ldf]{serbianc}
390 \TestPackage{setspace}
391 \TestPackage{slashed}
392 \TestPackage{soul}
393 \TestPackage{splitidx}
394 \TestPackage{stackrel}
395 \TestPackage{stmaryrd}
396 \TestPackage{subfig}
397 \TestPackage{subscript}
398 \TestPackage{Sweave}
399 \TestPackage{tablefootnote}
400 \TestPackage{tabularx}
401 \TestPackage{tcolorbox}
402 \TestPackage{textcomp}
403 \TestPackage{thswitch}
404 \TestPackage{tikz}
405 \TestPackage[turkmen.ldf]{turkmen}
406 \TestPackageAddVersion{ucs}
407 \TestPackage{ulem}
408 \TestPackage{undertilde}
409 \TestPackage{unicode-math}
410 \TestPackage{units}
411 \TestPackage{url}
412 \TestPackage{varioref}
413 \TestPackage{varwidth}
414 \TestPackage{wallpaper}
415 \TestPackage{wrapfig}
416 \TestPackage{xargs}
417 \TestPackage{xcolor}
418 \TestPackage[xetex.def]{xetex-def}
419 \TestPackage{xkeyval}
420 \TestPackage{xltabular}
421 \TestPackage{xskak} % required by chessboard
422
423 % Packages used by LyX's documentation files
424 \TestPackage{arydshln}
425 \TestPackage{braket}
426 \TestPackage{cancel}
427 \TestPackage{caption}
428 \TestPackage{colortbl}
429 \TestPackage{diagbox}
430 \TestPackage{etoolbox} % required by polyglossia and tcolorbox
431 \TestPackage{eurosym}
432 \TestPackage{fp}
433 \TestPackage{makecmds} % required by polyglossia
434 \TestPackage{marginnote}
435 \TestPackage{picinpar}
436 \TestPackage{pict2e}
437 \TestPackage{sidecap}
438 \TestPackage{upgreek}
439
440 % psnfss is in fact the name of a set of style files, among which
441 % times.sty. If times.sty is here, we will assume that everything is fine.
442 \TestPackage[times.sty]{psnfss}
443 % test the following fonts in case they are not in all versions of psnfss
444 \TestPackage{avant}
445 \TestPackage{bookman}
446 \TestPackage{chancery}
447 \TestPackage{charter}
448 \TestPackage{cochineal}
449 \TestPackage{courier}
450 \TestPackage{crimson}
451 \TestPackage{CrimsonPro}
452 \TestPackage{helvet}
453 \TestPackage{mathpazo}
454 \TestPackage{mathpple}
455 \TestPackage{mathptm}
456 \TestPackage{mathptmx}
457 \TestPackage{newcent}
458 \TestPackage{pifont}
459 \TestPackage{utopia}
460 % Other font packages
461 \TestPackage{ae}
462 \TestPackage{bera}
463 \TestPackage{biolinum}
464 \TestPackage{biolinum-type1}
465 %\TestFont[glic1000]{cbgreek}% for Greek % suported by LyX but too large to force downloading
466 \TestPackage{cantarell}
467 \TestPackage{ccfonts}
468 \TestPackage{Chivo}
469 \TestFont[ccr10]{concrete} % required by ccfonts
470 \TestFont[eorm10]{ecc} % required by ccfonts
471 \TestPackage[ot1ccr.fd]{concmath} % required by ccfonts
472 \TestPackage{cmbright}
473 \TestPackage{DejaVuSans}
474 \TestPackage{DejaVuSansCondensed}
475 \TestPackage{DejaVuSansMono}
476 \TestPackage{DejaVuSerif}
477 \TestPackage{DejaVuSerifCondensed}
478 \TestPackage{eco}
479 \TestPackage{eulervm}
480 \TestPackage{feyn}
481 \TestPackage{fourier}
482 \TestPackage{FiraMono}
483 \TestPackage{FiraSans}
484 \TestPackage{garamondx}
485 \TestPackage{plex-serif}
486 \TestPackage{plex-sans}
487 \TestPackage{plex-mono}
488 \TestPackage{sourceserifpro}
489 \TestPackage{sourcesanspro}
490 \TestPackage{sourcecodepro}
491 \TestFont[zgmr8r]{garamondx-fonts}
492 \TestPackage{iwona}
493 \TestPackage{kurier}
494 \TestPackage{lh-lcy}
495 \TestPackage{fontaxes} % required by libertine
496 \TestPackage{libertine}
497 \TestPackage{libertine-type1}
498 \TestPackage{libertineMono-type1}
499 \TestPackage{libertineMono}
500 \TestPackage{libertineRoman}
501 \TestPackage{libertinus}
502 \TestPackage{libertinust1math}
503 \TestPackage{lmodern}
504 \TestPackage{luximono}
505 \TestPackage{mathdesign}% for Roman fonts
506 \TestPackage{mdbch}
507 \TestPackage{mdput}
508 \TestPackage{mdugm}
509 \TestPackage{menukeys}
510 \TestPackage{MinionPro}
511 \TestFont[rzmnr]{minion2newtx}
512 \TestPackage{newtxmath}
513 \TestPackage[binhex.tex]{binhex} % required by newtxmath
514 \TestPackage{noto}
515 \TestPackage{noto-serif}
516 \TestPackage{noto-sans}
517 \TestPackage{noto-mono}
518 \TestPackage{paratype}
519 \TestFont[psyr]{symbol}
520 \TestPackage{tgadventor}
521 \TestPackage{tgbonum}
522 \TestPackage{tgchorus}
523 \TestPackage{tgcursor}
524 \TestPackage{tgheros}
525 \TestPackage{tgpagella}
526 \TestPackage{tgschola}
527 \TestPackage{tgtermes}
528 \TestFont[ugmr8r]{ugm}
529 \TestFont[uopr8r]{urwclassico}
530 \TestPackage{tipa}
531 \TestPackage{tipx}
532 \TestPackage{tone}
533 \TestPackage{txfonts}% For the txtt monospaced font
534 \TestPackage{XCharter}
535 % symbol packages supported by LyX for items and the special character dialog
536 % see the unicodesymbols file
537 \TestPackage{ascii}
538 \TestPackage{bbding}
539 \TestPackage{ifsym}
540 \TestPackage{marvosym}
541 \TestPackage{pmboxdraw}
542 \TestPackage{textgreek}
543 \TestPackage{tfrupee}
544 \TestFont[wasy10]{wasy}
545 \TestPackage{wasysym}
546 % These packages are disabled in the unicodesymbols file
547 % see comment there
548 %\TestPackage{txfonts}% But see above!
549 %\TestPackage{pxfonts}
550 %\TestPackage{mathabx}
551 %\TestPackage{mathdesign}% But see above!
552
553 %%% Document classes
554 % The list of layout files has been put in this file here by the
555 % configure script.
556 \input{chklayouts}
557 \input{chkmodules}
558 \input{chkciteengines}
559
560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
561 %%%%% END ACTUAL CONFIGURATION INSPECTION CODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%
562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
563
564 % End of the LaTeX job
565 \immediate\closeout\layouts
566 \immediate\closeout\vars
567 \immediate\closeout\packages
568 \typeout{\prefix Inspection done.}
569 \typeout{\prefix Read the file doc/LaTeXConfig.lyx for more information.}
570
571 % Get the real \end command, that has been hidden by LaTeX
572 \@@end