# Maven plugin and Math

13 messages
Open this post in threaded view
|

## Maven plugin and Math

 Hi all, I'm using the Asciidoctor Maven plugin quite a while and now I need to insert a lot of math. I tried asciimath and latexmath but both don't work for me. I'm using windows and don't have a clue what I've to do for getting my math rendered into the html files.
Open this post in threaded view
|

## Re: Maven plugin and Math

 Welcome, I see that asciimath (https://rubygems.org/gems/asciimath/) is written in ruby, so to use it from the maven plugin you need to add some extra code into the maven configuration. It's the same for any extra Ruby extension you want to use*, it's not hard, just cumbersome. You can take this example as template https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoctor-diagram-example/. Once you have the name of the gem and the version you want to use (https://rubygems.org/gems/asciimath/), just add them as a ruby dependency: · https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoctor-diagram-example/pom.xml#L33,L34And then, tell asciidoctor that you want to load it changing the name here: · https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoctor-diagram-example/pom.xml#L91This should work, if it doesn't please, let us know. * There are some extentions which are embedded with asciidoctorj adn don't require this configuration...but let's skip that for now to keep things simple ^^ PS: I guess latexmath is not asciidoctro right? I cannot find it.
Open this post in threaded view
|

## Re: Maven plugin and Math

 Administrator Actually, before we go down that road, this may just be a simple matter of loading MathJax. I think the question to be asked is what format are you producing? If you are producing standalone HTML files that are generated by Asciidoctor, then you simply need to enable the stem attribute in your document.= Document TitleAuthor Name:stem:You can also enable the stem attribute in the Maven configuration, though I recommend having it in the document if the document contains stem (i.e., math) because it's semantic.The asciimath gem is for converting AsciiMath blocks to MathML for DocBook output. It should not be needed if you are creating HTML directly.Cheers,-DanOn Sun, Oct 25, 2015 at 4:03 PM, abelsromero [via Asciidoctor :: Discussion] wrote: Welcome, I see that asciimath (https://rubygems.org/gems/asciimath/) is written in ruby, so to use it from the maven plugin you need to add some extra code into the maven configuration. It's the same for any extra Ruby extension you want to use*, it's not hard, just cumbersome. You can take this example as template https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoctor-diagram-example/. Once you have the name of the gem and the version you want to use (https://rubygems.org/gems/asciimath/), just add them as a ruby dependency: · https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoctor-diagram-example/pom.xml#L33,L34And then, tell asciidoctor that you want to load it changing the name here: · https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoctor-diagram-example/pom.xml#L91This should work, if it doesn't please, let us know. * There are some extentions which are embedded with asciidoctorj adn don't require this configuration...but let's skip that for now to keep things simple ^^ PS: I guess latexmath is not asciidoctro right? I cannot find it. If you reply to this email, your message will be added to the discussion below: http://discuss.asciidoctor.org/Maven-plugin-and-Math-tp3895p3896.html To start a new topic under Asciidoctor :: Discussion, email [hidden email] To unsubscribe from Asciidoctor :: Discussion, click here. NAML -- Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Open this post in threaded view
|

## Re: Maven plugin and Math

 Administrator In reply to this post by abelsromero ...and to clarify, all math in HTML is handled by MathJax (though Asciidoctor does do some things to prepare it).For details, see http://asciidoctor.org/docs/user-manual/#activating-stem-support-DanOn Mon, Oct 26, 2015 at 2:03 AM, Dan Allen wrote:Actually, before we go down that road, this may just be a simple matter of loading MathJax. I think the question to be asked is what format are you producing? If you are producing standalone HTML files that are generated by Asciidoctor, then you simply need to enable the stem attribute in your document.= Document TitleAuthor Name:stem:You can also enable the stem attribute in the Maven configuration, though I recommend having it in the document if the document contains stem (i.e., math) because it's semantic.The asciimath gem is for converting AsciiMath blocks to MathML for DocBook output. It should not be needed if you are creating HTML directly.Cheers,-DanOn Sun, Oct 25, 2015 at 4:03 PM, abelsromero [via Asciidoctor :: Discussion] wrote: Welcome, I see that asciimath (https://rubygems.org/gems/asciimath/) is written in ruby, so to use it from the maven plugin you need to add some extra code into the maven configuration. It's the same for any extra Ruby extension you want to use*, it's not hard, just cumbersome. You can take this example as template https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoctor-diagram-example/. Once you have the name of the gem and the version you want to use (https://rubygems.org/gems/asciimath/), just add them as a ruby dependency: · https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoctor-diagram-example/pom.xml#L33,L34And then, tell asciidoctor that you want to load it changing the name here: · https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoctor-diagram-example/pom.xml#L91This should work, if it doesn't please, let us know. * There are some extentions which are embedded with asciidoctorj adn don't require this configuration...but let's skip that for now to keep things simple ^^ PS: I guess latexmath is not asciidoctro right? I cannot find it. If you reply to this email, your message will be added to the discussion below: http://discuss.asciidoctor.org/Maven-plugin-and-Math-tp3895p3896.html To start a new topic under Asciidoctor :: Discussion, email [hidden email] To unsubscribe from Asciidoctor :: Discussion, click here. NAML -- Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen -- Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Open this post in threaded view
|

## Re: Maven plugin and Math

 Thanks guys, Both just worked fine. The second one with :stem: is for me the best to get it done. I'm sorry that I messed up with latex and latexmath. My output is only html.
Open this post in threaded view
|

## Re: Maven plugin and Math

 Administrator Perfect! Glad to hear it!-DanOn Mon, Oct 26, 2015 at 11:36 AM, Niklas [via Asciidoctor :: Discussion] wrote: Thanks guys, Both just worked fine. The second one with :stem: is for me the best to get it done. I'm sorry that I messed up with latex and latexmath. My output is only html. If you reply to this email, your message will be added to the discussion below: http://discuss.asciidoctor.org/Maven-plugin-and-Math-tp3895p3900.html To start a new topic under Asciidoctor :: Discussion, email [hidden email] To unsubscribe from Asciidoctor :: Discussion, click here. NAML -- Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Open this post in threaded view
|

## Re: Maven plugin and Math

 In reply to this post by Niklas Apologies for the miss-information, I jumped to quick conclusions. But after all, me too, happy it worked and was so simple.
Open this post in threaded view
|

## Re: Maven plugin and Math

 In reply to this post by mojavelinux Hi, im sorry to revive this old thread, but I'm tryinh to generate PDFs, så the stem attribute won't work for me. I tried to add MathJax as dependency:     org.webjars.npm    mathjax    3.0.5I also tried to add a require-section:     mathjaxThis is where it stops tho. I don't know where to go from here to tell maven to load it. When I run this in maven, I get the following:  Execution generate-pdf-doc of goal org.asciidoctor:asciidoctor-maven-plugin:2.0.0:process-asciidoc failed: (LoadError) no such file to load -- mathjax Regards, Kristian
Open this post in threaded view
|

## Re: Maven plugin and Math

 The error is because require is used to load Ruby gems, and mathJax is pure javascript. So it's not finding the expected files. As far as I know mathJax uses a script post-processing to render the images in HTML, so it may not be suited for PDF. Not at least with asciidoctor-pdf. If you explain what are you trying to achieve maybe we can work some alternative. For example, is maven and mathjax a must? Also someone at the gitter channel could help https://gitter.im/asciidoctor/asciidoctor.
Open this post in threaded view
|

## Re: Maven plugin and Math

 Administrator > As far as I know mathJax uses a script post-processing to render the images in HTML, so it may not be suited for PDF. Not at least with asciidoctor-pdf. That's correct. MathJax does not apply in this context.-DanOn Fri, Sep 11, 2020 at 5:00 AM abelsromero [via Asciidoctor :: Discussion] <[hidden email]> wrote: The error is because require is used to load Ruby gems, and mathJax is pure javascript. So it's not finding the expected files. As far as I know mathJax uses a script post-processing to render the images in HTML, so it may not be suited for PDF. Not at least with asciidoctor-pdf. If you explain what are you trying to achieve maybe we can work some alternative. For example, is maven and mathjax a must? Also someone at the gitter channel could help https://gitter.im/asciidoctor/asciidoctor. If you reply to this email, your message will be added to the discussion below: https://discuss.asciidoctor.org/Maven-plugin-and-Math-tp3895p8237.html To start a new topic under Asciidoctor :: Discussion, email [hidden email] To unsubscribe from Asciidoctor :: Discussion, click here. NAML -- Dan Allen (he, him, his) | @mojavelinux | https://twitter.com/mojavelinux
Open this post in threaded view
|

## Re: Maven plugin and Math

 In reply to this post by abelsromero That's good to know. Maven is a must since it's in our project build pipeline. MathJax is just the tool tried to use for solving the [latexmath] paragraphs to render formulas. We have our user manual newly converted from MS Word to AsciiDoc, and we're building the user manual PDF together with the rest of the application and release it through mvn deploy command. I'm usig the asciidotor maven plugin versions and dependencies:         2.0.0        1.5.3        2.4.0        9.2.11.1I was hoping to be able to just add the dependency to include support for formulas.