gpoore / pythontex

A LaTeX package that executes Python and other code in LaTeX documents, and includes the output
880 stars 100 forks source link

Add support for ConTeXt #48

Closed ghost closed 10 years ago

ghost commented 10 years ago

Hi,

Please, add support for ConTeXt.

gpoore commented 10 years ago

I have good news and bad news.

I'm afraid that adding ConTeXt support probably isn't a real possibility. PythonTeX currently consists of about 1600 lines of LaTeX code, and relies on a number of LaTeX packages. Conversion to ConTeXt would essentially require a complete rewrite, since all the LaTeX code would be incompatible. Since I don't use ConTeXt myself, doing a conversion would require me to learn it (a major time investment, given the low-level programming involved) or find someone who knows ConTeXt and has a lot of time. Even if we could get a working ConTeXt version, there would also be the issue of making sure the ConTeXt version kept up with the LaTeX version as new features were added.

Given the projected time investment, I can't simply volunteer the required development time in the foreseeable future. If there was a way to have the development of a ConTeXt version fully financed, then I could probably do it. But that is very unlikely.

However, there are still ways in which you may be able to use much of PythonTeX with ConTeXt in the future. I am planning to separate out the code-execution core of PythonTeX so that it can be used as a preprocessor, similar to Sweave and knitr. This would be compatible with essentially any text-based document format. This would allow you to insert Python code in a ConTeXt document and have the code replaced by its output. But since this would work as a preprocessor rather than as a ConTeXt package, it wouldn't be possible to do things like write macros that mix ConTeXt with Python.

ghost commented 10 years ago

Don't mind. I found that filter module could serve me...