Skip to content

Commit

Permalink
Shorten space widths to multiples of 0.35ex
Browse files Browse the repository at this point in the history
**Output changes**

- Spaces are significantly shorter. Specifically a multiple of 0.35ex
  instead of 1ex.

Resolves: #102
  • Loading branch information
runarberg committed Nov 28, 2023
1 parent 8af250a commit 6da81c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1416,8 +1416,10 @@ <h3>Spaces</h3>
<p>
MathML has an element called <code>&lt;mspace&gt;</code>. Two or
more spaces in a row will be translated into that element where it
makes sense. The width of the element will be
makes sense. The width of the space will be
<math>
<mn>0.35</mn>
<mo>&#x2062;</mo>
<mrow>
<mo fence="true">(</mo>
<mrow>
Expand All @@ -1427,10 +1429,9 @@ <h3>Spaces</h3>
</mrow>
<mo fence="true">)</mo>
</mrow>
<mi>ex</mi>
</math>
</math> <span class="unit">ex</span>
where <math><mi>n</mi></math> is the number of subsequent spaces and
<math><mi>ex</mi></math> is the height of the <i>‘x’</i>
<span class="unit">ex</span> is the height of the <i>‘x’</i>
character in your font.
</p>

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/parser/handlers/space.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function space({ start, tokens }) {
const { length } = token.value;
const attrs = blockSpace
? { depth: `${length}em` }
: { width: `${length - 1}ex` };
: { width: `${0.35 * (length - 1)}ex` };

return {
node: {
Expand Down

0 comments on commit 6da81c4

Please sign in to comment.