Search code examples
latexasciidocasciidoctor

Compile asciidoc with latexmath equations


I am trying to compile asciidoc document which contains some equations, the format is usually the following:

.First equation
[latexmath]
++++++++++++++++++++++++++++++++++++++++++++
\[C = \alpha + \beta Y^{\gamma} + \epsilon\]
++++++++++++++++++++++++++++++++++++++++++++

As I understand, I need first to use asciidoc processor to compile this to docbook:

 $ asciidoctor -o test.xml -b docbook test.asciidoc

The asciidoctor complains about latexmath block, but produces some xml anyway:

asciidoctor: WARNING: test.asciidoc: line 3: invalid style for pass block: latexmath

Then I try to create pdf using dblatex:

dblatex -D --pdf -o test1.pdf test.xml

However the produced pdf is just empty, I cannot see my equation whatsoever. What am I doing wrong?

Particularly I'm trying to compile this document: https://github.com/aantonop/bitcoinbook/blob/develop/ch04.asciidoc

I believe the problem is more related to asciidoc rather than tex, but can you help me anyway? How to render this file in Ubuntu?

I already asked this on asciidoctor forum, but nobody answers there... http://discuss.asciidoctor.org/Invalid-style-for-pass-block-latexmath-td2373.html


Solution

  • You must pass the the math attribute either via the commandline: asciidoctor -a math or in the header of the document: :math: if you want to do this with html output.

    I was not able to get it to work with dblatex nor asciidoctor-epub3, but a plain html should work, you could print to pdf from firefox or chrome.