!! input: raw_sys
!! output: html_sys

!set m_leftbrace1=
!set raw_sys=!trim $raw_sys
!set sys_eqn=!linecnt $raw_sys
!set l=!line 1 of $raw_sys
!set sys_dim=!itemcnt $l

!if $sys_dim<=3
 !for i=1 to $sys_dim
  !set var$i=!item $i of x,y,z
 !next i
!else
 !for i=1 to $sys_dim
  !set var$i=x<sub>$i</sub>
 !next i
!endif

!set html_sys=<table border=0 cellpadding=2>
!for i=1 to $sys_eqn
 !set l=!line $i of $raw_sys
 !set start=0
 !set html_sys=$html_sys<tr>
 !if $i=1
  !set html_sys=$html_sys<td rowspan=$sys_eqn>$(m_leftbrace$sys_eqn)</td>
 !endif
 !for j=1 to $sys_dim
  !set c=!item $j of $l
  !set c=$[$c]
  !set abs=$[abs($c)]
  !if $abs=1
   !set abs=
  !endif
  !ifval $c!=0
   !set html_sys=$html_sys<td align=right nowrap>
   !if $c>0 and $start>0
    !set html_sys=$html_sys+
   !endif
   !ifval abs($c)=1
    !set c=!char 1 to -2 of $c
   !endif
   !set html_sys=$html_sys$c$(var$j)
   !set start=1
  !else
   !set html_sys=$html_sys<td>
  !endif
 !next j
 !set html_sys=$html_sys<td>=&nbsp;0
!next i
!set html_sys=$html_sys</table>

