-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Synchronize mathtext docs and handling #26173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
``mathtext`` documentation improvements | ||
--------------------------------------- | ||
|
||
The documentation is updated to take information directly from the parser. This | ||
means that (almost) all supported symbols, operators etc are shown at :ref:`mathtext`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
``mathtext`` spacing corrections | ||
-------------------------------- | ||
|
||
As consequence of the updated documentation, the spacing on a number of relational and | ||
operator symbols were classified like that and therefore will be spaced properly. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1734,7 +1734,17 @@ class _MathStyle(enum.Enum): | |
\cap \triangleleft \dagger | ||
\cup \triangleright \ddagger | ||
\uplus \lhd \amalg | ||
\dotplus \dotminus'''.split()) | ||
\dotplus \dotminus \Cap | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is going to change how some things render, do we need a note about this? |
||
\Cup \barwedge \boxdot | ||
\boxminus \boxplus \boxtimes | ||
\curlyvee \curlywedge \divideontimes | ||
\doublebarwedge \leftthreetimes \rightthreetimes | ||
\slash \veebar \barvee | ||
\cupdot \intercal \amalg | ||
\circledcirc \circleddash \circledast | ||
\boxbar \obar \merge | ||
\minuscolon \dotsminusdots | ||
'''.split()) | ||
|
||
_relation_symbols = set(r''' | ||
= < > : | ||
|
@@ -1769,20 +1779,53 @@ class _MathStyle(enum.Enum): | |
\trianglelefteq \ntrianglelefteq \trianglerighteq | ||
\ntrianglerighteq \blacktriangleleft \blacktriangleright | ||
\equalparallel \measuredrightangle \varlrtriangle | ||
'''.split()) | ||
|
||
_arrow_symbols = set(r''' | ||
\leftarrow \longleftarrow \uparrow | ||
\Leftarrow \Longleftarrow \Uparrow | ||
\rightarrow \longrightarrow \downarrow | ||
\Rightarrow \Longrightarrow \Downarrow | ||
\leftrightarrow \longleftrightarrow \updownarrow | ||
\Leftrightarrow \Longleftrightarrow \Updownarrow | ||
\mapsto \longmapsto \nearrow | ||
\hookleftarrow \hookrightarrow \searrow | ||
\leftharpoonup \rightharpoonup \swarrow | ||
\leftharpoondown \rightharpoondown \nwarrow | ||
\rightleftharpoons \leadsto'''.split()) | ||
\Doteq \Bumpeq \Subset \Supset | ||
\backepsilon \because \therefore \bot | ||
\top \bumpeq \circeq \coloneq | ||
\curlyeqprec \curlyeqsucc \eqcirc \eqcolon | ||
\eqsim \fallingdotseq \gtrdot \gtrless | ||
\ltimes \rtimes \lessdot \ne | ||
\ncong \nequiv \ngeq \ngtr | ||
\nleq \nless \nmid \notin | ||
\nprec \nsubset \nsubseteq \nsucc | ||
\nsupset \nsupseteq \pitchfork \preccurlyeq | ||
\risingdotseq \subsetneq \succcurlyeq \supsetneq | ||
\varpropto \vartriangleleft \scurel | ||
\vartriangleright \rightangle \equal \backcong | ||
\eqdef \wedgeq \questeq \between | ||
\veeeq \disin \varisins \isins | ||
\isindot \varisinobar \isinobar \isinvb | ||
\isinE \nisd \varnis \nis | ||
\varniobar \niobar \bagmember \ratio | ||
\Equiv \stareq \measeq \arceq | ||
\rightassert \rightModels \smallin \smallowns | ||
\notsmallowns \nsimeq'''.split()) | ||
|
||
_arrow_symbols = set(r""" | ||
\leftarrow \longleftarrow \uparrow \Leftarrow \Longleftarrow | ||
\Uparrow \rightarrow \longrightarrow \downarrow \Rightarrow | ||
\Longrightarrow \Downarrow \leftrightarrow \updownarrow | ||
\longleftrightarrow \updownarrow \Leftrightarrow | ||
\Longleftrightarrow \Updownarrow \mapsto \longmapsto \nearrow | ||
\hookleftarrow \hookrightarrow \searrow \leftharpoonup | ||
\rightharpoonup \swarrow \leftharpoondown \rightharpoondown | ||
\nwarrow \rightleftharpoons \leadsto \dashrightarrow | ||
\dashleftarrow \leftleftarrows \leftrightarrows \Lleftarrow | ||
\Rrightarrow \twoheadleftarrow \leftarrowtail \looparrowleft | ||
\leftrightharpoons \curvearrowleft \circlearrowleft \Lsh | ||
\upuparrows \upharpoonleft \downharpoonleft \multimap | ||
\leftrightsquigarrow \rightrightarrows \rightleftarrows | ||
\rightrightarrows \rightleftarrows \twoheadrightarrow | ||
\rightarrowtail \looparrowright \rightleftharpoons | ||
\curvearrowright \circlearrowright \Rsh \downdownarrows | ||
\upharpoonright \downharpoonright \rightsquigarrow \nleftarrow | ||
\nrightarrow \nLeftarrow \nRightarrow \nleftrightarrow | ||
\nLeftrightarrow \to \Swarrow \Searrow \Nwarrow \Nearrow | ||
\leftsquigarrow \overleftarrow \overleftrightarrow \cwopencirclearrow | ||
\downzigzagarrow \cupleftarrow \rightzigzagarrow \twoheaddownarrow | ||
\updownarrowbar \twoheaduparrow \rightarrowbar \updownarrows | ||
\barleftarrow \mapsfrom \mapsdown \mapsup \Ldsh \Rdsh | ||
""".split()) | ||
|
||
_spaced_symbols = _binary_operators | _relation_symbols | _arrow_symbols | ||
|
||
|
@@ -2111,9 +2154,11 @@ def symbol(self, s, loc, toks): | |
# such as ${ -2}$, $ -2$, or $ -2$. | ||
prev_char = next((c for c in s[:loc][::-1] if c != ' '), '') | ||
# Binary operators at start of string should not be spaced | ||
if (c in self._binary_operators and | ||
(len(s[:loc].split()) == 0 or prev_char == '{' or | ||
prev_char in self._left_delims)): | ||
# Also, operators in sub- or superscripts should not be spaced | ||
if (self._in_subscript_or_superscript or ( | ||
c in self._binary_operators and ( | ||
len(s[:loc].split()) == 0 or prev_char == '{' or | ||
prev_char in self._left_delims))): | ||
return [char] | ||
else: | ||
return [Hlist([self._make_space(0.2), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -800,6 +800,8 @@ | |
'eta' : 951, | ||
'forall' : 8704, | ||
'eth' : 240, | ||
'dh' : 240, | ||
'DH' : 208, | ||
'colon' : 58, | ||
'sqcup' : 8852, | ||
'bigsqcup' : 10758, | ||
|
@@ -908,7 +910,7 @@ | |
'O' : 216, | ||
'hookleftarrow' : 8617, | ||
'trianglerighteq' : 8885, | ||
'nsime' : 8772, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Has this just been wrong from 2006 ?! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess so. However, I do not think it was documented so I wonder if someone ever used it? |
||
'nsimeq' : 8772, | ||
'oe' : 339, | ||
'nwarrow' : 8598, | ||
'o' : 248, | ||
|
@@ -1090,6 +1092,8 @@ | |
'bagmember' : 8959, | ||
'triangle' : 9651, | ||
'iiiint' : 10764, | ||
'amalg' : 10815, | ||
'merge' : 10837, | ||
} | ||
|
||
# Each element is a 4-tuple of the form: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't
therefore
andbecause
in Relation operators?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they are. As well.
I just saw some table with "dot symbols" somewhere (do not remember where, maybe the "List of LaTeX symbols..." or whatever it is called), where they were included, so thought that it may make sense. Easy to modify though.