Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting Asciidoc to LaTeX

Tags:

latex

asciidoc

I want to convert Asciidoc to LaTeX, then use an existing toolchain that includes LaTeX modules to convert the resulting document further to the final format. Asciidoc's native LaTeX conversion is "experimental" according to their documentation, and it also doesn't work for me. There is another toolchain supported by Asciidoc, which is converting to Docbook first, then use dblatex to convert it further. However, it includes a lot of formatting in its LaTeX output, which clashes with the formatting of my toolchain.

Is there any way to convert Asciidoc to LaTex in a way that the content is included in the resulting document, but without any exact formatting rules (expect those explicitly specified in the document). I don't want the LaTeX result to contain any information about fonts, page layout and so on, because for those I already have a toolchain.

like image 514
petersohn Avatar asked Jan 24 '18 09:01

petersohn


1 Answers

I get acceptable, almost good results with this toolchain using pandoc convertor:

  1. edit your document in asciidoc or asciidoctor
  2. convert your document to docbook: asciidoctor -b docbook5 your asciidoc document.
  3. convert your docbook document to (xe)latex using pandoc: pandoc -f docbook your docbook document --pdf-engine=xelatex

You can customize your latex layout and modules in a pandoc configuration file or convert your docbook file into a latex file with pandoc. The converted latex file is quite clean (because its source is docbook).

like image 90
Mike W Avatar answered Oct 31 '22 19:10

Mike W