[Templates] Developer version of Template::Plugin::Latex uploaded to CPAN
Andrew Ford
A.Ford at ford-mason.co.uk
Tue Feb 19 17:02:30 GMT 2008
Francesc Romà i Frigolé wrote:
> Hi Andrew,
>
> Thank you very much for your work on the latex plugins.
>
> I wonder if it's possible to use the latex_encode filter as a TT
> filter instead of filtering the data from the perl program.
latex_encode is provided as a TT2 filter with Template::Plugin::Latex
(version 3). Version 3 is essentially a rewrite of the LaTeX plugin,
with the low level code factored out into the separate LaTeX::Driver
module. I really don't want to support version 2 of the plugin and
would like to shake out the bugs in version 3, so I will do some more
testing on it and upload as a proper release (rather than the developer
release that is currently on CPAN).
>
> I'm using catalyst and DBIX::Class so I don't explicitly fetch the
> data from the database and pass it to my templates. Instead in my html
> templates I do something like [% table.field | html %] to filter my
> database content for html encoding. For my latex templates I'd like to
> be able to do something like:
> [% USE Latex %]
> [% FILTER latex('pdf') %]
> ...LaTeX doc...
> [% table.field | latex_encode %]
> ...
> [% END %]
>
>
> is that possible?
That looks OK to me.
>
> Regarding the TEXTINPUTS feature, I haven't tried the version 3 of
> your plugin, but for version 2.x I set up the TEXTINPUTS environment
> variable before calling the plugin, and I've noticed that relative
> paths don't work: So \includegraphics{./figure.eps} won't work but
> \includegraphics{figure.eps} will. I know it's a latex issue, but It
> would be nice if your filter would take care of it, since would make
> reusing latex files easier.
The new version of the plugin should sort out your relative paths for
LaTeX file inclusions as it sets up TEXINPUTS (not TEXTINPUTS) to
include the original source directory (the source file is normally
copied to a temporary directory for formatting, so without fiddling with
TEXINPUTS relative paths are not going to work).
>
> I've noticed that in your summary for the LaTeX::Driver module you
> don't mention pdflatex. Does it mean that it is not used anymore? I'm
> asking because pdflatex has some missing features (it doesn't support
> psfrag for example) and it would be very useful to be able to at least
> have the option of generating pdfs using latex + dvips + ps2pdf.
The LaTeX::Driver module man page does mention pdflatex, but I will have
a look at the documentation and see about making it clearer. By default
if you ask for PDF output then it is pdflatex that is run, but you can
specify "pdf(dvi)" in which case a dvi file is generated with latex and
then that is converted to PDF with dvipdfm, or "pdf(ps)" in which case
the dvi is converted to PostScript with dvips and then that file is run
through ps2pdf.
Thanks for emailing me - its nice to know that someone is looking at my
code, and it might kick me into making a new release.
Andrew
> On Oct 3, 2007 5:53 PM, Andrew Ford <A.Ford at ford-mason.co.uk
> <mailto:A.Ford at ford-mason.co.uk>> wrote:
>
> I have uploaded a new version of the TT2 Latex plugin to CPAN (version
> 3.00_03).
>
> The main new features are:
>
> * This version uses the LaTeX::Driver module to do the formatting,
> so the Template::Plugin::Latex code has become very slim. The
> LaTeX::Driver module includes the scripts "latex2dvi", "latex2ps"
> and "latex2pdf", which convert from a LaTeX file to the
> appropriate output format. The scripts can be used as classic
> Unix-style filters (they set up a temporary directory to do the
> formatting internally), and take a -tt2 option which specifies
> that the input document is a Template Toolkit template, so the
> input is processed through tt2 first before being formatted as a
> LaTeX document. (There is also a -define=key=value option to
> define variables that are passed to tt2). The scripts are
> not yet
> fully documented (partly because I have not quite appreciated all
> the flexibility that they have). The scripts work as sort of
> specialized versions of "tpage".
> * The plugin also defines a latex_encode filter, which is an
> interface to my new LaTeX::Encode module, which knows how to
> encode about 250 Unicode characters. It has an except option to
> specify characters that are not to be encoded, and an iquotes
> option (for intelligent quotes), which will turn <He said,
> "something."> into <He said, ``something.''> (the doubled
> back-ticks and doubled single quotes are LaTeX's commands for
> typographically correct quotation characters). This filter will
> take care of the fact that '&', '^', '#', '$', '_', '\', etc are
> special to LaTeX and will transform them to '\&', '\^{ }', '\$',
> '\_', '\textbackslash', etc, so you can filter your data fetched
> from databases or elsewhere through this filter before
> interpolating it into a LaTeX document template and be fairly
> confident of not getting LaTeX errors.
> * The plugin also defines a "table()" method, which is an interface
> to the LaTeX::Table module, which will take arrays of data items
> and headers, and other attributes of a table, and generate the
> LaTeX commands to typeset the table, so you could say
>
> [% USE Latex;
> data = [ [ 1, 2, 3 ],
> [ 4, 5, 6 ] ];
> headings = [ [ 'A', 'B', 'C' ] ];
>
> text = Latex.table( caption = 'Sample table',
> label = 'table:sample',
> headings = headings,
> data = data );
> %]
>
> and the variable "text" will contain all the LaTeX commands
> to set
> the table.
>
> That is about it. The module is nearing completion (and has
> spawned two
> other modules: LaTeX::Encode and LaTeX::Driver).
>
> What is left to do is flesh out the documentation and the test scripts
> (for the plugin module and also for the other two modules), and
> look at
> how the LaTeX environment variables (TEXINPUTS, TEXINPUTS_latex, etc)
> should interact with the filter options. I'll probably put out
> another
> developer version (or two) in the next couple of weeks, then it is
> about
> ready for prime time.
>
> As always I welcome feedback.
>
> Andrew
>
> Andrew Ford wrote:
> > I have finally released a developer version of the TT2 Latex
> plugin to
> > CPAN (version 3.00_01). This requires my LaTeX::Driver module
> version
> > 0.05. The files are also updates on svn.tt2.org
> <http://svn.tt2.org>.
> >
> > The main new features are:
> >
> > * internally it uses LaTeX::Driver to ensure that the
> document is
> > run through (pdf)latex, bibtex, makeindex, dvips, dvipdfm
> and/or
> > ps2pdf as many times as is necessary to format the
> document (with
> > an upper limit of maxruns times)
> >
> > * the TEXINPUTS path can be specified, so that one can
> include other
> > tex, ist, bib files from other directories than the document
> > directory - the document directory is included in the path, so
> > that including files that are local to the source document
> should
> > work, even when running ttree
> >
> > * the Template::Latex module is deprecated
> >
> > * the plugin includes a latex_encode filter that will encode
> special
> > characters, so that "20% of $42" becomes "20\% of \$42". I am
> > still working on this feature and it will be possible to
> specify
> > which characters to exclude so you can say
> >
> > "my company is \textbf{Ford & Mason Ltd}" |
> > latex_encode(exclude = "\\{}")
> >
> > and get out "my company is \textbf{Ford \& Mason Ltd}".
> This will
> > allow you to embed LaTeX formatting commands in your data
> while
> > having the non-excluded special characters escaped for you.
> >
> > There are probably other changes I've forgotten to mention but I
> just
> > want to get something out there for people to play with.
> >
> > I am still working on the documentation and the test suite, although
> > most of the tests do pass (and test useful things). I will be
> including
> > an examples directory with some scripts that show how to use the
> plugin
> > for database publishing and generating personalized PDF files, etc.
> >
> > I would welcome any feedback.
> >
> > Andrew
> >
> >
>
> --
> Andrew Ford, Director Pauntley Prints / Ford & Mason Ltd
> A.Ford at ford-mason.co.uk <mailto:A.Ford at ford-mason.co.uk> South
> Wing Compton House
> pauntley-prints.co.uk <http://pauntley-prints.co.uk> Compton
> Green, Redmarley Tel: +44 1531 829900
> ford-mason.co.uk <http://ford-mason.co.uk> Gloucester
> GL19 3JB Fax: +44 1531 829901
> refcards.com <http://refcards.com> cronolog.org
> <http://cronolog.org> Great Britain Mobile: +44 7785 258278
>
>
>
> _______________________________________________
> templates mailing list
> templates at template-toolkit.org <mailto:templates at template-toolkit.org>
> http://lists.template-toolkit.org/mailman/listinfo/templates
>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
--
Andrew Ford, Director Pauntley Prints / Ford & Mason Ltd
A.Ford at ford-mason.co.uk 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.template-toolkit.org/pipermail/templates/attachments/20080219/07ef6831/attachment-0001.htm
More information about the templates
mailing list