Bas,

You are having a normal AsciiDoc macro escaping problem. The closing square
bracket in the formula is prematurely closing the latexmath macro.

Here's what you have:

latexmath:[$\sqrt[3]{4}$]

Here's what you need to have:

latexmath:[$\sqrt[3\]{4}$]

Notice the backslash following the 3.

To avoid having to escape the backslash, you have to use another
passthrough mechanism (since latexmath is really just a pass macro).

You can use the triple plus (as you observed):

+++$\sqrt[3]{4}$+++

You can use the double dollar (though it looks odd):

$$$\sqrt[3]{4}$$$

However, what I recommend the most is to use something other than the
single dollar for the math equation boundaries. For instance, you can
configure mathjax to recognize backticks, so you can type:

$$`\sqrt[3]{4}`$$

Perhaps better is to choose a delimiter AsciiDoc doesn't already process,
such as the escaped round brackets:

\(\sqrt[3]{4}\)

Personally, I think the last solution is the best. You would configure it
as:

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  tex2jax: {
    inlineMath: [ ['\\(','\\)'] ]
  }
});
</script>

I hope that helps!

-Dan



On Fri, Oct 25, 2013 at 3:13 AM, Bas <[email protected]> wrote:

> In a LaTeX-section of my document I am trying to use sqrt, but it is not
> working properly. The output format is html5.
> Lines containing something like latexmath:[$\sqrt[3]{4}$] are ignored.
> MathJax seems to work properly (see +++-hack below).
>
> I guess the specialcharacters-function(?) is confused by the square
> brackets. I checked in html5.conf, if I can find anything, but I did not
> succeed.
>
> I'd appreciate if anyone could take a look at that. Thanks for your help!
>
>
> asciidoc code:
>
> This line will be rendered: latexmath:[$a=\sqrt{b}$]
> This line will NOT be rendered: latexmath:[$\sqrt[3]{4}$]
> The following hack works fine
>
> +++
> $\sqrt[3]{4}$
> +++
>
>
> html output:
>
> <div class="paragraph"><p>This line will be rendered: $a=\sqrt{b}$
> The following hack works fine</p></div>
> <div class="paragraph"><p>$\sqrt[3]{4}$</p></div>
>
>
> Image of html output (in Chrome/Win 8.1):
>
>
> <https://lh4.googleusercontent.com/-ayY6-Ea03FY/Umo1zVFYnbI/AAAAAAAAAL8/dYOrh65cGwo/s1600/sqrt.png>
>
> Integration of MathJax in html5.conf:
>
> <script type="text/x-mathjax-config">
>  MathJax.Hub.Config(\{tex2jax: \{inlineMath: [['$','$'],
> ['\\(','\\)']]}});
> </script>
> <script type="text/javascript"
>   src="
> https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML
> ">
> </script>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "asciidoc" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/asciidoc.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Dan Allen | http://google.com/profiles/dan.j.allen

-- 
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/asciidoc.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to