asciidoctor / asciidoctor-latex

:triangular_ruler: Add LaTeX features to AsciiDoc & convert AsciiDoc to LaTeX
http://asciidoctor.org
Other
111 stars 26 forks source link

Convert stem, asciimath to latex format #32

Open jxxcarlson opened 9 years ago

jxxcarlson commented 9 years ago

@mojavelinux or @jirutka, I have a question. In order to convert stem, asciimath input to LaTeX, I need to call something in the core to do the conversion for the LaTeX backend. For example, I need to map sqrt(2) to \sqrt(2). There must be something in the core that does this, so all I would need to do is call the right method on node.content go get the converted text. Could you tell me how to do this.

mojavelinux commented 9 years ago

There isn't really a way to do this yet in core. Unless you are tying into the stem inline macro or block, you have to do these replacements manually.

One possibility is to monkeypatch (or, more correctly, use the prepend feature in Ruby) the content method so that it calls your customized version. That way, you can intercept all calls to content and perform custom logic.

GarkGarcia commented 4 years ago

LaTeX output support in asciidoctor/asciimath has just shipped!

The only LaTeX commands outputted by asciidoctor/asciimath which are not currently supported by asciidoctor-latex are \mathscr and \twoheadrightarrowtail. All other commands and environments used are covered by amssymb and amsmath (and vanilla LaTeX).

GarkGarcia commented 4 years ago

@jxxcarlson I'm interested in writing a PR to fix this issue. Could you help me figure out which is the relevant section of code?