Converting to PDF

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Converting to PDF

akhayyat
This post was updated on .
I need to generate PDF output from AsciiDoc sources. I have tried various tools to obtain a proper PDF, but am having trouble getting one.

I have two requirements that, combined, seem to be hard to satisfy so far:
1. Inline and block math
2. Empty table rows

Here is my input in the desired input markup (I prefer latexmath over stem in the source; makes the source more intuitively readable, IMO):

= My Title
:stem: latexmath

This is inline math: latexmath:[y = \frac{1}{x}].

This is a math block:

[latexmath]
++++++++++++++++++++++++++++++
\[y = \frac{1}{x}\]
++++++++++++++++++++++++++++++

This is a table with empty rows:

[options="header,autowidth"]
|==============================
| First Column | Second Column
|              |  
|              |  
|              |  
|==============================

Using plain asciidoctor on this source file generates HTML output as expected.

asciidoctor-fopub


Both inline math and math blocks are not rendered properly: the block is completely gone, and the inline latex math code is not rendered, but included as is (latex code in the PDF).

If I replace latexmath with stem in the content, and leave the :stem: attribute empty, both inline math and the math block show the latex math code as is.

asciidoctor-pdf


Everything I've tried results in the same math behavior: inline math shows the latex code in the output as is, and the math block is completely gone.

Moreover, the
 
 is also shown as is (6 characters in the second column of each row in the table), so I'm not sure how to have asciidoctor-pdf render empty rows in a table.

wkhtmltopdf


Since the HTML output is fine, this appears to be an appealing option. I still got one annoyance with this tool though: I get a label at the end of the content saying "Typesetting math: 100%" !!

Browser Print Function


Although this option appears to generate flawless output, it is the least desirable: it's manual, and requires changing the default browser print settings to get a clean output.

---------------------------------------------------------------

In general, I like fopub's output the best, so I'd be most interested in getting that tool to do what I want. Some of things I like about its out are: it does not use a separate title page and a separate table-of-contents page, and It also appears the only option that includes page numbers (at least by default).

wkhtmltopdf and using the browser's print function are the least desirable options, as they lose the PDF index/TOC.


PS. I prefer the older name of the :math: attribute over the newer :stem: attribute; more obvious, says what it does more clearly, and makes sense to a wider audience, being a word, not an acronym.
Reply | Threaded
Open this post in threaded view
|

Re: Converting to PDF

akhayyat
I guess these are two independent issues. The real issue I'm struggling with is rendering math in PDF.

Is there any toolchain that I can use to produce PDFs with a TOC and math/stem rendered correctly?
Reply | Threaded
Open this post in threaded view
|

Re: Converting to PDF

akhayyat
For the record, I ended up using wkhtmltopdf to generate the PDFs. It does handle math (`--javascript-delay` may be needed).