Line 1,078: |
Line 1,078: |
| |} | | |} |
| | | |
− | ==Next== | + | == Color == |
| + | Equations can use color with the <code>\color</code> command. The default [[Wikipedia:Texvc|Texvc]] renderer and the [[MathJax]] renderers have different syntaxes to support both use <code>{\color{Blue}{text}}</code>. For example |
| + | * <source lang="text" enclose="none">{\color{Blue}{x^2}}+{\color{Orange}{2x}}-{\color{LimeGreen}{1}}</source> |
| + | *: <math>{\color{Blue}{x^2}}+{\color{Orange}{2x}}-{\color{LimeGreen}{1}}</math> |
| + | * <source lang="text" enclose="none">x_{1,2}=\frac{{\color{Blue}{-b}}\pm\sqrt{\color{Red}{b^2-4ac}}}{\color{Green}{2a}}</source> |
| + | *: <math>x_{1,2}=\frac{{\color{Blue}{-b}}\pm\sqrt{\color{Red}{b^2-4ac}}}{\color{Green}{2a}}</math> |
| + | There are several alternate notations styles |
| + | * <source lang="text" enclose="none">{\color{Blue}x^2}+{\color{Orange}2x}-{\color{LimeGreen}1}</source> works with both texvc and MathJax |
| + | *: <math>{\color{Blue}x^2}+{\color{Orange}2x}-{\color{LimeGreen}1}</math> |
| + | * <source lang="text" enclose="none">\color{Blue}x^2\color{Black}+\color{Orange}2x\color{Black}-\color{LimeGreen}1</source> works with both texvc and MathJax |
| + | *: <math>\color{Blue}x^2\color{Black}+\color{Orange}2x\color{Black}-\color{LimeGreen}1</math> |
| + | * <source lang="text" enclose="none">\color{Blue}{x^2}+\color{Orange}{2x}-\color{LimeGreen}{1}</source> only works with MathJax |
| + | *: <math>\color{Blue}{x^2}+\color{Orange}{2x}-\color{LimeGreen}{1}</math> |
| + | |
| + | Some color names are predeclared according to the following table, you can use them directly for the rendering of formulas (or for declaring the intended color of the page background). |
| + | |
| + | {| class="wikitable" |
| + | |+ Colors supported |
| + | |- |
| + | | <math>\color{Blue}{\text{Blue}}</math> || <math>\color{BlueGreen}{\text{BlueGreen}}</math> || <math>\color{BlueViolet}{\text{BlueViolet}}</math> || <math>\color{BrickRed}{\text{BrickRed}}</math> |
| + | |- |
| + | | <math>\color{Brown}{\text{Brown}}</math> || <math>\color{BurntOrange}{\text{BurntOrange}}</math> || <math>\color{CadetBlue}{\text{CadetBlue}}</math> || <math>\color{CarnationPink}{\text{CarnationPink}}</math> |
| + | |- |
| + | | <math>\color{DarkOrchid}{\text{DarkOrchid}}</math> || <math>\color{Emerald}{\text{Emerald}}</math> || <math>\color{ForestGreen}{\text{ForestGreen}}</math> || <math>\color{Fuchsia}{\text{Fuchsia}}</math> |
| + | |- |
| + | | <math>\color{Mahogany}{\text{Mahogany}}</math> || <math>\color{Maroon}{\text{Maroon}}</math> || <math>\color{Melon}{\text{Melon}}</math> || <math>\color{MidnightBlue}{\text{MidnightBlue}}</math> |
| + | |- |
| + | | <math>\color{Mulberry}{\text{Mulberry}}</math> || <math>\color{NavyBlue}{\text{NavyBlue}}</math> || <math>\color{OliveGreen}{\text{OliveGreen}}</math> || <math>\color{Orange}{\text{Orange}}</math> |
| + | |- |
| + | | <math>\color{OrangeRed}{\text{OrangeRed}}</math> || <math>\color{Orchid}{\text{Orchid}}</math> || <math>\color{Peach}{\text{Peach}}</math> || <math>\color{Periwinkle}{\text{Periwinkle}}</math> |
| + | |- |
| + | | <math>\color{PineGreen}{\text{PineGreen}}</math> || <math>\color{Plum}{\text{Plum}}</math> || <math>\color{ProcessBlue}{\text{ProcessBlue}}</math> || <math>\color{Purple}{\text{Purple}}</math> |
| + | |- |
| + | | <math>\color{RawSienna}{\text{RawSienna}}</math> || <math>\color{Red}{\text{Red}}</math> || <math>\color{RedOrange}{\text{RedOrange}}</math> || <math>\color{RedViolet}{\text{RedViolet}}</math> |
| + | |- |
| + | | <math>\color{Rhodamine}{\text{Rhodamine}}</math> || <math>\color{RoyalBlue}{\text{RoyalBlue}}</math> || <math>\color{RoyalPurple}{\text{RoyalPurple}}</math> || <math>\color{RubineRed}{\text{RubineRed}}</math> |
| + | |- |
| + | | <math>\color{Salmon}{\text{Salmon}}</math> || <math>\color{SeaGreen}{\text{SeaGreen}}</math> || <math>\color{Sepia}{\text{Sepia}}</math> || <math>\color{SkyBlue}{\text{SkyBlue}}</math> |
| + | |} |
| + | |
| + | Note that color should not be used as the ''only'' way to identify something, because it will become meaningless on black-and-white media or for color-blind people. See [[Wikipedia:Manual of Style (accessibility)#Color]]. |
| + | |
| + | Custom colours can be defined using |
| + | <syntaxhighlight lang="latex">\definecolor{myorange}{RGB}{255,165,100}\color{myorange}e^{i \pi}\color{Black} + 1 = 0</syntaxhighlight> |
| + | |
| + | :<math>\definecolor{myorange}{RGB}{255,165,100}\color{myorange}e^{i \pi}\color{Black} + 1 = 0</math> |
| + | |
| + | == Formatting issues == |
| + | |
| + | === Spacing === |
| + | |
| + | Note that {{TeX}} handles most spacing automatically, but you may sometimes want manual control. |
| + | |
| + | {| class="wikitable" |
| + | ! Feature |
| + | ! Syntax |
| + | ! How it looks rendered |
| + | |- |
| + | | double quad space |
| + | | <source lang="latex" enclose="none">a \qquad b</source> |
| + | | <math>a \qquad b</math> |
| + | |- |
| + | | quad space |
| + | | <source lang="latex" enclose="none">a \quad b</source> |
| + | | <math>a \quad b</math> |
| + | |- |
| + | | text space |
| + | | <source lang="latex" enclose="none">a\ b</source> |
| + | | <math>a\ b</math> |
| + | |- |
| + | | text space without PNG conversion |
| + | | <source lang="latex" enclose="none">a \mbox{ } b</source> |
| + | | <math>a \mbox{ } b</math> |
| + | |- |
| + | | large space |
| + | | <source lang="latex" enclose="none">a\;b</source> |
| + | | <math>a\;b</math> |
| + | |- |
| + | | medium space |
| + | | <source lang="latex" enclose="none">a\<b</source> |
| + | | [not supported] |
| + | |- |
| + | | small space |
| + | | <source lang="latex" enclose="none">a\,b</source> |
| + | | <math>a\,b</math> |
| + | |- |
| + | | tiny space (use for multiplication of factors) |
| + | | <source lang="latex" enclose="none">ab</source> |
| + | | <math>ab</math> |
| + | |- |
| + | | no space (use for multi-letter variables) |
| + | | <source lang="latex" enclose="none">\mathit{ab}</source> |
| + | | <math>\mathit{ab}</math> |
| + | |- |
| + | | small negative space |
| + | | <source lang="latex" enclose="none">a\!b</source> |
| + | | <math>a\!b</math> |
| + | |} |
| + | |
| + | Automatic spacing may be broken in very long expressions (because they produce an overfull hbox in {{TeX}}): |
| + | |
| + | : <source lang="latex" enclose="none">0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+\cdots</source> |
| + | : <math>0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+\cdots</math> |
| + | |
| + | This can be remedied by putting a pair of braces { } around the whole expression: |
| + | |
| + | : <source lang="latex" enclose="none">{0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+\cdots}</source> |
| + | : <math>{0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+\cdots}</math> |
| + | |
| + | === Alignment with normal text flow === |
| + | |
| + | Due to the default CSS |
| + | |
| + | <source lang="CSS">img.tex { vertical-align: middle; }</source> |
| + | |
| + | an inline expression like <math>\int_{-N}^{N} e^x\, dx</math> should look good. |
| + | |
| + | If you need to align it otherwise, use <code><nowiki><math style="vertical-align:-100%;">...</math></nowiki></code> and play with the <source lang="latex" enclose="none">vertical-align</source> argument until you get it right; however, how it looks may depend on the browser and the browser settings. |
| + | |
| + | Also note that if you rely on this workaround, if/when the rendering on the server gets fixed in future releases, as a result of this extra manual offset your formulae will suddenly be aligned incorrectly. So use it sparingly, if at all. |