CZ:Formatting mathematics/Scriptstyle: Difference between revisions
imported>Jitse Niesen (→Changing the system itself: details on "global resizing") |
imported>Larry Sanger No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Workgroup|group=Mathematics}} | |||
== Statement of proposed policy == | == Statement of proposed policy == | ||
Line 54: | Line 55: | ||
=== Two environments === | === Two environments === | ||
If this is possible, then it might also be possible to create two math environments, perhaps called <nowiki><imath></nowiki> and <nowiki><dmath></nowiki> (for inline and displayed), which would be almost exactly the same - except that <nowiki><imath></nowiki> would render smaller graphics while <nowiki><dmath></nowiki> would be like <nowiki><math></nowiki> is now. | If this is possible, then it might also be possible to create two math environments, perhaps called <nowiki><imath></nowiki> and <nowiki><dmath></nowiki> (for inline and displayed), which would be almost exactly the same - except that <nowiki><imath></nowiki> would render smaller graphics while <nowiki><dmath></nowiki> would be like <nowiki><math></nowiki> is now. | ||
We could also have <nowiki><imath></nowiki> automatically switch to \textstyle, so that | |||
* <tt><nowiki><imath> \sum_{k=1}^n k = \frac12 n(n-1) </imath></nowiki></tt> renders as <math>\textstyle \sum_{k=1}^n k = \frac12 n(n-1)</math> and | |||
* <tt><nowiki><dmath> \sum_{k=1}^n k = \frac12 n(n-1) </dmath></nowiki></tt> renders as <math>\displaystyle \sum_{k=1}^n k = \frac12 n(n-1)</math> | |||
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 ([[User:Jason Potkanski|Jason Potkanski]] and co). So it's more work than changing the size, but still quite reasonable. | |||
=== Vertical alignment === | === 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 <nowiki><math></nowiki> would display inline formulas as it does now, and <nowiki><math baseline=0.2></nowiki> 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. --[[User:Catherine Woodgold|Catherine Woodgold]] 13:29, 12 May 2007 (CDT) | 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 <nowiki><math></nowiki> would display inline formulas as it does now, and <nowiki><math baseline=0.2></nowiki> 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. --[[User:Catherine Woodgold|Catherine Woodgold]] 13:29, 12 May 2007 (CDT) |
Latest revision as of 09:11, 10 September 2007
Workgroups are no longer used for group communications, but they still are used to group articles into fields of interest. Each article is assigned to 1-3 Workgroups via the article's Metadata. |
| ||||||||
Mathematics article | All articles (906) | To Approve (0) | Editors: active (2) / inactive (15) and Authors: active (280) / inactive (0) |
Workgroup Discussion | ||||
Recent changes | Citable Articles (16) | |||||||
Subgroups (1) |
Checklist-generated categories:
Subpage categories:
|
Missing subpage categories:
Article statuses:
|
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/render.ml . 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)