In https://en.wikipedia.org/wiki/Wikipedia_talk:WikiProject_Mathematics#Bugs_and_Glitches there is a discussion on CSS issues with formatting <math display=block> elements. There is a local preference there to have these left-aligned with margin-left: 1.6em. This brings up a number of issues that might apply to CSS for all sites.
Ideally CSS should be configured so that there is no difference between the different rendering modes. I've created a test-case at https://en.wikipedia.org/wiki/User:Salix_alba/sandbox#Indentation_of_%3Cmath_display%3Dblock%3E_elements showing the different options.
- Font size of MathML formats. The SVG options uses a slightly bigger font size. This can be matched by adding stype rules for the MathML <math> tag with
math.mwe-math-element-block {
font-size: 118%;
}
math.mwe-math-element-inline {
font-size: 118%;
}- Spacing around blocks. The https://en.wikipedia.org/wiki/MediaWiki:Common.css has style rules
/* larger inline math */
span.mwe-math-mathml-inline {
font-size: 118%;
}
/* Make <math display="block"> be left aligned with one space indent for
* compatibility with style conventions
*/
.mwe-math-fallback-image-display,
.mwe-math-mathml-display {
margin-left: 1.6em !important;
margin-top: 0.6em;
margin-bottom: 0.6em;
}
.mwe-math-mathml-display math {
display: inline;
}The MathML mode produces a
<math xmlns="http://www.w3.org/1998/Math/MathML" class="mwe-math-element mwe-math-element-block mathjax_ignore" display="block" ...>
element, and the client-side SVG produces
<mjx-container class="MathJax" jax="SVG" overflow="overflow" display="true"><svg ...
These need corresponding CSS styles
mjx-container[display] {
text-align: left !important;
margin-left: 1.6em !important;
}
math.mwe-math-element-block {
display: flex;
justify-content: left;
margin-left: 1.6em;
margin-top: 0.6em;
margin-bottom: 0.6em;
}- It would be nice to have the same CSS options for the latex source mode. So if someone wanted to use the MathJax CDN via their common.js would have the same styles.
span.mwe-math-fallback-source-display {
margin-left: 1.6em;
margin-top: 0.6em;
margin-bottom: 0.6em;
}- At https://en.wikipedia.org/wiki/MediaWiki_talk:Common.css#Allignment_of_%3Cmath_display=block%3E @Izno has commented on the !important tags. Ideally we should be able to remove these. These seem to be needed as style sheet is included in the head of the page with
<style id="MJX-SVG-styles">
That overrides preferences from load.php and common.css.
- I've used display: flex; for the MathML <math> element, wondering if the rule
.mwe-math-mathml-display math {
display: inline;
}is needed or should be flex as well.










