Custom templatetag for latex users

32 views
Skip to first unread message

mrkiwi

unread,
Aug 4, 2010, 3:27:36 AM8/4/10
to Django developers
Hi,

I need to take a template ( written in latex ) and fill it with data,
then send it through pdflatex to get the pdf output, and return it to
the user. Django makes this easy, but not quite as smooth as an html
template.

I use render_to_string and output this to a file, then run pdflatex on
that file - i know this is not ideal (should really be done in memory)
so any advice on how to do this would be appreciated.

However the point of this email is that characters in the data such as
&, #, \, $ and some others are special latex characters and have to be
escaped, so i wrote a templatetag called escapelatex (i saw someone
has written escapejs, so i followed the naming convention) - my
question is where should i post this tag so others can critique it,
improve it, and possibly add it to contribs for all to use?

Russell Keith-Magee

unread,
Aug 4, 2010, 7:40:09 AM8/4/10
to django-d...@googlegroups.com

I'd suggest your best approach would be to publish it as a standalone
reusable library on something like Github or Bitbucket. This allows
you to publish the source, and allows others to easily use the source
and contribute fixes.

While I have great affection for LaTeX as a language (I wrote both my
theses using LaTeX), I don't think it's appropriate for the core of
Django. Ultimately, Django is a web framework, and HTML/JS are the
focus of web work.

Given that it's easy to distribute a template tag library as a
third-party feature, your library doesn't need to be in the core,
either. By maintaining a set of LaTeX tools as a third-party library,
you are able to:

* keep the development pace independent of Django's release cycle
(particularly important during initial development)
* help distribute the development load outside of the Django core
team (since you aren't dependent on Django's core team to commit
changes)
* help keep the size of Django's core library under control
(end-users are able to choose the extensions and languages they want
to support)

Best of luck with your LaTeX library.

Yours,
Russ Magee %-)

Reply all
Reply to author
Forward
0 new messages