# Generate Latex output

Similar to html. For example, using http/html_write, I can produce HTML text like this,
html(b(Text)), resulting in <HTML><B>Text*</B></HTML>, and Text* quoted if necessary.

Is there something similar for Latex output, e.g., document(emph(Text)) producing \begin{document}\emph{Text*}\end{document}? If not, I guess it is a good idea to use html_write as a starting point, isn’t it?

The library(pldoc/doc_latex) implements something along these lines. It is used for the LaTeX backend of PlDoc. doc_wiki.pl processes the markdown/wiki input to a Prolog term that roughly follows the HTML DOM model. doc_html.pl translates this into proper HTML and doc_latex.pl translates the same into LaTeX.

I fear the code is a bit targeted to the Prolog LaTeX style.