Mathjax expression in python sphinx has no correlation

I tried to figure out what was wrong with this expression in my docstring. I am using the sphinx.ext.mathjax extension in python sphinx v1.2b. Dockstone:

 .. math:: w_k^* = \min_{w_k} \ell_k(w_k) + \lambda\left(\alpha||w_k||_1 + \frac{1}{2}(1-\alpha) ||w_k||^2\right) 

Here is what appears: enter image description here

But he continues to generate this strange warning and not display the expression at all:

 WARNING: Block quote ends without a blank line; unexpected unindent. 

Oddly enough, if I delete the characters \alpha , \left , \right , \frac , the expression does fine without warning. Not sure why \lambda will be supported, not \alpha .

+4
source share
1 answer

From the Sphinx documentation :

Keep in mind that when you add math markup to Python docstrings read by autodoc, you either need to double all backslashes, or use the original Python strings ( r"raw" ).

This is necessary, so LaTeX commands such as \alpha are interpreted correctly ( \a and several other sequences have special meaning in a string literal).

+10
source

Source: https://habr.com/ru/post/1479973/


All Articles