I am just about ready to release the first developer release of
Template-Latex.  All the tests pass - I've just got to tidy up the
documentation and add some examples.

I am introducing some new features that I would like to run past the
community before I make a release.

The new features are:

   1. The plugin now runs latex (or pdflatex), bibtex, makeindex, dvips
      and ps2pdf as needed until the document formatting stabilizes. 
      This feature is uncontentious I think.
   2. The Latex plugin now defines the LaTeX command \TTLATEX when latex
      or pdflatex are being run.  This makes it possible to write LaTeX
      code that knows that it is being run from the Template Toolkit
      Latex plugin.
   3. I am going to include a latex style file (tt2.sty) that defines a
      macro \TTCODE that either formats its argument if not run from TT2
      or takes no argument and evaluates to nothing if run from TT2. 
      (It tests whether \TTLATEX is defined to decide which definition
      to use.)
   4. The plugin now defines a second filter called detex, which will
      escape [La]TeX special characters (\, &, #, ^, _, {, }) - this
      allows one to format values such as "AT&T" without explicitly
      having to escape special characters.

The upshot of this is if you have a LaTeX file (test.tex)

    % [% TAGS star %]
    \documentstyle{article}
    \usepackage{tt2}
    \begin{document}
    Name: \TTCODE{[* name | detex *]}\\
    Company: \TTCODE{[* company | detex *]}
    \end{document}

and a template (test.pdf)

    [% USE Latex;
          name = 'A.N. Other';
          company = 'AT&T';
          PROCESS test.tex | latex(format = 'pdf');
    -%]

Keeping the latex code out of the TT2 code means that the test.tex file
can be formatted directly with latex and will show the placeholders "*
name | detex *" and "* company | detex *", and processing the template
will not fall over because of the "&" character in the second variable. 
Also, specifying TAGS stars on the first line of the LaTeX file in a
comment means that the start and end tags do not confuse latex.

Separating the tex and the tt2 code also means that both can exist in a
directory hierarchy served say by a catalyst server, and requesting the
tex file could give you the source code (or the existence of the file
might be denied or might require authentication) while requesting the
tt2 file (actually named .pdf) could cause the Template view to be invoked.

Note that if you have TT2 control code in a LaTeX context that would
throw the formatting you can always hide it with a LaTeX comment, e.g.:

    \begin{tabular}{lr}
      Description & Price \\
      \hline
    %  [* FOREACH item IN items *]
      \TTCODE{[* item.description|detex *]} & \TTCODE{[*
    item.price|format("\%4.2f") *]} \\
    %  [* END *]
    \end{tabular}


Note also that preceding the "%" in the format string with a backslash
makes no odds to TT2, but stops latex from regarding it as a comment
indicator.

Any comments?  e.g. on having a second filter (detex) defined in the plugin.

I hope to have tidied up the documentation and to upload release 3.00_01
to CPAN in a couple of days.

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


Reply via email to