ConTeXt and Pollen

(moving a topic opened on the sourcehut mailing list to here, mostly to try out the forum!)

Have any of you used pollen with ConTeXt for creating printed output?

ConTeXt is a LaTeX subset designed for simpler customization. It has a
structure that reminds me of pollen, where you create an environment
file with custom ConTeXt tags that are powered underneath by LaTeX. So
I could imagine writing your context file, then having your pollen.rkt
functions convert pollen tags to html or ConText depending on the output.

I’ve just started looking at the language and find its documentation
much harder to follow than pollen, but much easier to follow than
standard LaTeX and so curious if anyone else in this community has used it!

I’ve not used ConTeXt, but on the topic of simpler LaTeX alternatives there is also SILE, which is interesting to me mainly because it can be expressed as XML. This of course also makes it easy to express from Racket.

From section 3.5 of the manual:

While we’re on the subject of alternative forms, SILE can actually process its input in a completely different file format. What we’ve seen so far has been SILE’s “TeX-like flavor”, but if the first character of the input file is an angle bracket (<) then SILE will interpret its input as an XML file. (If it isn’t well-formed XML, then SILE will get very upset.)

Any XML tags within the input file will then be regarded as SILE commands, and tag attributes are interpreted as command parameters […]


Thank you for your pioneering spirit.

1 Like

As yet another option, there is also TeXML, which apparently allows you to author TeX (either LaTeX or ConTeXt) documents in XML. So this could be an interesting avenue, since generating valid XML should be easier than generating valid TeX code (and the translation from XML to TeX will then be carried out by xsltproc/TeXML).

I remember using something like this for a university course and the professor also wrote the script for this course in TeXML. I haven’t used or seen it used elsewhere since then, however.

1 Like

I’ve been thinking about it. ConTeXt itself is very nice engine, the documentation is very rudimentary, but I prefer consistency of ConTeXt to the LaTeX-mess. I used ConTeXt & Pandoc to write my thesis (I wrote in plaintext markdown and used pandoc to convert it to PDF via ConTeXt with custom template), but markdown syntax was very limiting (I often had to inline ConTeXt tags in the markdown file to achieve certain formatting effects) and I was always thinking that ConTeXt would pair nicely with Pollen. However, I wasn’t able to materialize it due to lack of time, but I’d like to try it in the future.

For what it’s worth, there is also an implementation that is called stexme, by the same author as TeXML. But it seems to be about as alive as the other project, so I am unsure how well it actually works. It might be nice as a starting point, however, if one wants to implement a Racket library/lang for translating sexprs into context code.