Search code examples
asciidoc

How to convert asciidoc to pdf?


I attempted to convert my mybook.adoc to mybook.pdf using pandoc, and got the following error.

$ pandoc -s mybook.adoc -t asciidoc -o mybook.pdf
pandoc: cannot produce pdf output with asciidoc writer

Is there another tool that I should use instead of or in concert with pandoc? How can I convert asciidoc to pdf?


Solution

  • I now realize the ideal route from asciidoc to pdf is to first convert the asciidoc to docbook. This employs the intended sphere of asciidoc and a docbook->pdf converter using each in its separate area of concern.

    Furthermore, instead of pandoc I have found that when mathematical formulas are included, it was easier to use dblatex for docbook->pdf conversion. Thus my conversion pipeline is the following:

    asciidoc -> asciidoctor -> docbook -> dblatex -> pdf

    A sample make file:

    make: my.adoc
      asciidoc -b docbook my.adoc
      dblatex my.xml
    

    This discussion page suggests that asciidoc is primarily designed to compile to docbook.