Citizendium Forums
November 24, 2009, 10:29:00 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: POSTING RULES FOR MAIN CZ BOARDS: (1) The CZ Forums are Citizens-only (a "Citizen" is a Citizendium member). Non-Citizens may use only the "Non-member discussion" and "General help" boards, but still must register before posting (it's easy!). Non-Citizen posts elsewhere will be summarily deleted. (2) All must now use their own real names. To edit your displayed name, click on Profile > Account Related Settings. (3) Citizens must now link to their CZ user pages. To edit your signature, click on Profile > Forum Profile Information.
Click here to return to the wiki
 
   Home   Help Search Login Register  
Pages: 1 [2] 3
  Print  
Author Topic: inline math formulas  (Read 11173 times)
gerg
New Arrival
*
Posts: 13



« Reply #15 on: May 10, 2007, 03:28:16 PM »

I've been bold and started the CZ article http://en.citizendium.org/wiki/CZ:Formatting_mathematics, the purpose of which is to gather together all debates and policies related to formatting mathematics in Citizendium articles.''' I've put enough content there to suggest the format I have in mind: one main article with the statements of policies, proposed policies, and issues under discussion; and for each item, a subsidiary article with a detailed discussion of the issue, so that people will know why the policies that are (eventually) decided upon are the way they are (I fleshed out one such discussion article, http://en.citizendium.org/wiki/CZ:Formatting_mathematics/Theorem_capitalization, to give a sense of what I have in mind). I hope that this creation has value for our workgroup! If so, please feel free to develop the skeleton I put there.
Logged

- Greg Martin
Jitse Niesen
Forum Participant
**
Posts: 100



« Reply #16 on: May 13, 2007, 07:12:00 AM »

I'm quite sure that the size [of the PNG images displaying <math> formulas] is easy to change in the MediaWiki code.

I now looked into it and it's indeed trivial to change the size. I'd guess that it would take the technical staff a few minutes to do this (perhaps a bit longer because I assume that there is more than one server). So this seems definitely possible if we (the CZ community) decide that we want this.

I posted some details on [[CZ:Formatting mathematics/Scriptstyle]]. I also made a test page so that you can see how it looks like at http://www.ma.hw.ac.uk/~jitse/cz-math.html. In my setup, changing the resolution from the current 120 dpi to 100 dpi looks best.

As Catherine said, we should keep in mind that not everybody is blessed with good sight. While most browsers include an option to increase the text size, enlarging the pictures is not so easy for the user.
Logged

a.a.s.
Forum Communicator
***
Posts: 152


« Reply #17 on: May 13, 2007, 02:30:32 PM »

Fantastic test.

I'd fully support a change (as compared to \scriptstyle this results in no markup controversies and no danger of more side effects in different browsers). I agree that 100 dpi looks best. Fits (relatively) naturally the line, still quite clear and readable.
Logged

gerg
New Arrival
*
Posts: 13



« Reply #18 on: May 13, 2007, 10:46:28 PM »

This does look really good - even better if inline math can be at 100 dpi and displayed math remain at 120 dpi.
Logged

- Greg Martin
Greg Woodhouse
Forum Communicator
***
Posts: 167


Cygnus Loop SNR


WWW
« Reply #19 on: May 14, 2007, 06:35:02 AM »

This does look really good - even better if inline math can be at 100 dpi and displayed math remain at 120 dpi.

That's all the more reason for a special <imath>...</imath> tag, if that's techcally feasible.
Logged

User page: http://en.citizendium.org/wiki/User:Greg_Woodhouse

A writer is a person for whom writing is more difficult than it is for other people.

--Thomas Mann
German writer (1875 - 1955)
Fredrik Johansson
Forum Participant
**
Posts: 41


« Reply #20 on: May 14, 2007, 10:43:44 AM »

Or better yet, <m></m>, since there are a lot of them.
Logged

Jitse Niesen
Forum Participant
**
Posts: 100



« Reply #21 on: May 16, 2007, 08:10:46 AM »

This does look really good - even better if inline math can be at 100 dpi and displayed math remain at 120 dpi.

That's all the more reason for a special <imath>...</imath> tag, if that's technically feasible.

I added some details to [[CZ:Formatting mathematics/Scriptstyle#Two environments]]. It's definitely feasible; I'd expect it would cost me four hours or so to program and test it. The problem is that I won't have much time soon (going overseas) and that it also requires a change in the database structure. The latter is not as bad as it sounds, but we will need to convince the technicians to put some work in it.

So, my preference would be to change the size as soon as possible (it probably needs some wider discussion though than only us mathematicians) and to introduce the new tags, if we decide we want that, later.
Logged

Catherine Woodgold
Forum Participant
**
Posts: 50


« Reply #22 on: May 21, 2007, 06:55:55 PM »

Re changing the size:  Probably a good idea, but may make things difficult as I've pointed out before for people with poor eyesight or whatever who have their text size set large, or even for people with normal eyesight in some cases where subscripts or superscripts are small.  I wonder whether it would be too much trouble to let the user control the size in their preferences or with extra buttons at the top "math+" and "math-" or something.  I'm not thinking of myself so much, (I have good eyesight), but it can be frustrating sometimes trying to read fine print rendered in a pixelated image.
Logged
Derek Harkness
Forum Regular
****
Posts: 543


« Reply #23 on: May 22, 2007, 05:55:23 AM »

If I get the jist of this thread, the problem is that the math images don't match the hight of the html text and so the lines become missplaced. While some have attempted to solve this by adjusting the size of the images, thier is one serios omition in the logic:

How high is the html text?

the answer is, I have absolutely no idea. The CSS for the wiki does not specify the font, font size or any other setting other than to say it's Sans-serif. One browser (such as Internet Explorer) might display one font and size while another common browser (such as Firefox) may use a different font and size by default. Then add in the complications of people using different systems such a Apple Mac, Linux or Windows. On top of that mess we have to add that some people change their browser default settings.

You can tweak the size of the of the png images all you want but you will still find that they mess up on a large number of setups. What we need is a dynamic system that re-sizes the images depending on the font size used by the user. To do this we need to stop talking in pixels and dpi (the term dpi is for print and doesn't really apply to screen images) and use a dynamic unit such as 'em' or 'en' or % to size the images for the math.
Logged

Jitse Niesen
Forum Participant
**
Posts: 100



« Reply #24 on: May 22, 2007, 07:00:23 AM »

While some have attempted to solve this by adjusting the size of the images, there is one serious omission in the logic:

How high is the html text?

[...] To do this we need to stop talking in pixels and dpi (the term dpi is for print and doesn't really apply to screen images) and use a dynamic unit such as 'em' or 'en' or % to size the images for the math.

I'm well aware of this weakness. However, I don't see a practical way to use dynamic units. Could you be a bit more specific?
Logged

a.a.s.
Forum Communicator
***
Posts: 152


« Reply #25 on: May 25, 2007, 04:27:36 AM »

How high is the html text?
Let's think in terms of purpose, not technical means that lead to it. And the purpose is readability.  If so, an answer is: while it is not easy to know the "technically exact" height of html text -- and this can be changed at any moment locally by the user -- the actual  height is just set "to be readable" and  so does not vary that much for a large number of users. Moreover,  let me guess that rescaled math images would just fit better in a typical situation, since the height of formulas we have now is not quite natural. In other words: try to rescale your html fonts to fit the formulas, and you'll see.

You can tweak the size of the of the png images all you want but you will still find that they mess up on a large number of setups.
Rescaling can be seen as a (IMHO good) guess what a typical situation is -- and adjusting to it. I'd  add that  what we have now is a mess in  virtually any setup.
Logged

Derek Harkness
Forum Regular
****
Posts: 543


« Reply #26 on: May 26, 2007, 10:09:07 AM »

While some have attempted to solve this by adjusting the size of the images, there is one serious omission in the logic:

How high is the html text?

[...] To do this we need to stop talking in pixels and dpi (the term dpi is for print and doesn't really apply to screen images) and use a dynamic unit such as 'em' or 'en' or % to size the images for the math.

I'm well aware of this weakness. However, I don't see a practical way to use dynamic units. Could you be a bit more specific?

Normally, text on a screen is sized in px - that is pixels, the little coloured squares that make up your monitory/lcd display. The image is also normally sized in the same way. So technically you can just adjust the px sizes of the text and images until they look neat. But since the actual size of the text varies, you will never get it perfect.

Other units of measurement are available. One I suggested was 'em'. An 'em' is defined as the length of the letter 'm' in the font. If you make the font size bigger, then the em size is bigger. If you use arial font, you will get one size of em and if you use Verdana as your font, the the em will be a little bigger. So the pixel size of an em varies along with the font. We can thus use em sizes for the size of our images and as a result the image will re-size to match the size of the users font.

I have made a small web page to demonstrate the effect. If you look at http://www.dnselite.com/math2.html and try altering the size of the font in your browser (FireFox users press Ctrl++ and Ctrl+- to go up and down sizes) you should see the images increase and decrease in size to keep in step with the text.

One final tweak I added was to use relative positioning to shift the image  0.2em down so that the baseline of the text inside the image matches the baseline of the real text. For those who can read html and css, here's the code I used.

Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>

<style>
.inline {
width:7.7em;
position: relative;
top: 0.2em;
height: 1em;
}
.open {
width:10em;
height:1.2em;
}
</style>
</head>

<body>
<p>This image is sized using em unties
<img src="96b3a471449ac598a4e8fa4d38a461f7.png" alt="\scriptstyle N-1 = p_1 p_2 \cdots p_n" class="inline">
 as you resize your fonts, the image will get bigger and smaller along with the text.</p>

<p><img src="96b3a471449ac598a4e8fa4d38a461f7.png" class="open"></p>

<p>This is a fixed images sized in px units
<img src="e4b4138f031b6fece66f522372f52025.png" alt="\scriptstyle N-1 = p_1 p_2 \cdots p_n" width="95" height="12" >
 Nomatter what you do with your browsers font settings, the image will stay the same size.</p>
<p><img src="96b3a471449ac598a4e8fa4d38a461f7.png" width="161" height="18"></p>

</body>
</html>
Logged

Fredrik Johansson
Forum Participant
**
Posts: 41


« Reply #27 on: May 26, 2007, 12:22:38 PM »

Unfortunately, Browser-scaled images look horrible.
Logged

a.a.s.
Forum Communicator
***
Posts: 152


« Reply #28 on: May 26, 2007, 05:00:21 PM »

Looks interesting and maybe at some stage we could use it. Unfortunately, now I have to concur with Frederik. Just two minor remarks:
1) the baseline tweak is not "universal", since the pictures for some inline expressions should actually be moved up (e.g. formulas with superscripts).
2)  Apparently, my firefox (on xp) had some difficulty to interpret this code;  the test page is shown with the text repeated 3 times. Huh (I guess this is not a substantial problem)
Logged

Derek Harkness
Forum Regular
****
Posts: 543


« Reply #29 on: May 26, 2007, 07:57:09 PM »

Unfortunately, Browser-scaled images look horrible.
My example is restricted to starting with a low quality small image and making it bigger. Clearly starting with a larger higher quality image and scaling it smaller would look neater. For the most part we are talking about scaling of just a few pixels, this shouldn't make much distortion to the image. For those who use very big fonts due to bad eyesight, I think they will be glad to have very big, readable, images even if they do get a bit pixelated.

I think the actual image quality of the math is currently fairly poor. Does anyone else feel that all the text looks a bit blurred. It's like reading without my glasses on. Sharpening up the images might help somewhat.

Quote
1) the baseline tweak is not "universal", since the pictures for some inline expressions should actually be moved up (e.g. formulas with superscripts).
I didn't test superscripts, however this is a problem if consistency within the image rendering script. The height of the image and position of the text within that space should be made consistent. If there is no subscript and supper script then there should be white space fill in, not trimmed space.

Clearly there will be a problem with double height text - one thing dividing another - since you are trying to put two lines of math into one line of text. Such text will never work unless you make the math so small that it would be hard to read.

Quote
2)  Apparently, my firefox (on xp) had some difficulty to interpret this code;  the test page is shown with the text repeated 3 times. Huh (I guess this is not a substantial problem)
Not a problem. It was intentional. After posting here I wanted to test how the images looked at various points in a paragraph so see if things got distorted at any point. Simply repeating the text was easier than typing in some more to make the paragraph longer.
Logged

Pages: 1 [2] 3
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!