FANDOM


The "math tags" (<math> ... </math>) normally cannot contain any substitutable text, because of the order in which the wiki engine evaluates its input. This is most noticeable in a template, such as {{Lsym1}}, which is designed to show how LaTeX renders text, followed by the code used to generate the text. In the template, {{{1}}} appears inside the math tags, with the idea that the parameter will be expanded before the LaTeX code is evaluated. However, the wiki engine does it in the other order: the {{{1}}} is literally interpreted as LaTeX code, which, coincidentally, is meaningful to LaTeX. The curly braces are stripped off, leaving the value 1, which is dutifully rendered, regardless of the code actually intended.

SolutionEdit

Luckily, there is a solution: the #tag parser function allows the wiki engine to evaluate all the curly-braced things first, and then generates the math tags with the result, restoring the proper order to the universe.

ExamplesEdit

The special variable {{NUMBEROFPAGES}} is used to illustrate how the normal math tag fails to process the code correctly, but the #tag parser function does the right thing:

The following LaTeX markup... ...results in this:
The square root of the number of pages on this site is <math>\sqrt{ {{NUMBEROFPAGES}} }</math> The square root of the number of pages on this site is \sqrt{ {{NUMBEROFPAGES}} }
The square root of the number of pages on this site is {{#tag:math|\sqrt{ {{NUMBEROFPAGES}} } }} The square root of the number of pages on this site is \sqrt{ 686 }

Note: If you need to use a vertical bar character (|) within the LaTeX code, you will need to use the special-purpose {{!}} macro to generate it. Otherwise, it will be interpreted as a "pipe", ending the first parameter of the #tag:math parser function.


SummaryEdit

So instead of writing

<math> blah, blah, blah. </math>,

you now write,

{{#tag:math| blah, blah, blah. }},

and you can put that in a template, if you like!

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.