LucG
LucG

Reputation: 1334

Keep indentation after directive in list

In RST for a sphinx documentation and using the sphinx.ext.imgmath extension for maths equations, I would like to add an equation in the middle of a bullet point list but have a second paragraph after the said equation and keep the indentation level of the bullet point. I think the problem would be the same with any other kind of directive than math.

My current RST code looks like this:

Introducing the bullet list on zero-th level indentation:

- First bullet point on first level indentation.

.. math::

   centered math equation

I would like this to be at the first level indentation because it belongs to the first bullet point but it lands on zero-th level indentation.

- Second bullet point on first level indentation.

And this gives:

Introducing the bullet list on zero-th level indentation:
    
    - First bullet point on first level indentation.
    
                     centered math equation
    
I would like this to be at the first level indentation because it belongs to the first bullet point but it lands on zero-th level indentation.
    
    - Second bullet point on first level indentation.

but I would like:

Introducing the bullet list on zero-th level indentation:
    
    - First bullet point on first level indentation.
    
                     centered math equation
    
      I would like this to be at the first level indentation because it belongs to the first bullet point but it lands on zero-th level indentation.
    
    - Second bullet point on first level indentation.

Upvotes: 1

Views: 534

Answers (1)

mzjn
mzjn

Reputation: 50947

Indent the math block and the paragraph after it.

Introducing the bullet list on zero-th level indentation:

- First bullet point on first level indentation.

  .. math::

     centered math equation

  I would like this to be at the first level indentation because it belongs to the first bullet point  but it lands on zero-th level indentation.

- Second bullet point on first level indentation.

Consistent indentation is very important. See https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#indentation.

Upvotes: 2

Related Questions