There seems to be no good direct way to write in TeX and create a png or svg file. The method with the least impedimenta may be dislin example 14 by burkardt.

example  
TOOLS
TeX  ; ghostscript  ; skconvert  ; eps2eps ps2epsi tools  ; dvips
 ; Inkscape de LaTeX UNIX only; uses six other tools with Windows and five other tools
  source in eukleides  ; source in PS-tricks  ;
 ; wikipedia Ghostscript  ; wikipedia Pstoedit  ;  ; svg support  ; pstoedit download  ; long list
 ;inkscape  ; inkscape.org  ; Pango Library  ; pango.org
 ; png via GIMP  ; GIMP  ; svgkit  ; gurari at OSU  ; dvipng  ; dvi, Wikipedia uses a png driver  ; SGML  ; SGML  ; W3