CZ:Formatting mathematics/Scriptstyle

From Citizendium, the Citizens' Compendium
Jump to: navigation, search
The Citizendium Mathematics Workgroup
Mathematics article All articles (890) To Approve (0) Editors: active (7) / inactive (13)
Authors (275)
(Userinfo System)
Mathematics Workgroup Discussion
Recent changes Citable Articles (22) Mailing list (defunct):
Checklist-generated categories: Underlinked (431) | Cat Check (268) | Cleanup (0)
Subpage categories: Definitions (877) | Related Articles (791; to check 394) | Bibliography (220) | External Links (118) | Gallery (1) | Video (4) 
Missing subpage categories: Definitions (6) | Related Articles (5) | Bibliography (5) | External Links (4) 
44 Developed [1] | 399 Developing [2] | 394 Stub [3] | 24 External [4] | 66 Advanced [0-1] | 467 Nonstub [0-2] | 861 Internal [0-3]

Statement of proposed policy

To determine: Whether to use \scriptstyle to reduce the size of PNG-rendered inline math formulas.

Example with \scriptstyle: The identity is cool.

Example without \scriptstyle: The identity is cool.

Editors' opinions

  • Greg Martin 12:19, 11 May 2007 (CDT) supports a policy of not using \scriptstyle.

Arguments in favor of using \scriptstyle

  • The letters in look comically gigantic on some browsers.
Rebuttal: The appearance depends on preferences of the viewer - their chosen font size, for example - and so fixing the problem for one person might cause a problem for another.
  • \scriptstyle is almost never used for other purposes. Let's use it for this purpose, and then if the coding is ever changed to fix the problem for us, it's easy to automate the process of removing \scriptstyles from all the pages.
Rebuttal: Such an automated process could mess up "legitimate" uses of \scriptstyle.

Arguments in favor of not using \scriptstyle

  • Using \scriptstyle doesn't reflect the right structure; it's a hack. And it's a real pain to type all the time.
Rebuttal: So what? It provides the outcome we want. And math formatting in general is kind of a pain - this isn't any worse.
  • Using \scriptstyle messes up the spacing. Compare for instance and . In the latter formula, there is not enough spacing surrounding the equals sign.
  • Since some math environments are rendered as HTML and others as PNG, we'd have to remember when to use \scriptstyle and when not to.
Rebuttal: Just use it every appropriate time, assuming everything will be PNG-rendered. HTML will just ignore it.
  • The problem isn't with \scriptstyle; it's with the way the coding displays the results. We should have the coding changed rather than manually inserting \scriptstyle a hundred times an article.
Rebuttal: Coding changes that we request are rare and wondrous events. We need to make things look good right now.
  • Using \scriptstyle might fix the problems on some browsing environments, but it will cause problems on others. It depends on what preferences the user has selected for math rendering, font size, and so on.
Rebuttal: Anecdotal evidence suggests that for the large majority of users, using \scriptstyle helps.
  • Accessability: When the page is displayed in larger lettering, the math formula stays the same size. People with visual impairments who use large lettering may not be able to read the tiny math formulas rendered with "scriptstyle". I tried larger lettering on my browser just now: the "scriptstyle" formula looks too small and actually I have trouble reading it at that size regardless of the size of the text; while the non-scriptstyle formula looks about right as well as being readable. It's not always as easy to lean closer to a computer screen as it is to bring a book closer to your eyes to peer at a subscript or superscript. Being able to read the information may be more important than having it look conventional.

Changing the system itself

Global resizing

It was suggested that global resizing of PNG-rendered formulas is possible. This would eliminate the need for \scriptstyle (or leave it for its proper use). The only question would be to determine the "right" size, as the displayed formulas will be affected too. A test page is available to study the possibilities.

Technical details: Assuming that dvipng is used and CZ uses an up-to-date version of mediawiki, the only change in the code is to alter the -D command line option when calling dvipng in line 8 in math/ . Then, recompile texvc and remove the old PNG-rendered formulas, which can be found in $wgTmpDirectory and its subdirectories.

Two environments

If this is possible, then it might also be possible to create two math environments, perhaps called <imath> and <dmath> (for inline and displayed), which would be almost exactly the same - except that <imath> would render smaller graphics while <dmath> would be like <math> is now.

We could also have <imath> automatically switch to \textstyle, so that

  • <imath> \sum_{k=1}^n k = \frac12 n(n-1) </imath> renders as and
  • <dmath> \sum_{k=1}^n k = \frac12 n(n-1) </dmath> renders as

This would require several hours of programming (we need a small change to the parser, to modify the interface with texvc and to adapt texvc itself). It also requires a change in the database layout, so we need to liaise closely with the technical people (Jason Potkanski and co). So it's more work than changing the size, but still quite reasonable.

Vertical alignment

An idea re baseline: Someone on the forum guessed that it would probably be difficult to get LaTeX to output information about where in the image is the baseline that should line up with the text. An easier change to the software might be to allow the user to supply the information. Thus for example <math> would display inline formulas as it does now, and <math baseline=0.2> would display the formula as if the baseline inside the formula were 0.2 from the bottom of the image in units of the total height of the image. Perhaps this would require a change in browser software. Or perhaps the image could be padded with some whitespace to help centre it; in that case perhaps the supplied information should be about how high the centre of the formula is, rather than the baseline. I'm imagining that the writer would try a few values of the parameter to see what looks OK. --Catherine Woodgold 13:29, 12 May 2007 (CDT)