Hi Stefan.
AFAIK, this is not possible with Sphinx's :label: option, because this
always applies to the whole equation, even if it has multiple lines.
You might be able to split your multiple lines into separate "math"
directives, but I guess then it'll be hard to get the vertical
alignment right.
But if you are willing to use MathJax's labelling mechanism, it should
work like this:
.. math::
:nowrap:
\begin{align}
2x^2 + 3(x-1)(x-2) & = 2x^2 + 3(x^2-3x+2) \\ \nonumber
& = 2x^2 + 3x^2 - 9x + 6 \\
& = 5x^2 - 9x + 6
\label{testpdf}
\end{align}
In addition, you'll need to activate the MathJax labelling:
mathjax_config = {
'TeX': {'equationNumbers': {'autoNumber': 'AMS', 'useLabelIds': True}},
}
Also, the referencing with :eq: will not work anymore, instead you'll
have to use :math:`\ref{testpdf}`.
The big disadvantage of the whole thing is that MathJax references
only work within the same page.
And they don't take the section number into account. At least by
default, there might be a setting to fix this ...?
cheers,
Matthias