1
0

mathml.css 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. /* See https://github.com/fred-wang/mathml.css */
  5. @namespace "http://www.w3.org/1998/Math/MathML";
  6. /* math */
  7. math {
  8. display: inline;
  9. text-indent: 0;
  10. }
  11. math[display="block"] {
  12. display: block;
  13. text-align: center;
  14. }
  15. /* fraction */
  16. mfrac {
  17. display: inline-block !important;
  18. vertical-align: -50%;
  19. border-collapse: collapse;
  20. text-align: center;
  21. }
  22. mfrac > * {
  23. display: block !important;
  24. }
  25. mfrac > * + * {
  26. display: inline-block !important;
  27. vertical-align: top;
  28. }
  29. mfrac:not([linethickness="0"]) > *:first-child {
  30. border-bottom: solid thin;
  31. }
  32. /* sub/sup scripts */
  33. msub > *:nth-child(2), msubsup > *:nth-child(2),
  34. mmultiscripts > *:nth-child(2n+2),
  35. mmultiscripts > mprescripts ~ *:nth-child(2n+3) {
  36. font-size: 0.8em;
  37. vertical-align: sub;
  38. }
  39. msup > *:nth-child(2), msubsup > *:nth-child(3),
  40. mmultiscripts > *:nth-child(2n+3),
  41. mmultiscripts > mprescripts ~ *:nth-child(2n+2) {
  42. font-size: 0.8em;
  43. vertical-align: super;
  44. }
  45. mprescripts:after {
  46. content: ";";
  47. }
  48. /* under/over scripts */
  49. munder, mover, munderover {
  50. display: inline-flex !important;
  51. flex-direction: column;
  52. }
  53. munder > *:nth-child(2), munderover > *:nth-child(2) {
  54. font-size: 0.8em;
  55. order: +1;
  56. }
  57. mover > *:nth-child(2), munderover > *:nth-child(3) {
  58. font-size: 0.8em;
  59. order: -1;
  60. }
  61. munder {
  62. vertical-align: text-top;
  63. }
  64. mover {
  65. vertical-align: text-bottom;
  66. }
  67. munderover {
  68. vertical-align: middle;
  69. }
  70. /* roots */
  71. msqrt, mroot {
  72. display: inline-flex !important;
  73. margin-left: .5em;
  74. vertical-align: middle;
  75. border-top: solid thin;
  76. }
  77. msqrt:before, mroot:before {
  78. margin-left: -.5em;
  79. content: "\221A";
  80. }
  81. mroot > *:nth-child(2) {
  82. margin-right: .25em;
  83. margin-left: -.75em;
  84. font-size: 0.8em;
  85. order: -1;
  86. }
  87. /* menclose */
  88. menclose {
  89. display: inline-table !important;
  90. border-collapse: separate;
  91. border-spacing: 0.4ex 0;
  92. }
  93. menclose[notation*="top"], menclose[notation*="actuarial"] {
  94. border-top: solid thin;
  95. }
  96. menclose[notation*="bottom"], menclose[notation*="madruwb"] {
  97. border-bottom: solid thin;
  98. }
  99. menclose[notation*="right"], menclose[notation*="actuarial"],
  100. menclose[notation*="madruwb"] {
  101. border-right: solid thin;
  102. }
  103. menclose[notation*="left"] {
  104. border-left: solid thin;
  105. }
  106. menclose[notation*="box"], menclose[notation*="roundedbox"],
  107. menclose[notation*="circle"] {
  108. border: solid thin;
  109. }
  110. menclose[notation*="roundedbox"] {
  111. border-radius: 15%;
  112. }
  113. menclose[notation*="circle"] {
  114. border-radius: 50%;
  115. }
  116. menclose[notation*="horizontalstrike"] {
  117. text-decoration: line-through;
  118. }
  119. /* table */
  120. mtable {
  121. display: inline-table !important;
  122. vertical-align: middle;
  123. text-align: center;
  124. }
  125. mtr {
  126. display: table-row !important;
  127. }
  128. mtd {
  129. display: table-cell !important;
  130. padding: 0 0.5ex;
  131. }
  132. /* token elements */
  133. mspace {
  134. margin: .2em;
  135. }
  136. mi {
  137. font-style: italic;
  138. }
  139. mo {
  140. margin-right: .2em;
  141. margin-left: .2em;
  142. }
  143. ms:before, ms:after {
  144. content:"\0022";
  145. }
  146. ms[lquote]:before {
  147. content: attr(lquote);
  148. }
  149. ms[rquote]:after {
  150. content: attr(rquote);
  151. }
  152. /* mathvariants */
  153. [mathvariant="bold"], [mathvariant="bold-italic"],
  154. [mathvariant="bold-sans-serif"], [mathvariant="sans-serif-bold-italic"] {
  155. font-weight: bold;
  156. font-style: normal;
  157. }
  158. [mathvariant="monospace"] {
  159. font-family: monospace;
  160. font-style: normal;
  161. }
  162. [mathvariant="sans-serif"],
  163. [mathvariant="bold-sans-serif"], [mathvariant="sans-serif-italic"],
  164. [mathvariant="sans-serif-bold-italic"] {
  165. font-family: sans-serif;
  166. font-style: normal;
  167. }
  168. [mathvariant="italic"], [mathvariant="bold-italic"],
  169. [mathvariant="sans-serif-italic"], [mathvariant="sans-serif-bold-italic"] {
  170. font-style: italic;
  171. }
  172. [mathvariant="normal"] {
  173. font-style: normal;
  174. }
  175. /* mphantom */
  176. mphantom {
  177. visibility: hidden;
  178. }
  179. /* merror */
  180. merror {
  181. outline: solid thin red;
  182. }
  183. merror:before {
  184. content: "Error: ";
  185. }
  186. /* annotations */
  187. semantics > *:first-child {
  188. display: inline;
  189. }
  190. annotation, annotation-xml {
  191. font-family: monospace;
  192. display: none !important;
  193. }
  194. math:active > semantics > *:first-child,
  195. math:active > semantics > *:first-child {
  196. display: none !important;
  197. }
  198. math:active annotation:first-of-type {
  199. display: inline !important;
  200. }