Template:Chembox/doc
This is a documentation subpage for Template:Chembox. It contains usage information, categories and other content that is not part of the original template page. |
Template {{Chembox}}
is an infobox for chemicals. It has a large number of options to add relevant data and images. The infobox is organized in sections like "identifiers" and "hazards".
Usage
The Chembox has a modular design. After the general information like the chemical name and images, it can be built from multiple sections, each covering a group of information (like "pharmacology"). Depending on the compound, sections can be added or left out, and within a section parameters can be added or omitted (left blank).
The sections and their parameters are listed below.
Within the general chembox template (with its own parameters like |ImageFile=
and |IUPACName=
), each section is added with this pattern (as the value of a parameter |Sectionx=
.
<syntaxhighlight lang="wikitext">
Chembox/doc | |
---|---|
Except where noted otherwise, data are given for materials in their standard state (at 25 °C, 100 kPa) |
</syntaxhighlight>
In this format, spaces and new lines have no meaning and can be used freely to separate sections (though within a data value, a space has a meaning, except generally leading and trailing spaces).
Each section has its own number in |Section#=
. Then a section is defined with "|Section# = {{Chembox "
and ends with "}}"
. Sections cannot 'nest': one must close one section with }}
before adding another |Section#= {{Chembox ...
.
Keep in mind the advice in the main Infobox documentation to use the {{Unbulleted list}} template to present multiple values for a parameter so as to ensure that the values are each started on a new line and tagged appropriately in the underlying markup. This is particularly important with parameters like |OtherNames=
, since many names use commas within them, and using commas as separators leads to ambiguity. For example:
<syntaxhighlight lang="wikitext" style="overflow: auto">
| OtherNames =
- 2,4,6(1H,3H,5H)-pyrimidinetrione
- 2,4,6-trioxohexahydropyrimidine
- pyrimidinetriol
- malonylurea
- 6-hydroxyuracil
- N,N-(1,3-dioxo-1,3-propanediyl)urea
| (nextparameter)= </syntaxhighlight>
Small, simple form
To use, simply copy and paste the left column into the document, filling in whatever you can, and save:
<syntaxhighlight lang="wikitext" style="overflow: auto">
</syntaxhighlight> |
Medium form
To use, simply copy and paste the left column into the document, filling in whatever you can:
<syntaxhighlight lang="wikitext">
</syntaxhighlight> |
. Reference, use |
Full form
To use, simply copy and paste the left column into the document, and press save to get an empty Chembox:
Long parameter list for {{Chembox}}
| ||||||
---|---|---|---|---|---|---|
|
Indexed parameters
<syntaxhighlight lang="wikitext"> | CASNo = | CASNo1 = | CASNo2 = | CASNo3 = | CASNo4 = | CASNo5 = | CASNoOther = </syntaxhighlight>
Indexed parameters
| ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Overview |
CASNo = | CASNo1 = | CASNo5 = | CASNoOther = | ChEBI = | ChEBI1 = | ChEBI5 = | ChEBIOther = | ChEMBL = | ChEMBL1 = | ChEMBL5 = | ChEMBLOther = | ChemSpiderID = | ChemSpiderID1 = | ChemSpiderID5 = | ChemSpiderIDOther = | DrugBank = | DrugBank1 = | DrugBank5 = | DrugBankOther = | InChI = | InChI1 = | InChI5 = | InChIOther = | KEGG = | KEGG1 = | KEGG5 = | KEGGOther = | PubChem = | PubChem1 = | PubChem5 = | PubChemOther = | SMILES = | SMILES1 = | SMILES5 = | SMILESOther = | UNII = | UNII1 = | UNII5 = | UNIIOther = | 3DMet= | 3DMet1= | 3DMet5= | 3DMetOther= | EC_number1= | EC_number5= | EC_numberOther= | RTECS1= | RTECS5= | RTECSOther=
</syntaxhighlight> |
Indexed parameters take indexes 'blank', 1–5 (six options together). They should have straight input, such as a correct CAS Registry Number.
- Eight base parameters are indexed this way, all identifiers:
CASNo, ChEBI, ChEMBL, ChemSpiderID, DrugBank, InChI, KEGG, PubChem, SMILES, UNII, 3DMet, EC_number, RTECS
- Then
|_Other=
(like|CASNoOther=
) is available for free text input.
Same substance, same index
When the chembox has multiple substances, you can use the index. Make sure that |CASNo3=
and |SMILES3=
are about the same substance, and |CASNo3=
and |SMILES2=
are not. Treat index "0" the same way:
|CASNo=
is|InChI=
is|SMILES=
|CASNo1=
is|InChI1=
is|SMILES1=
|CASNo=
is not|InChI1=
is not|SMILES4=
Labeling the substances
By using a parameter like |index2_label=
, you can prefix every #2-input with that same prefix.
<syntaxhighlight lang="wikitext">
Linalool | |
---|---|
Identifiers | |
CAS number | |
PubChem | |
Except where noted otherwise, data are given for materials in their standard state (at 25 °C, 100 kPa) |
Linalool | |
---|---|
Identifiers | |
CAS number | |
PubChem | |
Except where noted otherwise, data are given for materials in their standard state (at 25 °C, 100 kPa) |
- For specific additions, each parameter has a
|_Comment=
option.
<syntaxhighlight lang="wikitext"> | CASNo_Comment = | CASNo1_Comment = | CASNo5_Comment =
</syntaxhighlight>- Use of the
|CASNo_Ref={{cascite|correct|CAS}}
parameter with argument places a small, green check mark, , after the CAS No., which indicates that an editor has confirmed that the CAS No. is correct. A red x in an infobox that follows any identifier means it has not been verified. See WP:CHEMVAL for more details.
Section subtemplates
The following section subtemplates are available:
- {{Chembox Identifiers}}
- {{Chembox Properties}}
- {{Chembox Structure}}
- {{Chembox Thermochemistry}}
- {{Chembox Explosive}}
- {{Chembox Pharmacology}}
- {{Chembox Hazards}}
- {{Chembox Related}}
And the automated section, that is visible when 'pagename (data page)' exists:
See these subsections for their parameter options.
The order of these sections in the infobox is set by the section number (|Section#=
) only. Not by the typed sequence. This documentation keeps this arbitrary order:
<syntaxhighlight lang="wikitext">
| Section1 =
| Section2 =
| Section3 = | Section4 = | Section5 = | Section6 = | Section7 =
| Section9 = </syntaxhighlight> Sections that are not used can be safely removed, renumbering is not necessary.
Container only
{{Chembox}} can be used to show a subsection only, for example <syntaxhighlight lang="text" enclose="none">Section3={{Chembox Hazards|...}}</syntaxhighlight>
. When set |container_only=yes
: The main {{Chembox}} is not tracked at all (image checks, bot validation categories, etc.), and the Footer (with STP notice) is suppressed. Example: Bromine#Biological role and toxicity. The article will be listed in Category:Chembox container only (0).
Automatic generation
The Wikipedia Drugbox and Chembox Maker can be used to automatically generate chembox templates. For quicker access, this tool can be added to the tools section of Wikipedia's left sidebar via User:Qwerfjkl/scripts/chemboxmaker. The Wikipedia template filling tool by Diberri and Boghog is another option for automatic chembox generation but fills fewer fields.
Adding images
Parameters
Image parameters for the first images: <syntaxhighlight lang="wikitext">
Chembox/doc | |
---|---|
Except where noted otherwise, data are given for materials in their standard state (at 25 °C, 100 kPa) |
</syntaxhighlight>
Examples
Image parameters for an image (example: File1). All are optional.
Chembox/doc | |
---|---|
Except where noted otherwise, data are given for materials in their standard state (at 25 °C, 100 kPa) |
<syntaxhighlight lang="wikitext" style="overflow: auto">
Chembox/doc | |
---|---|
Except where noted otherwise, data are given for materials in their standard state (at 25 °C, 100 kPa) |
</syntaxhighlight>
Adding two images:
Chembox/doc | |
---|---|
Except where noted otherwise, data are given for materials in their standard state (at 25 °C, 100 kPa) |
<syntaxhighlight lang="wikitext" style="overflow: auto">
Chembox/doc | |
---|---|
Except where noted otherwise, data are given for materials in their standard state (at 25 °C, 100 kPa) |
</syntaxhighlight>
This gives two images, each image on his own row (note, ImageFile is the first image, ImageFile1 is the second).
Adding two images, side by side (L1 and R1):
Chembox/doc | |
---|---|
Except where noted otherwise, data are given for materials in their standard state (at 25 °C, 100 kPa) |
<syntaxhighlight lang="wikitext" style="overflow: auto">
Chembox/doc | |
---|---|
Except where noted otherwise, data are given for materials in their standard state (at 25 °C, 100 kPa) |
</syntaxhighlight>
This gives one row with two images. Note that ImageFile is now not supplied.
Multiple images
row 1 | ImageFile | |
row 2 | ImageFile1 | |
row 3 | ImageFileL1 | ImageFileR1 |
row 4 | ImageFile2 | |
row 5 | ImageFileL2 | ImageFileR2 |
row 6 | ImageFile3 | |
row 7 | ImageFileL3 | ImageFileR3 |
This gives the possibility to play a bit with which image is first (rows with empty parameters are not displayed). Example:
Chembox/doc | |
---|---|
IUPAC name | example |
Except where noted otherwise, data are given for materials in their standard state (at 25 °C, 100 kPa) |
<syntaxhighlight lang="wikitext" style="overflow: auto">
Chembox/doc | |
---|---|
IUPAC name | example |
Except where noted otherwise, data are given for materials in their standard state (at 25 °C, 100 kPa) |
</syntaxhighlight>
This gives one row with two images, and one row with one image.
Names
<syntaxhighlight lang="wikitext">
</syntaxhighlight> |
Infobox title (Pagetitle is default) IUPAC name Using -s makes section header plural Preferred IUPAC name Systematic IUPAC name List of all other name(s) |
Example
cis-3-Hexen-1-ol | |
---|---|
Other names |
|
Except where noted otherwise, data are given for materials in their standard state (at 25 °C, 100 kPa) |
<syntaxhighlight lang="wikitext">
cis-3-Hexen-1-ol | |
---|---|
Other names |
|
Except where noted otherwise, data are given for materials in their standard state (at 25 °C, 100 kPa) |
</syntaxhighlight>
Input from Wikidata
E number, ECHA InfoCard ID, |DTXSID=
(CompTox Chemicals Dashboard) are read from Wikidata.
Maintenance
Troubleshooting
- When supplying a parameter with a value, and nothing or the wrong value shows up, check:
- Is the parameter placed in the correct section?
- Are the sections properly defined? Sections start with | Section# = {{Chembox sectionname |" and end with "}}".
- Is there inconsistency in the Section numbering? Available numbers for sections are 1–9.
Tracking categories
TemplateData
TemplateData for Chembox
<templatedata>
{
"description": "An infobox for chemicals. It has a large number of options to add relevant data and images. The Chembox has a modular design. After the general information like the chemical name and images, it can be built from multiple sections, each covering a group of information (like \"pharmacology\"). Depending on the compound, sections can be added or left out, and within a section parameters can be added or omitted (left blank). Please see this template's page for full documentation.",
"format": "Template:\n\n",
"params": {
"width": {
"label": "Width",
"description": "The overall width of the box; the default is normally fine. Using the unit \"em\" helps the box scale for different font sizes.",
"example": "22 em",
"default": "22 em"
},
"style": {
"label": "Custom CSS",
"description": "Any additional CSS to apply to the box; see the width parameter to set the width."
},
"Name": {
"label": "Name",
"description": "Compound name for the chembox's title. Defaults to the page title.",
"example": "Ethanoic acid",
"type": "string",
"default": "Page title.",
"suggested": true
},
"Reference": {
"label": "Title reference",
"description": "A reference to be shown in the title. Use <ref> tags or equivalent, such as
"type": "content",
"suggested": true
},
"IUPACName": {
"label": "IUPAC name",
"description": "For a single name. Use IUPAC names for a plural.",
"type": "content",
"suggested": true
},
"IUPACNames": {
"label": "IUPAC names",
"description": "For multiple names. Use IUPAC name for the singular.",
"type": "content"
},
"PIN": {
"label": "Preferred IUPAC name",
"type": "content"
},
"SystematicName": {
"label": "Systematic IUPAC name",
"type": "content",
"suggested": true
},
"Names_ref": {
"label": "Names reference",
"description": "A reference for the names. Use <ref> tags or equivalent such as |