My current code (LaTeX formula in Jupyter notebook's markdown) looks like below:

\left \{ \begin{array}{c l}
&MSE_{node} = \sum_{i \in node}^{} \left ( \hat{y} - y^{i} \right )^2 \\
\quad \\
&\hat{y}_{node} = {\frac{1}{m_{node}} \sum_{i \in node}^{}y^{(i)}}

which gives the output like this:

enter image description here

There are 2 questions:

  1. How can I align those lines to the beginning of the open bracket, instead of having them quite indented like that?
  2. How can I move the $i \in node$ below the sum?
  • 1
    The reason the expressions are shifted to the right in the array is that each of them starts with & except for the \quad in the middle row. The \quad is set (logically) before the position of the &, shoving the other two lines to the right. Jan 5, 2023 at 4:36

1 Answer 1


This is hard to answer without knowing exactly what markdown system you're using, and how much LaTeX it can handle, but in regular LaTeX, you might consider using a cases environment rather than an array, and you can use the \limits command to put the i ∈ node under the \sum's.

You shouldn't put whole words in math mode without using something like \mathit or \mathrm to space the letters normally:

    \mathit{MSE}_{\mathit{node}} = \sum\limits_{i \in \mathit{node}} \left( \hat{y} - y^{i} \right)^2 \\[3ex]
    \hat{y}_{\mathit{node}} = {\frac{1}{m_{\mathit{node}}} \sum\limits_{i \in \mathit{node}}^{}y^{(i)}}

enter image description here

Alternatively you can use \displaystyle to put the whole part in display mode, which will yield bigger \sum's.

    \mathit{MSE}_{\mathit{node}} = \displaystyle\sum_{i \in \mathit{node}} \left( \hat{y} - y^{i} \right)^2 \\[3ex]
    \hat{y}_{\mathit{node}} = {\frac{1}{m_{\mathit{node}}} \displaystyle\sum_{i \in \mathit{node}}^{}y^{(i)}}

enter image description here

  • Thanks, both solutions work. I'm writing a markdown in a Jupyter notebook.
    – NonSleeper
    Jan 4, 2023 at 3:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .