Template:Frac: Difference between revisions
Jump to navigation
Jump to search
DroneBetter (talk | contribs) m Continued fractions are fixed and it is nicer now (no enclosings necessary :-) |
DroneBetter (talk | contribs) m note necessity of spaces in between + and - operators, update continued fraction explanation (caveat no longer pertains) |
||
| Line 2: | Line 2: | ||
<span style="padding: 0 0.5ch; display: inline-block; text-align: center; vertical-align: middle;"><span>{{{num|{{{1|p}}}}}}</span><span style="display: block; margin: 0 -0.5ch; border-top: 1px solid currentcolor;"></span><span>{{{den|{{{2|q}}}}}}</span></span>--></includeonly><noinclude><tt><nowiki>{{</nowiki>'''frac'''<nowiki>}}</nowiki></tt> is a template for expressing fractions with vertically-displaced numerators and denominators. The parameters, <tt>num</tt> and <tt>den</tt>, may have their namees forgone, and default to the first and second inputs, as one would expect. | <span style="padding: 0 0.5ch; display: inline-block; text-align: center; vertical-align: middle;"><span>{{{num|{{{1|p}}}}}}</span><span style="display: block; margin: 0 -0.5ch; border-top: 1px solid currentcolor;"></span><span>{{{den|{{{2|q}}}}}}</span></span>--></includeonly><noinclude><tt><nowiki>{{</nowiki>'''frac'''<nowiki>}}</nowiki></tt> is a template for expressing fractions with vertically-displaced numerators and denominators. The parameters, <tt>num</tt> and <tt>den</tt>, may have their namees forgone, and default to the first and second inputs, as one would expect. | ||
For instance, <tt><nowiki><tt>{{frac|-(b:{{=}}{{frac|b|2}}) | For instance, <tt><nowiki><tt>{{frac|-(b:{{=}}{{frac|b|2}}) ± {{sqrt|b<sup>2</sup>-a*c}}|a}}</tt></nowiki></tt> becomes <tt>{{frac|-(b:{{=}}{{frac|b|2}}) ± {{sqrt|b<sup>2</sup>-a*c}}|a}}</tt>. | ||
You must separate it with a space between each <tt>+</tt> or <tt>-</tt>, lest the symbol appear to be connected with the line, for instance <tt>{{frac|1+x<sup>2</sup>|1-x<sup>2</sup>}} = {{frac|1|1-x}} + {{frac|1|1+x}} - 1</tt> instead of <tt>{{frac|1|1-x}}+{{frac|1|1+x}}-1</tt>. (May render differently on some devices) | |||
:<tt>φ=1+{{frac|1|1+{{frac|1|1+{{frac|1|1+...}}}}}}</tt> | |||
</noinclude> | The surrounding text aligns with the line of separation, so continued (and otherwise nested) fractions work. | ||
:<tt>φ = 1 + {{frac|1|1 + {{frac|1|1 + {{frac|1|1 + ...}}}}}}</tt>{{DISPLAYTITLE:Template:frac}}</noinclude> | |||
Latest revision as of 13:40, 2 September 2023
{{frac}} is a template for expressing fractions with vertically-displaced numerators and denominators. The parameters, num and den, may have their namees forgone, and default to the first and second inputs, as one would expect.
For instance, <tt>{{frac|-(b:{{=}}{{frac|b|2}}) ± {{sqrt|b<sup>2</sup>-a*c}}|a}}</tt> becomes -(b:=b2) ± √b2-a*ca.
You must separate it with a space between each + or -, lest the symbol appear to be connected with the line, for instance 1+x21-x2 = 11-x + 11+x - 1 instead of 11-x+11+x-1. (May render differently on some devices)
The surrounding text aligns with the line of separation, so continued (and otherwise nested) fractions work.
- φ = 1 + 11 + 11 + 11 + ...