Converting Asciidoc to LaTeX
Asked Answered
T

1

8

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.

Tabbatha answered 24/1, 2018 at 9:58 Comment(2)
Hello @petersohn, would you mind to give a reference to the 2 toolchains that you are writing about ?Stonwin
I am just stumbling upon asciidoctor-latex. Might be worth a look and an answer from someone more knowledgeable.Pursy
P
7

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).

Phenica answered 6/4, 2018 at 13:40 Comment(1)
Can you fortify this answer with a working example file and subsequent code-blocked commands?Pursy

© 2022 - 2024 — McMap. All rights reserved.