You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ python
Python 3.5.1 (default, Dec 7 2015, 12:58:09)
[GCC 5.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt; plt.gca().set_xlabel("$^{''}$/yr"); plt.show()
<matplotlib.text.Text object at 0x7f6451604f98>
(same result from within ipython with %matplotlib active)
EDIT: This part is invalid and should be ignored
Weirdly enough, running the same command from with python -c a different result:
$ python -c 'import matplotlib.pyplot as plt; plt.gca().set_xlabel("$^{''}$/yr"); plt.show()'
Also note that this only happens with the Computer Modern mathtext fontset (which is default in 1.5.x but will not be in 2.x). with the dejavusans fontset the rendering is better but there is still some weirdness with the first ':
mathtext will convert apostrophes into ^\prime, so that's why the second apostrophe gets typeset correctly, but it will only do this change to apostrophes coming after a nucleus (so it will change $a'$ into $a^{\prime}$ but not $'$ into $^\prime$). Because of this, {}'' would actually give the correct behaviour.
the latex_to_bakoma dictionary does not have an entry for ', and the Bakoma fonts included do not have a quotesingle character, only quoteleft and quoteright. I don't know why the lack of a entry results in \phi, though.
The second part could be fixed by adding an entry in the latex_to_bakoma dict to, e.g., quoteleft. However, I think fixing the behaviour of the first part (converting all ' to superscripted primes) is better. I am still having some trouble implementing that, though.
@anntzer - I did not know about ' being an active character (hence my comment above about a proper way...), it looks very useful. I tried to add the full functionality of that in #5880 so that even apostrophes as first charachters get recognised as primes.
Activity
QuLogic commentedon Jan 17, 2016
The result with
python -cis different because the single quotes in the middle end and start two Bash strings.anntzer commentedon Jan 17, 2016
Oops, failed at triple nesting my quotes. The main issue still stands though.
[-]Strange mathtext behavior (for lack of better description...)[/-][+]mathtext mishandling of certain exponents[/+]zblz commentedon Jan 17, 2016
The first result is definitely weird, I have no idea where that phi comes from. I'll take a look to try to find the culprit.
For the record, the proper way of of typesetting arcseconds would be with primes
$^{\prime\prime}$.zblz commentedon Jan 17, 2016
Also note that this only happens with the Computer Modern mathtext fontset (which is default in 1.5.x but will not be in 2.x). with the dejavusans fontset the rendering is better but there is still some weirdness with the first

':Proper typing of "prime" in docs, see matplotlib#5864.
zblz commentedon Jan 17, 2016
So I narrowed the behaviour down to two effects:
^\prime, so that's why the second apostrophe gets typeset correctly, but it will only do this change to apostrophes coming after a nucleus (so it will change$a'$into$a^{\prime}$but not$'$into$^\prime$). Because of this,{}''would actually give the correct behaviour.latex_to_bakomadictionary does not have an entry for', and the Bakoma fonts included do not have aquotesinglecharacter, onlyquoteleftandquoteright. I don't know why the lack of a entry results in\phi, though.The second part could be fixed by adding an entry in the
latex_to_bakomadict to, e.g.,quoteleft. However, I think fixing the behaviour of the first part (converting all'to superscripted primes) is better. I am still having some trouble implementing that, though.efiring commentedon Jan 17, 2016
On 2016/01/17 10:40 AM, Victor Zabalza wrote:
If I understand correctly, this is making mathtext less compatible
with LaTeX. Is this a desired result? Granted,
$^\prime$is clunkyand ugly.
anntzer commentedon Jan 17, 2016
Actually I just learnt that
'is an active character in tex that gets converted to^\prime(plus some more). So it's actually more compatible.Minor doc/example fixes.
Fix apostrophes as primes
zblz commentedon Jan 19, 2016
@anntzer - I did not know about
'being an active character (hence my comment above about a proper way...), it looks very useful. I tried to add the full functionality of that in #5880 so that even apostrophes as first charachters get recognised as primes.Minor doc/example fixes.