Skip to content

LaTeX \check{...} and \not{...} not working #7738

Open

Description

@mxmlnkn

When trying \check{k} or \not{k} the accent is rendered left of k, not above k:
testaccents
This is the code to create the above image:

from numpy import *
from matplotlib.pyplot import *

#matplotlib.rc('text', usetex=True)
figure( figsize=(6,1) )
axis('off')
title( r"|$\check{k}$|$\hat{k}$|$\dot{k}$|$\ddot{k}$|$\grave{k}$|$\acute{k}$|$\tilde{k}$|$\breve{k}$|$\bar{k}$|$\not{k}$|$\vec{k}$|$\widetilde{k}$|$\widehat{k}$|$\overleftarrow{k}$|$\overrightarrow{k}$|$\overline{k}$|" )
# Unknown symbol: \underline (at char 0), (line:1, col:1)
# Unknown symbol: \overbrace (at char 0), (line:1, col:1)
# Unknown symbol: \underbrace (at char 0), (line:1, col:1)
# $\underline{k}$|$\overbrace{k}$|$\underbrace{k}$|
tight_layout()
savefig( "testAccents.png" )
show()

When uncommenting usetex=True the output is:
testaccentsusetextrue
I.e. the accents are rendered correctly now, but the vertical bars are for some reason rendered as horizontal bars suddenly. Not sure if I should open yet another issue for that?

Just for comparison, this is what codecogs renders:
codecogseqn-testcheck

Also as indicated in the sourcecode \underline{...} \overbrace{...} \underbrace{...} don't work at all. I tested those, because they were in the same "accent"(?)-category in the codecogs equation editor.

System:

  • Debian Sid
  • python-matplotlib 1.5.3-1
  • python 2.7.11-2
  • Everything installed through apt-get

Activity

  1. anntzer commented on Mar 27, 2019

    @anntzer
    Contributor

    Looks like

    diff --git i/lib/matplotlib/mathtext.py w/lib/matplotlib/mathtext.py
    index ef7b8768f..17271895d 100644
    --- i/lib/matplotlib/mathtext.py
    +++ w/lib/matplotlib/mathtext.py
    @@ -2824,7 +2824,8 @@ class Parser(object):
             r'^'     : r'\circumflexaccent',
             r'overrightarrow' : r'\rightarrow',
             r'overleftarrow'  : r'\leftarrow',
    -        r'mathring' : r'\circ'
    +        r'mathring' : r'\circ',
    +        r'check' : r'\check',
             }
     
         _wide_accents = set(r"widehat widetilde widebar".split())

    fixes the positioning of the \check, but a similar fix does not work for \not (it ends up positioned "higher" than the character, at the "accent" position).

    As for the vertical vs. horizontal bar thing: https://tex.stackexchange.com/questions/193216/vertical-bar-turning-horizontal

  2. oscargus commented on Jun 1, 2022

    @oscargus
    Member

    Similar problems appear for Hungarian umlaut, all accents positioned underneath the character, like cedilla and ogonek, and for tie. See https://en.wikibooks.org/wiki/LaTeX/Special_Characters

  3. github-actions commented on Jun 2, 2023

    @github-actions

    This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

  4. story645 commented on Jun 2, 2023

    @story645
    Member

    @devRD is this in scope for you?

  5. devRD commented on Jun 2, 2023

    @devRD
    Contributor

    @story645 Yeah, I think it is in my scope of work

  6. added
    keepItems to be ignored by the “Stale” Github Action
    and removed
    status: inactiveMarked by the “Stale” Github Action
    on Jun 2, 2023
  7. oscargus commented on Jun 2, 2023

    @oscargus
    Member

    I'd have a look at #23189 that adds support for check and a few other accents. However, it got stuck as I added the feature of "properly" combining accents, i.e., using the composite Unicode character rather than "visually pasting two characters on top of each other". I think that is really the correct way to go, but it will change the rendering (to the better...). The good thing is that this will also support accents independent of the location (currently we cannot do things like not or accents placed below the character) and it uses the correct version of the accent, for check looks different dependent on letter, see e.g. d here: https://www.compart.com/en/unicode/U+030C. But it is not optimal in that there must be a corresponding character defined for this to work in all cases (my PR falls back to the old behavior otherwise).

    Still, getting the additional accents from #23189 should be simple (I thought I had done that already, but apparently it was only suggested and I think I wanted to discuss replacing the whole mechanism before ditching it).

    Edit: I'll see if I can find some time to extract the accents over the weekend. The idea is not to ask @devRD to finish all my abandoned PRs...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    keepItems to be ignored by the “Stale” Github Actiontopic: text/mathtext

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions