Template talk:Tmath
Behavior of parser functions [either extensions or not] when the parameter is not provided
[edit]The #tag
parser function extension returns 1
instead of {{{1}}}
when the parameter is not provided. Do all the parser functions and/or parser function extensions behave in this way? Just asking. — TentaclesTalk or ✉ mailto:Tentacles 15:26, 30 March 2016 (UTC)
Using magic words, parser functions [either extensions or not] and/or templates inside the tmath template
[edit]Should I mention (or not) on the doc page that one may use magic words, parser functions [either extensions or not] and/or templates inside the {{tmath}} template, with an example such as:
The code
{{tmath| \frac{1}{\zeta(2)} {{=}} \frac{6}{\pi^2} {{=}} {{#expr: 6 / (pi^2) }}\ldots }}
yields
-
Or is this discouraged? — TentaclesTalk or ✉ mailto:Tentacles 15:43, 30 March 2016 (UTC)
- You may see that parser functions are ignored ans stripped. So there is no point in using them.
-- [[User:Edokter]] {{talk}}
21:13, 30 March 2016 (UTC)
- The parser function [extension]
{{#expr: 6 / (pi^2) }}
used in the {{tmath}} example above yielded0.60792710185402
so it did work. — TentaclesTalk or ✉ mailto:Tentacles 23:31, 30 March 2016 (UTC)
- The parser function [extension]
Improving the template
[edit]This template documentation as the users above noted is downplaying its potential quite a bit in my opinion. Compared to using <math></math>
there's plenty of positives such as
- Allowing templates and semantic mediawiki properties inside it is a VERY strong feature. Example:
<math>{{#expr:{{CURRENTYEAR}} + 1}}</math>
yields Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "http://localhost:6011/wiki.riteme.site/v1/":): {\displaystyle {{#expr:{{CURRENTYEAR}} + 1}}} , it should of course show which{{Tmath}}
successfully did. As the calculations imply; supporting templates, parser functions and SMW properties allows creating advanced math examples that will stay synchronized with the wiki even if the variables changes. - Controlling styles and background colors can easily be done in templates. Maybe not that useful for this wiki in particular.
The issue with equal signs isn't that big of a deal with named parameters, if it allowed the named parameter "formula":
{{TMath|formula= {{CURRENTYEAR}} + 1 = {{#expr: {{CURRENTYEAR}} + 1}} }}
And if you expand the template a bit to include {{NumBlk}}
and {{EquationRef}}
you can create numbered equations by just adding "nr=1" as a named parameter and then reference them with {{EquationNote}}
. Here's the code suggestion, taken from here:
{{#vardefine:math| {{#tag:math | \pagecolor[RGB]{15,15,15} \color[RGB]{163,141,109} {{{1|{{{formula|{\color{Red}error} }}}}}} | display="{{{display|}}}" | style="background-color:transparent; padding:0;" }} }} {{#if: {{{nr|}}} | {{NumBlk|1=:|2={{#var:math}}|3={{EquationRef|{{{nr}}}}}}} | {{#var:math}} }}
Remove \pagecolor[RGB]{15,15,15} \color[RGB]{163,141,109}
if it's not needed.--Illviljan (talk) 20:46, 22 January 2017 (UTC)
Not to print "1" in the case of empty argument
[edit]I think it is not necessary to print "1" in the case of empty argument for this template, so I add "|" in the end of it.
But it is reverted. What other friends think about this change (adding "|") in this template?
Thanks, Hooman Mallahzadeh (talk) 16:44, 27 September 2020 (UTC)