Discussion:
[Docutils-users] power in reStructuredText
mansour amini
2015-06-14 07:46:45 UTC
Permalink
hihow can i show power function in reStructedText (for exapmle instead of 2 * 2 = 4 write 2^2 =4)? i don't want to use ^, i want show like mathematics expression
 
Guenter Milde
2015-06-14 20:48:12 UTC
Permalink
Post by mansour amini
hihow can i show power function in reStructedText (for exapmle instead
of 2 * 2 = 4 write 2^2 =4)? i don't want to use ^, i want show like
mathematics expression
Then you can use a mehtematical expression in a "math" role or directive.
The input syntax is "LaTeX math", the output is properly typeset (if the
aoutput format supports math (html and latex do, see the reStructuredText
documentation for details).)

Aternatively, you can use superscript Unicode characters or the "sup" role
for the exponent.

Günter
David Goodger
2015-06-15 15:44:12 UTC
Permalink
Post by Guenter Milde
Post by mansour amini
hihow can i show power function in reStructedText (for exapmle instead
of 2 * 2 = 4 write 2^2 =4)? i don't want to use ^, i want show like
mathematics expression
Then you can use a mehtematical expression in a "math" role or directive.
The input syntax is "LaTeX math", the output is properly typeset (if the
aoutput format supports math (html and latex do, see the reStructuredText
documentation for details).)
Aternatively, you can use superscript Unicode characters or the "sup" role
for the exponent.
For simple expressions (x² etc), I like to use Unicode superscript
characters: ¹²³⁴⁵⁶⁷⁸⁹⁰. There are also subscript characters:
₁₂₃₄₅₆₇₈₉₀. And lots of others besides.

To type these, I enable the Compose Key on my systems. Native support
on Linux, WinCompose on Windows.
--
David Goodger <http://python.net/~goodger>

------------------------------------------------------------------------------
Ben Finney
2015-06-14 20:57:07 UTC
Permalink
Post by mansour amini
i don't want to use ^, i want show like mathematics expression
It is worth observing that reStructuredText is a markup format designed
for widespread use, rendering to many different output formats.

Not all the output formats Docutils targets are capable of rendering
complex mathematical expressions.

With that said, the “math” interpreted text role and directive
<URL:http://docutils.sourceforge.net/docs/ref/rst/roles.html#math>
<URL:http://docutils.sourceforge.net/docs/ref/rst/directives.html#math>
are available in Docutils version 0.8 and later::

The input format is LaTeX math syntax[1] with support for Unicode
symbols […]

Support is limited to a subset of LaTeX math by the conversion
required for many output formats.

I hope that helps.
--
\ “I believe our future depends powerfully on how well we |
`\ understand this cosmos, in which we float like a mote of dust |
_o__) in the morning sky.” —Carl Sagan, _Cosmos_, 1980 |
Ben Finney


------------------------------------------------------------------------------
Loading...