Wikipedia:WikiProject Mathematics/Typography

Main pageDiscussionContentAssessmentParticipantsResources

Mathematical writing fundamentally involves formulas, whose typography is often quite complicated and difficult. This page hopes to serve as a central location for discussion of issues of mathematical typography on Wikipedia.

Current Issues

edit
Inconsistent sizing

The sizing of texhtml (TeX code, rendered as HTML) and PNGs are often grossly inconsistent with the size of HTML text, and this varies between browser configurations.

As a preliminary measure, a calibration Help page should be created (I’ll do this – Nils).

If texhtml is too big for some, it makes inline TeX unusable – the output is ugly and likely to be painstakingly corrected by other editors to better-rendering but hard-to-edit HTML, which is suboptimal for all.

If PNG is too big for some, it is often then hacked around using \scriptstyle which both messes with spacing, and renders too small for those whose PNG rendering is properly calibrated.

Compare:

<math>x+y</math>
<math>x+y\,</math>
''x''&nbsp;+&nbsp;''y''

which display as:

x + y

To my eye, the TeX code is much more readable, but (in my setup) renders more poorly simply due to being too large (forced PNG is acceptably sized, but suboptimal and a hack). This is more visible inline, with capitals: the expression is too large, compared to and X + Y.

For others the texhtml renders correctly, but the PNG is displayed too large.

Continuing on this line, \scriptstyle should never be necessary.

\scriptstyle is used in some places as a hack to produce smaller PNG output, due to PNG output being too large. This has several problems:

  • the output is too small on some displays
  • it is verbose
  • it breaks spacing, notably super/sub-scripts

It should not be necessary, and PNG rendering should be fixed instead.

<math> defaults to \displaystyle

Inline equations should be set in \textstyle as in while displayed equations should be set in \displaystyle as in:

However, by default all equations are set in \displaystyle and one must manually specify \textstyle for inline equations, which is verbose and rarely done, as in:

<math>\textstyle{\sum_{k=1}^n k},</math>

Allowing a shorter way of doing this would be much better. Concretely, this could be done by adding another tag, as in <mathtx> to default to text style, or more elegantly by using the existing convention of

:<math>...</math>

to denote displaystyle, and otherwise having math mode default to textstyle.

PNG baseline alignment

The baseline on inline PNG images is often too low or too high, resulting in the PNG not flowing with the text. Consider:

Lorem ipsum dolor 23 sit amet,
consectetur adipisicing elit, ai sed
do eiusmod tempor ain incididunt

Note that the vertically balanced formulas (sub and superscripts) have roughly correct baseline, though those with just sub- or super- scripts are significantly off. This is apparently very difficult to fix.

Linebreak between </math> and trailing punctuation

Linebreaks may be inserted between </math> and trailing punctuation, such as:

.

This can be fixed either by including the punctuation within math mode (which may result in ugly rendering, or using {{nowrap}}, which is verbose. Ideally this would not be necessary.

Goals

edit

Math formulas should serve readers and editors, and accordingly should be:

  • Good typesetting: displayed legibly, correctly, and attractively both on-screen and in print
  • Easy writing: easy to write and edit for people from varied backgrounds – notably via TeX, HTML, and graphical equation editors
  • Able to be transformed into other forms (e.g., read by screen-readers).

Mathematical typesetting software can be difficult to write and maintain, and thus one also has the considerations of developers. Ideally, typography will "just work", but accommodations should be made if something is difficult to implement in software.

General issues

edit

Some general issues to be aware of:

  • consistent display in both TeX-to-PNG and TeX-to-HTML rendering
  • consistent display in both TeX authoring and HTML authoring
  • formula size – legible size, consistent with normal text
    • both for texhtml and PNG display
  • inline formula alignment (PNGs may in particular be too low)
  • line spacing with inline formulas
  • serif vs. sans-serif – PNG rendering defaults to serif fonts, but the default skin uses sans-serif fonts, which creates a clash
  • users can change fonts and font sizes – how does rendering (esp. PNG) react?

Technical limitations

edit

There are various limits on math typesetting due to:

  • Different web browsers and different operating systems
  • Different fonts in the browser
  • limitations of texvc

Please list here as relevant.

Infrastructure

edit

Math typesetting works as follows:

  • Pure HTML rendering works as HTML
    • {{math}} renders the HTML in the texhtml CSS style
  • TeX rendering (using <math> mode) uses:
    • texvc for PNG rendering
    • is put in a texhtml CSS style when rendered as HTML
  • There are also various Wikipedia templates used in some HTML rendering.

…and MathML output.

Rendering depends on:

  • browser
  • operating system
  • wiki configuration – “My preferences → Appearance → Skin/Math”
  • browser configuration (font size and font face, notably)

Safest way to test default rendering is to view a page while not logged in, on a fresh install or public computer, rather than on your own account & browser.

Enhancements

edit

Long-term desirable enhancements include:

However, these likely would require significant development work.

Resources

edit

Participants

edit

To join and signal your interest, please:

  • watch this page
  • list yourself below, using ~~~ to sign your name,
  • and include particular interests, if any.

Participants:

See also

edit

Other rendering engines

edit