In pull request #1541 , John MacFarlane floated the idea of having a Pandoc writer whose output could be “processed by plain tex (or perhaps eplain), without latex or context macros.” In their proof of concept , Dominik Rehák explores what this would look like in practice. Dominik’s proof of concept contains a custom Lua writer pandoc-to-markdown.lua that you can use as follows: *$ cat > example.md*Under his pillow P'raps found ~~A cake that weighed a half a pound.~~ A plenty of space to roll around. $ pandoc -i example.md -f pandoc-to-markdown.lua -o example.tex *$ cat example.tex*\pandocDocumentBegin Under\pandocSpace{}his\pandocSpace{}pillow\pandocSpace{}P’raps\pandocSpace{}found\pandocLineBreak \pandocStrikeout{A\pandocSpace{}cake\pandocSpace{}that\pandocSpace{}weighed\pandocSpace{}a\pandocSpace{}half\pandocSpace{}a\pandocSpace{}pound.}\pandocLineBreak A\pandocSpace{}plenty\pandocSpace{}of\pandocSpace{}space\pandocSpace{}to\pandocSpace{}roll\pandocSpace{}around. \pandocDocumentEnd To typeset the example document, you can use a macro package that defines how the various \pandoc... commands should be formatted. For LaTeX, the proof of concept contains the pandoc-to-markdown.sty style file that you can use as follows: *$ cat > example.ltx*\documentclass{article} \usepackage{pandoc-to-markdown} \begin{document} \input example.tex \end{document} $ pdflatex example.ltx Here is the output document example.pdf: [image: example.png] The proof-of-concept contains many more examples for you to try out in the examples/ directory . Dominik's work is part of their bachelor's thesis, which is to appear this fall. Dominik has already published two articles about their work in hobbyist journals: the CSTUG Bulletin 31:1–4 (in Slovak, see a machine translation to English ) and in TUGboat 43:1 (see Section 2.3). The implementation rests on my Markdown package for TeX , which provides formatting for most elements of the Pandoc AST across different TeX formats such as plain TeX, LaTeX, and ConTeXt. Here are some limitations of the proof of concept: - For the sake of convenience, some of the \pandoc... commands that we produce are in a form that closely mimics the commands provided by the Markdown package rather than Pandoc’s AST. For example, the \pandocCode, \pandocLink, and \pandocHeader commands discard attributes, the \pandocImage and \pandocCaptionedImage commands receive parameters with TeX’s special characters escaped in a way required by the Markdown package, and the LineBlock element of Pandoc’s AST is simulated by a series of \pandocLineBreak commands. In the future, we would like to make the \pandoc... commands closer to the Pandoc’s AST, so that a lossless round trip from AST to TeX and back is possible. In TeX, we can process text using regular expressions (see the l3regex module of the expl3 macro package ), which allows us to move most parameter preprocessing code from our Lua writer to the definitions of the \pandoc… commands. - The custom Lua writer pandoc-to-markdown.lua uses the old-style custom Lua writer API that will no longer be supported in Pandoc 3.0.0. We would like to rewrite the custom Lua write to Haskell, so that it can become an integral part of Pandoc independent of Pandoc’s Lua API. In the future, the ConTeXt and LaTeX writers of Pandoc could be replaced by a single writer that would produce format-agnostic TeX code. Formatting for the TeX code would then be provided by format-specific TeX macro packages such as the pandoc-to-markdown.sty style file for LaTeX. This approach will reduce the amount of code maintained by Pandoc and increase the number of supported TeX formats, which is a win-win for both Pandoc maintainers and Pandoc users. Both Dominik and I would be happy to discuss with you how to best get there. -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/51539828-c876-437b-bb1e-a5efcf752762n%40googlegroups.com.