Actually, that's exactly what I'm trying to do. I have database tables whose columns contain TeX fragments. I am trying to generate various file outputs from database searches - TeX, pdf, etc.
I could construct the tex file on the fly with python strings as you suggest but that's rather cumbersome. It's simpler with a template. I've also considered using the xml.element api to construct my own template but that would set me back several weeks. I'm trying to finish. :/ I have something that almost resembles a template. It is not the most flexible or elegant but it works. I have a single replacement string between \begin{document} and \end{document} and I simply replace this one token with a string.replace() On Wednesday, March 13, 2013 11:39:18 AM UTC-5, Drew Ferguson wrote: > > On Wed, 13 Mar 2013 07:01:45 -0700 (PDT) > Ken <t...@anl.gov <javascript:>> wrote: > > > I would like to write a tex/latex file with django tags in it. Load it > > with the template loader and render it with a context. The problem is > > that my tex/latex file has quite a few '{%' in them. They are > > conventional in TeX for writing readable macros and are used to escape > > the newline. I could try rewriting them but before I do, I thought I'd > > ask if this is even worth tackling. TeX uses curly braces as grouping > > and percent signs as a comment. > > > > The TeX file would look rather confusing but the more important question > > is what the loader does when it sees braces and brace comments. Is it > > possible to reassign the block and variable tags? > > > > Thanks > > > > > > I have done this in the past (with Plone rather than django) by calling a > python wrapper script to generate a file which latex can process; > essentially construct the Latex source as python strings > and have the script assemble the components you want. The objective was to > generate a PDF file by Latex with variables fed from SQL & a web page. But > this may not be what you are interested in. > > Are you trying to render a Latex source document as a web page? > > -- > Drew > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.