Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Math in reStructuredText with LaTeX

I would like to use a lightweight markup language to take notes in my college classes.

My editor of choice is gedit, and I found reStructuredText Tools for Gedit, which will run the reStructuredText processor and render the HTML in a pane in gedit. This is great, and 80% of the way there.

But for many of my classes I need to include math equations or greek characters in my notes. Although I'm not very familiar with LaTeX, my understanding is that it has these capabilities.

How can I use LaTeX in a reST document? Would the reST document need to be processed into LaTeX, then that rendered into HTML, or is there a better way? Would markdown make this easier? I can modify the gedit plugin if necessary.

Lastly, does anyone do this? Any other suggestions for taking class notes in a plain text editor?

Thanks!

like image 913
Craig Younkins Avatar asked Aug 31 '10 15:08

Craig Younkins


People also ask

How do you put math in LaTeX mode?

There are a few ways to enter math mode, however the most common is $.... $, where the text within the dollar signs is in the math mode environment. You have already been using math mode unknowingly by using the \begin{equation} and \end{equation} commands.

How do you write a math block in LaTeX?

If you want to write more complex math, insert a LaTeX snippet in your document To insert a LaTeX block, click on Insert -> LaTeX. In the LaTeX block, you can insert an inline formula by typing the equation inside $.. $ . For example, type: An inline equation is $e=mc^2$.

How do you add math to LYX?

To insert math use the menu Insert→Math→Inline Formula (shortcut Ctrl+m). This inserts a small blue box which will contain the formula. Note that the math toolbar pops up automatically if the cursor is in a math box. (Note also the footnote which was inserted using the menu Insert→Footnote.)


1 Answers

Since version 0.8 it is supported natively: You shouldn't use any workaround anymore. The syntax is also very simple. It is the same as latex math, but without the enclosing $$

So you can simply write the following for a math block

.. math::     \frac{ \sum_{t=0}^{N}f(t,k) }{N} 

Or if you want to write inline you can use this:

:math:`\frac{ \sum_{t=0}^{N}f(t,k) }{N}` 

notice the delimiting backticks there.


UPDATE:

in newer versions it seems to be necessary to use a double-backslash for the math elements, so it's \\frac and not \frac

like image 200
devsnd Avatar answered Oct 18 '22 16:10

devsnd