Шаблон:Frac
{{#if:
|{{{1}}} {{{2}}}⁄{{{3}}}
|{{#if:
|{{{1}}}⁄{{{2}}}
|{{#if:
|1⁄{{{1}}}
|⁄
}}
}}
}}
{{#ifeq:frac |док
|
{{#ifeq:show |show
|| Ово је документациона подстраница за Шаблон:Frac. Садржи информације о коришћењу, категоријама и другом садржају који није део оригиналне странице. |
}}{{#if: |
| {{#ifexist:Шаблон:Frac
| [[Категорија:Документација {{#switch:Шаблон |Шаблон=шаблона |Модул=модула |Корисник=корисничких страница |#default=Википедије}}]]
|
}}
}}
|
}}
This template builds an alternative form of common fractions. The template takes one, two, or three parameters: the optional integer (may be signed), the optional numerator and the required denominator; in this order.
Please do not subst:itute it. This template should not be used in science or mathematical articles, per MOS:FRAC and MOS:MATH#Fractions; use {{sfrac}} instead. To allow numerical sorting of a column containing fractions, use {{sortfrac}} instead. It is a combination of this template and {{sort}}.
{{frac|A|B|C}}- {{#if:C
|A B⁄C
|{{#if:B
|A⁄B
|{{#if:A
|1⁄A
|⁄
}}
}}
}} (integer, numerator and denominator)
{{frac|A|B}}- {{#if:
|A B⁄{{{3}}}
|{{#if:B
|A⁄B
|{{#if:A
|1⁄A
|⁄
}}
}}
}} (numerator and denominator)
{{frac|A}}- {{#if:
|A {{{2}}}⁄{{{3}}}
|{{#if:
|A⁄{{{2}}}
|{{#if:A
|1⁄A
|⁄
}}
}}
}} (denominator only)
{{frac}}- {{#if:
|{{{1}}} {{{2}}}⁄{{{3}}}
|{{#if:
|{{{1}}}⁄{{{2}}}
|{{#if:
|1⁄{{{1}}}
|⁄
}}
}}
}} (fraction slash only)
Examples
- Numbers
- {{#if:
|2 {{{2}}}⁄{{{3}}}
|{{#if:
|2⁄{{{2}}}
|{{#if:2
|1⁄2
|⁄
}}
}}
}} {{#if:
|3 {{{2}}}⁄{{{3}}}
|{{#if:
|3⁄{{{2}}}
|{{#if:3
|1⁄3
|⁄
}}
}}
}} {{#if:
|2 3⁄{{{3}}}
|{{#if:3
|2⁄3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|1⁄8
|⁄
}}
}}
}} {{#if:
|3 8⁄{{{3}}}
|{{#if:8
|3⁄8
|{{#if:3
|1⁄3
|⁄
}}
}}
}} {{#if:
|5 8⁄{{{3}}}
|{{#if:8
|5⁄8
|{{#if:5
|1⁄5
|⁄
}}
}}
}} {{#if:
|7 8⁄{{{3}}}
|{{#if:8
|7⁄8
|{{#if:7
|1⁄7
|⁄
}}
}}
}} {{#if:
|16 {{{2}}}⁄{{{3}}}
|{{#if:
|16⁄{{{2}}}
|{{#if:16
|1⁄16
|⁄
}}
}}
}} {{#if:
|3 16⁄{{{3}}}
|{{#if:16
|3⁄16
|{{#if:3
|1⁄3
|⁄
}}
}}
}} {{#if:
|5 16⁄{{{3}}}
|{{#if:16
|5⁄16
|{{#if:5
|1⁄5
|⁄
}}
}}
}} {{#if:
|7 16⁄{{{3}}}
|{{#if:16
|7⁄16
|{{#if:7
|1⁄7
|⁄
}}
}}
}} {{#if:
|9 16⁄{{{3}}}
|{{#if:16
|9⁄16
|{{#if:9
|1⁄9
|⁄
}}
}}
}} {{#if:
|11 16⁄{{{3}}}
|{{#if:16
|11⁄16
|{{#if:11
|1⁄11
|⁄
}}
}}
}} {{#if:
|13 16⁄{{{3}}}
|{{#if:16
|13⁄16
|{{#if:13
|1⁄13
|⁄
}}
}}
}} {{#if:
|15 16⁄{{{3}}}
|{{#if:16
|15⁄16
|{{#if:15
|1⁄15
|⁄
}}
}}
}}
- Units
- {{#if:
|m s⁄{{{3}}}
|{{#if:s
|m⁄s
|{{#if:m
|1⁄m
|⁄
}}
}}
}} {{#if:
|km h⁄{{{3}}}
|{{#if:h
|km⁄h
|{{#if:km
|1⁄km
|⁄
}}
}}
}} {{#if:
|kg·m s²⁄{{{3}}}
|{{#if:s²
|kg·m⁄s²
|{{#if:kg·m
|1⁄kg·m
|⁄
}}
}}
}} {{#if:
|s {{{2}}}⁄{{{3}}}
|{{#if:
|s⁄{{{2}}}
|{{#if:s
|1⁄s
|⁄
}}
}}
}} {{#if:
|Mbit s⁄{{{3}}}
|{{#if:s
|Mbit⁄s
|{{#if:Mbit
|1⁄Mbit
|⁄
}}
}}
}}
Notes
{{frac}}or⁄may be used to print out the fraction slash glyph " ⁄ ".
Parameters
TemplateData за Frac
}} <templatedata>{ "description": "A template for displaying common fractions of the form int+num/den nicely. It supports 0–3 anonymous parameters with positional meaning.", "params": { "1": {
"label": "leftmost part", "description": "Denominator if only parameter supplied. Numerator if 2 parameters supplied. Integer if 3 parameters supplied. If no parameter is specified the template will render a fraction slash only.", "type": "string/line", "required": false
}, "2": {
"label": "middle-right part", "description": "Denominator if 2 parameters supplied. Numerator if 3 parameters supplied.", "inherits": "1"
}, "3": {
"label": "rightmost part", "description": "Denominator, always.", "inherits": "1"
} }}</templatedata>
See also
- Wikipedia:Rendering math
- {{1/2}} ({{#if:
|1 2⁄{{{3}}}
|{{#if:2
|1⁄2
|{{#if:1
|1⁄1
|⁄
}}
}}
}}), {{1/3}}, {{2/3}}, {{1/4}}, {{3/4}} – shorthands that use this template
- {{sfrac}} (2 <span}} style="display:inline-block; vertical-align:-0.5em; font-size:85%; text-align:center;">{{#if:|{{{2}}}|{{#if:|2|1}}}}/2{{#if:|}}) – displays common fractions using a vinculum (horizontal line), for scientific and mathematical text
- {{su}} (superscript
subscript text) – to align both b=subscript & p=superscript - {{sub}} (subscript text) – to show a subscript
- {{sup}} (superscript text) – to show a superscript
- Help:Displaying a formula#Fractions, matrices, multilines
- Help:Convert#Fractions
{{#ifeq:Frac|Frac| }}