Dr. Mark Humphrys School of Computing. Dublin City University. Online coding site: Ancient Brain Free course: Online AI programming exercises Search:

# Math in HTML

How to put math into HTML pages.




# Write in Latex

• Write math in latex
• Run latex2html to convert it to HTML.
• latex2html renders mathematics as inline images
• We have 3 colors to think of: the mathematics, its background within the image, and the background of the window. We want black-on-X-on-X.
• One way of achieving this is black-on-(transparent)-on-X. This is what latex2html does by default.
• My pages use black-on-white-on-white. Normal, solid, non-transparent, white gifs, and a white background.





### How to make non-transparent gifs (latex2html switch)

TRANSPARENT_IMAGES 0;




### How to make non-transparent gifs (comment latex2html code)

Other way: latex2html generates normal gifs first and only then runs a routine to make them transparent. So I copied the latex2html file itself, edited the make_transparent routine, and commented out the relevant lines.



### How to convert to other color (netpbm)

You can then convert these images to a color (non-transparent) other than white, and then give the pages that color background.

To use netpbm / pbmplus to convert the images:

for i in *.gif
do
giftopnm $i | pnmdepth 255 | pgmtoppm "#ffffcc" | ppmtogif > tmp.gif mv tmp.gif$i
done




### How to convert to other color (giftrans)

You can do the same conversion using giftrans:
 giftrans -g white="#ffffcc" \$i > tmp.gif





# Write in HTML / JS




ancientbrain.com      w2mind.org      humphrysfamilytree.com

On the Internet since 1987.

Wikipedia: Sometimes I link to Wikipedia. I have written something In defence of Wikipedia. It is often a useful starting point but you cannot trust it. Linking to it is like linking to a Google search. A starting point, not a destination. I automatically highlight in red all links to Wikipedia and Google search and other possibly-unreliable user-generated content.