Simon Moore wrote:
Hi Andrew,
Glad you have taken up the Latex side of things. A few suggestions.
We tend to use TT to produce on the fly PDF reports on our website.
I appreciate some people will be using Latex for things other than
PDF. The things we have noticed as being issues and I have no idea
whether it would actually be something that could be fixed in TT,
hence mailing offlist:
1) It is very slow at producing PDFs from TT (Perhaps this is
just Latex, but is there anything that can be done to speed it up -
perhaps there is a better engine for PDFs than latex and we should
build a plugin for that?)
2) Latex while in theory you can do anything with it, is
actually very difficult to do some simple things that look good and
can cope with varying input data....
I agree. I wrote a script recently to produce PDFs using Latex and TT.
Although I like some of the ideas behind Latex and I like the output
it produces when it works, I find it difficult to get it to DWIM. I've
been thinking about using FOP for my next PDF-generating project. I
think that it would be easier, coming from a web background, since
XSL-FO is heavily influenced by HTML/CSS.
3) Might be nice to have some predefined Text filters that
ensure everything is legal that you input to Latex
I "stole" some code from Pod::LaTeX for the escape function I use:
sub latex_escape {
my $paragraph = shift;
# Replace a \ with $\backslash$
# This is made more complicated because the dollars will be escaped
# by the subsequent replacement. Easiest to add \backslash
# now and then add the dollars
$paragraph =~ s/\\/\\backslash/g;
# Must be done after escape of \ since this command adds latex escapes
# Replace characters that can be escaped
$paragraph =~ s/([\$\#&%_{}])/\\$1/g;
# Replace ^ characters with \^{} so that $^F works okay
$paragraph =~ s/(\^)/\\$1\{\}/g;
# Replace tilde (~) with \texttt{\~{}}
$paragraph =~ s/~/\\texttt\{\\~\{\}\}/g;
# Now add the dollars around each \backslash
$paragraph =~ s/(\\backslash)/\$$1\$/g;
return $paragraph;
}
_______________________________________________
templates mailing list
templates@template-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/templates