使用方法/chem:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
无编辑摘要
Kangkk​(留言 | 贡献)
第3行: 第3行:


==Chemistry==
==Chemistry==
<!-- 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>
* <nowiki><chem>...</chem></nowiki>(是已弃用的别名)<nowiki><ce>...</ce></nowiki>
(where <code>X</code> is a chemical sum formula)
* <nowiki><math chem>...</math></nowiki>
* <nowiki>{{chem}}</nowiki> 和 <nowiki>{{chem2}}</nowiki>,需要模板支持


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].
{{Warning|
请注意,MediaWiki中的mhchem支持仍然存在主要问题。通过启用扩展功能并使用格式化单个项目,可以解决某些问题。例如, <nowiki><math chem>\ce</nowiki>


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].
{{leftrightflex|
 
<pre>
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.
<math chem>\ce{pIC_{50}} = -\log_{10} \ce{(IC_{50})}</math></pre>
 
|
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>}}
<math chem>\ce{pIC_{50}} = -\log_{10} \ce{(IC_{50})}</math>
}}
}}


===Molecular and condensed formula===
===Molecular and condensed formula===
{|class="wikitable" style="text-align:center"
{|class="wikitable" style="text-align:center"
! mhchem !! {{tlx|chem}} !! {{tlx|chem2}} !! Equivalent HTML
! mhchem !! Equivalent HTML
|-
|-
|style="vertical-align:bottom"|
|style="vertical-align:bottom"|
第31行: 第31行:
}}
}}
|class="mw-collapsible mw-collapsed"|
|class="mw-collapsible mw-collapsed"|
{{automarkup
{{markup
|{{((}}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
  |H<sub>2</sub>O
  |Sb<sub>2</sub>O<sub>3</sub>
  |Sb<sub>2</sub>O<sub>3</sub>