mathml.css 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. @namespace "http://www.w3.org/1998/Math/MathML";
  2. math {
  3. -webkit-line-box-contain: glyphs replaced;
  4. text-indent: 0;
  5. }
  6. mtext {
  7. line-height: 1.0;
  8. }
  9. /* Keep font-family and other defaults here consistent with http://mxr.mozilla.org/mozilla-central/source/layout/mathml/mathml.css and feedback from www-math. */
  10. math, mfenced > * {
  11. font-family: MathJax_Main, STIXGeneral, "DejaVu Serif", Cambria, "Cambria Math", Times, serif;
  12. }
  13. mo, mfenced {
  14. font-family: MathJax_Main, STIXGeneral, STIXSizeOneSym, "DejaVu Sans", "DejaVu Serif", Cambria, "Cambria Math",
  15. "Lucida Sans Unicode", "Arial Unicode MS", "Lucida Grande", OpenSymbol, "Standard Symbols L", sans-serif;
  16. }
  17. math {
  18. display: -webkit-inline-flex !important;
  19. padding-left: 1px;
  20. padding-right: 1px;
  21. }
  22. math[display="block"] {
  23. display: -webkit-flex !important;
  24. -webkit-justify-content: center;
  25. page-break-inside: avoid;
  26. /* -webkit-margin-before: 1em; -- FIXME: Ask www-math for a default MathML stylesheet, including this (or margin-top). */
  27. -webkit-margin-after: 1em;
  28. }
  29. mo, mrow, mfenced, mfrac, msub, msup, msubsup, munder, mover, munderover, msqrt, mroot {
  30. display: -webkit-inline-flex !important;
  31. }
  32. msup {
  33. -webkit-align-items: flex-start;
  34. }
  35. msub {
  36. -webkit-align-items: flex-end;
  37. }
  38. math, mrow, mfenced, msqrt, mroot {
  39. -webkit-align-items: baseline;
  40. }
  41. msqrt > * { /* This rule is needed because of <msqrt>'s anonymous <mrow>. */
  42. -webkit-align-self: baseline;
  43. }
  44. mo, mfrac, munder, mover, munderover {
  45. -webkit-flex-direction: column;
  46. }
  47. munder, mover, munderover {
  48. -webkit-align-items: center;
  49. }
  50. mfrac > * {
  51. -webkit-align-self: center;
  52. }
  53. mfrac[numalign="left"] > :first-child {
  54. -webkit-align-self: flex-start;
  55. }
  56. mfrac[numalign="right"] > :first-child {
  57. -webkit-align-self: flex-end;
  58. }
  59. mfrac[denomalign="left"] > :last-child {
  60. -webkit-align-self: flex-start;
  61. }
  62. mfrac[denomalign="right"] > :last-child {
  63. -webkit-align-self: flex-end;
  64. }
  65. mfrac > :first-child {
  66. -webkit-margin-after: 0.2em;
  67. }
  68. mfrac > :last-child {
  69. -webkit-margin-before: 0.2em;
  70. }
  71. mfrac {
  72. -webkit-margin-start: 1px;
  73. -webkit-margin-end: 1px;
  74. }
  75. msubsup > :last-child, mover > :last-child, munderover > :last-child {
  76. -webkit-order: -1;
  77. }
  78. msub > * + *, msup > * + *, msubsup > * + *, munder > * + *, mover > * + *, munderover > * + * {
  79. font-size: 0.75em; /* FIXME: MathML standard is 0.71em */
  80. }
  81. mi {
  82. font-style: italic;
  83. -webkit-padding-end: 0.1em;
  84. }
  85. msub > mi:first-child, msubsup > mi:first-child {
  86. -webkit-padding-end: 0;
  87. }
  88. msubsup > mi:first-child + * + * {
  89. -webkit-margin-start: 0.14em; /* This is larger than 0.1em because the child's font-size is smaller than the <msubsup>'s. */
  90. }
  91. /* FIXME: For a RenderMathMLOperator's margin-start and margin-end, or for a MathML "embellished operator", check the operator's lspace and rspace attributes,
  92. and the MathML operator dictionary. */
  93. math > mo, mrow > mo, msqrt > mo, mtd > mo {
  94. -webkit-margin-start: 0.2em;
  95. -webkit-margin-end: 0.2em;
  96. }
  97. math > mo:first-child, mrow > mo:first-child, msqrt > mo:first-child, mtd > mo:first-child,
  98. math > mo:last-child, mrow > mo:last-child, msqrt > mo:last-child, mtd > mo:last-child {
  99. -webkit-margin-start: 0.1em;
  100. -webkit-margin-end: 0.1em;
  101. }
  102. mroot {
  103. position: relative;
  104. }
  105. mroot > * + * {
  106. font-size: 0.75em;
  107. position: absolute;
  108. left: 0;
  109. top: 0;
  110. padding-right: 0.4em;
  111. padding-left: 0.2em;
  112. padding-bottom: 0.35em;
  113. }
  114. math[mathvariant="normal"], mstyle[mathvariant="normal"], mo[mathvariant="normal"], mn[mathvariant="normal"], mi[mathvariant="normal"], mtext[mathvariant="normal"], mspace[mathvariant="normal"], ms[mathvariant="normal"] {
  115. font-style: normal;
  116. font-weight: normal;
  117. }
  118. math[mathvariant="bold"], mstyle[mathvariant="bold"], mo[mathvariant="bold"], mn[mathvariant="bold"], mi[mathvariant="bold"], mtext[mathvariant="bold"], mspace[mathvariant="bold"], ms[mathvariant="bold"] {
  119. font-style: normal;
  120. font-weight: bold;
  121. }
  122. math[mathvariant="italic"], mstyle[mathvariant="italic"], mo[mathvariant="italic"], mn[mathvariant="italic"], mi[mathvariant="italic"], mtext[mathvariant="italic"], mspace[mathvariant="italic"], ms[mathvariant="italic"] {
  123. font-style: italic;
  124. font-weight: normal;
  125. }
  126. math[mathvariant="bold-italic"], mstyle[mathvariant="bold-italic"], mo[mathvariant="bold-italic"], mn[mathvariant="bold-italic"], mi[mathvariant="bold-italic"], mtext[mathvariant="bold-italic"], mspace[mathvariant="bold-italic"], ms[mathvariant="bold-italic"] {
  127. font-weight: bold;
  128. font-style: italic;
  129. }
  130. math[mathsize="small"], mstyle[mathsize="small"], mo[mathsize="small"], mn[mathsize="small"], mi[mathsize="small"], mtext[mathsize="small"], mspace[mathsize="small"], ms[mathsize="small"] {
  131. font-size: 0.75em;
  132. }
  133. math[mathsize="normal"], mstyle[mathsize="normal"], mo[mathsize="normal"], mn[mathsize="normal"], mi[mathsize="normal"], mtext[mathsize="normal"], mspace[mathsize="normal"], ms[mathsize="normal"] {
  134. font-size: 1em;
  135. }
  136. math[mathsize="big"], mstyle[mathsize="big"], mo[mathsize="big"], mn[mathsize="big"], mi[mathsize="big"], mtext[mathsize="big"], mspace[mathsize="big"], ms[mathsize="big"] {
  137. font-size: 1.5em;
  138. }
  139. annotation, annotation-xml {
  140. display: none;
  141. }
  142. mphantom {
  143. visibility: hidden;
  144. }
  145. merror {
  146. outline: solid thin red;
  147. font-weight: bold;
  148. font-family: sans-serif;
  149. background-color: lightYellow;
  150. }
  151. mtable {
  152. display: inline-table;
  153. text-align: center;
  154. }
  155. mtr {
  156. display: table-row;
  157. }
  158. mtd {
  159. display: table-cell;
  160. padding: 0.5ex;
  161. }
  162. mtable[columnalign="left"], mtr[columnalign="left"], mtd[columnalign="left"] {
  163. text-align: left;
  164. }
  165. mtable[columnalign="right"], mtr[columnalign="right"], mtd[columnalign="right"] {
  166. text-align: right;
  167. }
  168. mtable[rowalign="top"] mtd, mtable mtr[rowalign="top"] mtd, mtable mtr mtd[rowalign="top"] {
  169. vertical-align: top;
  170. }
  171. mtable[rowalign="bottom"] mtd, mtable mtr[rowalign="bottom"] mtd, mtable mtr mtd[rowalign="bottom"] {
  172. vertical-align: bottom;
  173. }
  174. mtable[rowalign="center"] mtd, mtable mtr[rowalign="center"] mtd, mtable mtr mtd[rowalign="center"] {
  175. vertical-align: middle;
  176. }
  177. mtable[frame="solid"] {
  178. border: solid thin;
  179. }
  180. mtable[frame="dashed"] {
  181. border: dashed thin;
  182. }
  183. mtable[rowlines="solid"], mtable[rowlines="dashed"], mtable[columnlines="solid"], mtable[columnlines="dashed"] {
  184. border-collapse: collapse;
  185. }
  186. mtable[rowlines="solid"] > mtr + mtr {
  187. border-top: solid thin;
  188. }
  189. mtable[rowlines="dashed"] > mtr + mtr {
  190. border-top: dashed thin;
  191. }
  192. mtable[columnlines="solid"] > mtr > mtd + mtd {
  193. border-left: solid thin;
  194. }
  195. mtable[columnlines="dashed"] > mtr > mtd + mtd {
  196. border-left: dashed thin;
  197. }
  198. mspace[linebreak="newline"] {
  199. display: block;
  200. }