How Do I Write The Multiplication Sign In ReStructuredText (reST)?
Solution 1:
It turns out that the Sphinx documentation contains the answer, I just didn't read quite far enough:
Since the easiest way to include special characters like em dashes or copyright signs in reST is to directly write them as Unicode characters, one has to specify an encoding. Sphinx assumes source files to be encoded in UTF-8 by default; you can change this with the source_encoding config value.
https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#source-encoding
Edit: Just to follow up here: while the multiplication sign works just fine, many other seemingly standard unicode symbols (less than or equal to, and greater than or equal to) are missing from the default font used in LaTeX (and thus PDF) rendering.
Solution 2:
To add to @Paul McMillan's answer, if you're trying to publish your sphinx documentation as a latex pdf, you can often get around the missing unicode symbols by including in your conf.py
preamble:
_PREAMBLE = r"""
\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{00D7}{\times}
"""
latex_elements = {
'preamble': _PREAMBLE,
}
Where 00D7
is the unicode encoding, and \times
is what you want it to be replaced by in latex.
You can find the unicode encoding for your character on the fileformat website.
Solution 3:
I would use MathML within rst :math:`m \times p`
Solution 4:
What's wrong with |times|
after using .. include:: <isonum.txt>
?
From http://docutils.sourceforge.net/0.6/docutils/parsers/rst/include/isonum.txt :
.. |sup2| unicode:: U+000B2 .. SUPERSCRIPT TWO
.. |sup3| unicode:: U+000B3 .. SUPERSCRIPT THREE
.. |times| unicode:: U+000D7 .. MULTIPLICATION SIGN
.. |trade| unicode:: U+02122 .. TRADE MARK SIGN
.. |uarr| unicode:: U+02191 .. UPWARDS ARROW
Post a Comment for "How Do I Write The Multiplication Sign In ReStructuredText (reST)?"