View Javadoc
1   /*
2    * The akquinet maven-latex-plugin project
3    *
4    * Copyright (c) 2011 by akquinet tech@spree GmbH
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package eu.simuline.m2latex.core;
20  // is AbstractLatexMojo but not public 
21  import eu.simuline.m2latex.mojo.CfgLatexMojo;// for javadoc only 
22  
23  import java.io.File;
24  
25  import java.util.SortedSet;
26  import java.util.TreeSet;
27  
28  import org.apache.maven.plugins.annotations.Parameter;
29  
30  /**
31   * The settings for a maven plugin and for an ant task. 
32   * These are the elements of the maven pom in element <code>settings</code> 
33   * and accordingly for the ant build file. 
34   */
35  public class Settings {
36  
37      // static initializer 
38  
39      /**
40       * On unix <code>src/site/tex</code>, 
41       * on other operating systems accordingly. 
42       */
43      final static String SST;
44  
45      static {
46  	String fs = System.getProperty("file.separator");
47  	SST = "src" + fs + "site" + fs + "tex";
48      }
49  
50      // readonly parameters 
51  
52      /**
53       * The base directory of this maven project. 
54       *
55       * @see CfgLatexMojo#baseDirectory
56       */
57      private File baseDirectory;
58  
59      /**
60       * The target directory of this maven project. 
61       * By default this is <code>{@link #baseDirectory}/target</code> 
62       * on Unix systems. 
63       *
64       * @see CfgLatexMojo#targetDirectory
65       */
66      private File targetDirectory;
67  
68      /**
69       * The target site directory of this maven project. 
70       * By default this is <code>{@link #targetDirectory}/site</code> 
71       * on Unix systems. 
72       *
73       * @see CfgLatexMojo#targetSiteDirectory
74       */
75      private File targetSiteDirectory;
76  
77      // read/write parameters and related. 
78      // If a parameter represents a relative path, this is a string 
79      // and there is an according field of type File. 
80  
81      /**
82       * The latex source directory as a string 
83       * relative to {@link #baseDirectory}, 
84       * containing {@link #texSrcProcDirectory}. 
85       * This directory determines also the subdirectory of 
86       * {@link #outputDirectory} to lay down the generated artifacts. 
87       * The according file is given by {@link #texSrcDirectoryFile}. 
88       * The default value is {@link #SST}. 
89       */
90      @Parameter(name = "texSrcDirectory", 
91  	       defaultValue = "src${file.separator}site${file.separator}tex")
92      private String texSrcDirectory = SST;
93  
94      /**
95       * File for {@link #texSrcDirectory} based on {@link #baseDirectory}. 
96       */
97      private File texSrcDirectoryFile = new File(this.baseDirectory, 
98  						this.texSrcDirectory);
99  
100     /**
101      * The latex source processing directory as a string 
102      * relative to {@link #texSrcDirectory}
103      * containing all tex main documents 
104      * and the graphic files to be processed 
105      * and also to be cleaned. 
106      * Whether this is done recursively in subfolders 
107      * is specified by {@link #readTexSrcProcDirRec}. 
108      * The according file is given by {@link #texSrcProcDirectoryFile}. 
109      * The default value is <code>.</code>, 
110      * i.e. the latex souce processing directory is the latex source directory. 
111      */
112     @Parameter(name = "texSrcProcDirectory", defaultValue = ".")
113     private String texSrcProcDirectory = ".";
114 
115     /**
116      * File for {@link #texSrcProcDirectory} based on {@link #texSrcDirectory}. 
117      */
118     private File texSrcProcDirectoryFile = new File(this.texSrcDirectoryFile,
119 						    this.texSrcProcDirectory);
120 
121     /**
122      * Whether the tex source directory {@link #texSrcProcDirectory} 
123      * shall be read recursively, 
124      * i.e. including the subdirectories recursively. 
125      * This is set to <code>false</code> only during information development. 
126      * The default value is <code>true</code>. 
127      */
128     // FIXME: maybe in the long run: only latex main files. 
129     @Parameter(name = "readTexSrcProcDirRec", defaultValue = "true")
130     private boolean readTexSrcProcDirRec = true;
131 
132     /**
133      * The artifacts generated by {@link #latex2pdfCommand} 
134      * will be copied to this folder 
135      * which is given relative to {@link #targetSiteDirectory}. 
136      * The default value is <code>.</code>. 
137      * The according file is given by {@link #outputDirectoryFile}. 
138      *
139      * @see #texSrcDirectory
140      */
141     @Parameter(name = "outputDirectory", defaultValue = ".")
142     private String outputDirectory = ".";
143 
144     /**
145      * File for {@link #outputDirectory} based on {@link #targetSiteDirectory}. 
146      */
147     private File outputDirectoryFile = new File(this.targetSiteDirectory, 
148 						this.outputDirectory);
149 
150     /**
151      * A comma separated list of targets 
152      * returned as a set by {@link #getTargetSet()}. 
153      * For allowed values see {@link Target}. 
154      * The default value is <code>pdf, html</code>. 
155      */
156     @Parameter(name = "targets", defaultValue = "pdf, html")
157     private String targets = "pdf, html";
158 
159 
160     /**
161      * The pattern to be applied to the beginning of the contents of tex-files 
162      * which identifies a latex main file. 
163      * The default value is choosen to match quite exactly 
164      * the latex main files. 
165      * Here we assume that the latex main file should contain 
166      * the declaration `\documentclass' 
167      * or the old fashioned `documentstyle' 
168      * preceeded by a few constucts. 
169      * Strictly speaking, this is not necessary. 
170      * For a more thorough discussion, 
171      * and for an alternative approach, consult the manual. 
172      * <p>
173      * The default value is choosen to match quite exactly 
174      * the latex main files, no more no less. 
175      * Since the pattern is chosen 
176      * according to documentation collected from the internet, 
177      * one can never be sure whether the pattern is perfect. 
178      * <p>
179      * If the current default value is not appropriate, 
180      * please overwrite it in the configuration 
181      * and notify the developer of this plugin of the deficiency. 
182      */
183     // FIXME: not only on this pattern: 
184     // Matching is linewise which is inappropriate. 
185     // pattern is to be applied to the start of the tex-file 
186     @Parameter(name = "patternLatexMainFile")
187     private String patternLatexMainFile = 
188 	"\\A(\\\\RequirePackage\\s*" +           // RequirePackage 
189 	/**/"(\\[(\\s|\\w|,)*\\])?\\s*" +    // [options]
190 	/**/"\\{\\w+\\}\\s*(\\[(\\d|\\.)+\\])?|" + // {name}version
191 	"%.*$|" + // comments 
192 	"\\\\PassOptionsToPackage\\s*" +     // PassOptionsToPackage
193 	/**/"\\{\\w+\\}\\s*" +    // {options}
194 	/**/"\\{\\w+\\}|" +       // {packagename}
195 	"%.*$|" + // comments 
196 	"\\\\input\\{[^{}]*\\}|" + // inputs 
197 	"\\s)*" + // spaces FIXME: quicker were \s* but BUG IN MATCHER 
198 	"\\\\(documentstyle|documentclass)";
199 
200 
201     // texPath, commands and arguments 
202 
203     /**
204      * Path to the TeX scripts or <code>null</code>. 
205      * In the latter case, the scripts must be on the system path. 
206      * Note that in the pom, <code>&lt;texPath/&gt;</code> 
207      * and even <code>&lt;texPath&gt;    &lt;/texPath&gt;</code> 
208      * represent the <code>null</code>-File. 
209      * The default value is <code>null</code>. 
210      */
211     @Parameter(name = "texPath")//, defaultValue = null
212     private File texPath = null;
213 
214     /**
215      * Clean up the working directory in the end? 
216      * May be used for debugging when setting to <code>false</code>. 
217      * The default value is <code>true</code>. 
218      */
219     @Parameter(name = "cleanUp", defaultValue = "true")
220     private boolean cleanUp;
221 
222     /**
223      * This pattern is applied to file names 
224      * and matching shall accept all the files 
225      * which were created from a latex main file <code>xxx.tex</code>. 
226      * It is neither applied to directories 
227      * nor to <code>xxx.tex</code> itself. 
228      * It shall not comprise neither graphic files to be processed 
229      * nor files created from those graphic files. 
230      * <p>
231      * This pattern is applied 
232      * in the course of processing graphic files 
233      * to decide which graphic files should be processed 
234      * (those rejected by this pattern) 
235      * and to log warnings if there is a risk, 
236      * that graphic files to be processed 
237      * are skipped or that processing a latex main file overwrites 
238      * the result of graphic preprocessing. 
239      * <p>
240      * When clearing the tex source directory {@link #texSrcProcDirectory}, 
241      * i.e. all generated files should be removed, 
242      * first those created from latex main files. 
243      * As an approximation, 
244      * those are removed which match this pattern. 
245      * <p>
246      * The sequence <code>T$T</code> 
247      * is replaced by the prefix <code>xxx</code>. 
248      * The sequence <code>T$T</code> must always be replaced: 
249      * The symbol <code>$</code> occurs as end-sign as <code>)$</code> 
250      * or as literal symbol as <code>\$</code>. 
251      * Thus <code>T$T</code> is no regular occurrence 
252      * and must always be replaced with <code>xxx</code>. 
253      * <p>
254      * Spaces and newlines are removed 
255      * from that pattern before matching. 
256      * <p>
257      * This pattern may never be ensured to be complete, 
258      * because any package 
259      * may create files with names matching its own patterns 
260      * and so any new package may break completeness. 
261      * <p>	 
262      * If the current default value is not appropriate, 
263      * please overwrite it in the configuration 
264      * and notify the developer of this plugin of the deficiency. 
265      * The default value is given below. 
266      */
267     @Parameter(name = "patternCreatedFromLatexMain")
268     private String patternCreatedFromLatexMain = 
269 	// besides T$T.xxx, with xxx not containing ., 
270 	// we allow T$T.synctex.gz and T$T.out.ps 
271 	"^(T$T(\\.([^.]*|synctex\\.gz(\\(busy\\))?|out\\.ps)|" + 
272 	// tex4ht creates files T$Tyy.(x)htm(l)... 
273 	"(-|ch|se|su|ap|li)?\\d+\\.x?html?|" + 
274 	// ... and T$Tddx.(x)bb, T$Tddx.png and T$T-dd.svg... 
275 	"\\d+x\\.x?bb|" + 
276 	"\\d+x?\\.png|" + 
277 	"-\\d+\\.svg|" + 
278 	// by (splitidx and) splitindex 
279 	"-.+\\.(idx|ind|ilg))|" + 
280 	// ... and xxT$T.eps... 
281 	"zzT$T\\.e?ps|" + 
282 	// ... and scripts cmsy....png 
283 	"(cmsy)\\d+(-c)?-\\d+c?\\.png|" + 
284 	// The following occurs sporadic 
285 	"(pdf)?latex\\d+\\.fls)$";
286 
287 
288     // parameters for graphics preprocessing 
289 
290 
291     /**
292      * The fig2dev command for conversion of fig-files 
293      * into various formats. 
294      * Currently only pdf combined with pdf_t is supported. 
295      * Note that preprocessing one fig-file 
296      * requires two invocations of {@link #fig2devCommand}, 
297      * one for each part. 
298      * The default value is <code>fig2dev</code>. 
299      *
300      * @see #fig2devGenOptions
301      * @see #fig2devPtxOptions
302      * @see #fig2devPdfEpsOptions
303      */
304     @Parameter(name = "fig2devCommand", defaultValue = "fig2dev")
305     private String fig2devCommand = "fig2dev";
306 
307     /**
308      * The options for the command {@link #fig2devCommand} 
309      * common to both output languages. 
310      * For the options specific for the two output langugages 
311      * <code>pdftex</code> and <code>pdftex_t</code>, 
312      * see {@link #fig2devPtxOptions} and {@link #fig2devPdfEpsOptions}, 
313      * respectively. 
314      * The default value is the empty string. 
315      * <p>
316      * Possible are the following options: 
317      * <ul>
318      * <li><code>-D +/-rangelist</code> 
319      * Export layers selectively (<code>+</code>) 
320      * or exclude layers from export (<code>-</code>). 
321      * E.g. -D +10,40,55:70,80  means  keep 
322      * only layers 10, 40, 55 through 70, and 80.
323      * <li><code>-j</code> 
324      * i18n (internationalization feature)
325      * <li><code>-m mag</code> 
326      * Set the magnification at which the figure is rendered 
327      * to <code>mag</code>.
328      * The default is <code>1.0</code>. 
329      * This is not usable within latex; not even <code>1.0</code>. 
330      * <li><code>-s fsize</code> 
331      * Set the default font size (in points) 
332      * for text objects to <code>fsize</code>.
333      * Refers to the latex-fonts only. 
334      * <li><code>-b width</code> 
335      * specify width of blank border around figure (1/72 inch). 
336      * </ul>
337      * Except for the option <code>-j</code>, 
338      * all these options take parameters 
339      * and it may make sense to use them with different parameters 
340      * for the two output languages. 
341      * In this case include them in 
342      * {@link #fig2devPtxOptions} and in {@link #fig2devPdfEpsOptions}. 
343      */
344     @Parameter(name = "fig2devGenOptions", defaultValue = "")
345     private String fig2devGenOptions = "";
346 
347     /**
348      * The options for the command {@link #fig2devCommand} 
349      * specific for the output languages <code>pdftex_t</code> 
350      * and <code>pstex_t</code> which are the same. 
351      * Note that in addition to these options, 
352      * the option <code>-L pdftex_t</code> specifies the language, 
353      * {@link #fig2devGenOptions} specifies the options 
354      * common for the two output langugages 
355      * <code>pdftex</code> and <code>pdftex_t</code> 
356      * and <code>-p xxx</code> specifies the full path 
357      * of the pdf/eps-file to be included without extension. 
358      * <p>
359      * The default value for this option is the empty string. 
360      * <p>
361      * Possible options are the following: 
362      * (These seem to work for tex only 
363      * although according to documentation for all languages. )
364      * <ul>
365      * <li> options specified for {@link #fig2devGenOptions} 
366      * <li> <code>-E num</code>
367      * Set encoding for latex text translation 
368      * (0 no translation, 1 ISO-8859-1, 2 ISO-8859-2), 
369      * others allowed also, effect not clear. 
370      * <li> <code>-F</code>  
371      * don't set font family/series/shape, 
372      * so you can set it from latex. 
373      * <li> <code>-v</code>
374      * Verbose mode.
375      * </ul>
376      */
377     // Note that several options do not make sense as global options, 
378     // better as individual options. 
379     // Maybe it makes sense, to include those options 
380     // in the fig-file and use a wrapper around fig2dev 
381     // instead of fig2dev itself, 
382     // which invokes fig2dev with the according options. 
383     // Problem is that xfig does not support this. 
384     @Parameter(name = "fig2devPtxOptions", defaultValue = "")
385     private String fig2devPtxOptions = "";
386 
387     /**
388      * The options for the command {@link #fig2devCommand} 
389      * specific for the output language <code>pdftex</code>. 
390      * Note that in addition to these options, 
391      * the option <code>-L pdftex</code> specifies the language and 
392      * {@link #fig2devGenOptions} specifies the options 
393      * common for the two output langugages 
394      * <code>pdftex</code> and <code>pdftex_t</code>. 
395      * The default value for this option is the empty string. 
396      * <p>
397      * Possible options are the following: 
398      * (These seem to work specifically for pdf 
399      * although according to documentation for all languages. )
400      * <ul>
401      * <li> options specified for {@link #fig2devGenOptions} 
402      * <li> <code>-G minor[:major][unit]</code>
403      * Draws a grid on the page.  
404      *    e.g. "-G .25:1cm" draws a thin line every .25 cm 
405      *    and a thicker line every 1 cm. 
406      *    Default unit is in.  
407      *    Allowable units are: 
408      *    i, in, inch, f, ft, feet, c, cm, mm, and m. 
409      * <li> <code>-A</code>
410      * Add an ASCII (EPSI) preview.
411      * <li> <code>-c</code>
412      * centers the figure on the page.  (default)
413      * seems not to have an effect...
414      * <li> <code>-e</code>
415      * puts the  figure against the edge (not centered) of the page. 
416      * seems not to have an effect...
417      * <li> <code>-F</code>
418      * Use correct font sizes (points) instead of the traditional  size
419      * <li> <code>-g color</code>
420      * Use color for the background. 
421      * FIXME: Not clear how to specify the color. 
422      * <li> <code>-N</code>
423      * Convert all colors to grayscale. (not available for latex fonts)
424      * <li> <code>-n name</code>
425      * Set  the /Title(xxx) of the PostScript output to <code>name</code>. 
426      * without it is just the filename <code>xxx.fig</code>. 
427      */
428     // Note that several options do not make sense as global options, 
429     // better as individual options. 
430     // Maybe it makes sense, to include those options 
431     // in the fig-file and use a wrapper around fig2dev 
432     // instead of fig2dev itself, 
433     // which invokes fig2dev with the according options. 
434     // Problem is that xfig does not support this. 
435     @Parameter(name = "fig2devPdfEpsOptions", defaultValue = "")
436     private String fig2devPdfEpsOptions = "";
437 
438     /**
439      * The command for conversion of gnuplot-files 
440      * into various formats. 
441      * Currently only pdf (graphics) 
442      * combined with pdf_t (latex-texts) is supported. 
443      * The default value is <code>gnuplot</code>. 
444      */
445     @Parameter(name = "gnuplotCommand", defaultValue = "gnuplot")
446     private String gnuplotCommand = "gnuplot";
447 
448     /**
449      * The options specific for {@link #gnuplotCommand}'s 
450      * output terminal <code>cairolatex</code>, 
451      * used for mixed latex/pdf-creation. 
452      * <p>
453      * Possible values are: 
454      * <ul>
455      * <li><code>{standalone | input}</code>
456      * <li><code>{blacktext | colortext | colourtext}</code>
457      * Specifies whether for text colors are taken into account or not. 
458      * For all but text see separate options. 
459      * <li><code>{header <header> | noheader}</code>
460      * <li><code>{mono|color}</code>
461      * Specifies whether colors are taken into account or not. 
462      * Refers to all but text (for text see separate options)
463      * <li><code>{{no}transparent} {{no}crop} {background <rgbcolor>}</code>
464      * <li><code>{font <font>}</code>
465      * <li><code>{fontscale <scale>}</code>
466      * <li><code>{linewidth <lw>} {rounded|butt|square} {dashlength <dl>}</code>
467      * <li><code>{size <XX>{unit},<YY>{unit}}</code>
468      * The size of this picture. 
469      * This is not usable, because it imposes deformation. 
470      * Default unit is inch (<code>in</code>). 
471      * </ul>
472      * Note that the option <code>pdf|eps</code> 
473      * of the terminal <code>cairolatex</code> is not available, 
474      * because it is set internally. 
475      * The default option string is empty. 
476      */
477     @Parameter(name = "gnuplotOptions", defaultValue = "")
478     private String gnuplotOptions = "";
479 
480     /**
481      * The command for conversion of gnuplot-files 
482      * into metapost's postscript. 
483      * The default value is <code>mpost</code>. 
484      */
485     @Parameter(name = "metapostCommand", defaultValue = "mpost")
486     private String metapostCommand = "mpost";
487 
488     /**
489      * The options for the command {@link #metapostCommand}. 
490      * Leading and trailing blanks are ignored. 
491      * A sequence of at least one blank separate the proper options. 
492      * The default value comprises the following options: 
493      * <ul>
494      * <li><code>-interaction=nonstopmode</code> 
495      * prevents metapost from stopping at the first error. 
496      * <li><code>-recorder</code> 
497      * makes metapost create an fls-file specifying all inputted files. 
498      * <li><code>-s prologues=2</code> 
499      * makes metapost create a postscript file 
500      * which is viewable by ghostscript viewer.
501      * </ul>
502      * 
503      * -debug creates intermediate files mp3mnuvD.dvi and mp3mnuvD.tex 
504      * No info available about the details. 
505      */
506     @Parameter(name = "metapostOptions", 
507 	       defaultValue = "-interaction=nonstopmode -recorder " + 
508 	       "-s prologues=2")
509     private String metapostOptions = 
510 	"-interaction=nonstopmode -recorder -s prologues=2";
511 
512     /**
513      * The command for conversion of svg-files 
514      * into a mixed format FIXME, synchronize with fig2devCommand. 
515      * The default value is <code>inkscape</code>. 
516      */
517     @Parameter(name = "svg2devCommand", defaultValue = "inkscape")
518     private String svg2devCommand = "inkscape";
519 
520     /**
521      * The options for the command {@link #svg2devCommand} 
522      * for exporting svg-figures into latex compatible files. 
523      * <p>
524      * The following options are mandatory: 
525      * <ul>
526      * <li><code>-D</code> or <code>--export-area-drawing</code> 
527      * Export the drawing (not the page)
528      * <li><code>--export-latex</code> 
529      * Export PDF/PS/EPS without text. 
530      * Besides the PDF/PS/EPS, a LaTeX file is exported,
531      * putting the text on top of the PDF/PS/EPS file. 
532      * Include the result in LaTeX like: \input{latexfile.tex}. 
533      * Note that the latter option is necessary, 
534      * to create the expected files. 
535      * It is also conceivable to export text as pdf/eps 
536      * </ul>
537      * <p>
538      * The following options are prohibited, 
539      * because they are automatically added by the software 
540      * or are in conflict with automatically added options: 
541      * <ul>
542      * <li><code>--export-filename==FILENAME</code>
543      * <li><code>--export-tyoe=type</code> 
544      * <ul>
545      *
546      * The default value is the minimal value, 
547      * <code>-D --export-latex</code>. 
548      */
549    @Parameter(name = "svg2devOptions", defaultValue = "-D --export-latex")
550    private String svg2devOptions = "-D --export-latex";
551 
552     /**
553      * The command to create bounding box information 
554      * from jpg-files and from png-files. 
555      * This is run twice: 
556      * once with parameter <code>-m</code> 
557      * to create <code>.bb</code>-files for driver <code>dvipdfm</code> and 
558      * once with parameter <code>-x</code> 
559      * to create <code>.xbb</code>-files for driver <code>dvipdfmx</code>. 
560      * The default value is <code>ebb</code>. 
561      */
562     @Parameter(name = "ebbCommand", defaultValue = "ebb")
563     private String ebbCommand = "ebb";
564 
565     /**
566      * The options for the command {@link #ebbCommand} 
567      * except <code>-m</code> and <code>-x</code> 
568      * which are added automatically. 
569      * The default value is <code>-v</code>. 
570      */
571     // without -x and -m 
572     @Parameter(name = "ebbOptions", defaultValue = "-v")
573     private String ebbOptions  = "-v";
574 
575     // parameters for latex2pdf-conversion 
576 
577     /**
578      * The LaTeX command to create a pdf-file or a dvi-file. 
579      * FIXME: documentation must be updated. 
580      * Possible values are e.g. 
581      * <code>pdflatex</code>, <code>lualatex</code> and <code>xelatex</code>. 
582      * The default value (for which this software is also tested) 
583      * is <code>pdflatex</code>. 
584      */
585     @Parameter(name = "latex2pdfCommand", defaultValue = "pdflatex")
586     private String latex2pdfCommand = "pdflatex";
587 
588     /**
589      * The options for the command {@link #latex2pdfCommand}. 
590      * Leading and trailing blanks are ignored. 
591      * The setter method {@link #setLatex2pdfOptions(String)} ensures, 
592      * that exactly one blank separate the proper options. 
593      * <p>
594      * The default value comprises the following options: 
595      * <ul>
596      * <li><code>-interaction=nonstopmode</code> 
597      * prevents latex from stopping at the first error. 
598      * <li><code>-synctex=1</code> 
599      * makes latex create a pdf file 
600      * which synchronizes with an editor supporting synchtex. 
601      * <li><code>-src-specials</code> 
602      * includes source specials into the output. dvi only? 
603      * <li><code>-recorder</code> 
604      * makes latex create an fls-file specifying all inputted files. 
605      * <li><code>-shell-escape</code> 
606      * allows to use write18-mechanism for shell commands (why needed?)
607      * </ul>
608      */
609     // useful also: -file-line-error
610     @Parameter(name = "latex2pdfOptions", 
611 	       defaultValue = "-interaction=nonstopmode " + // 
612 	"-synctex=1 " + 
613 	"-src-specials " + 
614 	"-recorder " + 
615 	"-shell-escape")
616     private String latex2pdfOptions = 
617 	"-interaction=nonstopmode " + // 
618 	"-synctex=1 " + 
619 	"-src-specials " + 
620 	"-recorder " + 
621 	"-shell-escape";
622 
623     /**
624      * The pattern is applied linewise to the log-file 
625      * and matching indicates an error 
626      * emitted by the command {@link #latex2pdfCommand}. 
627      * <p>
628      * The default value is choosen to match quite exactly 
629      * the latex errors in the log file, no more no less. 
630      * Since no official documentation was found, 
631      * the default pattern may be incomplete. 
632      * In fact it presupposes, that $latex2pdfOptions 
633      * does not contain `<code>-file-line-error-style</code>'.   
634      * <p>
635      * If the current default value is not appropriate, 
636      * please overwrite it in the configuration 
637      * and notify the developer of this plugin of the deficiency. 
638      * The default value is `<code>(^! )</code>' (note the space). 
639      */
640     // FIXME: Problem with line error style 
641     @Parameter(name = "patternErrLatex", defaultValue = "(^! )")
642     private String patternErrLatex = "(^! )";
643 
644     /**
645      * The pattern is applied linewise to the log-file 
646      * and matching indicates a warning 
647      * emitted by the command {@link #latex2pdfCommand}, 
648      * disragarding warnings on bad boxes 
649      * provided {@link #debugWarnings} is set. 
650      * <p>
651      * This pattern may never be ensured to be complete, 
652      * because any package may indicate a warning 
653      * with its own pattern any new package may break completeness. 
654      * Nevertheless, the default value aims completeness 
655      * while be restrictive enough 
656      * not to indicate a warning where none was emitted. 
657      * <p>
658      * If the current default value is not appropriate, 
659      * please overwrite it in the configuration 
660      * and notify the developer of this plugin of the deficiency. 
661      * The default value is given below. 
662      *
663      * @see #debugBadBoxes
664      */
665      @Parameter(name = "patternWarnLatex", 
666 		defaultValue = 
667 		"^(LaTeX Warning: |" +
668 		"LaTeX Font Warning: |" + 
669 		"(Package|Class) .+ Warning: |" + 
670 		// pdftex warning (ext4): destination with the same identifier
671 		// pdfTeX warning (dest): ... has been referenced ...
672 		// pdfTeX warning: pdflatex (file pdftex.map): cannot open font map file 
673 		// pdfTeX warning: Found pdf version 1.5, allowed maximum 1.4 
674 		// pdfTeX warning: pdflatex (file ./Carlito-Bold.pfb): glyph `index130' undefined
675 		"pdfTeX warning( \\((\\d|\\w)+\\))?: |" +
676 		"\\* fontspec warning: |" +
677 		"Missing character: There is no .* in font .*!$|" +
678 		"A space is missing\\. (No warning)\\.)")
679     private String patternWarnLatex = 
680 	"^(LaTeX Warning: |" +
681 	"LaTeX Font Warning: |" + 
682 	"(Package|Class) .+ Warning: |" + 
683 	"pdfTeX warning( \\((\\d|\\w)+\\))?: |" +
684 	"\\* fontspec warning: |" +
685 	"Missing character: There is no .* in font .*!$|" +
686 	"A space is missing\\. (No warning)\\.)";
687 
688     /**
689      * Whether debugging of overfull/underfull hboxes/vboxes is on: 
690      * If so, a bad box occurs in the last LaTeX run, a warning is displayed. 
691      * For details, set $cleanUp to false, 
692      * rerun LaTeX and have a look at the log-file. 
693      * The default value is <code>true</code>. 
694      */
695     @Parameter(name = "debugBadBoxes", defaultValue = "true")
696     private boolean debugBadBoxes = true;
697 
698     /**
699      * Whether debugging of warnings is on: 
700      * If so, a warning in the last LaTeX run is displayed. 
701      * For details, set $cleanUp to false, 
702      * rerun LaTeX and have a look at the log-file. 
703      * The default value is <code>true</code>. 
704      */
705     @Parameter(name = "debugWarnings", defaultValue = "true")
706     private boolean debugWarnings = true;
707 
708     /**
709      * Whether creation of pdf-files from latex-files goes via dvi-files. 
710      * <p>
711      * If <code>pdfViaDvi</code> is set 
712      * and the latex processor needs repetitions, 
713      * these are all done creating dvi 
714      * and then pdf is created in a final step 
715      * invoking the command {@link #dvi2pdfCommand}. 
716      * If <code>pdfViaDvi</code> is not set, 
717      * latex is directly converted into pdf. 
718      * <p>
719      * Currently, not only conversion of latex-files is affected, 
720      * but also conversion of graphic files 
721      * into graphic formats which allow inclusion in the tex-file. 
722      * If it goes via latex, 
723      * then the formats are more based on (encapsulated) postscript; 
724      * else on pdf. 
725      * <p>
726      * Of course, the target dvi is not affected: 
727      * This uses always the dvi-format. 
728      * What is also affected are the tasks 
729      * creating html, odt or docs: 
730      * Although these are based on htlatex which is always dvi-based, 
731      * the preprocessing is done in dvi or in pdf. 
732      * Also the task txt is affected. 
733      * <p>
734      * The default value is <code>false</code>. 
735      */
736     // if false: directly 
737     @Parameter(name = "pdfViaDvi", defaultValue = "false")
738     private boolean pdfViaDvi = false;
739 
740     /**
741      * The driver to convert dvi into pdf-files. 
742      * Note that this must fit the options 
743      * of the packages <code>xcolor</code> and <code>graphicx</code>. 
744      * Sensible values are 
745      * <code>dvipdf</code>, <code>dvipdfm</code>, <code>dvipdfmx</code>, 
746      * and <code>dvipdft</code> 
747      * (which is <code>dvipdfm</code> with option <code>-t</code>). 
748      * The default value is <code>dvipdfmx</code>. 
749      */
750     @Parameter(name = "dvi2pdfCommand", defaultValue = "dvipdfmx")
751     private String dvi2pdfCommand = "dvipdfmx";
752 
753     /**
754      * The options for the command {@link #dvi2pdfCommand}. 
755      * The default value is the empty string. 
756      */
757     @Parameter(name = "dvi2pdfOptions", defaultValue = "")
758     private String dvi2pdfOptions = "";
759 
760     /**
761      * The pattern is applied linewise to the log-file 
762      * and matching triggers rerunning {@link #latex2pdfCommand} 
763      * if {@link #maxNumReRunsLatex} is not yet reached 
764      * to ensure termination. 
765      * <p>
766      * This pattern may never be ensured to be complete, 
767      * because any package 
768      * may indicate the need to rerun {@link #latex2pdfCommand} 
769      * with its own pattern any new package may break completeness. 
770      * Nevertheless, the default value aims completeness 
771      * while be tight enough not to trigger a superfluous rerun. 
772      * <p>
773      * If the current default value is not appropriate, 
774      * please overwrite it in the configuration 
775      * and notify the developer of this plugin of the deficiency. 
776      * The default value is given below. 
777      */
778     // FIXME: default? to be replaced by an array of strings? **** 
779     // FIXME: explicit tests required for each pattern. 
780     // Not only those but all patterns. 
781     // FIXME: seems a problem with the pattern spreading over two lines 
782     @Parameter(name = "patternReRunLatex", 
783 	       defaultValue = 
784 	       // general message 
785 	       "^(LaTeX Warning: Label\\(s\\) may have changed\\. " 
786 	       + "Rerun to get cross-references right\\.$|" +
787 	       // default message in one line for packages 
788 	       "Package \\w+ Warning: .*Rerun( .*|\\.)$|" +
789 	       // works for 
790 	       // Package totcount Warning: Rerun to get correct total counts
791 	       // Package longtable Warning: Table widths have changed. Rerun LaTeX ...
792 	       // Package hyperref Warning: Rerun to get outlines right (old hyperref)
793 	       // Package rerunfilecheck Warning: File `...' has changed. Rerun.
794 	       // ... 
795 	       // default message in two lines for packages 
796 	       // FIXME: would require parsing of more than one line 
797 	       "Package \\w+ Warning: .*$"
798 	       + "^\\(\\w+\\) .*Rerun .*$|" +
799 	       // works for 
800 	       // Package natbib Warning: Citation\\(s\\) may have changed.
801 	       // (natbib)                Rerun to get citations correct.
802 	       // Package Changebar Warning: Changebar info has changed.
803 	       // (Changebar)                Rerun to get the bars right
804 	       // Package rerunfilecheck Warning: File `foo.out' has changed.
805 	       // (rerunfilecheck)                Rerun to get outlines right"
806 	       // (rerunfilecheck)                or use package `bookmark'.
807 	       // but not for 
808 	       // Package biblatex Warning: Please (re)run Biber on the file:
809 	       // (biblatex)                test
810 	       // (biblatex)                and rerun LaTeX afterwards. 
811 	       //
812 	       // messages specific to various packages 
813 	       "LaTeX Warning: Etaremune labels have changed\\.$|" +
814 	       // 'Rerun to get them right.' is on the next line
815 	       //
816 	       // from package rerunfilecheck used by other packages like new hyperref 
817 	       // Package rerunfilecheck Warning: File `foo.out' has changed.
818 	       "\\(rerunfilecheck\\)                Rerun to get outlines right$)"
819 	       //  (rerunfilecheck)                or use package `bookmark'.
820     )
821    private String patternReRunLatex = 
822        // general message 
823        "^(LaTeX Warning: Label\\(s\\) may have changed. " 
824        + "Rerun to get cross-references right\\.$|" +
825        // default message in one line for packages 
826        "Package \\w+ Warning: .*Rerun .*$|" +
827        // works for 
828        // Package totcount Warning: Rerun to get correct total counts
829        // Package longtable Warning: Table widths have changed. Rerun LaTeX ...
830        // Package hyperref Warning: Rerun to get outlines right (old hyperref)
831        // ... 
832        // default message in two lines for packages 
833        "Package \\w+ Warning: .*$"
834        + "^\\(\\w+\\) .*Rerun .*$|" +
835        // works for 
836        // Package natbib Warning: Citation\\(s\\) may have changed.
837        // (natbib)                Rerun to get citations correct.
838        // Package Changebar Warning: Changebar info has changed.
839        // (Changebar)                Rerun to get the bars right
840        //
841        // messages specific to various packages 
842        "LaTeX Warning: Etaremune labels have changed\\.$|" +
843        // 'Rerun to get them right.' is on the next line
844        //
845        // from package rerunfilecheck used by other packages like new hyperref 
846        // Package rerunfilecheck Warning: File `foo.out' has changed.
847        "\\(rerunfilecheck\\)                Rerun to get outlines right$)";
848        // (rerunfilecheck)                or use package `xxx'.
849 
850     /**
851      * The maximal allowed number of reruns of {@link #latex2pdfCommand}. 
852      * This is to avoid endless repetitions. 
853      * The default value is 5. 
854      * This shall be non-negative 
855      * or <code>-1</code> which signifies that there is no threshold. 
856      */
857     @Parameter(name = "maxNumReRunsLatex", defaultValue = "5")
858     private int maxNumReRunsLatex = 5;
859 
860 
861     // parameters for bibliography 
862 
863 
864     /**
865      * The BibTeX command to create a bbl-file 
866      * from an aux-file and a bib-file 
867      * (using a bst-style file). 
868      * The default value is <code>bibtex</code>. 
869      */
870     @Parameter(name = "bibtexCommand", defaultValue = "bibtex")
871     private String bibtexCommand = "bibtex";
872 
873     // FIXME: Any parameters for bibtex? 
874 // Usage: bibtex [OPTION]... AUXFILE[.aux]
875 //   Write bibliography for entries in AUXFILE to AUXFILE.bbl,
876 //   along with a log file AUXFILE.blg.
877 // -min-crossrefs=NUMBER  include item after NUMBER cross-refs; default 2
878 // -terse                 do not print progress reports
879 // -help                  display this help and exit
880 // -version               output version information and exit
881 
882 // how to detect errors/warnings??? 
883 //Process exited with error(s)
884 
885     /**
886      * The options for the command {@link #bibtexCommand}. 
887      * The default value is the empty string. 
888      */
889     @Parameter(name = "bibtexOptions", defaultValue = "")
890     private String bibtexOptions = "";
891 
892 
893 
894     /**
895      * The Pattern in the blg-file 
896      * indicating that {@link #bibtexCommand} failed. 
897      * The default value is chosen 
898      * according to the <code>bibtex</code> documentation. 
899      */
900     @Parameter(name = "patternErrBibtex", defaultValue = "error message")
901     private String patternErrBibtex = "error message";
902 
903     /**
904      * The Pattern in the blg-file 
905      * indicating a warning {@link #bibtexCommand} emitted. 
906      * The default value is chosen 
907      * according to the <code>bibtex</code> documentation. 
908      */
909     @Parameter(name = "patternWarnBibtex", defaultValue = "^Warning--")
910     private String patternWarnBibtex = "^Warning--";
911 
912 
913     // parameters for index 
914 
915 
916     /**
917      * The MakeIndex command to create an ind-file 
918      * from an idx-file logging on an ilg-file. 
919      * The default value is <code>makeindex</code>. 
920      */
921     @Parameter(name = "makeIndexCommand", defaultValue = "makeindex")
922     private String makeIndexCommand = "makeindex";
923 
924     /**
925      * The options for the command {@link #makeIndexCommand}. 
926      * Note that the option <code>-o xxx.ind</code> to specify the output file 
927      * is not allowed because this plugin 
928      * expects the output for the latex main file <code>xxx.tex</code> 
929      * <code>xxx.ind</code>. 
930      * Likewise, the option <code>-t xxx.ilg</code> 
931      * to specify the logging file is not allowed, 
932      * because this software uses the standard logging file 
933      * to detect failures processing the idx-file. 
934      * Also the option <code>-i</code> 
935      * which specifies reading the raw index from standard input 
936      * is not allowed. 
937      * Specifying a style file with option <code>-s yyy.ist</code> 
938      * is possible if only an index is used but no glossary. 
939      * FIXME: rethink what about multiple indices. 
940      * <p>
941      * Note that the options specified here 
942      * are also used to create glossaries. 
943      * In addition for glossaries, the options 
944      * <code>-s</code>, <code>-o</code> and <code>-t</code> are used. 
945      * Thus also these options should not be used. 
946      * The default value is the empty string. 
947      * Useful options in this context are 
948      * <ul>
949      * <li><code>-c</code> remove blanks from index entries 
950      * <li><code>-g</code> german ordering
951      * <li><code>-l</code> letter ordering
952      * <li><code>-r</code> without collecting index entries 
953      * on 3 or more successive pages. 
954      * </ul>
955      */
956     @Parameter(name = "makeIndexOptions", defaultValue = "")
957     private String makeIndexOptions = "";
958 
959     /**
960      * The Pattern in the ilg-file 
961      * indicating that {@link #makeIndexCommand} failed. 
962      * The default value <code>(!! Input index error )</code> 
963      * is chosen according to the <code>makeindex</code> documentation. 
964      */
965     @Parameter(name = "patternErrMakeIndex", 
966 	       defaultValue = "(!! Input index error )")
967     private String patternErrMakeIndex = "(!! Input index error )";
968 
969     /**
970      * The Pattern in the ilg-file 
971      * indicating a warning {@link #makeIndexCommand} emitted. 
972      * The default value <code>(## Warning )</code> 
973      * is chosen according to the <code>makeindex</code> documentation. 
974      */
975     @Parameter(name = "patternWarnMakeIndex", defaultValue = "(## Warning )")
976     private String patternWarnMakeIndex = "(## Warning )";
977 
978     /**
979      * The pattern in the log-file which triggers 
980      * rerunning {@link #makeIndexCommand} 
981      * followed by {@link #latex2pdfCommand}. 
982      * This pattern only occurs, if package <code>rerunfilecheck</code> 
983      * is used with option <code>index</code>. 
984      * The default value 
985      * is chosen according to the package documentation. 
986      * If the user finds that default value is not appropriate, 
987      * (s)he is asked to contribute 
988      * and to notify the developer of this plugin. 
989      */
990     @Parameter(name = "patternReRunMakeIndex", 
991 	       defaultValue = 
992 	//"^Package rerunfilecheck Warning: File `.*\\.idx' has changed\\.$" //+
993 	"^\\(rerunfilecheck\\) +Rerun LaTeX/makeindex to get index right\\.$"
994 )
995     // FIXME: should be included the full pattern. 
996     // First part works second also but not together. 
997     // Also did not find any way to connect the two parts. 
998     // This gives rise to the conjecture 
999     // that also other patterns do not work properly. 
1000     private String patternReRunMakeIndex = 
1001 	//"^Package rerunfilecheck Warning: File `.*\\.idx' has changed\\.$" //+
1002 	"^\\(rerunfilecheck\\) +Rerun LaTeX/makeindex to get index right\\.$";
1003  
1004     /**
1005      * The SplitIndex command to create ind-files 
1006      * from an idx-file logging on ilg-files. 
1007      * This command invokes {@link #makeIndexCommand}. 
1008      * The default value is <code>splitindex</code>. 
1009      */
1010     @Parameter(name = "splitIndexCommand", defaultValue = "splitindex")
1011     private String splitIndexCommand = "splitindex";
1012 
1013     /**
1014      * The options for {@link #splitIndexCommand}. 
1015      * Here, one has to distinguish between the options 
1016      * processed by {@link #splitIndexCommand} 
1017      * and those passed to {@link #makeIndexCommand}. 
1018      * The second category cannot be specified here, 
1019      * it is already given by {@link #makeIndexOptions}. 
1020      * In the first category is the option <code>-m</code> 
1021      * to specify the {@link #makeIndexCommand}. 
1022      * This is used automatically and cannot be specified here. 
1023      * Since {@link #splitIndexCommand} is used 
1024      * in conjunction with package <code>splitidx</code>, 
1025      * which hardcodes various parameters 
1026      * which are the default values for {@link #splitIndexCommand} 
1027      * and because the option may not alter certain interfaces, 
1028      * the only option which may be given explicitly 
1029      * is <code>-V</code>, the short cut for <code>--verbose</code>. 
1030      * Do not use <code>--verbose</code> either for sake of portability. 
1031      * The default value is <code>-V</code>; it could also be empty. 
1032      */
1033     @Parameter(name = "splitIndexOptions", defaultValue = "-V")
1034     private String splitIndexOptions = "splitindexOptions";
1035 
1036 
1037     // parameters for glossary 
1038 
1039 
1040     /**
1041      * The MakeGlossaries command to create a gls-file 
1042      * from a glo-file (invoked without file ending) 
1043      * also taking ist-file or xdy-file 
1044      * into account logging on a glg-file. 
1045      * The default value is <code>makeglossaries</code>. 
1046      */
1047     @Parameter(name = "makeGlossariesCommand", defaultValue = "makeglossaries")
1048     private String makeGlossariesCommand = "makeglossaries";
1049 
1050     /**
1051      * The options for the command {@link #makeGlossariesCommand}. 
1052      * These are the options for <code>makeindex</code> 
1053      * (not for {@link #makeIndexCommand}) 
1054      * and for <code>xindy</code> (also hardcoded). 
1055      * The aux-file decides on whether program is executed 
1056      * and consequently which options are used. 
1057      * <p>
1058      * The default value is the empty option string. 
1059      * Nevertheless, <code>xindy</code> is invoked as 
1060      * <code>xindy -L english  -I xindy -M ...</code>. 
1061      * With option <code>-L german</code>, this is added. 
1062      * Options <code>-M</code> for <code>xindy</code> 
1063      * <code>-s</code> for <code>makeindex</code> and 
1064      * <code>-t</code> and <code>-o</code> for both, 
1065      * <code>xindy</code> and <code>makeindex</code>. 
1066      */
1067     @Parameter(name = "makeGlossariesOptions", defaultValue = "")
1068     private String makeGlossariesOptions = "";
1069 
1070     /**
1071      * The Pattern in the glg-file 
1072      * indicating that {@link #makeGlossariesCommand} failed. 
1073      * The default value is <code>(^\*\*\* unable to execute: )</code>. 
1074      * If this is not appropriate, please modify 
1075      * and notify the developer of this plugin. 
1076      */
1077     @Parameter(name = "patternErrMakeGlossaries", 
1078 	       defaultValue = "^\\*\\*\\* unable to execute: ")
1079     private String patternErrMakeGlossaries = 
1080 	"^\\*\\*\\* unable to execute: ";
1081 
1082     /**
1083      * The pattern in the glg-file 
1084      * indicating that running <code>xindy</code> 
1085      * via {@link #makeGlossariesCommand} failed. 
1086      * The default value is <code>(^ERROR: )</code> (note the space). 
1087      * If this is not appropriate, please modify 
1088      * and notify the developer of this plugin. 
1089      * FIXME: This is not used. 
1090      */
1091     @Parameter(name = "patternErrXindy", defaultValue = "(^ERROR: )")
1092     private String patternErrXindy = "(^ERROR: )";
1093 
1094     /**
1095      * The pattern in the glg-file 
1096      * indicating a warning when running <code>xindy</code> 
1097      * via {@link #makeGlossariesCommand}. 
1098      * The default value is <code>(^WARNING: )</code> 
1099      * (note the space and the brackets). 
1100      * If this is not appropriate, please modify 
1101      * and notify the developer of this plugin. 
1102      */
1103     @Parameter(name = "patternWarnXindy", defaultValue = "(^WARNING: )")
1104     private String patternWarnXindy = "(^WARNING: )";
1105 
1106     /**
1107      * The pattern in the log-file which triggers 
1108      * rerunning {@link #makeGlossariesCommand} 
1109      * followed by {@link #latex2pdfCommand}. 
1110      * This pattern only occurs, if package <code>rerunfilecheck</code> 
1111      * is used with option <code>glossary</code>. 
1112      * The default value 
1113      * is chosen according to the package documentation. 
1114      * If the user finds that default value is not appropriate, 
1115      * (s)he is asked to contribute 
1116      * and to notify the developer of this plugin. 
1117      */
1118     @Parameter(name = "patternReRunMakeGlossaries", 
1119 	       defaultValue = 
1120 	//"^Package rerunfilecheck Warning: File `.*\\.glo' has changed\\.$" +
1121 	// FIXME: really MAKEINDEX! 
1122 	// Problem: package glossaries redefines makeglossary 
1123 	// which breaks this solution with rerunfilecheck 
1124 	"^\\(rerunfilecheck\\) +Rerun LaTeX/makeindex to get glossary right\\.$"
1125     )
1126     private String patternReRunMakeGlossaries = 
1127 	//"^Package rerunfilecheck Warning: File `.*\\.glo' has changed\\.$" +
1128 	// FIXME: really MAKEINDEX! 
1129 	// Problem: package glossaries redefines makeglossary 
1130 	// which breaks this solution with rerunfilecheck 
1131 	"^\\(rerunfilecheck\\) +Rerun LaTeX/makeindex to get glossary right\\.$";
1132 
1133 
1134    // parameters for latex2html-conversion 
1135 
1136     /**
1137      * The tex4ht command. 
1138      * Possible values are e.g. 
1139      * <code>htlatex</code> and <code>htxelatex</code>. 
1140      * The default value (for which this software is also tested) 
1141      * is <code>htlatex</code>. 
1142      */
1143     @Parameter(name = "tex4htCommand", defaultValue = "htlatex")
1144     private String tex4htCommand = "htlatex";
1145 
1146     /**
1147      * The options for the <code>tex4ht</code>-style 
1148      * which creates a dvi-file or a pdf-file 
1149      * with information to create sgml, 
1150      * e.g. html or odt or something like that. 
1151      * The default value is <code>html,2</code>. 
1152      */
1153     @Parameter(name = "tex4htStyOptions", defaultValue = "html,2")
1154     private String tex4htStyOptions = "html,2";
1155 
1156     /**
1157      * The options for <code>tex4ht</code> which extracts information 
1158      * from a dvi-file or from a pdf-file 
1159      * into the according lg-file and idv-file producing html-files 
1160      * and by need and if configured accordingly 
1161      * svg-files, 4ct-files and 4tc-files and a css-file and a tmp-file.
1162      * The former two are used by <code>t4ht</code> 
1163      * which is configured via {@link #t4htOptions}. 
1164      */
1165     @Parameter(name = "tex4htOptions", defaultValue = "")
1166     private String tex4htOptions = "";
1167 
1168     /**
1169      * The options for <code>t4ht</code> which converts idv-file and lg-file 
1170      * into css-files, tmp-file and, 
1171      * by need and if configured accordingly into png files. 
1172      * The value <code>-p</code> prevents creation of png-pictures.
1173      * The default value is the empty string. 
1174      */
1175     @Parameter(name = "t4htOptions", defaultValue = "")
1176     private String t4htOptions = "";
1177 
1178     /**
1179      * The pattern for the target files of goal {@link Target#html} 
1180      * for a given latex main file <code>xxx.tex</code>. 
1181      * The patterns for the other targets 
1182      * are hardcoded and take the form 
1183      * <code>^T$T\.yyy$</code>, where <code>yyy</code> 
1184      * may be an ending or an alternative of endings. 
1185      * <p>
1186      * For an explanation of the pattern <code>T$T</code>, 
1187      * see {@link #patternCreatedFromLatexMain}. 
1188      * Spaces and newlines are removed 
1189      * from that pattern before processing. 
1190      * <p>
1191      * The default value has the following components: 
1192      * <ul>
1193      * <li><code>^T$T\.x?html?$</code> 
1194      * is the main file. 
1195      * <li><code>^T$Tli\d+\.x?html?$</code> 
1196      * are lists: toc, lof, lot, indices, glossaries, NOT the bibliography. 
1197      * <li><code>^T$T(ch|se|su|ap)\d+\.x?html?$</code> 
1198      * are chapters, sections and subsections or below 
1199      * and appendices. 
1200      * <li><code>^T$T\d+\.x?html?$</code> 
1201      * are footnotes. 
1202      * <li><code>^T$T\.css$</code> 
1203      * are cascaded stylesheets. 
1204      * <li><code>^T$T-\d+\.svg$</code> and <code>^T$T\d+x\.png$</code>
1205      * are svg/png-files representing figures. 
1206      * <li><code>^(cmsy)\d+(-c)?-\d+c?\.png$</code> 
1207      * represents special symbols. 
1208      * </ul>
1209      * Note that the patterns for the html-files 
1210      * can be summarized as <code>^T$T((ch|se|su|ap|li)?\d+)?\.x?html?$</code>. 
1211      * Adding the patterns for the css-file and the svg-files, we obtain 
1212      * <pre>
1213      * ^T$T(((ch|se|su|ap|li)?\d+)?\.x?html?|
1214      * \.css|
1215      * \d+x\.x?bb|
1216      * \d+x\.png|
1217      * -\d+\.svg)$
1218      * </pre>. 
1219      * <p>
1220      * The pattern is designed to match quite exactly 
1221      * the files to be copied to {@link #targetSiteDirectory}, 
1222      * for the goal {@link Target#html}, 
1223      * not much more and at any case not less. 
1224      * since {@link #tex4htCommand} is not well documented, 
1225      * and still subject to development, 
1226      * this pattern cannot be guaranteed to be final. 
1227      * If the user finds an extension, (s)he is asked to contribute 
1228      * and to notify the developer of this plugin. 
1229      * Then the default value will be extended. 
1230      */
1231     @Parameter(name = "patternT4htOutputFiles", defaultValue = "")
1232     private String patternT4htOutputFiles = 
1233 	"^(T$T(((ch|se|su|ap|li)?\\d+)?\\.x?html?|" + 
1234 	/*   */"\\.css|" + 
1235 	/*   */"\\d+x\\.x?bb|" + 
1236 	/*   */"\\d+x\\.png|" +
1237 	/*   */"-\\d+\\.svg)|" + 
1238 	"(cmsy)\\d+(-c)?-\\d+c?\\.png)$";
1239 
1240 
1241    // parameters for further conversions 
1242 
1243     /**
1244      * The latex2rtf command to create rtf from latex directly. 
1245      * The default value is <code>latex2rtf</code>. 
1246      */
1247     @Parameter(name = "latex2rtfCommand", defaultValue = "latex2rtf")
1248     private String latex2rtfCommand = "latex2rtf";
1249 
1250     /**
1251      * The options of the command {@link #latex2rtfCommand}. 
1252      * The default value is the empty string. 
1253      */
1254     @Parameter(name = "latex2rtfOptions", defaultValue = "")
1255     private String latex2rtfOptions = "";
1256 
1257     /**
1258      * The odt2doc command 
1259      * to create MS word-formats from otd-files. 
1260      * The default value is <code>odt2doc</code>; 
1261      * equivalent here is <code>unoconv</code>. 
1262      * Note that <code>odt2doc</code> just calls <code>unoconv</code> 
1263      * with odt-files as input and doc-file as default output. 
1264      *
1265      * @see #odt2docOptions
1266      */
1267     @Parameter(name = "odt2docCommand", defaultValue = "odt2doc")
1268     private String odt2docCommand = "odt2doc";
1269 
1270     /**
1271      * The options of the command {@link #odt2docCommand}. 
1272      * Above all specification of output format 
1273      * via the option <code>-f</code>. 
1274      * Invocation is <code>odt2doc -f&lt;format&gt; &lt;file&gt;.odt</code>. 
1275      * All output formats are shown by <code>odt2doc --show</code> 
1276      * but the formats interesting in this context 
1277      * are <code>doc, doc6, doc95,docbook, docx, docx7, ooxml, rtf</code>. 
1278      * Interesting also the verbosity options <code>-v, -vv, -vvv</code> 
1279      * the timeout <code>-T=secs</code> and <code>--preserve</code> 
1280      * to keep permissions and timestamp of the original document. 
1281      * The default value is <code>-fdocx</code>. 
1282      *
1283      * @see #odt2docCommand
1284      */
1285     @Parameter(name = "odt2docOptions", defaultValue = "-fdocx")
1286     private String odt2docOptions = "-fdocx";
1287 
1288     /**
1289      * The pdf2txt-command for converting pdf-files into plain text files. 
1290      * The default value is <code>pdftotext</code>. 
1291      *
1292      * @see #pdf2txtOptions
1293      */
1294     @Parameter(name = "pdf2txtCommand", defaultValue = "pdftotext")
1295     private String pdf2txtCommand = "pdftotext";
1296 
1297     /**
1298      * The options of the command {@link #pdf2txtCommand}. 
1299      * The default value is the empty string. 
1300      *
1301      * @see #pdf2txtCommand
1302      */
1303     @Parameter(name = "pdf2txtOptions", defaultValue = "-q")
1304     private String pdf2txtOptions = "-q";
1305 
1306 
1307 
1308     /**
1309      * The chktex-command for checking latex main files. 
1310      * The default value is <code>chktex</code>. 
1311      *
1312      * @see #chkTexOptions
1313      */
1314     @Parameter(name = "chkTexCommand", defaultValue = "chktex")
1315     private String chkTexCommand = "chktex";
1316 
1317 
1318     /**
1319      * The options of the command {@link #chkTexCommand}, 
1320      * except <code>-o output-file</code> 
1321      * specifying the output file which is added automatically. 
1322      * <p>
1323      * Here is a list of options useful in this context. 
1324      * The first group of these are muting options: 
1325      * <ul>
1326      * <li><code>-w</code>, <code>-e</code>, <code>-m</code>, 
1327      * Make the message number passed as parameter 
1328      * a warning/an error/a message and turns it on. 
1329      * Messages are not counted. 
1330      * <li><code>-n</code>
1331      * Turns the warning/error number passed as a parameter off. 
1332      * <li><code>-L</code>
1333      * Turns off suppression of messages on a per line basis. 
1334      * </ul>
1335      * The next group of interesting options are for output control: 
1336      * <ul>
1337      * <li><code>-q</code>
1338      * Shuts up about copyright information.
1339      * <li><code>-o output-file</code>
1340      * Specifies the output file. This is added automatically 
1341      * and shall thus not be specified by the user. 
1342      * <li><code>-b[0|1]</code>
1343      * If you use the -o switch, and the named outputfile exists,
1344      * it will be renamed to <code>filename.bak</code>.
1345      * <li><code>-f format</code>
1346      * Specifies the format of the output 
1347      * via a format similar to <code>printf()</code>. 
1348      * For details consult the manual. 
1349      * <li><code>-vd</code>
1350      * Verbosity level followed by a number <code>d</code> 
1351      * specifying the format of the output. 
1352      * The verbosity number is resolved as a pattern 
1353      * as if given by the option <code>-f format</code>. 
1354      * Thus the option <code>-v</code> is ignored 
1355      * if the option <code>-f format</code> is specified. 
1356      * </ul>
1357      * The default value is <code>-q -b0</code> 
1358      * avoiding verbose output and backing up the output log-file. 
1359      *
1360      * @see #chkTexCommand
1361      */
1362     // -v: verbosity: 
1363     //     - 0 File:Line:Column:Warning number:Warning message
1364     //         No specification on the kind of the entry 
1365     //     - 1 1st line: (Error|Warning|Message) in <File> line <Line>: message 
1366     //         2nd line: according line of the source 
1367     //         3rd line: cursor ^ pointing to the place where the problem is 
1368     //     - 2 1st line as for level 1 
1369     //         2nd line: line of source with pointer for the problem 
1370     //                   has shape:  
1371     //     - 3 "File", line Line: Warning message 
1372     //     - 4 1st line as for 3, 
1373     //         2nd line as for 1 
1374     //         3rd line as for 1 
1375     // -f format: this allows to create more flexible formats as with -vxxx 
1376     //         to determine the kind of entry (Error|Warning|Message) 
1377     //         if kind is given, it must be at the beginning of the line 
1378     // -q: no copyright information 
1379     // -b: toggle creation of backup file: with -o: yes, additional -b: no 
1380     //     explicitly as -b0 and -b1, respectively. 
1381     @Parameter(name = "chkTexOptions", defaultValue = "")
1382     private String chkTexOptions = "-q -b0";
1383 
1384     // getter methods partially implementing default values. 
1385 
1386 
1387     // private File getBaseDirectory() throws BuildFailureException {
1388     // 	if (!(this.baseDirectory.exists() && 
1389     // 	      this.baseDirectory.isDirectory())) {
1390     // 	    throw new BuildFailureException
1391     // 		("The base directory '" + this.baseDirectory + 
1392     // 		 "' should be an existing directory, but is not. ");
1393     // 	}
1394     // 	return this.baseDirectory;
1395     // }
1396 
1397     // private File getTargetDirectory() {
1398     //     return this.targetDirectory;
1399     // }
1400 
1401     // private File getTargetSiteDirectory() {
1402     //     return this.targetSiteDirectory;
1403     // }
1404 
1405     /**
1406      *
1407      * @throws BuildFailureException 
1408      *    TSS01 if the tex source directory does either not exist 
1409      *    or is not a directory. 
1410      */
1411     // used in LatexProcessor only: 
1412     // .create() to determine the output directory of the created files 
1413     public File getTexSrcDirectoryFile() throws BuildFailureException {
1414 	if (!(this.texSrcDirectoryFile.exists() && 
1415 	      this.texSrcDirectoryFile.isDirectory())) {
1416 	    throw new BuildFailureException
1417 		("TSS01: The tex source directory '" + 
1418 		 this.texSrcDirectoryFile + 
1419 		 "' should be an existing directory, but is not. ");
1420 	}
1421 	return this.texSrcDirectoryFile;
1422     }
1423 
1424     /**
1425      *
1426      * @throws BuildFailureException 
1427      *    TSS02 if the tex source processing directory does either not exist 
1428      *    or is not a directory. 
1429      */
1430     // used in LatexProcessor only: 
1431     // .create() to determine which directories to be processed 
1432     // .processGraphics() to get all graphics files 
1433     // .clearAll() 
1434     public File getTexSrcProcDirectoryFile() throws BuildFailureException {
1435 	if (!(this.texSrcProcDirectoryFile.exists() && 
1436 	      this.texSrcProcDirectoryFile.isDirectory())) {
1437 	    throw new BuildFailureException 
1438 		("TSS02: The tex source processing directory '" + 
1439 		 this.texSrcProcDirectoryFile + 
1440 		 "' should be an existing directory, but is not. ");
1441 	}
1442 	
1443 	return this.texSrcProcDirectoryFile;
1444     }
1445 
1446     public boolean getReadTexSrcProcDirRec() {
1447 	return   this.readTexSrcProcDirRec;
1448     }
1449 
1450     /**
1451      *
1452      * @throws BuildFailureException 
1453      *    TSS03 if the output directory exists and is no directory. 
1454      */
1455     public File   getOutputDirectoryFile() throws BuildFailureException {
1456 	if (/**/this.outputDirectoryFile.exists() && 
1457 	    !   this.outputDirectoryFile.isDirectory()) {
1458 	    throw new BuildFailureException
1459 		("TSS03: The output directory '" + this.outputDirectoryFile + 
1460 		 "' should be a directory if it exists, but is not. ");
1461 	}
1462        return this.outputDirectoryFile;
1463     }
1464 
1465     public SortedSet<Target> getTargetSet() {
1466 	String[] targetSeq = this.targets.split(" *, *");
1467 	// TreeSet is sorted. maybe this determines ordering of targets. 
1468 	SortedSet<Target> targetSet = new TreeSet<Target>();
1469 	for (int idx = 0; idx < targetSeq.length; idx++) {
1470 	    targetSet.add(Target.valueOf(targetSeq[idx]));
1471 	}
1472 	return targetSet;
1473     }
1474 
1475     public String getPatternLatexMainFile() {
1476 	return  this.patternLatexMainFile;
1477     }
1478 
1479 
1480     // texPath, commands and arguments 
1481 
1482     public File  getTexPath() {
1483         return this.texPath;
1484     }
1485 
1486     public boolean isCleanUp() {
1487         return  this.cleanUp;
1488     }
1489 
1490     public String getPatternCreatedFromLatexMain() {
1491 	return  this.patternCreatedFromLatexMain;
1492     }
1493 
1494 
1495     public String getFig2devCommand() {
1496         return  this.fig2devCommand;
1497     }
1498 
1499     public String getFig2devGenOptions() {
1500         return  this.fig2devGenOptions;
1501     }
1502 
1503     public String getFig2devPtxOptions() {
1504         return  this.fig2devPtxOptions;
1505     }
1506 
1507     public String getFig2devPdfEpsOptions() {
1508         return  this.fig2devPdfEpsOptions;
1509     }
1510 
1511     public String getGnuplotCommand() {
1512         return  this.gnuplotCommand;
1513     }
1514 
1515     public String getGnuplotOptions() {
1516         return  this.gnuplotOptions;
1517     }
1518 
1519     public String getMetapostCommand() {
1520         return  this.metapostCommand;
1521     }
1522 
1523     public String getMetapostOptions() {
1524         return  this.metapostOptions;
1525     }
1526 
1527     public String getSvg2devCommand() {
1528 	return  this.svg2devCommand;
1529     }
1530 
1531     public String getSvg2devOptions() {
1532 	return  this.svg2devOptions;
1533     }
1534 
1535     public String getEbbCommand() {
1536         return  this.ebbCommand;
1537     }
1538     public String getEbbOptions() {
1539         return  this.ebbOptions;
1540     }
1541 
1542 
1543 // FIXME: to be renamed: latex2pdf-command 
1544     public String getLatex2pdfCommand() {
1545         return  this.latex2pdfCommand;
1546     }
1547 
1548     // FIXME: to be renamed: texOptions 
1549     public String getLatex2pdfOptions() {
1550         return  this.latex2pdfOptions;
1551     }
1552 
1553     public String getPatternErrLatex() {
1554 	return  this.patternErrLatex;
1555     }
1556 
1557     // same pattern as for latex 
1558     public String getPatternErrMPost() {
1559 	return  this.patternErrLatex;
1560     }
1561 
1562     public String getPatternWarnLatex() {
1563 	return  this.patternWarnLatex;
1564     }
1565 
1566     public boolean getDebugBadBoxes() {
1567 	return   this.debugBadBoxes;
1568     }
1569 
1570     public boolean getDebugWarnings() {
1571 	return   this.debugWarnings;
1572     }
1573 
1574     public     LatexDev getPdfViaDvi() {
1575 	return LatexDev.   devViaDvi(this.pdfViaDvi);
1576     }
1577 
1578     public String getDvi2pdfCommand() {
1579 	return  this.dvi2pdfCommand;
1580     }
1581 
1582     public String getDvi2pdfOptions() {
1583 	return  this.dvi2pdfOptions;
1584     }
1585 
1586     public String getPatternReRunLatex() {
1587 	return  this.patternReRunLatex;
1588     }
1589 
1590     public int   getMaxNumReRunsLatex() {
1591 	return this.maxNumReRunsLatex;
1592     }
1593 
1594 
1595     public String getBibtexCommand() {
1596         return  this.bibtexCommand;
1597     }
1598     public String getBibtexOptions() {
1599         return  this.bibtexOptions;
1600     }
1601 
1602     public String getPatternErrBibtex() {
1603 	return  this.patternErrBibtex;
1604     }
1605 
1606     public String getPatternWarnBibtex() {
1607 	return  this.patternWarnBibtex;
1608     }
1609 
1610 
1611     public String getMakeIndexCommand() {
1612 	return  this.makeIndexCommand;
1613     }
1614 
1615     public String getMakeIndexOptions() {
1616 	return  this.makeIndexOptions;
1617     }
1618 
1619     public String getPatternErrMakeIndex() {
1620 	return  this.patternErrMakeIndex;
1621     }
1622 
1623     public String getPatternWarnMakeIndex() {
1624 	return this.patternWarnMakeIndex;
1625     }
1626 
1627     public String getPatternReRunMakeIndex() {
1628 	return this.patternReRunMakeIndex;
1629     }
1630 
1631     public String getSplitIndexCommand() {
1632 	return  this.splitIndexCommand;
1633     }
1634 
1635     public String getSplitIndexOptions() {
1636 	return  this.splitIndexOptions;
1637     }
1638 
1639     public String getMakeGlossariesCommand() {
1640 	return  this.makeGlossariesCommand;
1641     }
1642 
1643     public String getMakeGlossariesOptions() {
1644 	return  this.makeGlossariesOptions;
1645     }
1646 
1647     public String getPatternErrMakeGlossaries() {
1648 	return  this.patternErrMakeGlossaries;
1649     }
1650 
1651     public String getPatternWarnXindy() {
1652 	return  this.patternWarnXindy;
1653     }
1654 
1655     public String getPatternReRunMakeGlossaries() {
1656 	return  this.patternReRunMakeGlossaries;
1657     }
1658 
1659 
1660     public String getTex4htCommand() {
1661         return  this.tex4htCommand;
1662     }
1663 
1664     public String getTex4htStyOptions() {
1665         return  this.tex4htStyOptions;
1666     }
1667 
1668     public String getTex4htOptions() {
1669         return  this.tex4htOptions;
1670     }
1671 
1672     public String getT4htOptions() {
1673         return  this.t4htOptions;
1674     }
1675 
1676     public String getPatternT4htOutputFiles() {
1677 	return  this.patternT4htOutputFiles;
1678     }
1679 
1680     public String getLatex2rtfCommand() {
1681         return  this.latex2rtfCommand;
1682     }
1683 
1684     public String getLatex2rtfOptions() {
1685         return  this.latex2rtfOptions;
1686     }
1687 
1688     public String getOdt2docCommand() {
1689         return  this.odt2docCommand;
1690     }
1691 
1692     public String getOdt2docOptions() {
1693 	return  this.odt2docOptions;
1694     }
1695 
1696     public String getPdf2txtCommand() {
1697         return  this.pdf2txtCommand;
1698     }
1699 
1700     public String getPdf2txtOptions() {
1701         return  this.pdf2txtOptions;
1702     }
1703 
1704     public String getChkTexCommand() {
1705         return  this.chkTexCommand;
1706     }
1707 
1708     public String getChkTexOptions() {
1709         return  this.chkTexOptions;
1710     }
1711 
1712 
1713 
1714     // setter methods 
1715 
1716    /**
1717      * Sets {@link #baseDirectory} and updates 
1718      * {@link #texSrcDirectoryFile} and {@link #texSrcProcDirectoryFile}. 
1719      */
1720     public void setBaseDirectory(File baseDirectory) {
1721         this.baseDirectory = baseDirectory;
1722 	this.texSrcDirectoryFile     = new File(this.baseDirectory, 
1723 						this.texSrcDirectory);
1724 	this.texSrcProcDirectoryFile = new File(this.texSrcDirectoryFile,
1725 						this.texSrcProcDirectory);	
1726     }
1727 
1728     /**
1729      * Sets {@link #targetDirectory}. 
1730      */
1731     public void setTargetDirectory(File targetDirectory) {
1732         this.targetDirectory = targetDirectory;
1733     }
1734 
1735     /**
1736      * Sets {@link #targetSiteDirectory} and updates 
1737      * {@link #outputDirectoryFile}. 
1738      */
1739     public void setTargetSiteDirectory(File targetSiteDirectory) {
1740         this.targetSiteDirectory = targetSiteDirectory;
1741 	this.outputDirectoryFile = new File(this.targetSiteDirectory, 
1742 					    this.outputDirectory);
1743     }
1744 
1745     /**
1746      * Sets {@link #texSrcDirectory} and updates 
1747      * {@link #texSrcDirectoryFile} and {@link #texSrcProcDirectoryFile}. 
1748      */
1749     public void setTexSrcDirectory(String texSrcDirectory) {
1750         this.texSrcDirectory = texSrcDirectory;
1751 	this.texSrcDirectoryFile     = new File(this.baseDirectory, 
1752 						this.texSrcDirectory);
1753 	this.texSrcProcDirectoryFile = new File(this.texSrcDirectoryFile,
1754 						this.texSrcProcDirectory);
1755     }
1756 
1757     /**
1758      * Sets {@link #texSrcProcDirectory} and updates 
1759      * {@link #texSrcProcDirectoryFile}. 
1760      */
1761     public void setTexSrcProcDirectory(String texSrcProcDirectory) {
1762 	this.texSrcProcDirectory = texSrcProcDirectory;
1763 	this.texSrcProcDirectoryFile = new File(this.texSrcDirectoryFile,
1764 						this.texSrcProcDirectory);
1765     }
1766 
1767     public void setReadTexSrcProcDirRec(boolean readTexSrcDirProcRec) {
1768 	this.readTexSrcProcDirRec = readTexSrcProcDirRec;
1769     }
1770 
1771     /**
1772      * Sets {@link #outputDirectory} and updates {@link #outputDirectoryFile}. 
1773      */
1774     public void setOutputDirectory(String outputDirectory) {
1775         this.outputDirectory = outputDirectory;
1776 	this.outputDirectoryFile = new File(this.targetSiteDirectory, 
1777 					    this.outputDirectory);
1778     }
1779 
1780     public void setTargets(String targets) {
1781 	this.targets = targets.trim();
1782     }
1783 
1784     // setter method for patternLatexMainFile in maven 
1785     // trims parameter before setting 
1786     public void setPatternLatexMainFile(String patternLatexMainFile) {
1787 	this.patternLatexMainFile = patternLatexMainFile
1788 	    .replaceAll("(\t|\n)+", "").trim();
1789     }
1790 
1791     // method introduces patternLatexMainFile in ant 
1792     public PatternLatexMainFile createPatternLatexMainFile() {
1793    	return new PatternLatexMainFile();
1794     }
1795 
1796     // defines patternLatexMainFile element with text in ant 
1797     public class PatternLatexMainFile {
1798 	// FIXME: this is without property resolution. 
1799 	// to add this need  pattern = getProject().replaceProperties(pattern)
1800 	// with Task.getProject() 
1801    	public void addText(String pattern) {
1802    	    Settings.this.setPatternLatexMainFile(pattern);
1803    	}
1804     }
1805 
1806     public void setTexPath(File texPath) {
1807         this.texPath = texPath;
1808     }
1809 
1810     public void setCleanUp(boolean cleanUp) {
1811         this.cleanUp = cleanUp;
1812     }
1813 
1814     // FIXME: as patternCreatedFromLatexMain 
1815     // replace "\n" (canonical newline in xml) also for other patterns by ""
1816 
1817     // setter method for patternCreatedFromLatexMain in maven 
1818     // eliminates tab, newline and blanks and trims parameter before setting 
1819     public void setPatternCreatedFromLatexMain(String pattern) {
1820 	this.patternCreatedFromLatexMain = pattern
1821 	    .replaceAll("(\t|\n| )+", "").trim();
1822     }
1823 
1824     // method introduces patternCreatedFromLatexMain in ant 
1825     public PatternCreatedFromLatexMain createPatternCreatedFromLatexMain() {
1826    	return new PatternCreatedFromLatexMain();
1827     }
1828 
1829     // defines patternCreatedFromLatexMain element with text in ant 
1830     public class PatternCreatedFromLatexMain {
1831 	// FIXME: this is without property resolution. 
1832 	// to add this need  pattern = getProject().replaceProperties(pattern)
1833 	// with Task.getProject() 
1834    	public void addText(String pattern) {
1835    	    Settings.this.setPatternCreatedFromLatexMain(pattern);
1836    	}
1837     }
1838 
1839     public void setFig2devCommand(String fig2devCommand) {
1840         this.fig2devCommand = fig2devCommand;
1841     }
1842 
1843     public void setFig2devGenOptions(String fig2devGenOptions) {
1844         this.fig2devGenOptions = fig2devGenOptions
1845 	    .replaceAll("(\t|\n| )+", " ").trim();
1846     }
1847 
1848     public void setFig2devPtxOptions(String fig2devPtxOptions) {
1849         this.fig2devPtxOptions = fig2devPtxOptions
1850 	    .replaceAll("(\t|\n| )+", " ").trim();
1851     }
1852 
1853     public void setFig2devPdfEpsOptions(String fig2devPdfEpsOptions) {
1854         this.fig2devPdfEpsOptions = fig2devPdfEpsOptions
1855 	    .replaceAll("(\t|\n| )+", " ").trim();
1856     }
1857 
1858     public void setGnuplotCommand(String gnuplotCommand) {
1859         this.gnuplotCommand = gnuplotCommand;
1860     }
1861 
1862     public void setGnuplotOptions(String gnuplotOptions) {
1863         this.gnuplotOptions = gnuplotOptions
1864 	    .replaceAll("(\t|\n| )+", " ").trim();
1865     }
1866 
1867     public void setMetapostCommand(String metapostCommand) {
1868         this.metapostCommand = metapostCommand;
1869     }
1870 
1871     // setter method for metapostOptions in maven 
1872     public void setMetapostOptions(String metapostOptions) {
1873         this.metapostOptions = metapostOptions
1874 	    .replaceAll("(\t|\n| )+", " ").trim();
1875     }
1876 
1877     // method introduces metapostOptions in ant 
1878     public MetapostOptions createMetapostOptions() {
1879    	return new MetapostOptions();
1880     }
1881 
1882    // defines e element with text in ant 
1883     public class MetapostOptions {
1884 	// FIXME: this is without property resolution. 
1885 	// to add this need  pattern = getProject().replaceProperties(pattern)
1886 	// with Task.getProject() 
1887    	public void addText(String args) {
1888    	    Settings.this.setMetapostOptions(args);
1889    	}
1890     }
1891 
1892     public void setSvg2devCommand(String svg2devCommand) {
1893 	this.svg2devCommand = svg2devCommand;
1894     }
1895 
1896     public void setSvg2devOptions(String svg2dev) {
1897 	this.svg2devOptions = svg2devOptions
1898 	    .replaceAll("(\t|\n| )+", " ").trim();
1899     }
1900 
1901     public void setEbbCommand(String ebbCommand) {
1902         this.ebbCommand = ebbCommand;
1903     }
1904 
1905     public void setEbbOptions(String ebbOptions) {
1906         this.ebbOptions = ebbOptions
1907 	    .replaceAll("(\t|\n| )+", " ").trim();
1908     }
1909 
1910     public void setLatex2pdfCommand(String latex2pdfCommand) {
1911         this.latex2pdfCommand = latex2pdfCommand;
1912     }
1913 
1914     /**
1915      * Sets the argument string of the latex command 
1916      * given by {@link #latex2pdfCommand}. 
1917      * It is ensured that {@link #latex2pdfOptions} 
1918      * consist of proper options separated by a single blank. 
1919      *
1920      * @param args
1921      *    The arguments string to use when calling LaTeX 
1922      *    via {@link #latex2pdfCommand}. 
1923      *    Leading and trailing blank and newline are ignored. 
1924      *    Proper arguments are separated by blank and newline. 
1925      */
1926     // setter method for latex2pdfOptions in maven 
1927     public void setLatex2pdfOptions(String args) {
1928         this.latex2pdfOptions = args.replaceAll("(\t|\n| )+", " ").trim();
1929     }
1930 
1931     // method introduces latex2pdfOptions in ant 
1932     public Latex2pdfOptions createLatex2pdfOptions() {
1933    	return new Latex2pdfOptions();
1934     }
1935 
1936    // defines e element with text in ant 
1937     public class Latex2pdfOptions {
1938 	// FIXME: this is without property resolution. 
1939 	// to add this need  pattern = getProject().replaceProperties(pattern)
1940 	// with Task.getProject() 
1941    	public void addText(String args) {
1942    	    Settings.this.setLatex2pdfOptions(args);
1943    	}
1944     }
1945 
1946  
1947     // setter method for patternErrLatex in maven 
1948     public void setPatternErrLatex(String patternErrLatex) {
1949 	this.patternErrLatex = patternErrLatex;
1950     }
1951 
1952     // method introduces patternErrLatex in ant 
1953     public PatternErrLatex createPatternErrLatex() {
1954    	return new PatternErrLatex();
1955     }
1956 
1957     // defines patternErrLatex element with text in ant 
1958     public class PatternErrLatex {
1959 	// FIXME: this is without property resolution. 
1960 	// to add this need  pattern = getProject().replaceProperties(pattern)
1961 	// with Task.getProject() 
1962    	public void addText(String pattern) {
1963    	    Settings.this.setPatternErrLatex(pattern);
1964    	}
1965     }
1966 
1967 
1968 
1969     // setter method for patternWarnLatex in maven 
1970     public void setPatternWarnLatex(String patternWarnLatex) {
1971 	this.patternWarnLatex = patternWarnLatex
1972 	    .replaceAll("(\t|\n)+", "").trim();
1973     }
1974 
1975     // method introduces patternWarnLatex in ant 
1976     public PatternWarnLatex createPatternWarnLatex() {
1977    	return new PatternWarnLatex();
1978     }
1979 
1980     // defines patternWarnLatex element with text in ant 
1981     public class PatternWarnLatex {
1982 	// FIXME: this is without property resolution. 
1983 	// to add this need  pattern = getProject().replaceProperties(pattern)
1984 	// with Task.getProject() 
1985    	public void addText(String pattern) {
1986    	    Settings.this.setPatternWarnLatex(pattern);
1987    	}
1988     }
1989 
1990     public void setDebugBadBoxes(boolean debugBadBoxes) {
1991 	this.debugBadBoxes = debugBadBoxes;
1992     }
1993 
1994     public void setDebugWarnings(boolean debugWarnings) {
1995 	this.debugWarnings = debugWarnings;
1996     }
1997 
1998     public void setPdfViaDvi(boolean pdfViaDvi) {
1999 	this.pdfViaDvi = pdfViaDvi;
2000     }
2001 
2002     public void setDvi2pdfCommand(String dvi2pdfCommand) {
2003 	this.dvi2pdfCommand = dvi2pdfCommand;
2004     }
2005 
2006     public void setDvi2pdfOptions(String dvi2pdfOptions) {
2007 	this.dvi2pdfOptions = dvi2pdfOptions
2008 	    .replaceAll("(\t|\n| )+", " ").trim();
2009     }
2010 
2011     // setter method for patternReRunLatex in maven 
2012     public void setPatternReRunLatex(String pattern) {
2013 	this.patternReRunLatex = pattern
2014 	    .replaceAll("(\t|\n)+", "").trim();
2015     }
2016 
2017     // method introduces patternReRunLatex in ant 
2018     public PatternReRunLatex createPatternReRunLatex() {
2019    	return new PatternReRunLatex();
2020     }
2021 
2022     // defines patternNeedAnotherLatexRun element with text in ant 
2023     public class PatternReRunLatex {
2024 	// FIXME: this is without property resolution. 
2025 	// to add this need  pattern = getProject().replaceProperties(pattern)
2026 	// with Task.getProject() 
2027    	public void addText(String pattern) {
2028    	    Settings.this.setPatternReRunLatex(pattern);
2029    	}
2030     }
2031 
2032     // FIXME: real check needed. also in other locations. 
2033     public void setMaxNumReRunsLatex(int maxNumReRunsLatex) {
2034 	assert maxNumReRunsLatex >= 1 || maxNumReRunsLatex == -1
2035 	    : "Found illegal max number of reruns "+maxNumReRunsLatex+". ";
2036 	this.maxNumReRunsLatex = maxNumReRunsLatex;
2037     }
2038 
2039 
2040     public void setBibtexCommand(String bibtexCommand) {
2041         this.bibtexCommand = bibtexCommand;
2042     }
2043     public void setBibtexOptions(String bibtexOptions) {
2044         this.bibtexOptions = bibtexOptions
2045 	    .replaceAll("(\t|\n| )+", " ").trim();
2046     }
2047 
2048     // setter method for patternErrBibtex in maven 
2049     public void setPatternErrBibtex(String patternErrBibtex) {
2050         this.patternErrBibtex = patternErrBibtex;
2051     }
2052 
2053     // method introduces patternErrBibtex in ant 
2054     public PatternErrBibtex createPatternErrBibtex() {
2055    	return new PatternErrBibtex();
2056     }
2057 
2058     // defines patternErrBibtex element with text in ant 
2059     public class PatternErrBibtex {
2060 	// FIXME: this is without property resolution. 
2061 	// to add this need  pattern = getProject().replaceProperties(pattern)
2062 	// with Task.getProject() 
2063    	public void addText(String pattern) {
2064    	    Settings.this.setPatternErrBibtex(pattern);
2065    	}
2066     }
2067 
2068     // setter method for patternWarnBibtex in maven 
2069     public void setPatternWarnBibtex(String patternWarnBibtex) {
2070         this.patternWarnBibtex = patternWarnBibtex;
2071     }
2072 
2073     // method introduces patternWarnBibtex in ant 
2074     public PatternWarnBibtex createPatternWarnBibtex() {
2075    	return new PatternWarnBibtex();
2076     }
2077 
2078     // defines patternWarnBibtex element with text in ant 
2079     public class PatternWarnBibtex {
2080 	// FIXME: this is without property resolution. 
2081 	// to add this need  pattern = getProject().replaceProperties(pattern)
2082 	// with Task.getProject() 
2083    	public void addText(String pattern) {
2084    	    Settings.this.setPatternWarnBibtex(pattern);
2085    	}
2086     }
2087 
2088 
2089     public void setMakeIndexCommand(String makeIndexCommand) {
2090         this.makeIndexCommand = makeIndexCommand;
2091     }
2092 
2093     public void setMakeIndexOptions(String makeIndexOptions) {
2094 	this.makeIndexOptions = makeIndexOptions
2095 	    .replaceAll("(\t|\n| )+", " ").trim();
2096     }
2097 
2098     // setter method for patternErrMakeIndex in maven 
2099     public void setPatternErrMakeIndex(String patternErrMakeIndex) {
2100         this.patternErrMakeIndex = patternErrMakeIndex
2101 	    .replaceAll("\n+", "").trim();
2102     }
2103 
2104     // method introduces patternErrMakeIndex in ant 
2105     public PatternErrMakeIndex createPatternErrMakeIndex() {
2106    	return new PatternErrMakeIndex();
2107     }
2108 
2109     // defines patternErrMakeIndex element with text in ant 
2110     public class PatternErrMakeIndex {
2111 	// FIXME: this is without property resolution. 
2112 	// to add this need  pattern = getProject().replaceProperties(pattern)
2113 	// with Task.getProject() 
2114    	public void addText(String pattern) {
2115    	    Settings.this.setPatternErrMakeIndex(pattern);
2116    	}
2117     }
2118 
2119     // FIXME: MakeIndex
2120     // setter method for patternWarnMakeIndex in maven 
2121     public void setPatternWarnMakeIndex(String patternWarnMakeIndex) {
2122         this.patternWarnMakeIndex = patternWarnMakeIndex
2123 	    .replaceAll("\n+", "").trim();
2124     }
2125 
2126     // method introduces patternWarnMakeIndex in ant 
2127     public PatternWarnMakeIndex createPatternWarnMakeIndex() {
2128    	return new PatternWarnMakeIndex();
2129     }
2130 
2131     // defines patternWarnMakeIndex element with text in ant 
2132     public class PatternWarnMakeIndex {
2133 	// FIXME: this is without property resolution. 
2134 	// to add this need  pattern = getProject().replaceProperties(pattern)
2135 	// with Task.getProject() 
2136    	public void addText(String pattern) {
2137    	    Settings.this.setPatternWarnMakeIndex(pattern);
2138    	}
2139     }
2140 
2141     // setter method for patternReRunMakeIndex in maven 
2142     public void setPatternReRunMakeIndex(String pattern) {
2143         this.patternReRunMakeIndex = pattern
2144 	    .replaceAll("\n+", "").trim();
2145     }
2146 
2147     // method introduces patternMakeIndex in ant 
2148     public PatternReRunMakeIndex createPatternReRunMakeIndex() {
2149    	return new PatternReRunMakeIndex();
2150     }
2151 
2152     // defines patternReRunMakeIndex element with text in ant 
2153     public class PatternReRunMakeIndex {
2154 	// FIXME: this is without property resolution. 
2155 	// to add this need  pattern = getProject().replaceProperties(pattern)
2156 	// with Task.getProject() 
2157    	public void addText(String pattern) {
2158    	    Settings.this.setPatternReRunMakeIndex(pattern);
2159    	}
2160     }
2161 
2162     public void setSplitIndexCommand(String splitIndexCommand) {
2163         this.splitIndexCommand = splitIndexCommand;
2164     }
2165 
2166     public void setSplitIndexOptions(String splitIndexOptions) {
2167         this.splitIndexOptions = splitIndexOptions
2168 	    .replaceAll("(\t|\n| )+", " ").trim();
2169     }
2170 
2171     public void setMakeGlossariesCommand(String makeGlossariesCommand) {
2172         this.makeGlossariesCommand = makeGlossariesCommand;
2173     }
2174 
2175     public void setMakeGlossariesOptions(String makeGlossariesOptions) {
2176 	this.makeGlossariesOptions = makeGlossariesOptions
2177 	    .replaceAll("(\t|\n| )+", " ").trim();
2178     }
2179 
2180     public void setPatternErrMakeGlossaries(String patternErrMakeGlossaries) {
2181 	this      .patternErrMakeGlossaries =      patternErrMakeGlossaries
2182 	    .replaceAll("\n+", "").trim();
2183     }
2184 
2185      public void setPatternWarnXindy(String patternWarnXindy) {
2186 	this.patternWarnXindy = patternWarnXindy
2187 	    .replaceAll("\n+", "").trim();
2188     }
2189 
2190     // setter method for patternReRunMakeGlossaries in maven 
2191     public void setPatternReRunMakeGlossaries(String pattern) {
2192         this.patternReRunMakeGlossaries = pattern
2193 	    .replaceAll("\n+", "").trim();
2194     }
2195 
2196     // method introduces patternReRunMakeGlossaries in ant 
2197     public PatternReRunMakeGlossaries createPatternReRunMakeGlossaries() {
2198    	return new PatternReRunMakeGlossaries();
2199     }
2200 
2201     // defines patternReRunMakeGlossaries element with text in ant 
2202     public class PatternReRunMakeGlossaries {
2203 	// FIXME: this is without property resolution. 
2204 	// to add this need  pattern = getProject().replaceProperties(pattern)
2205 	// with Task.getProject() 
2206    	public void addText(String pattern) {
2207    	    Settings.this.setPatternReRunMakeGlossaries(pattern);
2208    	}
2209     }
2210 
2211  
2212     public void setTex4htCommand(String tex4htCommand) {
2213         this.tex4htCommand = tex4htCommand;
2214     }
2215 
2216     public void setTex4htStyOptions(String tex4htStyOptions) {
2217 	this.tex4htStyOptions = tex4htStyOptions
2218 	    .replaceAll("(\t|\n| )+", " ").trim();
2219    }
2220 
2221     public void setTex4htOptions(String tex4htOptions) {
2222 	this.tex4htOptions = tex4htOptions
2223 	    .replaceAll("(\t|\n| )+", " ").trim();
2224     }
2225 
2226      public void setT4htOptions(String t4htOptions) {
2227 	this.t4htOptions = t4htOptions
2228 	    .replaceAll("(\t|\n| )+", " ").trim();
2229     }
2230 
2231     // setter method for patternT4htOutputFiles in maven 
2232     public void setPatternT4htOutputFiles(String patternT4htOutputFiles) {
2233 	this.patternT4htOutputFiles = patternT4htOutputFiles
2234 	    .replaceAll("(\t|\n| )+", "").trim();
2235     }
2236 
2237     // method introduces patternT4htOutputFiles in ant 
2238     public PatternT4htOutputFiles createPatternT4htOutputFiles() {
2239    	return new PatternT4htOutputFiles();
2240     }
2241 
2242     // defines patternT4htOutputFiles element with text in ant 
2243     public class PatternT4htOutputFiles {
2244 	// FIXME: this is without property resolution. 
2245 	// to add this need  pattern = getProject().replaceProperties(pattern)
2246 	// with Task.getProject() 
2247    	public void addText(String pattern) {
2248    	    Settings.this.setPatternT4htOutputFiles(pattern);
2249    	}
2250     }
2251 
2252     public void setLatex2rtfCommand(String latex2rtfCommand) {
2253         this.latex2rtfCommand = latex2rtfCommand;
2254     }
2255 
2256     // FIXME: replaceAll: should be unified. 
2257     public void setLatex2rtfOptions(String latex2rtfOptions) {
2258         this.latex2rtfOptions = latex2rtfOptions
2259 	    .replaceAll("(\t|\n| )+", " ").trim();
2260     }
2261 
2262     public void setOdt2docCommand(String odt2docCommand) {
2263         this.odt2docCommand = odt2docCommand;
2264      }
2265 
2266     public void setOdt2docOptions(String odt2docOptions) {
2267         this.odt2docOptions = odt2docOptions
2268 	    .replaceAll("(\t|\n| )+", " ").trim();
2269      }
2270 
2271     public void setPdf2txtCommand(String pdf2txtCommand) {
2272         this.pdf2txtCommand = pdf2txtCommand;
2273     }
2274 
2275     public void setPdf2txtOptions(String pdf2txtOptions) {
2276         this.pdf2txtOptions = pdf2txtOptions
2277 	    .replaceAll("(\t|\n| )+", " ").trim();
2278     }
2279 
2280     public void setChkTexCommand(String chkTexCommand) {
2281         this.chkTexCommand = chkTexCommand;
2282     }
2283 
2284     public void setChkTexOptions(String chkTexOptions) {
2285         this.chkTexOptions = chkTexOptions
2286 	    .replaceAll("(\t|\n| )+", " ").trim();
2287     }
2288 
2289 
2290     public String toString() {
2291         StringBuilder sb = new StringBuilder();
2292 	// directories and related 
2293 	sb.append("[ baseDirectory=")       .append(this.baseDirectory);
2294 	sb.append(", targetDirectory=")     .append(this.targetDirectory);
2295 	sb.append(", targetSiteDirectory=") .append(this.targetSiteDirectory);
2296 	sb.append(", texSrcDirectory=")     .append(this.texSrcDirectory);
2297 	sb.append(", texSrcProcDirectory=") .append(this.texSrcProcDirectory);
2298 	sb.append(", readTexSrcProcDirRec=").append(this.readTexSrcProcDirRec);
2299  	sb.append(", outputDirectory=")     .append(this.outputDirectory);
2300 	// general parameters
2301  	sb.append(", targets=")             .append(this.targets);
2302  	sb.append(", patternLatexMainFile=").append(this.patternLatexMainFile);
2303         sb.append(", texPath=")             .append(this.texPath);
2304 	sb.append(", cleanUp=")             .append(this.cleanUp);
2305 	sb.append(", patternCreatedFromLatexMain=")
2306 	    .append(this.patternCreatedFromLatexMain);
2307 
2308 	// parameters for graphical preprocessors 
2309         sb.append(", fig2devCommand=")      .append(this.fig2devCommand);
2310         sb.append(", fig2devGenOptions")    .append(this.fig2devGenOptions);
2311         sb.append(", fig2devPtxOptions")    .append(this.fig2devPtxOptions);
2312         sb.append(", fig2devPdfEpsOptions") .append(this.fig2devPdfEpsOptions);
2313         sb.append(", gnuplotCommand=")      .append(this.gnuplotCommand);
2314         sb.append(", gnuplotOptions=")      .append(this.gnuplotOptions);
2315         sb.append(", metapostCommand=")     .append(this.metapostCommand);
2316         sb.append(", metapostOptions=")     .append(this.metapostOptions);
2317 	sb.append(", svg2devCommand=")      .append(this.svg2devCommand);
2318 	sb.append(", svg2devOptions=")      .append(this.svg2devOptions);
2319   
2320 	sb.append(", ebbCommand=")          .append(this.ebbCommand);
2321         sb.append(", ebbOptions=")          .append(this.ebbOptions);
2322 
2323 	// parameters for latex2pdf
2324         sb.append(", latex2pdfCommand=")    .append(this.latex2pdfCommand);
2325 	sb.append(", latex2pdfOptions=")    .append(this.latex2pdfOptions);
2326 	sb.append(", patternErrLatex=")     .append(this.patternErrLatex);
2327 	sb.append(", patternWarnLatex=")    .append(this.patternWarnLatex);
2328  	sb.append(", debugBadBoxes=")       .append(this.debugBadBoxes);
2329  	sb.append(", debugWarnings=")       .append(this.debugWarnings);
2330  	sb.append(", pdfViaDvi=")           .append(this.pdfViaDvi);
2331  	sb.append(", dvi2pdfCommand=")      .append(this.dvi2pdfCommand);
2332  	sb.append(", dvi2pdfOptions=")      .append(this.dvi2pdfOptions);
2333 
2334 	sb.append(", patternReRunLatex=")   .append(this.patternReRunLatex);
2335 	sb.append(", maxNumReRunsLatex=")   .append(this.maxNumReRunsLatex);
2336 	// parameters for BibTeX
2337         sb.append(", bibtexCommand=")       .append(this.bibtexCommand);
2338         sb.append(", bibtexOptions=")       .append(this.bibtexOptions);
2339         sb.append(", patternErrBibtex=")    .append(this.patternErrBibtex);
2340         sb.append(", patternWarnBibtex=")   .append(this.patternWarnBibtex);
2341 	// parameters for MakeIndex 
2342         sb.append(", makeIndexCommand=")    .append(this.makeIndexCommand);
2343         sb.append(", makeIndexOptions=")    .append(this.makeIndexOptions);
2344         sb.append(", patternErrMakeIndex=") .append(this.patternErrMakeIndex);
2345         sb.append(", patternWarnMakeIndex=").append(this.patternWarnMakeIndex);
2346         sb.append(", patternReRunMakeIndex=")
2347 	    .append(this.patternReRunMakeIndex);
2348 	sb.append(", splitIndexCommand=")    .append(this.splitIndexCommand);
2349 	sb.append(", splitIndexOptions=")    .append(this.splitIndexOptions);
2350  	// parameters for MakeGlossaries
2351         sb.append(", makeGlossariesCommand=")
2352 	    .append(this.makeGlossariesCommand);
2353         sb.append(", makeGlossariesOptions=")
2354 	    .append(this.makeGlossariesOptions);
2355 	sb.append(", patternErrMakeGlossaries=")
2356 	   .append(this.patternErrMakeGlossaries);
2357 	sb.append(", patternWarnXindy=").append(this.patternWarnXindy);
2358         sb.append(", patternReRunMakeGlossaries=")
2359 	    .append(this.patternReRunMakeGlossaries);
2360 	// parameters for latex2html 
2361         sb.append(", tex4htCommand=")       .append(this.tex4htCommand);
2362         sb.append(", tex4htStyOptions=")    .append(this.tex4htStyOptions);
2363         sb.append(", tex4htOptions=")       .append(this.tex4htOptions);
2364 	sb.append(", t4htOptions=")         .append(this.t4htOptions);
2365 	sb.append(", patternT4htOutputFiles=")
2366 	    .append(this.patternT4htOutputFiles);
2367 	// parameters for latex2rtf 
2368         sb.append(", latex2rtfCommand=")    .append(this.latex2rtfCommand);
2369         sb.append(", latex2rtfOptions=")    .append(this.latex2rtfOptions);
2370 	// parameters for odt2doc
2371         sb.append(", odt2docCommand=")      .append(this.odt2docCommand);
2372         sb.append(", odt2docOptions=")      .append(this.odt2docOptions);
2373 	// parameters for pdf2txt 
2374         sb.append(", pdf2txtCommand=")      .append(this.pdf2txtCommand);
2375         sb.append(", pdf2txtOptions=")      .append(this.pdf2txtOptions);
2376 	// parameters for chktex
2377 	sb.append(", chkTexCommand=")      .append(this.chkTexCommand);
2378         sb.append(", chkTexOptions=")      .append(this.chkTexOptions);
2379 
2380 	sb.append(']');
2381         return sb.toString();
2382     }
2383 
2384     public static void main(String[] args) {
2385 	System.out.println("texpath: "+new Settings().getTexPath());
2386     }
2387 }