Skip to content

Commit bf46fb2

Browse files
committed
Replace "cramped" with a new math-superscript-shift-style CSS property.
w3c/mathml#164
1 parent a2e9631 commit bf46fb2

File tree

5 files changed

+108
-40
lines changed

5 files changed

+108
-40
lines changed

index.html

+86-40
Original file line numberDiff line numberDiff line change
@@ -2299,6 +2299,8 @@ <h4>Fractions <code>&lt;mfrac&gt;</code></h4>
22992299
<a><code>displaystyle</code></a> to <code>false</code>,
23002300
or if it was already <code>false</code> increments
23012301
<a><code>scriptlevel</code></a> by 1, within its children.
2302+
It sets <a>math-superscript-shift-style</a> to
2303+
<code>inline</code> within its second child.
23022304
To avoid visual confusion between the fraction bar and another
23032305
adjacent items (e.g. minus sign or another fraction's bar),
23042306
a default 1-pixel space is added around the element.
@@ -2319,7 +2321,9 @@ <h4>Fractions <code>&lt;mfrac&gt;</code></h4>
23192321
<div class="note" id="fraction-css-rules-on-children">
23202322
In practice, an <code>&lt;mfrac&gt;</code> element has two children
23212323
that are <a>in-flow</a>. Hence the CSS rules basically performs
2322-
<a><code>scriptlevel</code></a> and <a><code>displaystyle</code></a> changes for the <a>numerator</a> and
2324+
<a><code>scriptlevel</code></a>, <a><code>displaystyle</code></a>
2325+
and <a>math-superscript-shift-style</a>
2326+
changes for the <a>numerator</a> and
23232327
<a>denominator</a>.
23242328
</div>
23252329
<section id="fraction-with-nonzero-line-thickness">
@@ -2340,7 +2344,7 @@ <h5>Fraction with nonzero line thickness</h5>
23402344
<figcaption>Box model for the <code>&lt;mfrac&gt;</code> element</figcaption>
23412345
</figure>
23422346
<p>The <a>min-content inline size</a>
2343-
(respectively <a>max-content inline size</a>)
2347+
(respectively <a>max-content inline size</a>)
23442348
of content is the maximum between the
23452349
<a>min-content inline size</a>
23462350
(respectively <a>max-content inline size</a>) of the <a>numerator</a>'s
@@ -2567,13 +2571,16 @@ <h4>Radicals <code>&lt;msqrt&gt;</code>, <code>&lt;mroot&gt;</code></h4>
25672571
in <a href="#global-attributes"></a>.
25682572
</p>
25692573
<p>
2574+
The <code>&lt;msqrt&gt;</code> and <code>&lt;mroot&gt;</code>
2575+
elements sets <a>math-superscript-shift-style</a> to
2576+
<code>inline</code>.
25702577
The <code>&lt;mroot&gt;</code> element sets
25712578
increments <a><code>scriptlevel</code></a> by 2, and sets <a><code>displaystyle</code></a> to "false" in all
25722579
but its first child.
25732580
The <a href="#user-agent-stylesheet">user agent stylesheet</a>
25742581
must contain the following rule in order to implement that behavior:
25752582
</p>
2576-
<pre class="css" data-include="user-agent-stylesheet/mroot.css"></pre>
2583+
<pre class="css" data-include="user-agent-stylesheet/radicals.css"></pre>
25772584
<p>
25782585
If the <code>&lt;msqrt&gt;</code> or <code>&lt;mroot&gt;</code>
25792586
element do not have their computed
@@ -3505,27 +3512,6 @@ <h3>Script and Limit Schemata</h3>
35053512
These elements can be used to place limits on large operators, or fo
35063513
placing accents and lines above or below the base.
35073514
</p>
3508-
<section id="cramped-elements">
3509-
<h4>Cramped Elements</h4>
3510-
<p>
3511-
A <a>MathML Core element</a> is <dfn>cramped</dfn> if it satisfies
3512-
one of the following condition:
3513-
</p>
3514-
<ol>
3515-
<li>Its parent is <a>cramped</a> or a <a>radical element</a>.</li>
3516-
<li>It is the second <a>in-flow</a> child of an
3517-
<a><code>&lt;mfrac&gt;</code></a>,
3518-
<a><code>&lt;msub&gt;</code></a>,
3519-
<a><code>&lt;msubsup&gt;</code></a>,
3520-
<a><code>&lt;munder&gt;</code></a> or
3521-
<a><code>&lt;munderover&gt;</code></a> element.
3522-
</li>
3523-
</ol>
3524-
<div class="note" id="cramped-element">
3525-
The second <a>in-flow</a> child corresponds to a <a>numerator</a>, subscript or
3526-
underscript.
3527-
</div>
3528-
</section>
35293515
<section id="subscripts-and-superscripts-msub-msup-msubsup">
35303516
<h4>Subscripts and Superscripts <code>&lt;msub&gt;</code>, <code>&lt;msup&gt;</code>, <code>&lt;msubsup&gt;</code></h4>
35313517
<div class="issue" data-number="22">Use MathKernInfo?</div>
@@ -3706,9 +3692,10 @@ <h5>Base with superscript</h5>
37063692
</p>
37073693
<ul>
37083694
<li>The value <a>SuperscriptShiftUpCramped</a> if the
3709-
<code>&lt;msup&gt;</code> element is
3710-
<a>cramped</a> or
3711-
the value <a>SuperscriptShiftUp</a> otherwise.</li>
3695+
element has a computed
3696+
<a>math-superscript-shift-style</a> property equal to
3697+
<code>inline</code>, or
3698+
<a>SuperscriptShiftUp</a> otherwise.</li>
37123699
<li>
37133700
<a>SuperscriptBottomMin</a> + the <a>ink line-descent</a> of the
37143701
superscript's <a>margin box</a></li>
@@ -4648,20 +4635,42 @@ <h5>Base with prescripts and postscripts</h5>
46484635
</section>
46494636
</section>
46504637
<section>
4651-
<h4>Displaystyle and scriptlevel in scripts</h4>
4638+
<h4 id="displaystyle-and-scriptlevel-in-scripts">Displaystyle, scriptlevel and math-superscript-shift-style in scripts</h4>
46524639
<p>
4653-
For all MathML elements used for scripts and limits schemata,
4654-
the rule of thumb is to set
4655-
<a><code>displaystyle</code></a> to <code>false</code>
4656-
and to increment <a><code>scriptlevel</code></a> in all child
4640+
For all <a>scripted elements</a>, the rule of thumb is to set
4641+
<a><code>displaystyle</code></a> to <code>false</code> and
4642+
to increment <a><code>scriptlevel</code></a> in all child
46574643
elements but the first one.
4658-
However, when an overscript (respectively underscript)
4659-
has an <a href="#attribute-munderover-accent" class="internalDFN" data-link-type="dfn"><code>accent</code></a>
4660-
(respectively <a href="#attribute-munderover-accentunder" class="internalDFN" data-link-type="dfn"><code>accentunder</code></a>)
4644+
However, an <a><code>&lt;mover&gt;</code></a> (respectively
4645+
<a><code>&lt;munderover&gt;</code></a>)
4646+
element with an <a href="#attribute-munderover-accent" class="internalDFN" data-link-type="dfn"><code>accent</code></a>
46614647
attribute that is an
46624648
<a data-cite="INFRA#ascii-case-insensitive">ASCII case-insensitive</a>
4663-
match to <code>"true"</code> then
4664-
the <a><code>scriptlevel</code></a> is not incremented.
4649+
match to <code>"true"</code> does not increment scriptlevel within
4650+
its second child (respectively third child). Similarly,
4651+
<a><code>&lt;mover&gt;</code></a> and
4652+
<a><code>&lt;munderover&gt;</code></a> elements
4653+
with an <a href="#attribute-munderover-accent" class="internalDFN" data-link-type="dfn"><code>accentunder</code></a>
4654+
attribute that is an
4655+
<a data-cite="INFRA#ascii-case-insensitive">ASCII case-insensitive</a>
4656+
match to <code>"true"</code> do not increment scriptlevel within
4657+
their second child.
4658+
</p>
4659+
<p><code>&lt;mmultiscripts&gt;</code> sets
4660+
<a><code>math-superscript-shift-style</code></a> to
4661+
<code>inline</code> on its children at even position if they are
4662+
before an <a>&lt;mprescripts&gt;</a>, and on those at odd position
4663+
if they are after
4664+
an <a>&lt;mprescripts&gt;</a>. Other <a>scripted elements</a>
4665+
set <a><code>math-superscript-shift-style</code></a> to
4666+
<code>inline</code> on their second child.
4667+
An <a><code>&lt;mover&gt;</code></a> and
4668+
<a><code>&lt;munderover&gt;</code></a>
4669+
elements with an <a href="#attribute-munderover-accent" class="internalDFN" data-link-type="dfn"><code>accent</code></a>
4670+
attribute that is an
4671+
<a data-cite="INFRA#ascii-case-insensitive">ASCII case-insensitive</a>
4672+
match to <code>"true"</code> also sets <a><code>math-superscript-shift-style</code></a> to
4673+
<code>inline</code> within their first child.
46654674
</p>
46664675
<p>
46674676
The
@@ -4680,7 +4689,9 @@ <h4>Displaystyle and scriptlevel in scripts</h4>
46804689
this section are <a>in-flow</a> and the
46814690
<code>&lt;mprescript&gt;</code> is empty.
46824691
Hence the CSS rules essentially performs automatic <a><code>displaystyle</code></a> and
4683-
<a><code>scriptlevel</code></a> changes for the scripts.
4692+
<a><code>scriptlevel</code></a> changes for the scripts ; and
4693+
<a><code>math-superscript-shift-style</code></a> changes for
4694+
subscripts and sometimes the base.
46844695
</div>
46854696
</section>
46864697
</section>
@@ -5020,6 +5031,41 @@ <h3>The <code>math-style</code> property</h3>
50205031
layout should not take such constraints into consideration.
50215032
</p>
50225033
</section>
5034+
<section id="the-math-superscript-shift-style">
5035+
<h3>The <code>math-superscript-shift-style</code> property</h3>
5036+
<table>
5037+
<tbody>
5038+
<tr>
5039+
<th>Name:</th>
5040+
<td>
5041+
<dfn><code>math-superscript-shift-style</code></dfn>
5042+
</td>
5043+
</tr>
5044+
<tr><th>Value:</th><td><code>display | inline</code></td></tr>
5045+
<tr><th>Initial:</th><td><code>display</code></td></tr>
5046+
<tr><th>Applies to:</th><td>All elements</td></tr>
5047+
<tr><th>Inherited:</th><td>yes</td></tr>
5048+
<tr><th>Percentages:</th><td>n/a</td></tr>
5049+
<tr><th>Media:</th><td>visual</td></tr>
5050+
<tr><th>Computed value:</th><td>specified keyword</td></tr>
5051+
<tr><th>Canonical order:</th><td>n/a</td></tr>
5052+
<tr><th>Animation type:</th><td>not animatable</td></tr>
5053+
</tbody>
5054+
</table>
5055+
<p>
5056+
If the value of <code>math-superscript-shift-style</code> is <code>inline</code>, the math layout on descendants will use the
5057+
<a>superscriptShiftUpCramped</a> parameter to place superscript.
5058+
If the value of <code>math-superscript-shift-style</code> is <code>display</code>, the math
5059+
will use the <a>superscriptShiftUp</a> parameter instead.
5060+
</p>
5061+
<p>
5062+
This property is used for positioning superscript during the layout
5063+
of MathML <a>scripted elements</a>.
5064+
See § <a href="#subscripts-and-superscripts-msub-msup-msubsup"></a>
5065+
<a href="#prescripts-and-tensor-indices-mmultiscripts"></a> and
5066+
<a href="#underscripts-and-overscripts-munder-mover-munderover"></a>.
5067+
</p>
5068+
</section>
50235069
<section id="the-math-script-level-property">
50245070
<h3>The <code>math-script-level</code> property</h3>
50255071
<table>
@@ -5650,8 +5696,8 @@ <h2>User Agent Stylesheet</h2>
56505696
<span data-include-replace="true" data-include="user-agent-stylesheet/mtable.css"></span><span data-include-replace="true" data-include="user-agent-stylesheet/mtable-frame.css"></span><span data-include-replace="true" data-include="user-agent-stylesheet/mtr.css"></span><span data-include-replace="true" data-include="user-agent-stylesheet/mtd.css"></span>
56515697
/* Fractions */
56525698
<span data-include-replace="true" data-include="user-agent-stylesheet/mfrac.css"></span>
5653-
/* Other rules for scriptlevel and displaystyle */
5654-
</span><span data-include-replace="true" data-include="user-agent-stylesheet/mroot.css"></span><span data-include-replace="true" data-include="user-agent-stylesheet/scripts.css"></span>
5699+
/* Other rules for scriptlevel, displaystyle and math-superscript-shift-style */
5700+
</span><span data-include-replace="true" data-include="user-agent-stylesheet/radicals.css"></span><span data-include-replace="true" data-include="user-agent-stylesheet/scripts.css"></span>
56555701
</pre>
56565702
</section>
56575703
<section class="normative">

user-agent-stylesheet/math.css

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ math {
55
font-style: normal;
66
font-family: math;
77
math-style: inline;
8+
math-superscript-shift-style: display;
89
math-script-level: initial;
910
}
1011
math[display="block" i] {

user-agent-stylesheet/mfrac.css

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ mfrac > * {
66
math-script-level: auto;
77
math-style: inline;
88
}
9+
mfrac > :nth-child(2) {
10+
math-superscript-shift-style: inline;
11+
}

user-agent-stylesheet/mroot.css renamed to user-agent-stylesheet/radicals.css

+3
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ mroot > :not(:first-child) {
22
math-script-level: add(2);
33
math-style: inline;
44
}
5+
mroot, msqrt {
6+
math-superscript-shift-style: inline;
7+
}

user-agent-stylesheet/scripts.css

+15
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,18 @@ munderover[accentunder="true" i] > :nth-child(2),
1414
munderover[accent="true" i] > :nth-child(3) {
1515
math-script-level: inherit;
1616
}
17+
msub > :nth-child(2),
18+
msup > :nth-child(2),
19+
msubsup > :nth-child(2),
20+
munder > :nth-child(2),
21+
mover > :nth-child(2),
22+
munderover > :nth-child(2),
23+
mmultiscripts > :nth-child(even),
24+
mmultiscripts > mprescripts ~ *:nth-child(odd),
25+
mover[accent="true" i] > :first-child,
26+
munderover[accent="true" i] > :first-child {
27+
math-superscript-shift-style: inline;
28+
}
29+
mmultiscripts > mprescripts ~ *:nth-child(even) {
30+
math-superscript-shift-style: inherit;
31+
}

0 commit comments

Comments
 (0)