!! input: raw_matrix, matrix_name
!! output: html_matrix

!set m_leftbrace1=
!set raw_matrix=!trim $raw_matrix
!set matrix_eqn=!linecnt $raw_matrix
!set l=!line 1 of $raw_matrix
!set matrix_dim=!itemcnt $l

!set html_matrix=<table border=0 cellpadding=2>
!for i=1 to $matrix_eqn
 !set l=!line $i of $raw_matrix
 !set html_matrix=$html_matrix<tr>
 !if $i=1
  !if $matrix_name!=$empty
   !set html_matrix=$html_matrix<td rowspan=$matrix_eqn>$matrix_name&nbsp;=
  !endif
  !set html_matrix=$html_matrix<td rowspan=$matrix_eqn>$(m_leftpar$matrix_eqn)</td>
 !endif
 !for j=1 to $matrix_dim
  !set c=!item $j of $l
  !set html_matrix=$html_matrix<td align=center nowrap>$c
 !next j
 !if $i=1
  !set html_matrix=$html_matrix<td rowspan=$matrix_eqn>$(m_rightpar$matrix_eqn)</td>
 !endif
!next i
!set html_matrix=$html_matrix</table>

