Closed nomeata closed 11 months ago
I don't understand the question. In the procedure you describe, lhs2tex would still be needed. Also, lhs2tex does more than format code blocks. It applies to inline code as well.
Ok, replace “if it would not require an external tool” with “if it would not require the user to manually call an external tool”. Right now, using lhs2Tex
always require changes to the workflow, custom Makefile, is tricky to get going with latexmk
and any kind of LaTeX-aware editor that simply wants to call pdflatex
on the input file.
I still don't see how this could be done, sorry. The whole way lhs2TeX works is designed to be essentially looking at the entire document. As I said, how would inline code work in your scenario? How would lhs2TeX know which formatting directives are in scope and which aren't?
I've been using latexmk a number of times myself. In this case, I simply called lhs2TeX and then latexmk. As the main benefit of latexmk is to call TeX as many times as needed, but lhs2TeX has to be run only once, this seems an acceptable solution. http://tex.stackexchange.com/questions/142540/configuring-latexmk-to-use-a-preprocessor-lhs2tex seems to discuss some other options, too.
So I guess it cannot work with the way lhs2tex is set up and configured right now. I would already enjoy a (separate) mode, even if I have to include the setup in a new lhs2texsetup
environment. Inline code would require some serious TeX programming, and if only code blocks are supported, that'd still be a start.
In fact, I am mostly intrerested in the part that creates popytable from aligned text (rather than the syntax highlighting), given that in some papers, I ended up not using lhs2Tex and instead wrote polytable code by hand.
It would be much nicer to use lhs2tex, in particular with collaborators, if it would not require an external tool but would rather work by simply running
latex
on the normal.tex
file. This would work if the thelhs2tex.sty
package would dump the contents of each code environment to a file, run thelhs2tex
binary over it, and read back the result.There is prior art: The
minted
package (which invokes pygments) could probably used as inspiration.(There is a related Stack Overflow question which may have useful discussion at some point.)