Search code examples
mathjaxasciidoc

How to define custom macro for mathjax expression inside asciidoc?


I have some mathematical expression that I would like to reuse in my asciidoc document:

:stem: latexmath

[latexmath]
++++        
E^{\unicode{x2307}\unicode{x2307}\unicode{x2307}}       
++++

In order to get equations that are easier to read I would like to use a shortcut, e.g.

:stem: latexmath

[latexmath]
++++        
E^{\myCustomSymbol}       
++++

or

:stem: latexmath

[latexmath]
++++        
E^{include::myCustomSymbol.ad}       
++++

=> How can I use asciidoc imports inside mathematical expressions or

=> How can I define mathjax macros inside asciidoc (is it possible to adapt the mathjax configuration with some special commands) ?

Related questions:


Solution

  • Try

    :stem: latexmath
    
    [latexmath]
    ++++        
    \newcommand{\myCustomSymbol}{{\unicode{x2307}\unicode{x2307}\unicode{x2307}}}
    E^{\myCustomSymbol}       
    ++++
    
    [latexmath]
    ++++
    E^{\myCustomSymbol}       
    ++++
    

    You only need to define the symbol once, then can use it from then on.