Help:Math Help part 1

From Amateur Radio Wiki
(Redirected from Math Help part 1)
Jump to navigation Jump to search

Please note that non standard characters will probably not render properly

The complete helpfile is over 50kB in size. Some browsers may have difficulty in rendering the page, because many have a notional upper limit of 32kB per page. Please choose from one of the following options to access the help file:

Related Math Help pages

  • Math Help part 2 - contains information on Functions, Symbols and Special characters
  • Math Help part 3 - contains information on Subscripts, Superscripts and Integrals
  • Math Help part 6 - contains information on Parenthesising big exprssions, Brackets and Bars
  • Math Help part 7 - contains information about Spacing, Aligning with normal text flow,Forced PNG rendering, Color and examples.

This wiki uses a subset of TeX markup, including some extensions from LaTeX and AMS-LaTeX, for mathematical formulae. It generates either PNG images or simple HTML markup, depending on user preferences and the complexity of the expression. In the future, as more browsers are smarter, it will be able to generate enhanced HTML or even MathML in many cases.

More precisely, MediaWiki filters the markup through Texvc, which in turn passes the commands to TeX for the actual rendering. Thus, only a limited part of the full TeX language is supported; see below for details.

Syntax

Math markup goes inside <math> ... </math>. The edit toolbar]] has a button for this.

Similarly to HTML, in TeX extra spaces and newlines are ignored.

The TeX code has to be put literally: MediaWiki templates, predefined templates, and parameters cannot be used within math tags: pairs of double braces are ignored and "#" gives an error message. However, math tags work in the then and else part of #if, etc.

Rendering

The PNG images are black on white (not transparent). These colors, as well as font sizes and types, are independent of browser settings or CSS. Font sizes and types will often deviate from what HTML renders. Vertical alignment with the surrounding text can also be a problem. The css selector of the images is img.tex.

It should be pointed out that most of these shortcomings have been addressed by Maynard Handley, but have not been released yet.

The alt attribute of the PNG images (the text that is displayed if your browser can't display images; Internet Explorer shows it up in the hover box) is the wikitext that produced them, excluding the <math> and </math>.

Apart from function and operator names, as is customary in mathematics for variables, letters are in italics; digits are not. For other text, (like variable labels) to avoid being rendered in italics like variables, use \mbox or \mathrm. For example, <math>\mbox{abc}</math> gives <math>\mbox{abc}</math>.

TeX vs HTML

Before introducing TeX markup for producing special characters, it should be noted that, as this comparison table shows, sometimes similar results can be achieved in HTML Special characters.

TeX Syntax (forcing PNG) TeX Rendering HTML Syntax HTML Rendering
<math>\alpha\,</math> <math>\alpha\,</math> &alpha; α
<math>\sqrt{2}</math> <math>\sqrt{2}</math> &radic;2 √2
<math>\sqrt{1-e^2}</math> <math>\sqrt{1-e^2}</math> &radic;(1&minus;''e''&sup2;) √(1−e²)


The use of HTML instead of TeX is still under discussion. The arguments either way can be summarised as follows.

Pros of HTML

  • In-line HTML formulae always align properly with the rest of the HTML text.
  • The formula's background, font size and face match the rest of HTML contents and the appearance respects CSS and browser settings.
  • Pages using HTML will load faster.

Pros of TeX

  • TeX is semantically superior to HTML. In TeX, "<math>x</math>" means "mathematical variable <math>x</math>", whereas in HTML "x" could mean anything. Information has been irrevocably lost. This has multiple benefits:
    1. TeX can be transformed into HTML, but not vice-versa. This means that on the server side we can always transform a formula, based on its complexity and location within the text, user preferences, type of browser, etc. Therefore, where possible, all the benefits of HTML can be retained, together with the benefits of TeX. It's true that the current situation is not ideal, but that's not a good reason to drop information/contents.
    2. TeX can be converted to MathML for browsers which support it, thus keeping its semantics and allowing it to be rendered as a vector.
  • TeX has been specifically designed for typesetting formulae, so input is easier and more natural, and output is more aesthetically pleasing.
  • When writing in TeX, editors need not worry about browser support, since it is rendered into an image by the server. HTML formulae, on the other hand, can end up being rendered inconsistent of editor's intentions (or not at all), by some browsers or older versions of a browser.