Search code examples
htmlalignmentlatexmathjaxreveal.js

left allign formula MathJax


I'm creating a presentation with reveal.js

To show some math stuff I use the builtin plugin for MathJax (thin MathJax wrapper). It works fine so far except for one thing:

I'm struggeling to left allign one of my math formulas. I want it to be like this:

                               a^2 + b^2 = c^2 (centered text)
a: in CM (left alligned text)
b: in CM (left alligned text)
c: in CM (left alligned text)

At the moment everything is centered.

                               a^2 + b^2 = c^2 (centered text)
                               a: in CM (centered text)
                               b: in CM (centered text)
                               c: in CM (centered text)

Solution

  • One way is to use the multline environment and \shoveleft to left align the equations to the left. Unfortunately, the default is to use only 85% of the container for multline environments, but perhaps that is good enough.

    <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/MathJax.js?config=TeX-AMS_CHTML'></script>
    
    \begin{multline}
    \shoveleft a\\
    \shoveleft b\\
    \shoveleft c
    \end{multline}

    Otherwise, if that is not far enough to the left, you could use a container with negative left margin CSS to shift the math further to the left.