# Make http://www.mozilla.org/projects/mathml/demo/texvsmml.xhtml validate

RESOLVED FIXED

www.mozilla.org
General
RESOLVED FIXED
13 years ago
5 years ago

## Attachments

### (4 attachments, 1 obsolete attachment)

 7.46 KB, patch Details | Diff | Splinter Review 7.17 KB, image/png Details 7.23 KB, image/png Details 7.64 KB, image/png Details
(Reporter)

### Description

13 years ago
The page is still at its old URL at
http://www.mozilla.org/projects/mathml/demo/texvsmml.xhtml.

(But that page doesn't validate, is 'torture' also including invalid markup?)

### Comment 1

13 years ago
*** Bug 268750 has been marked as a duplicate of this bug. ***

### Comment 2

13 years ago
Since the link part has been fixed, I'm turning this into a "make valid" bug.

Someone with suggestions for the ALT text?
Assignee: mozilla.webmaster → bug
Blocks: 151557
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: [404] link to http://www.mozilla.org/projects/mathml/demo/texvsmml.xml → Make http://www.mozilla.org/projects/mathml/demo/texvsmml.xhtml validate
(Reporter)

### Comment 3

13 years ago
As far as validation is concerned, alt="" will do.

What about alt="Formula screenshot"?

Going for alt="(x+y**2)/k+1" etc., is probably too farfetched?

### Comment 4

13 years ago
Maybe an empty OBJECT element should be used instead? Or an OBJECT element with
as alternative content MathML or a description of the formula (so not 'F = m * a').

Jacques Distler, do you have any suggestions?

### Comment 5

13 years ago
Good Alt text?

For those of us who use mathematics on the web, the best Alt text would be a
(La)TeX representation of the same formula. That's what I would put as the Alt
text for any GIF image representing a mathematical formula.

But that page isn't called "torture test" for nothing. Here's the (AMS)LaTeX
representation of #23:

alt="\begin{pmatrix}\begin{pmatrix} a &amp; b\\ c &amp; d \end{pmatrix} &amp;
\begin{pmatrix} e &amp; f\\ g &amp; h \end{pmatrix} \\ 0 &amp; \begin{pmatrix} i
&amp; j\\ k &amp; l \end{pmatrix} \end{pmatrix}"

Plain LaTeX would be even more convoluted:

alt="\left(\begin{array}\left(\begin{array}\right) a &amp; b\\ c &amp; d
\end{array}\right) &amp; \left(\begin{array} e &amp; f\\ g &amp; h
\end{array}\right) \\ 0 &amp; \left(\begin{array} i &amp; j\\ k &amp; l
\end{array}\right) \end{array}\right)"

And I like plain TeX even less.
(Reporter)

### Comment 6

13 years ago
For a serious MathML page, having a MathML object failback to TeX, which
failbacks to a GIF object, with failback to HTML is a good idea.

But this page - being a test - will be better served with alt="load this GIF to
see what the formula should look like".

### Comment 7

13 years ago
We all know that <object> provides more flexible fallback options than <img
alt="..." longdesc="...">. That's not the *point*.

alt="..." is supposed to provide a textual alternative to the image. "Load the
GIF" is *not* a textual alternative. Better to leave it blank, alt="".

If you want a textual alternative, use the (La)TeX formula. That is the Lingua
Franca for describing what a formula should look like, using plain text.

### Comment 8

13 years ago
There seems to be a publishing problem with this file. I updated it a while ago
and it still isn't republished. David, do you know what might be wrong?

### Comment 9

13 years ago
The change you checked in looks like it's reflected on the website.  Or is it on
some mirrors and not others?

### Comment 10

13 years ago
It's changed now. Maybe it was my cache, sorry about bugging you.

### Comment 11

13 years ago
*** Bug 273184 has been marked as a duplicate of this bug. ***

### Updated

11 years ago
QA Contact: danielwang → www-mozilla-org

### Comment 12

10 years ago
Created attachment 288134 [details] [diff] [review]
Make the torture test valid

I add empty alt texts to images of TeX.
I remove the "mphamtom" hack (example 22), as it seems useless for me. However you can keep it if you change the "(" by "<mo>(</mo>".
Attachment #288134 - Flags: review?(rbs)

### Comment 13

10 years ago
> I remove the "mphamtom" hack (example 22), as it seems useless for me.

Useless? Looks like you may be overlooking the fact that the two braces on that expression may not be on the same level anymore. [without that mphantom, one brace should be at a little lower position than the other one because you have the braces on top of "a,...,a" and "b,...,b" -- which are of different height -- c.f. "ab". The trick with that "(" is to give the same height to "(a" and "b", see "(a" and "(b"?  TeX calls the height of an (invisible/zero-width) parenthesis the \mathstrut, and it is handy to stack things uniformly. MathML doesn't have this thing -- which is what that mphantom hack tried to emulate.]

### Comment 14

10 years ago
Created attachment 288149 [details] [diff] [review]
W3C-valid, but with the hack

OK, so here is a new patch that preserve the hack...
Attachment #288134 - Attachment is obsolete: true
Attachment #288149 - Flags: review?(rbs)
Attachment #288134 - Flags: review?(rbs)

### Comment 15

10 years ago
All you want is to change the "(" by "<mo>(</mo>", as you thought earlier. My comment was to document the why-side of the hack.

[It can not be achieved with a fixed setting like "20px" or such -- because it is a dynamic hack -- like the "ex" or "em" units that can change dynamically with the CSS cascade/font-size/zoom/etc.]

### Comment 16

10 years ago
I had also tried to change the "(" by "<mo>(</mo>", but in this case the hack does not work (I suppose Firefox display it smaller when it is in a <mo>) ! I agree about the dynamic problem of "20px" but it is not worse than doing the assumption about the size of the parenthesis... and at less it validates.
(Assignee)

### Comment 17

9 years ago
Hello all,

I have read all of the comments so far and have examined attachment 288149 [details] [diff] [review] carefully. I'm ready to apply such patch unless I hear objections, opposing comments.

Regards, Gérard

### Comment 18

9 years ago
The main objection was about the way to fix the "ugly hack". Some people wanted to preserve it even if it makes the page not valid and may only work with Firefox 2. Maybe you should study the rendering with Firefox 3 before applying the patch.
(Assignee)

### Comment 19

9 years ago
Hello Frédéric,

Thank you for the quick reply.

The (only!) difference between attachment 288134 [details] [diff] [review] and attachment 288149 [details] [diff] [review] is the way this code from example 22 is coded and replaced:

Line 802 and line 822 in the source code:
<!-- \mathstrut -ugly hack a la TeX -->

My intent - and it is still the same - is to replace that line (802 and 822 in source code) of code with what you proposed in attachment 288149 [details] [diff] [review]:

+          <mstyle mathsize="20px">
+             <!-- ugly hack a la TeX -->
+          </mstyle>

In any case(1), whether we agree or not on such way to replace that line of code, I see no reason not to submit, apply all of the other changes (namely add the alt="") for that webpage.

I must say that I do NOT have the font faces CMSY10, CMEX10 (tex.css), Math1, Math2, Math4 (mathematica.css) installed on my machines.. so I do not see exactly what the ugly hack is about and why or what it does... most likely overcoming a layout issue with the rendering of those font faces.

Anyway... if some of you or some of you prefer that I leave lines 802 and 822
as they are, I can do that too.
(Assignee)

### Comment 20

9 years ago
One small thing that bugged me when examining the code. All of the images do not have their width and height attributes specified.

It's always preferable to define width and height for images. The reason for that is that defining image width and height helps speed up rendering as the browser knows how much space to allocate a particular area (image placeholder) while parsing and rendering the page. Otherwise, the browser has to wait until the graphic is loaded before it knows where to put anything below or to the right of the graphic. The browser may need to rearrange the page as the images are downloaded. When it does, the visitor sees a reflow, a shift in the page
layout.
(Assignee)

### Comment 21

9 years ago
Note to self:

Other mathml webpages which would also need to be tuned for validation are:
http://www.mozilla.org/projects/mathml/start.xhtml (22 errors)
http://www.mozilla.org/projects/mathml/start-hebrew.xhtml (23 errors)
http://www.mozilla.org/projects/mathml/start-thai.xhtml (22 errors)
http://www.mozilla.org/projects/mathml/demo/basics.xhtml (39 errors)
http://www.mozilla.org/projects/mathml/demo/mfrac.xhtml (20 errors)
http://www.mozilla.org/projects/mathml/demo/mo.xhtml (24 errors)
http://www.mozilla.org/projects/mathml/demo/mtable.xhtml (21 errors)
http://www.mozilla.org/projects/mathml/demo/mspace.xhtml (21 errors)
http://www.mozilla.org/projects/mathml/demo/mmultiscripts.xhtml (20 errors)
http://www.mozilla.org/projects/mathml/demo/roots.xhtml (20 errors)


(Assignee)

### Comment 22

9 years ago
right part of the underbrace doesn't render correctly, mathml torture
page #22:   (1.66 KB, image/gif) from peter kootstra,
attachment 99389 [details] from bug 120198

Is that what the ugly hack is trying to overcome?
(Assignee)

### Comment 23

9 years ago
Also
http://www.mozilla.org/projects/mathml/demo/extras.xhtml (41 errors with W3C validator)

When I use Firefox extension HTML validator 0.8.5.2, I get 1 or 2 more errors than from when using the W3C validation service.

(Assignee)

### Comment 24

9 years ago
Re comment #21
Bug 445029:
Make several MathML xhtml demo webpages validate (with no errors)
has just been created for this purpose.

### Comment 25

9 years ago
- Yes, adding alt tag to each image will be a good thing to fix several errors. Nevertheless, note that even if empty alt tag are recommended for "decorative" image (http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8 ) I don't really know what is appropriate for the present case (see the discussion above).

- I agree that adding size of the image would be useful.

- If I remember well, the "ugly hack" was used to fix layout problem but your screenshot shows rather a font issue. In Firefox 3, layout engine has been rewritten and normally the STIX font are used. Hence the result may be different and I don't know if the hack is still relevant.
(Assignee)

### Comment 26

9 years ago
- alt attribute value: the webpage is served as utf-8. One thing we can do for simple mathematical expressions is to find the correspondent utf-8 (numerical) character entity references. E.g.:
Example 1's alt attribute could be: x&x2082;y&x2082; or x&#8322;y&#8322;
So Line 98:
<td><img src="../screenshots/ex1.gif" /></td>
becomes then
<td><img src="../screenshots/ex1.gif" width="38" height="22" alt="x&#8322;y&#8322;" /></td>

subscripts and superscripts: U2070 to U2094: 0 to 9 and some others

mathematical symbols: U2200 to U23DB
E.g.: large left parenthesis upper hook, extension and lower hook: U239B, U239C, U239D

miscellaneous mathematical symbols A: U27C0 to U27FF

For a majority of the examples in the webpage, it's not possible to construct an alternate text's alt attribute value. I think it's not that important since the image is there to graphically render what the rendered text should be or look like... and alt attribute value is there to provide a textual equivalent, a text rendering of a non-text content (image, audio, video).

- I'll include the width and height values in their correspondent attribute value then

- the link href value at line 84
<a href="http://bugzilla.mozilla.org/show_bug.cgi?id=120198">
should rather be
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=120198">

- at line 60
<body onclick="javascript:viewmath(event);">
<body onclick="viewmath(event);">

and in the <head> part, we could (and should!) just include

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />

In that spirit, I suggest changing line 1
<?xml version="1.0"?>
into
<?xml version="1.0" encoding="UTF-8"?>

- at line 42 and 43,
tr {
vertical-align: middle;
}
should be entirely removed since
vertical-align only applies to table-cells and inline elements
"vertical-align
Applies to: inline-level and 'table-cell' elements "
http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align

and because the default vertical alignement of table cells [in all browsers too] is middle.
"middle: Cell data is centered vertically within the cell. This is the default value."

- "I don't know if the hack is still relevant"
Ok, then. I will leave line 802 and line 822 in the source code as they are:
<!-- \mathstrut -ugly hack a la TeX -->
We can later reevaluate or make corrections once we clarify that issue.

Agreed?


(Assignee)

### Comment 27

9 years ago
Argh... Doh!

x&x2082;y&x2082; or x&#8322;y&#8322;
is for subscripts, not superscript which is what is in the example.

Correction:
Line 98:
<td><img src="../screenshots/ex1.gif" /></td>
becomes then
<td><img src="../screenshots/ex1.gif" width="38" height="22"
alt="x&#178;y&#178;" /></td>

(or x&#x00B2;y&#x00B2; for hexadecimal)

(Assignee)

### Comment 28

9 years ago
Line 116:
<td><img src="../screenshots/ex2.gif" /></td>
becomes then
<td><img src="../screenshots/ex2.gif" width="30" height="17" alt="&x2082;F&x2083;" /></td>

Line 138:
<td><img src="../screenshots/ex21.gif" /></td>
becomes then
<td><img src="../screenshots/ex21.gif" width="58" height="47" alt="x + y&#178; divided by k + 1" /></td>

etc.. for cases which are possible to do.

(Assignee)

### Comment 29

9 years ago
> Line 116:
> <td><img src="../screenshots/ex2.gif" /></td>
> becomes then
> <td><img src="../screenshots/ex2.gif" width="30" height="17"
> alt="&x2082;F&x2083;" /></td>

I tried that in a local version and I must do

<td><img src="../screenshots/ex2.gif" width="30" height="17"
alt="&#8322;F&#8323;" /></td>

With all the changes discussed, I go from 31 errors to 2 errors only... which correspond to the "hacks" discussed before:

<mpadded width="0"><mphantom>(</mphantom></mpadded> <!-- \mathstrut -ugly hack a la TeX -->
(Assignee)

### Comment 30

9 years ago
Patched webpage (intermediary stage), which include all changes discussed (except the 2 "hacks"):

http://www.gtalbot.org/BugzillaSection/Bug267882-new-version-inter.xhtml

What I wanted to test is if HTML Tidy was able to pretty print that XHTML + MathML code.

Note that 5 images have relevant non-empty alt attribute values.
(Assignee)

### Comment 31

9 years ago
In this webpage:

http://www.gtalbot.org/BugzillaSection/Bug267882-new-version-inter.xhtml

on top of the changes and corrections discussed and submitted,

- I tweaked the local stylesheet code a bit
- I added scope="col" for the table headers
- I converted " -> " into " -&gt; "
- code outside the <table> has been re-indented to 2 characters (just like default code indentation value in HTML Tidy)
- code outside the <table> line-wraps at 76 characters. This helps code maintenance and eventual code review, code comparison with previous versions.
- added <code> around user_pref("font.minimum-size.x-western", 10)

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.gtalbot.org%2FBugzillaSection%2FBug267882-new-version-inter.xhtml&charset=(detect+automatically)&doctype=Inline&group=0

(Assignee)

### Comment 32

9 years ago
Another thing. The content of items 3 and 4 (about font size, minimal font size and how to text zoom) should be updated and be on par with Firefox 3 and not with the old Mozilla suite or previous versions of Firefox.

Current text:
"
(...) this can be
set with, e.g, user_pref("font.minimum-size.x-western", 10).
(...) to increase your default font size in the menu:
'Edit -> Preferences -> Appearance -> Fonts'.
(...) 4. You can use 'View -> Text Zoom' in the usual way to zoom the MathML text
"

Suggested changes:
"
(...) this can be
set with Tools/Options.../Content tab/Fonts and colors/Advanced button/
(...) to increase your default font size in the menu:
'Tools -> Options... -> Content tab -> Fonts and colors, size'
(...) 4. You can use 'View -> Zoom, Text Zoom only checked' to zoom the MathML text
"


### Comment 33

9 years ago
Created attachment 329632 [details]
Screenshot of the hack

### Comment 34

9 years ago
Created attachment 329633 [details]
Hack with mo

### Comment 35

9 years ago
Created attachment 329634 [details]
No hack

### Comment 36

9 years ago
- "the webpage is served as utf-8. One thing we can do for simple mathematical expressions is to find the correspondent utf-8 (numerical) character entity references". Just a small remark: It seems that you believe serving the page as UTF-8 is mandatory in order to use the entity references. It is not true, since characters used to encode entity references in XML are all ASCII (digits, sharp etc). Actually, serving the page as UTF-8 allows to directly write these characters in the page, without using entity references! By the way I don't see why you fail using hexadecimal entity references in alt text. Is it a bug of Firefox?

- I've just made some tests with the hack, using the new configuration of Firefox 3 (Gecko 1.9 + STIX fonts). As I said before, the purpose of this hack was to fix a problem of layout: alignment of the two braces (see the screenshots). I remember that adding <mo> arround the parenthesis did not fix the problem, but it seems that it does with the new configuration. Hence I suppose you can make this correction to make the page valid. However, I still think we should find a way to do the alignment properly... I guess we should look to http://www.w3.org/TR/MathML3/chapter3.html#presm.malign

- For alt text, I'm not sure that your idea of using utf-8 characters is good and you admit yourself that it can not be applied for all tests. Some people proposed TeX syntax but the problem is that it is not universally understood. In my opinion there are two main cases where the alt text is useful for people: when they have visual disabilities or when their browsers are not able to display images. Ideally, if they use tools that can deal with MathML, such as speech synthesizers, they don't need a non-empty alt text attached to the image of the formula (after all, replacing image was one of the reason MathML was done!). Nevertheless, we have to remember that it is a test page and so these tools may fail, just like a browser may not render the formulae properly. Finally, I believe that we can leave the alt text empty (or if we really want to, write how the formula is read in english) but we must add a column that describes the test rather than the formula. For instance "variables with exponents" (1), "variable with multiscripts" (2) etc.
(Assignee)

### Comment 37

9 years ago
> serving the page as
> UTF-8 is mandatory in order to use the entity references. It is not true,
> (...)  Actually, serving the page as UTF-8 allows to directly write these
> characters in the page, without using entity references!

Yes. Correct. You are right.
The use of character entity references is mainly, only limited by the capabilities (Unicode range support) of the font in use.

> I don't see
> why you fail using hexadecimal entity references in alt text. Is it a bug of
> Firefox?

I have no idea.

> - For alt text, I'm not sure that your idea of using utf-8 characters is good
> and you admit yourself that it can not be applied for all tests.

I agree with you that if a found solution can not be applied to all 28 test-lines, then it may not be a suitable solution.

> I believe that we can leave the alt text empty (or if we really want
> to, write how the formula is read in english)

Yes. Writing how the whole formula would be read in english is most likely a better solution and a solution which would work for all 28 test-lines.
So the table of that "MathML Torture Test" needs a 3rd column now.

> but we must add a column that
> describes the test rather than the formula. For instance "variables with
> exponents" (1), "variable with multiscripts" (2) etc.

I agree. A column describing what each test-line is doing will be useful in such "MathML Torture Test". So, that would be a 4th column.
(Assignee)

### Comment 38

9 years ago
Ok, here's what I'll do.

I'll make a first patch this weekend and apply it. It won't have any alt text. It will have all of the issues, corrections discussed and agreed so far, including the one in comment #32.

It will have what you proposed in attachment 288149 [details] [diff] [review] regarding
line (802 and 822 in source code) of code

+          <mstyle mathsize="20px">
+             <!-- ugly hack a la TeX -->
+          </mstyle>

After such patch, we can tackle issues which may be remaining.

So, if anyone has objections or issues, they have until this weekend to speak up in this bug.

-------------

As for another column indicating how the formula is read in english, I can not do that. And another bug report should be created specifically for that.

As for another column describing the test, I can not do that and again, best would be to create another bug. I took assignment of bug 151557 and wanted to see if I could help fix this 267882 bug.
Status: NEW → ASSIGNED
(Assignee)

### Updated

9 years ago
Assignee: annevankesteren+mozilla → bugzilla
Status: ASSIGNED → NEW
(Assignee)

### Comment 39

9 years ago
-> me
Status: NEW → ASSIGNED

### Comment 40

9 years ago
For the hack, you can replace

by

<mpadded width="0"><mphantom><mo>(</mo></mphantom></mpadded>
(Assignee)

### Comment 41

9 years ago
Patched submitted and checked in

Checking in mozilla-org/html/projects/mathml/demo/texvsmml.xhtml;
/www/mozilla-org/html/projects/mathml/demo/texvsmml.xhtml,v  <--  texvsmml.xhtml
new revision: 1.4; previous revision: 1.3
done

Let me know if anything is wrong or missing.

Gérard
(Assignee)

### Comment 42

9 years ago
Checking in mozilla-org/html/projects/mathml/demo/texvsmml.xhtml;
/www/mozilla-org/html/projects/mathml/demo/texvsmml.xhtml,v  <--  texvsmml.xhtml
new revision: 1.5; previous revision: 1.4
done

and at
http://www.mozilla.org/contribute/writing/markup; added <link>s for Site navigation toolbar for the same reasons; made "ViewView -&gt; Zoom, Text Zoom only checked" styled as .menu; replaced single quote around strechy='false' with double quotes.

Unless I hear something from someone about something missing or wrong, I will resolve this bug as FIXED in 4 days or so.

Regards, Gérard
(Assignee)

### Updated

9 years ago
Whiteboard: Resolve as FIXED on July 24th 2008.

### Comment 43

9 years ago
http://www.mozilla.org/projects/mathml/demo/texvsmml.xhtml
validates as XHTML with

This Page Is Valid XHTML 1.1 plus MathML 2.0!

but fails CSS validation at ( http://jigsaw.w3.org/css-validator/ ) with

Target: http://www.mozilla.org/projects/mathml/demo/texvsmml.xhtml
Line 239
Column 15
A colon is not allowed in the name 'IS10744:arch' when namespaces are enabled.

(Assignee)

### Comment 44

9 years ago
The error message regarding the colon and the IS10744:arch have nothing to do with the actual CSS code of local embedded stylesheet and alternate stylesheets but rather with namespace support.

Resolving as FIXED
Status: ASSIGNED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
(Assignee)

### Updated

9 years ago
Whiteboard: Resolve as FIXED on July 24th 2008.

### Updated

9 years ago
Product: mozilla.org → Websites

### Updated

9 years ago
Attachment #288149 - Flags: review?(rbs)

### Updated

5 years ago
Component: www.mozilla.org → General
Product: Websites → www.mozilla.org
You need to log in before you can comment on or make changes to this bug.