Skip to content

\begin{equation}...\end{equation} (numbered equations) #15

@HuidaeCho

Description

@HuidaeCho

Numbered equations

Thanks for the great plugin. I've tried \begin{equation}...\end{equation} syntax with little success. If there are \{ and '}`, I had to escape backslashes because of the Markdown syntax(?). For example,

\begin{equation}
\left\{\sin(x)\right\}
\end{equation}

doesn't work while

\begin{equation}
\left\\{\sin(x)\right\\}
\end{equation}

does.

I think you're escaping them if they're between the default delimiters. I could add \begin{} and \end{} as delimiters, but then, my auto-numbering setting (TeX: {equationNumbers: {autoNumber: "AMS"}} in mathjax.js) wouldn't work anymore. For this setting, I directly modified the JS file in the plugin, which I don't link (see below for more details). Please support \begin{} and \end{} syntax as well.

Custom JS file

Also, since I wanted to add the auto-numbering setting, I tried to follow your instructions to create a custom JS file. I'm using my inherited Quark theme, so I copied mathjax.js to themes/my-quark/js and added {% do assets.addJs('theme://js/mathjax.js') %} to themes/my-quark//templates/partials/base.html.twig. Then, disabled the build-in JS. Now, in the developer console of my Firefox, I'm getting these errors (Undefined MathJax.Hub.. Full error message below). Do you have any idea why this is happening? One thing I can think of is.. in my other non-Grav site, I'm using the text/x-mathjax-config type, not the script type as in

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

<script>
// here load MathJax.js?config=TeX-AMS_CHTML
</script>

Thank you,
Huidae

Full error message

Uncaught TypeError: can't access property "Startup", MathJax.Hub is undefined
    onload https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    execute https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    cb https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    onLoad https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    <anonymous> https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    <anonymous> https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
MathJax.js:19:49644
Uncaught TypeError: can't access property "Config", MathJax.Hub is undefined
    <anonymous> https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/config/TeX-AMS-MML_HTMLorMML.js?V=2.7.0:15
TeX-AMS-MML_HTMLorMML.js:15:1
Uncaught TypeError: can't access property "isArray", MathJax.Object is undefined
    Set https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    loadError https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    loadTimeout https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    execute https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    cb https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    setTimeout handler*JS https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    Load https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    Require https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    execute https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    cb https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    Process https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    Push https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    Config https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    execute https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    cb https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    Process https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    Push https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    <anonymous> https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
    <anonymous> https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML:19
MathJax.js:19:28828

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions