使用方法/chem:修订间差异
来自康健生活
无编辑摘要 |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
{{ | 有关显示化学符号的MediaWiki 解析器扩展标签 <ce>(重命名为<chem>),显示公式 Chemistry”。 | ||
< | |||
<chem>{ | |||
| | ==Chemistry== | ||
<chem>{ | <!-- this is linked from [[Template:Xtag]] -->{{shortcut|WP:MATHCHEM}} | ||
There are three ways to render chemical sum formulae as used in [[chemical equation]]s: | |||
*{{xtag|chem|p}} ({{xtag|ce|p}} is a deprecated alias for it) | |||
*{{xtag|math|p|params=chem}} | |||
*{{tlx|chem}} and {{tlx|chem2}} | |||
{{xtag|chem|p|content=X}} is short for <syntaxhighlight lang="xml" inline><math chem>\ce{X}</math></syntaxhighlight> | |||
(where <code>X</code> is a chemical sum formula) | |||
Technically, {{xtag|math|params=chem}} is a <code>math</code> tag with the extension <code>mhchem</code> enabled, according to the [http://mathjax.readthedocs.org/en/latest/tex.html#mhchem MathJax documentation]. | |||
Note, that the commands <code>\cee</code> and <code>\cf</code> are disabled, because they are marked as deprecated in the [http://www.ctan.org/pkg/mhchem mhchem LaTeX package documentation]. | |||
If the formula reaches a certain "complexity", spaces might be ignored (<code><nowiki><chem>A + B</chem></nowiki></code> might be rendered as if it were <code><nowiki><chem>A+B</chem></nowiki></code> with a positive charge). In that case, write <code><nowiki><chem>A{} + B</chem></nowiki></code> (and ''not'' <code><nowiki><chem>{A} + {B}</chem></nowiki></code> as was previously suggested). This will allow auto-cleaning of formulae once the bug will be fixed and/or a newer <code>mhchem</code> version will be used. | |||
Please note that there are still [https://phabricator.wikimedia.org/T140217 major issues] with mhchem support in MediaWiki. Some issue can be solved by enabling the extension using {{xtag|math|params=chem}} and formatting individual items with <code>\ce</code>. For example, {{markup2|m=<syntaxhighlight lang="tex" inline><math chem>\ce{pIC_{50}} = -\log_{10} \ce{(IC_{50})}</math></syntaxhighlight>|r=<math chem>\ce{pIC_{50}} = -\log_{10} \ce{(IC_{50})}</math>}} | |||
===Molecular and condensed formula=== | |||
{|class="wikitable" style="text-align:center" | |||
! mhchem !! {{tlx|chem}} !! {{tlx|chem2}} !! Equivalent HTML | |||
|- | |||
|style="vertical-align:bottom"| | |||
{{markup | |||
|<nowiki><chem>H2O</chem></nowiki>|<chem>H2O</chem> | |||
|<nowiki><chem>Sb2O3</chem></nowiki>|<chem>Sb2O3</chem> | |||
|<nowiki><chem>(NH4)2S</chem></nowiki>|<chem>(NH4)2S</chem> | |||
}} | |||
|class="mw-collapsible mw-collapsed"| | |||
{{automarkup | |||
|{{((}}chem{{!}}H{{!}}2{{!}}O{{))}} | |||
|{{((}}chem{{!}}Sb{{!}}2{{!}}O{{!}}3{{))}} | |||
|{{((}}chem{{!}}({{((}}chem{{!}}N{{!}}H{{!}}4{{))}}){{!}}2{{!}}S{{))}} | |||
}} | |||
|class="mw-collapsible mw-collapsed"| | |||
{{automarkup | |||
|{{((}}chem2{{!}}H2O{{))}} | |||
|{{((}}chem2{{!}}Sb2O3{{))}} | |||
|{{((}}chem2{{!}}(NH4)2S{{))}} | |||
}} | |||
|class="mw-collapsible mw-collapsed"| | |||
{{automarkup | |||
|H<sub>2</sub>O | |||
|Sb<sub>2</sub>O<sub>3</sub> | |||
|(NH<sub>4</sub>)<sub>2</sub>S | |||
}} | |||
|} | |||
===Bonds=== | |||
{|class="wikitable" style="text-align:center" | |||
! mhchem !! Equivalent {{tlx|chem}} and HTML !! {{tlx|chem2}} | |||
|- | |||
|style="vertical-align:bottom"| | |||
{{markup | |||
|<nowiki><chem>C6H5-CHO</chem></nowiki>|<chem>C6H5-CHO</chem> | |||
|<nowiki><chem>A-B=C#D</chem></nowiki>|<chem>A-B=C#D</chem> | |||
}} | |||
|class="mw-collapsible mw-collapsed"| | |||
{{markup | |||
|<nowiki>{{chem|C|6|H|5}}-CHO | |||
<br/> | |||
C<sub>6</sub>H<sub>5</sub>-CHO</nowiki> | |||
|{{chem|C|6|H|5}}-{{chem|C|H|O}} | |||
<br/> | |||
C<sub>6</sub>H<sub>5</sub>-CHO | |||
|A-B{{=}}C≡D | |||
|N/A | |||
}} | |||
|class="mw-collapsible mw-collapsed"| | |||
{{markup | |||
|<nowiki>{{chem2|C6H5\sCHO}}</nowiki> | |||
|{{chem2|C6H5\sCHO}} | |||
|<nowiki>{{chem2|1=A\sB=C≡D}}</nowiki> | |||
|{{chem2|1=A\sB=C≡D}} | |||
}} | |||
|} | |||
===Charges=== | |||
{|class="wikitable" style="text-align:center" | |||
! mhchem !! {{tlx|chem}} !! Equivalent HTML | |||
|- | |||
|style="vertical-align:bottom"| | |||
{{markup | |||
|<nowiki><chem>H+</chem></nowiki>|<chem>H+</chem> | |||
|<nowiki><chem>NO3-</chem></nowiki>|<chem>NO3-</chem> | |||
|<nowiki><chem>CrO4^2-</chem></nowiki>|<chem>CrO4^2-</chem> | |||
|<nowiki><chem>AgCl2-</chem></nowiki>|<chem>AgCl2-</chem> | |||
|<nowiki><chem>[AgCl2]-</chem></nowiki>|<chem>[AgCl2]-</chem> | |||
|<nowiki><chem>Y^99+</chem></nowiki> | |||
<nowiki><chem>Y^{99+}</chem></nowiki>|<chem>Y^99+</chem><br/><chem>Y^{99+}</chem> | |||
}} | |||
|class="mw-collapsible mw-collapsed"| | |||
{{automarkup | |||
|{{((}}chem{{!}}H{{!}}+{{))}} | |||
|{{((}}chem{{!}}N{{!}}O{{!}}3{{!}}-{{))}} | |||
|{{((}}chem{{!}}Cr{{!}}O{{!}}4{{!}}2-{{))}} | |||
|{{((}}chem{{!}}Ag{{!}}Cl{{!}}2{{!}}-{{))}} | |||
|{{((}}chem{{!}}[{{((}}chem{{!}}Ag{{!}}Cl{{!}}2{{))}}]{{!}}-{{))}} | |||
|{{((}}chem{{!}}Y{{!}}99+{{))}} | |||
}} | |||
|class="mw-collapsible mw-collapsed"| | |||
{{automarkup | |||
|H<sup>+</sup>|NO<sub>3</sub><sup>−</sup>|CrO<sub>4</sub><sup>2-</sup>|AgCl<sub>2</sub><sup>−</sup>|[AgCl<sub>2</sub>]<sup>−</sup>|Y<sup>99+</sup>}} | |||
|} | |||
===Addition compounds and stoichiometric numbers=== | |||
{|class="wikitable" style="text-align:center" | |||
! mhchem !! {{tlx|chem}} !! {{tlx|chem2}} | |||
|- | |||
|style="vertical-align:middle"| | |||
{{markup|style=vertical-align:middle | |||
|<nowiki><chem>MgSO4.7H2O</chem></nowiki>|<chem>MgSO4.7H2O</chem> | |||
|<nowiki><chem>KCr(SO4)2*12H2O</chem></nowiki>|<chem>KCr(SO4)2*12H2O</chem> | |||
|<nowiki><chem>CaSO4.1/2H2O + 1\!1/2 H2O -> CaSO4.2H2O</chem></nowiki>|<chem>CaSO4.1/2H2O + 1\!1/2 H2O -> CaSO4.2H2O</chem> | |||
|<nowiki><chem>25/2 O2 + C8H18 -> 8 CO2 + 9 H2O</chem></nowiki>|<chem>25/2 O2 + C8H18 -> 8 CO2 + 9 H2O</chem> | |||
}} | |||
|class="mw-collapsible mw-collapsed"| | |||
{{markup|style=vertical-align:middle | |||
|<syntaxhighlight lang="html" inline>{{chem|Mg|S|O|4}}·7{{chem|H|2|O}}</syntaxhighlight> | |||
|{{chem|Mg|S|O|4}}·7{{chem|H|2|O}} | |||
|<syntaxhighlight lang="html" inline>{{chem|K|Cr|({{chem|S|O|4}})|2}}·12{{chem|H|2|O}}</syntaxhighlight> | |||
|{{chem|K|Cr|({{chem|S|O|4}})|2}}·12{{chem|H|2|O}} | |||
|<syntaxhighlight lang="html" inline>{{chem|Ca|S|O|4}}·½{{chem|H|2|O}} + 1½{{chem|H|2|O}} → {{chem|Ca|S|O|4}}·2{{chem|H|2|O}}</syntaxhighlight> | |||
|{{chem|Ca|S|O|4}}·½{{chem|H|2|O}} + 1½{{chem|H|2|O}} → {{chem|Ca|S|O|4}}·2{{chem|H|2|O}} | |||
|<syntaxhighlight lang="html" inline>{{frac|25|2}}{{chem|O|2}} + {{chem|C|8|H|18}} → 8{{chem|C|O|2}} + 9{{chem|H|2|O}}</syntaxhighlight> | |||
|{{frac|25|2}}{{chem|O|2}} + {{chem|C|8|H|18}} → 8{{chem|C|O|2}} + 9{{chem|H|2|O}} | |||
}} | |||
|class="mw-collapsible mw-collapsed"| | |||
{{markup|style=vertical-align:middle | |||
|<nowiki>{{chem2|MgSO4*7H2O}}</nowiki>|{{chem2|MgSO4*7H2O}} | |||
|<nowiki>{{chem2|KCr(SO4)2*12H2O}}</nowiki>|{{chem2|KCr(SO4)2*12H2O}} | |||
|<nowiki>{{chem2|2CaSO4*H2O + 3H2O -> 2CaSO4*2H2O}}</nowiki>|{{chem2|2CaSO4*H2O + 3H2O -> 2CaSO4*2H2O}} | |||
|<nowiki>{{chem2|25 O2 + 2 C8H18 -> 16 CO2 + 18 H2O}}</nowiki>|{{chem2|25 O2 + 2 C8H18 -> 16 CO2 + 18 H2O}} | |||
}} | |||
|} | |||
===Wiki linking=== | |||
{|class="wikitable" style="width:100%" | |||
! {{tlx|chem}} | |||
|{{markupv|width=100%|style="vertical-align:middle" | |||
|m=<nowiki>25 {{chem|link=oxygen|O|2}} + 2 {{chem|link=octane|C|8|H|18}} → 16 {{chem|link=Carbon dioxide|C|O|2}} + 9 {{chem|link=water|H|2|O}}</nowiki> | |||
|r=25 {{chem|link=oxygen|O|2}} + 2 {{chem|link=octane|C|8|H|18}} → 16 {{chem|link=Carbon dioxide|C|O|2}} + 9 {{chem|link=water|H|2|O}} | |||
}} | |||
|- | |||
! {{tlx|chem2}} | |||
|{{markupv|width=100%|style="vertical-align:middle" | |||
|m=<nowiki>{{chem2|25 [[oxygen|O2]] + 2 [[octane|C8H18]] -> 16 [[Carbon dioxide|CO2]] + 18 [[water|H2O]]}}</nowiki> | |||
|r={{chem2|25 [[oxygen|O2]] + 2 [[octane|C8H18]] -> 16 [[Carbon dioxide|CO2]] + 18 [[water|H2O]]}} | |||
}} | |||
|} | |||
===(Italic) Math=== | |||
{|class="wikitable" style="width:100%" | |||
! mhchem | |||
|{{markupv|width=100%|style="vertical-align:middle" | |||
|m=<syntaxhighlight lang="tex" inline><chem>{C_\mathit{x}H_\mathit{y}} + \mathit{z}O2 -> {\mathit{x}CO2} + \frac{\mathit{y}}{2}H2O</chem></syntaxhighlight> | |||
|r=<chem>{C_\mathit{x}H_\mathit{y}} + \mathit{z}O2 -> {\mathit{x}CO2} + \frac{\mathit{y}}{2}H2O</chem> | |||
}} | |||
|- | |||
! {{tlx|chem}} | |||
|{{markupv|width=100%|style="vertical-align:middle" | |||
|m=<nowiki>{{chem|C|''x''|H|''y''}} + ''z''{{chem|O|2}} → ''x''{{chem|C|O|2}} + {{frac|''y''|2}}{{chem|H|2|O}}</nowiki> | |||
|r={{chem|C|''x''|H|''y''}} + ''z''{{chem|O|2}} → ''x''{{chem|C|O|2}} + {{frac|''y''|2}}{{chem|H|2|O}} | |||
}} | |||
|} | |||
===Oxidation states=== | |||
{|class="wikitable" style="text-align:center" | |||
! mhchem | |||
|style="vertical-align:bottom"| | |||
{{markupv | |||
|m=<nowiki><chem>Fe^{II}Fe^{III}2O4</chem></nowiki> | |||
|r=<chem>Fe^{II}Fe^{III}2O4</chem>}} | |||
|- | |||
! {{tlx|chem}} with {{tag|sup}} | |||
|{{markupv | |||
|m=<nowiki>{{chem|Fe|<sup>II</sup>|Fe|<sup>III</sup>|2|O|4}}</nowiki> | |||
|r={{chem|Fe|<sup>II</sup>|Fe|<sup>III</sup>|2|O|4}} | |||
}} | |||
|} | |||
===Greek characters=== | |||
{|class="wikitable" style="text-align:center;" | |||
! mhchem !! Equivalent {{tlx|chem}} and HTML | |||
|- | |||
|style="vertical-align:center;"| | |||
{{markup|style=vertical-align:center | |||
|<syntaxhighlight lang="tex" inline><chem>\mu-Cl</chem></syntaxhighlight>|<chem>\mu-Cl</chem> | |||
|<syntaxhighlight lang="tex" inline><chem>[Fe(\eta^5-C5H5)2]</chem></syntaxhighlight>|<chem>[Fe(\eta^5-C5H5)2]</chem> | |||
}} | |||
|class="mw-collapsible mw-collapsed"| | |||
{{markup|style=vertical-align:center | |||
|<syntaxhighlight lang="html" inline>''μ''-Cl</syntaxhighlight>|''μ''-Cl | |||
|<syntaxhighlight lang="html">[{{chem|Fe|(''η''<sup>5</sup>-{{chem|C|5|H|5}})|2}}] | |||
<br/> | |||
[Fe(''η''<sup>5</sup>-C<sub>5</sub>H<sub>5</sub>)<sub>2</sub>]</syntaxhighlight> | |||
|[{{chem|Fe|(''η''<sup>5</sup>-{{chem|C|5|H|5}})|2}}]<br/> | |||
[Fe(''η''<sup>5</sup>-C<sub>5</sub>H<sub>5</sub>)<sub>2</sub>] | |||
}} | |||
|} | |||
===Isotopes=== | |||
{|class="wikitable" style="text-align:center;" | |||
! mhchem !! Equivalent {{tlx|chem}} and HTML | |||
|- | |||
|style="vertical-align:center;"| | |||
{{markup|style=vertical-align:center | |||
|<syntaxhighlight lang="tex" inline><chem>^{227}_{90}Th+</chem></syntaxhighlight>|<chem>^{227}_{90}Th+</chem> | |||
|<syntaxhighlight lang="tex" inline><chem>^0_{-1}n-</chem></syntaxhighlight>|<chem>^0_{-1}n-</chem> | |||
}} | |||
|class="mw-collapsible mw-collapsed"| | |||
{{markup|style=vertical-align:center | |||
|<nowiki>{{chem|227|90|Th|+}}</nowiki>|{{chem|227|90|Th|+}} | |||
|<nowiki>{{chem|0|-1}}n<sup>−</sup></nowiki>|{{chem|0|-1}}n<sup>−</sup> | |||
}} | |||
|} | |||
===States=== | |||
States subscripting is not IUPAC recommendation. | |||
{|class="wikitable" style="text-align:center" | |||
! mhchem !! {{tlx|chem}} | |||
|- | |||
|style="vertical-align:bottom;"| | |||
{{markup | |||
|<nowiki><chem>H2_{(aq)}</chem> | |||
</nowiki>|<chem>H2_{(aq)}</chem> | |||
|<nowiki><chem>CO3^{2-}(aq)</chem> | |||
</nowiki>|<chem>CO3^{2-}(aq)</chem> | |||
}} | |||
|class="mw-collapsible mw-collapsed"| | |||
{{automarkup | |||
|{{((}}chem{{!}}H{{!}}2(aq){{))}} |{{((}}chem{{!}}C{{!}}O{{!}}3{{!}}2-{{))}}(aq) | |||
}} | |||
|} | |||
===[[Precipitate]]=== | |||
{|class="wikitable" style="width:100%" | |||
! mhchem | |||
|{{markupv|width=100%|style="vertical-align:middle" | |||
|m=<nowiki><chem>Ba^2+ + SO4^{2-} -> BaSO4(v)</chem></nowiki>|r=<chem>Ba^2+ + SO4^{2-} -> BaSO4(v)</chem>}} | |||
|- | |||
! {{tlx|chem}} | |||
|{{markupv|width=100%|style="vertical-align:middle" | |||
|m=<nowiki>{{chem|Ba|2+}} + {{chem|S|O|4|2-}} → {{chem|Ba|S|O|4}}↓</nowiki> | |||
|r={{chem|Ba|2+}} + {{chem|S|O|4|2-}} → {{chem|Ba|S|O|4}}↓ | |||
}} | |||
|- | |||
! {{tlx|chem2}} | |||
|{{markupv|width=100%|style="vertical-align:middle" | |||
|m=<nowiki>{{chem2|Ba(2+) + SO4(2-) -> BaSO4↓}}</nowiki> | |||
|r={{chem2|Ba(2+) + SO4(2-) -> BaSO4↓}} | |||
}} | |||
|- | |||
! Equivalent HTML | |||
|{{markupv|width=100%|style="vertical-align:middle" | |||
|m=<syntaxhighlight lang="html" inline>Ba<sup>2+</sup> + SO<sub>4</sub><sup>2−</sup> → BaSO<sub>4</sub>↓</syntaxhighlight> | |||
|r=Ba<sup>2+</sup> + SO<sub>4</sub><sup>2−</sup> → BaSO<sub>4</sub>↓ | |||
}} | |||
|} | |||
===Reaction arrows=== | |||
{{markup|style=vertical-align:middle | |||
|<nowiki><chem>A ->B</chem></nowiki> | |||
|<chem>A -> B</chem> | |||
|<nowiki><chem>A <- B</chem></nowiki> | |||
|<chem>A <- B</chem> | |||
|<nowiki><chem>A <=> B</chem></nowiki> | |||
|<chem>A <=> B</chem> | |||
|<nowiki><chem>A <=>> B</chem></nowiki> | |||
|<chem>A <=>> B</chem> | |||
|<nowiki><chem>A <<=> B</chem></nowiki> | |||
|<chem>A <<=> B</chem> | |||
|<syntaxhighlight lang="latex" inline><chem>A ->[{}\atop x] B</chem></syntaxhighlight> | |||
|<chem>A ->[{}\atop x] B</chem> | |||
|<syntaxhighlight lang="latex" inline><chem>A ->[\text{text above}][\text{text below}] B</chem></syntaxhighlight> | |||
|<chem>A ->[\text{text above}][\text{text below}] B</chem> | |||
|<syntaxhighlight lang="latex" inline><chem>A ->[{}\atop\ce{+H2O}] B</chem></syntaxhighlight> | |||
|<chem>A ->[{}\atop\ce{+H2O}] B</chem> | |||
}} | |||
==== Comparison of arrow symbols ==== | |||
{{markup | |||
|<nowiki><math>\rightarrow</math></nowiki>|<math>\rightarrow</math> | |||
|<nowiki><math>\rightleftarrows</math></nowiki>|<math>\rightleftarrows</math> | |||
|<nowiki><math>\rightleftharpoons</math></nowiki>|<math>\rightleftharpoons</math> | |||
|<nowiki><math>\leftrightarrow</math></nowiki>|<math>\leftrightarrow</math> | |||
|<nowiki><math>\longrightarrow</math> | |||
<chem>-></chem></nowiki>|<math>\longrightarrow</math><br/><chem>-></chem> | |||
|<nowiki><math>\rightleftharpoons</math></nowiki> | |||
<nowiki><chem><=></chem></nowiki>|<math>\rightleftharpoons</math><br/><chem><=></chem> | |||
|<nowiki><math>\longleftrightarrow</math> | |||
<chem><-></chem></nowiki>|<math>\longleftrightarrow</math><br/><chem><-></chem> | |||
}} | |||
===Further examples using ordinary LaTeX tags=== | |||
<syntaxhighlight lang="latex"> | |||
<math chem>\begin{align} | |||
\overbrace{\ce{2Fe3O4}}^{\text{magnetite}} + \ce{1/2 O2 ->}\ &{\color{Brown}\overbrace{\ce{3(\lambda{-}Fe2O3)}}^{\text{maghemite}}}\\ | |||
\underbrace{\ce{2Fe3O4}}_{\text{magnetite}} + \ce{1/2 O2 ->}\ &{\color{Red}\underbrace{\ce{3(\alpha{-}Fe2O3)}}_{\text{hematite}}} | |||
\end{align}</math> | |||
</syntaxhighlight> | |||
:<math chem>\begin{align} | |||
\overbrace{\ce{2Fe3O4}}^{\text{magnetite}} + \ce{1/2 O2 ->}\ &{\color{Brown}\overbrace{\ce{3(\lambda{-}Fe2O3)}}^{\text{maghemite}}}\\ | |||
\underbrace{\ce{2Fe3O4}}_{\text{magnetite}} + \ce{1/2 O2 ->}\ &{\color{BrickRed}\underbrace{\ce{3(\alpha{-}Fe2O3)}}_{\text{hematite}}} | |||
\end{align}</math> | |||
To align the equations or color them, use {{xtag|math chem}} and {{code|\ce}}. | |||
{{-}} | |||