Math
Math
Style Sheets
George Chavchanidze
Department of Theoretical Physics, A. Razmadze Institute of Mathematics, 1
Aleksidze Street, Tbilisi 0193, Georgia
Abstract. This page shows how to format mathematical articles with
Cascading Style Sheets (CSS). Simple XML 1.0 markup is used to capture
basic structure of math expressions while rendering is specified via CSS
2.0/2.1. Abilities and limitations of present approach are discussed.
Keywords: eXtensible Markup Language, Cascading Style Sheets,
Mathematics in XML
Date: Sun, 10 Oct 2004 (revised version)
1. Introduction
CSS is the simplest way to control formatting of XML and SGML
documents. Today it is mainly used in web design to render and style
(X)HTML documents, but its applications spread far beyond ordinary web
design and one can use XML and CSS to embed mathematical expressions
in web pages. Generally speaking it is easy to control general layout and
style of scientific documents with CSS, the only problem is rendering of
complex mathematical formulæ. So in this article we will mainly focus on
this problem and suggest relatively simple approach for rendering of
mathematical expressions that may appear in scientific papers. We use
simple XML 1.0 markup to capture basic structure of math expressions and
CSS 2.0/2.1 to specify their rendering (see [2]-[4] for specs).
z = 1/c (1)
Na − e− = Na+ (5)
27
+ 2He4 = 15P30 + 0n1 (10)
13Al
Tk k = − T k k (14)
1 2 2 1
Xh(F) = LX F (17)
h
5 5 5
∇k1Rkk2k3k4 + ∇k4Rkk2k1k3 + ∇k3Rkk2k4k1 = 0 (18)
So rendering indices with CSS2 is not a big problem. Their rendering can be
controlled in details by both author and user through adjusting relative
positioning offsets, font-size and style in author and user style sheets.
(36)
G= ∑ ApBs
p, s ∈ Z
Product
(37)
Ω= ∏ Ω(m)
m∈N
Unification operator
∞
(38)
A= ∪A (m)
m=1
and intersection
2n
(39)
B(s) = ∩B (m)
m=1
Direct sum and tensor products are rendered in the same manner
n n
(40)
Q ⊕x k = ⊕x Q[k]
k=1 k=1
n m
(41)
Â= ⊗ ⊗N ksMs
k=1 s=1
(43)
F= ∑ pm pm
1 2
m1 ≠ m 2
Residue
Under script with brace (rendering of such a simple square under/over braces
is not a problem but making them round, or curly or allowing overlaps is
much more difficult to achieve, so currently it is better to stick to simplest
case).
V(n) = W ∧ W ∧ ⋯ ∧ W (58)
n times
Below you see some samples from chemistry
+IV 0 +VI −I
Na2SO3 + J2 + H2O = Na2SO4 + 2HJ (59)
+IV −I +II 0
MnO2 + 4HCl = MnCl2 + Cl2 + 2H2O (60)
+2e−
(61)
Zn + H2 SO4 = ZnSO4 + H2
Ra → Rn + He (62)
226 222 4
Under over scripts are really rarely used. Below is rather artificial example
from chemistry.
27 4 30 1
Al + He = P + n (63)
13 2 15 0
m2 k5 3k (69)
Fs(x) + 12 Gs(x)
∏ ∏
3
(m) k
Ĉ = kF (x) +
k=m s = c4 Fs(x) − 12 Gs(x)
4b2
4θ2 (70)
∫ ∑
2 2
Ŝ± = e± 3uc ŵ + e±m1m2ŵ dŵ
z2
6z3 + 3u 2c
2
m1 ≠ m 2
q? + q?2 + q4 = c̃ (71)
but at the moment browsers does not support combining diacritical marks
properly and it is better to use precomposed characters
[Â , Ĥ] = 0 (72)
12. Radicals
The most reliable way to settle issue with radicals is to use more simple
power notations
− b ± (b² − 4ac)½ (73)
x=
2a
3/2 (74)
± 2 12c5
R = m ±
29w7
In this way one avoids dependence on font metrics.
14. Conclusions
CSS2 is basically simple style language, but in spite of its simplicity it is
powerful enough to afford rendering of most of mathematical expressions.
So one can start using CSS for formatting of scientific and technical XML
documents already today. Rendering of some things like for instance
radicals, and deeply nested expressions are not fully addressed in the present
article. However it happened just because current CSS2 based solutions for
rendering of radicals are slightly artificial, while support for deep nesting
requires slightly more detailed markup then we currently use, so taking into
account that this issues are not urgent we think it is better to address them
later when we will have more natural solutions (like CSS3 math module).
References
1. B. Beeton et al.,Unicode Support for Mathematics, 2003
2. B. Bos et al., Cascading Style Sheets, level 2 revision 1, 2004
3. T. Bray et al., Extensible Markup Language (XML) 1.0, 2004
4. J. Clark, Associating Style Sheets with XML documents, 1999