Hi a quick question: - how do I write a label like this:
> ylabel("\\sigma\_\{\\rm\{R\}\} / \\sigma\_e")
> to have: sigma_R / sigma_e with the R in \rm mode ?
> At the moment it does not seem to work..
Hi Eric,
Yes, this reflects a bug in the parser -- thanks for letting me know.
FYI, there is also a bug in your code: remember that it is necessary
to use quoted "raw" strings to protect the backslashes. With the
amended parser I'm attaching below, both of the following parse
properly.
from pylab import *
plot([1,2,3])
ylabel(r"\\sigma\_\{\\rm\{R\}\} / \\sigma\_e", fontsize=20)
xlabel(r"\\sigma\_\\rm\{R\} / \\sigma\_e", fontsize=20)
show()
> [Is there any exhaustive list of what we can do in
> latex-like mode ? I am for example looking for different
> ways to include ''spaces'']
Information about space handling is included in the module
documentation, eg at
http://matplotlib.sourceforge.net/matplotlib.mathtext.html
The spacing elements \ , \/ and \hspace{num} are provided. \/
inserts a small space, and \hspace{num} inserts a fraction of the
current fontsize. Eg, if num=0.5 and the fontsize is 12.0,
hspace{0.5} inserts 6 points of space
and this information can also be found in the User's Guide section
"mathtext" (section 2.6.4 in
http://matplotlib.sourceforge.net/users_guide_0.71.pdf). Also in the
module documentation linked above is a listing of mathtext symbols
\/ \Delta \Downarrow \Gamma \Im \LEFTangle \LEFTbrace \LEFTbracket
\LEFTparen \Lambda \Leftarrow \Leftbrace \Leftbracket \Leftparen
\Leftrightarrow \Omega \P \Phi \Pi \Psi \RIGHTangle \RIGHTbrace
\RIGHTbracket \RIGHTparen \Re \Rightarrow \Rightbrace \Rightbracket
\Rightparen \S \SQRT \Sigma \Sqrt \Theta \Uparrow \Updownarrow
\Upsilon \Vert \Xi \aleph \alpha \approx \angstrom \ast \asymp
\backslash \beta \bigcap \bigcirc \bigcup \bigodot \bigoplus
\bigotimes \bigtriangledown \bigtriangleup \biguplus \bigvee
\bigwedge \bot \bullet \cap \cdot \chi \circ \clubsuit \coprod \cup
\dag \dashv \ddag \delta \diamond \diamondsuit \div \downarrow \ell
\emptyset \epsilon \equiv \eta \exists \flat \forall \frown \gamma
\geq \gg \heartsuit \hspace \imath \in \infty \int \iota \jmath
\kappa \lambda \langle \lbrace \lceil \leftangle \leftarrow
\leftbrace \leftbracket \leftharpoondown \leftharpoonup \leftparen
\leftrightarrow \leq \lfloor \ll \mid \mp \mu \nabla \natural
\nearrow \neg \ni \nu \nwarrow \odot \oint \omega \ominus \oplus
\oslash \otimes \phi \pi \pm \prec \preceq \prime \prod \propto \psi
\rangle \rbrace \rceil \rfloor \rho \rightangle \rightarrow
\rightbrace \rightbracket \rightharpoondown \rightharpoonup
\rightparen \searrow \sharp \sigma \sim \simeq \slash \smile
\spadesuit \sqcap \sqcup \sqrt \sqsubseteq \sqsupseteq \subset
\subseteq \succ \succeq \sum \supset \supseteq \swarrow \tau \theta
\times \top \triangleleft \triangleright \uparrow \updownarrow
\uplus \upsilon \varepsilon \varphi \varphi \varrho \varsigma
\vartheta \vdash \vee \vert \wedge \wp \wr \xi \zeta
I have been working on a comprehensive listing of all supported
mathtext commands for the user's guide, but was delayed over
formatting all these symbols properly into latex tables.
JDH
mathtext.py (36.8 KB)