168 Pages

The "math tags" ($...$) 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.

### Solution

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.

### Examples

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 $\sqrt{ {{NUMBEROFPAGES}} }$ The square root of the number of pages on this site is
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

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.

### Summary

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