#### Do you have a question? Post it now! No Registration Necessary. Now with pictures!

**posted on**

September 28, 2006, 10:26 pm

I often use formula's on my website. Therefore I often have to make

images of the formula. At wikipedia it is possible to insert formulas

(which are then automatically converted to image) in the latex style.

Does anyone know if there is some script (maybe php/GD, or whatever)

that makes it possible to insert the formulas on my pages, without

making images by hand for each formula?

Suggestions are welcome.

## Re: wikipedia latex formulas solution

Scripsit Toby Inkster:

Actually, it's fairly simple and natural, if you accept a presentation where

you use, say, sqrt(foo) to denote the square root of foo, instead of

requiring a square root symbol with a vinculum that extends over the

radicand. Even the latter can be handled relatively easily, as the demo page

http://www.cs.tut.fi/~jkorpela/test/dist.html

If you try it using varying font sizes, you will see some of the benefits of

text and HTML over images.

For general and miscellaneous notes on presenting math expressions in HTML

(and CSS), see

http://www.cs.tut.fi/~jkorpela/math /

(I just updated it a bit when I realized that the vinculum is better

constructed using a top border rather than an overline.)

--

Jukka K. Korpela ("Yucca")

http://www.cs.tut.fi/~jkorpela/

Actually, it's fairly simple and natural, if you accept a presentation where

you use, say, sqrt(foo) to denote the square root of foo, instead of

requiring a square root symbol with a vinculum that extends over the

radicand. Even the latter can be handled relatively easily, as the demo page

http://www.cs.tut.fi/~jkorpela/test/dist.html

If you try it using varying font sizes, you will see some of the benefits of

text and HTML over images.

For general and miscellaneous notes on presenting math expressions in HTML

(and CSS), see

http://www.cs.tut.fi/~jkorpela/math /

(I just updated it a bit when I realized that the vinculum is better

constructed using a top border rather than an overline.)

--

Jukka K. Korpela ("Yucca")

http://www.cs.tut.fi/~jkorpela/

## Re: wikipedia latex formulas solution

True. There are ways to overcome this as AF pointed out in a

recent thread on em based pic dims. It is a drag to do (important

to make the pic reasonably big and let the browser downsize it

rather than up it). Here is something quickly made.

http://tinyurl.com/rzhqn

This last is an interesting article. Thank you for posting the

url.

--

dorayme

## Re: wikipedia latex formulas solution

Jukka K. Korpela wrote:

This would certainly not be the usual way a mathematician would represent

a square root; and while it may work for one or two isolated formulae,

I can't imagine it being a good solution for a page with a lot of

equations.

It may be a good solution for image alt text though.

It's not bad, and the way you've done it does degrade quite nicely without

stylesheets, but I maintain that for complex formulae, HTML doesn't cut

it. The non-presentational parts of MathML are good, but lack decent

browser support at the moment, so for now, images are the most sensible

option.

--

Toby A Inkster BSc (Hons) ARCS

Contact Me ~ http://tobyinkster.co.uk/contact

This would certainly not be the usual way a mathematician would represent

a square root; and while it may work for one or two isolated formulae,

I can't imagine it being a good solution for a page with a lot of

equations.

It may be a good solution for image alt text though.

It's not bad, and the way you've done it does degrade quite nicely without

stylesheets, but I maintain that for complex formulae, HTML doesn't cut

it. The non-presentational parts of MathML are good, but lack decent

browser support at the moment, so for now, images are the most sensible

option.

--

Toby A Inkster BSc (Hons) ARCS

Contact Me ~ http://tobyinkster.co.uk/contact

## Re: wikipedia latex formulas solution

Scripsit Toby Inkster:

Mathematicians, like everyone else, need to adapt their notations to various

possibilities and limitations. They may even need to use plain ASCII text

and to find various special and even ad hoc notations. (I'll skip the issue

that real mathematicians seldom use square roots. Real mathematicians live

in abstract spaces and seldom use numbers or specific algebraic functions.

;-) )

Compared with all the compromises and modifications that are so often

needed, using sqrt(...) is hardly a big deal. You might alternatively

represent the square root as a power, (...)<sup>½</sup>, which is actually

preferred to the radix expression by many.

That was never under dispute. But most of the formulas that people use are

not complex formulas (in either meaning of the word). The original poster of

this thread was asked to clarify what he meant, but unless I have missed

something, we still have no idea of that.

and as useless as MathML as a whole. MathML is broken by design, since it

hopelessly mixes structure and presentation in an unprecedented manner. Give

us the math part of the HTML 3 draft, a little polished, and make browsers

implement it - a reasonable request -, and people will use it.

For formulas that cannot easily be expressed in HTML and CSS, yes. This

typically means material that we are used to seeing in some types of

mathematical textbooks and research, and occasionally in physics.

Many web pages use images excessively for mathematical expressions, even

e.g. for simple variables with subscripts in running text. Try to change the

text size and see what happens. (OK, you

font size via image sizing in CSS, but it would mean quite some extra work

and care, and authors just don't do that. Besides, image sizing by browsers

doesn't always produce pretty results.)

--

Jukka K. Korpela ("Yucca")

http://www.cs.tut.fi/~jkorpela/

Mathematicians, like everyone else, need to adapt their notations to various

possibilities and limitations. They may even need to use plain ASCII text

and to find various special and even ad hoc notations. (I'll skip the issue

that real mathematicians seldom use square roots. Real mathematicians live

in abstract spaces and seldom use numbers or specific algebraic functions.

;-) )

Compared with all the compromises and modifications that are so often

needed, using sqrt(...) is hardly a big deal. You might alternatively

represent the square root as a power, (...)<sup>½</sup>, which is actually

preferred to the radix expression by many.

That was never under dispute. But most of the formulas that people use are

not complex formulas (in either meaning of the word). The original poster of

this thread was asked to clarify what he meant, but unless I have missed

something, we still have no idea of that.

and as useless as MathML as a whole. MathML is broken by design, since it

hopelessly mixes structure and presentation in an unprecedented manner. Give

us the math part of the HTML 3 draft, a little polished, and make browsers

implement it - a reasonable request -, and people will use it.

For formulas that cannot easily be expressed in HTML and CSS, yes. This

typically means material that we are used to seeing in some types of

mathematical textbooks and research, and occasionally in physics.

Many web pages use images excessively for mathematical expressions, even

e.g. for simple variables with subscripts in running text. Try to change the

text size and see what happens. (OK, you

___could___make the images adapt tofont size via image sizing in CSS, but it would mean quite some extra work

and care, and authors just don't do that. Besides, image sizing by browsers

doesn't always produce pretty results.)

--

Jukka K. Korpela ("Yucca")

http://www.cs.tut.fi/~jkorpela/

## Re: wikipedia latex formulas solution

[...]

Our theorists also need to discuss such things in email, and they've

become accustomed to writing (and reading) mathematical notation in

the form of latex source. Consequently they're inclined to do the

same thing in HTML. However, this is only good for a specialist

audience who is familiar with the notation.

That was my impression too.

We had it with UdiWWW, around 10 years back. Some things don't get

better with time :-{

You still have the fun of devising an alt text. And alt text (like

attributes in general) can't use markup. (OBJECT is much better in

this regard, provided that you make some alternative provision for

obsolete browsers, particularly MSIE).

This is basically what latex2html used to do. I have to admit I've

lost contact with its recent developments, but more complex

expressions will surely still be turned into images. For an

alternative view, one could look at TtH (tex-to-html converter). (But

don't get me started on the way the author uses font face=Symbol)

As I say, I don't know what latex2html is doing currently, but I

reckon it would be simple enough to configure it to size its images in

em units. I tried that by hand a few years back, making the natural

image size somewhat larger than I expected the final result to be

(we've discussed this topic recently on this group in a different

context), and the results were at least acceptable.

The results may not be ideal, but neither is it ideal to have images

in the running text whose size is too different from the size of the

text. So - once the decision has been made to use images - it's a

compromise, and each one is welcome to make their own choice of

compromise.

regards

## Re: wikipedia latex formulas solution

Jukka K. Korpela wrote:

Depends on the field they work in. People dealing with sets,

rings and fields are very unlikely to come across a square root

in their day to day work. People who work in cryptography

though are more likely to deal with more concrete functions,

including square roots.

n-th roots (which would need to be represented similarly in a

typographical sense) pop up all over the place when dealing with

n-dimentional spaces, including the 4-dimentional space-time of

which Einstein was rather fond, and the cutting-edge string

theories currently proposed in the world of physics, which

operate on a universe with up to 11 dimensions.

I think ultimately the best solution, if at all possible, is

to store the equation in some machine-intelligible format on

the server and serve it up as an image, as MathML, as HTML or

as something else depending on client capabilities and

preferences.

--

Toby A Inkster BSc (Hons) ARCS

Contact Me ~ http://tobyinkster.co.uk/contact

Depends on the field they work in. People dealing with sets,

rings and fields are very unlikely to come across a square root

in their day to day work. People who work in cryptography

though are more likely to deal with more concrete functions,

including square roots.

n-th roots (which would need to be represented similarly in a

typographical sense) pop up all over the place when dealing with

n-dimentional spaces, including the 4-dimentional space-time of

which Einstein was rather fond, and the cutting-edge string

theories currently proposed in the world of physics, which

operate on a universe with up to 11 dimensions.

I think ultimately the best solution, if at all possible, is

to store the equation in some machine-intelligible format on

the server and serve it up as an image, as MathML, as HTML or

as something else depending on client capabilities and

preferences.

--

Toby A Inkster BSc (Hons) ARCS

Contact Me ~ http://tobyinkster.co.uk/contact

## Re: wikipedia latex formulas solution

Roderik wrote:

You could install MediaWiki <http://mediawiki.org/ , which is the same

software that Wikipedia uses. It can be set not to allow editing by the

general public, and you can change the theme to match your site.

There's probably a simpler solution that just handles the formulas, but

I don't know what it is.

You could install MediaWiki <http://mediawiki.org/ , which is the same

software that Wikipedia uses. It can be set not to allow editing by the

general public, and you can change the theme to match your site.

There's probably a simpler solution that just handles the formulas, but

I don't know what it is.

## Re: wikipedia latex formulas solution

Roderik wrote:

If you're able to install it on your server, this should do the job:

http://www.cse.ohio-state.edu/~gurari/TeX4ht /

It can convert LaTeX into various formats, including HTML+images,

HTML+MathML, OpenOffice.org and DocBook.

You probably need to know quite a bit about LaTeX to make it work though.

--

Toby A Inkster BSc (Hons) ARCS

Contact Me ~ http://tobyinkster.co.uk/contact

If you're able to install it on your server, this should do the job:

http://www.cse.ohio-state.edu/~gurari/TeX4ht /

It can convert LaTeX into various formats, including HTML+images,

HTML+MathML, OpenOffice.org and DocBook.

You probably need to know quite a bit about LaTeX to make it work though.

--

Toby A Inkster BSc (Hons) ARCS

Contact Me ~ http://tobyinkster.co.uk/contact

#### Site Timeline

- » Remove margins in HTML
- — Next thread in » HTML Markup Language

- » Re: ok
- — Previous thread in » HTML Markup Language

- » Big data Tutorials
- — Newest thread in » HTML Markup Language

- » archiving question
- — Last Updated thread in » HTML Markup Language

- » Dell Battery Slice LED codes
- — The site's Newest Thread. Posted in » Laptop Computers Forum