How to use \\ to break lines in mathjax math

I use mathjax with hugo to make my blogs have math support. I added a custom partial that added the mathjax scripts and I have the following code in my mathjax.html:

<script>
  MathJax = {
    tex: {
      inlineMath: [['$', '$'], ['\(', '\)']],
      displayMath: [['$$','$$'], ['\[', '\]']],
      processEscapes: true,
      processEnvironments: true
    },
    options: {
      skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre']
    }
  };

Whenever I want to create a new equation I have to write 4 backlashes to make my enviroments work, as the following example:

\[
\begin{cases}
f(x) = x & 1 \\\\
f(x) = x & 2 
\end{cases}
\]

and I would like to write

\[
\begin{cases}
f(x) = x & 1 \\
f(x) = x & 2 
\end{cases}
\]

to make all my latex and markdown files consistent. How can I achieve this?

See https://gohugo.io/content-management/mathematics/.

If you follow the procedure, this…

\[
\begin{cases}
f(x) = x & 1 \\
f(x) = x & 2 
\end{cases}
\]

is rendered to:

image

1 Like

thanks!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.