[prev] [thread] [next] [Date index for 2004/07/10]
Alexander Klenin wrote:
>> From: Andrew Ford <A.Ford@xxxxxxxxxx.xx.xx>
>
>
>> 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.
>
> Yes, I have also used CGI and TT with latex filter in a similiar
> scenario, and the enhancements you listed below would be very welcome ;)
>
>> * 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).
>
> Or perhaps a more generic mechanism for setting arbitrary environment
> variable. Also of value would be a possibility to set some TeX
> variables, like \graphicspath{} from graphics package, but I do not
> see a good way to implement this.
>
> [...]
>
>> "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
>
> Also sometimes I wished for an 'output_errors' option which would
> output TeX errors to a given file (or instead of normal template
> output), so that it can be easier obtained remotely.
> A warning when the filter output is written to a text-mode stream
> would be useful for a newbies, who (like me) forget to put binmode=>1
> in process directive.
>
>> I am still at the planning stage for this and would welcome comments
>> and suggestions.
>
> I am not a TT developer, but from the general spirit of TT I would
> suggest to investigate the idea of generic Template::Filter::External.
> Such a filter could set environment varialbes, write per-filter text
> to a temp file, execute one or more external programs, than read their
> output and return it as a filtered text.
> After that, latex filter can be implemented as a special case. Another
> application which immediately comes on mind is DocBook and other
> similiar document generators. Still other is an auto-packaging feature
> for generating archived downloads on demand.
I'm thinking that I'll adopt a two-pronged approach. I'll patch the
latex filter in Template::Filters to Do What I Mean, while providing
backwards compatibility, and think about a more general external process
plugin, which could be a separate module.
The latex plugin could be patched to run conditionally bibtex and
makeindex as well as running latex multiple times. No additional
options are required. The log would be:
1. run latex on the text, aborting on errors
2. if latex warns of unresolved references (latex exits with status 0
but reports "LaTeX warning: there were undefined references") then run
latex again, aborting on errors
3. if the log file contains lines "LaTeX warning: Citation `xxx' on page
N undefined" then run bibtex (if it can be found)
4. if the temporary directory contains a ".idx" file then run makeindex
(if it can be found)
5. if bibtex or makeindex were run then run latex again, aborting on errors
6. if latex was rerun in step 5 and the latex log file contains "LaTeX
warning: Label(s) may have changed. Rerun to get cross-references
right." then rerun latex.
This will handle most simple requirements. For simple LaTeX docuements
with no indexes or citations and no forward references the filter will
behave as it does now, just running latex once. If the document does
make use of LaTeX's bibliographic or indexing facilities or uses forward
references then the filter will transparently run the appropriate
programs. I won't complicate matters at this stage by adding options to
add directories to the TEXINPUTS environment variable or such like.
This can be done by setting the variable appropriately on the command
line or in the makefile when ttree is invoked, or in the program
invoking Template->process.
I'll have a think about Alexander's idea of a generic external filter
(or probably plugin) to handle more complex scenarios.
Any more thoughts anyone?
Andrew
--
Andrew Ford, Director Pauntley Prints / Ford & Mason Ltd
A.Ford@xxxxxxxxxx.xx.xx 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
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates
|
[Templates] Re: Latex filter enhancements
|
|
Re: [Templates] Re: Latex filter enhancements
|
|
Re: [Templates] Re: Latex filter enhancements
|
Generated at 08:56 on 15 Mar 2005 by mariachi v0.52