<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml-stylesheet type="text/css" href="matrix_xml.css" alternate="no"?>
<?xml-stylesheet type="text/css" href="xml_to_xhtml.css" alternate="no"?>
<?xml-stylesheet type="text/css" href="../../styles/atouchofstyle.css" alternate="no"?>
<xml xml:lang="en">
<body>
<h1>Matrices with XML and CSS</h1>
<p>In a quest to display mathematics on the web, it was desirable to find a method to display matrices by means of X(HT)ML and CSS. Currently no real matrices can be created due to limitations in border styles, but a close attempt is possible. The approach outlined below allows ordening in columns (i.e. vectors) instead of rows such as tables, requires little markup and scales quite easily. It is however limited, because the border-colours have to be chosen with care.</p>
<p>This page is the XML example page and the elements for the matrices have been replaced by short and logical custom tags. So for instance a matrix is started with <code>&lt;m&gt;</code>, a vector with <code>&lt;v&gt;</code> and a cell with <code>&lt;c&gt;</code>.</p>
<h2>Examples</h2>
<p>The outer div with the borders is <code>display:inline-table</code> (to allow multiple matrices on one line), the vectors are <code>display:inline-table</code> (to allow multiple vectors in one matrix) and the cells are <code>display:block</code> (which will force the cells to show below each other). In this setup both the vectors and the cells are coloured. Individual styling is always possible of course.</p>
<div class="example">
<m><v><c>11</c><c>21</c><c>31</c></v><v><c>12</c><c>22</c><c>31</c></v></m>
<m><v><c>11</c><c>21</c></v><v><c>12</c><c>22</c></v></m>
=
<m><v><c>11</c><c>21</c><c>31</c></v><v><c>12</c><c>22</c><c>31</c></v></m>
</div>

<p>The next example uses transpose vectors to create rows. The rows are <code>display:table</code> and the cells are <code>display:table-cell</code>. It is to be solved for a vector.</p>
<div class="example">
<m><t><c>11</c><c>12</c><c>13</c></t><t><c>21</c><c>22</c><c>23</c></t></m><v><c>a</c><c>b</c></v>
</div>
<p>A difficulty here is the rows cannot easily be given a background-color, as possible with the vectors, because background-color won't apply to <code>table-row</code>.</p>

<small>&#169; 2003-2006, Mark Schenk.</small>
</body>
</xml>