I am just delving into Template::Filters to add an enhancement to the latex/pdf filter, namely to rerun latex/pdflatex if there are undefined references after the first run. My specific requirement is when generating a PDF version of a price list on the fly I want the footers to say "Page n of m", which can easily be done with the latex "lastpage" package, but which requires two runs of latex to resolve the last page reference, but also using the supertabular package to typeset multi-page tables requires multiple runs. Latex and TT make a good combination -- a guy at the 2000 TeX User Group conference gave a talk about his employer, an insurance company, using latex from CGI scripts to generate customized insurance policies as PDF documents -- and they weren't even using a proper templating system.

The latex filter is currently quite basic, and could be enhanced with all sorts of bells and whistle options, for example:

* set the TEXINPUTS environment variable to include the directory the template was found in, so that file inclusion (in latex) picks up files in that directory (the template is copied to a temporary directory and latex is run in that directory so that temporary files can be cleaned up after the template has been filtered).

* specify the auxilliary programs to be run on the template (e.g. makeindex, bibtex, etc) and the order they should be run in (for a book or manual this may be: "latex, latex, bibtex, makeindex, latex, latex" with latex run twice at the start to resolve forward references and twice after bibtex and makeindex in order to firstly get the page numbers of the bibliography and index into the .aux file and secondly to get those page numbers into the table of contents).

I had thought to use named parameters to the filter for these options, perhaps:

"maxruns" for the maximum number of runs of latex (with a default of either 1 or 2 -- 1 is current behaviour, 2 would allow forward references to be resolved and if there were no forward references then latex would only run once anyway)

"commands" for a list of commands to be run on the templates as illustrated above

"extradirs" to specify a list of directories to be prepended to TEXINPUTS (with relative paths being taken as relative to the directory of the template)

"includes" to specify files to be copied to the temporary directory, such as images or files to be \include{}'ed into the latex template.

"tmpdir" to specify a 'temporary' directory for debugging -- this would not be deleted by tt2 after processing the template, so that one could go in and sort out latex problems


I am still at the planning stage for this and would welcome comments and suggestions.


Andrew

--
Andrew Ford, Director Pauntley Prints / Ford & Mason Ltd
[EMAIL PROTECTED] South Wing Compton House pauntley-prints.co.uk Compton Green, Redmarley Tel: +44 1531 829900
ford-mason.co.uk Gloucester GL19 3JB Fax: +44 1531 829901
refcards.com/cronolog.org Great Britain Mobile: +44 7785 258278



_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to