barrysteyn / pelican_plugin-render_math

A plugin for the pelican blog to allow it render mathematics in Latex.
67 stars 25 forks source link

Are labels supported for rst? #20

Closed warmspringwinds closed 9 years ago

warmspringwinds commented 9 years ago

Hello.

I am trying to use labels using your plugin, but nothing seems to work.

This is how I try to do it:

.. math:: :label: blah \label{eq}a_j(\textbf{x}) = ln\left( p(\textbf{x}|C_j) p(C_j) \right)

and then reference :math:\ref{eq}

barrysteyn commented 9 years ago

Give me the entire RST file dump please...

barrysteyn commented 9 years ago

On second thought, I don't think labels are supported the way the plugin is setup now. Can you do some research please and tell me exactly how to enable them please.

warmspringwinds commented 9 years ago

This is the dump. The problem part is in the bottom. http://pastebin.com/WUVzbcdn

So, the only fast workaround is to use markdown instead in this case?

Ok, I will try.

warmspringwinds commented 9 years ago

So, basically I want to do the thing with labels that is possible in markdown like mentioned in your documentation here but for rst file format.

barrysteyn commented 9 years ago

Yes, I understand what you are trying to do. It's just that RST is weird: Its really its own language (unlike markdown which is more of a subset of html). When I was originally making this plugin, I had (and this is still true for me today) no use for RST - I always used MD. But for the sake of completeness, I researched how to make RST use math. It turned out one had to set the math_output to mathajx (this is set automatically by the plugin in the DOCUTILS_SETTINGS variable). That would enable the math role. The only thing I then had to do was insert the mathjax script into the content which was very easy.

Now the mathjax script is setup to use labels. And this is evident when using it in Markdown. Looking at the RST documentation, I see that :label: <name> is a special option. I don't know how to make that option available (although it will either be very easy to do, or very difficult). Seeing as I don't use RST and I am very busy, I don't have time to investigate this. But if you tell me how to enable this and send me a link to the documentation, I will do it for you.