Template talk:Chem2

(Redirected from Template talk:Chem2/testcases)
Latest comment: 4 months ago by JWBTH in topic We need to get rid of <br>

The {{chem2}} template works incorrectly on certain Wikipedia pages

edit

Why the {{chem2}} template works incorrectly on certain Wikipedia pages? This bug has nothing to do with browsers, operating systems or computer settings, it is a {{chem2}} template bug.

For example, the {{chem2|CO3(2−)}} and {{chem2|NO3−}} normally gives CO2−3 and NO3 respectively, but on certain pages (e.g., Trigonal planar molecular geometry, Caesium sesquioxide and all Search results pages) it crashes and gives CO2−3 and NO−3 respectively. What on this Earth is going on? Can someone correct this annoying bug? Bernardirfan (talk) 13:30, 18 August 2023 (UTC)Reply

Using chem2 inside the wikilink text seems to stuff up subsequent uses with charges over subscripts. Graeme Bartlett (talk) 21:38, 25 October 2023 (UTC)Reply
Even using {{chem2}} outside wikilink and outside anything, the same bug attacks randomly. Seems the {{chem2}} template crashes randomly on certain Wikipedia articles. Sometimes it crashes whenever I change the article outside the {{chem2}} templates, sometimes it crashes only when I press the "Show preview" button, sometimes it crashes both when I press the "Show preview" button and when I press the "Publish changes" button, sometimes it randomly crashes without any reason, just like that. Very wierd bug. Yes, I can use the {{chem}} template and <chem> element instead, but why not correct this annoying {{chem2}} bug in the first place. Bernardirfan (talk) 18:37, 9 December 2023 (UTC)Reply

Incorrect physical state notation

edit

Putting physical state (like solid, gaseous, aqueous) to lower index does not seem to be correct, and examples like

  • CH4(g)

should be fixed to

  • CH4(g)

(See e.g. IUPAC Red Book, IR-2.2.3.1, example 16.)

Mykhal (talk) 10:12, 2 October 2023 (UTC)Reply

As the problem was with doc page, I've already fixed it. —Mykhal (talk) 13:12, 2 October 2023 (UTC)Reply
I agree. I see there are so many incorrect physical state notations accross Wikipedia. As soon as I see such errors, I correct them immediately, according to the IUPAC Red Book. I will search for such errors and try to correct them one by one accros Wikipedia articles, because I like finding errors and correcting them. Dear editors, join us, you can correct them also. Bernardirfan (talk) 15:25, 18 October 2023 (UTC)Reply

Fractions

edit

I'm surprised no one has mentioned this yet, but stoichiometric fractions are a mess with this template. Simply putting in both numbers and a slash results in the following:

3 Me3SiCl + 3 Li + 1/2 N2 → (Me3Si)3N + 3 LiCl

A simple workaround I've seen is to put the numerator as a superscript:

3 Me3SiCl + 3 Li + 1/2 N2 → (Me3Si)3N + 3 LiCl

but this is very ugly IMO, at least compared to {{sfrac}}, 1/2, or its cousin {{frac}}, 12. Putting those templates into the chem2 template produces the following gnarly error:

3 Me3SiCl + 3 Li + '"`UNIQtemplatestyles00000020QINU`"'1<span class="sronly">/2 N2 → (Me3Si)3N + 3 LiCl

Sure, one could split the template up and include {{sfrac}} midway, but then you'd have to encase the whole thing in {{nowrap}} to ensure the equation doesn't line break when the webpage is made thin. Surely there's a way to code for this in the template directly? <chem> detects syntax like '1/2' and automatically renders it as a vertical fraction. User:Graeme Bartlett has told me off before for converting line equations to <chem>, but at least <chem> can present fractions simply, cleanly, and correctly without wacky workarounds:

 

Could something like this be implemented into chem2? I'd love to try my hand at fixing this issue rather than complain, but I'm afraid I have no idea where to even begin coding a template like this, much less edit one OlliverWithDoubleL (talk) 07:21, 25 October 2023 (UTC)Reply

I agree it would be good to get chem2 to support fractions nicely. It would be better than using 0.5 or doubling the numbers all around or using Unicode fractions. 1/2 covers most situations but there could be other factions coming up too. Graeme Bartlett (talk) 20:44, 25 October 2023 (UTC)Reply

Staggered Charges

edit

Isn't the IUPAC recommendation to stagger the charges? e.g. SO42-

See section 2.10.1 iv p51 of IUPAC (2007) Quantities, Units and Symbols in Physical Chemistry, Third Edition (The “Green Book”) https://iupac.org/wp-content/uploads/2019/05/IUPAC-GB3-2012-2ndPrinting-PDFsearchable.pdf

Ewen (talk) 13:11, 19 February 2024 (UTC)Reply

That ref is quite clear: "the staggered arrangement is now recommended", cited to:
  • N. G. Connelly, T. Damhus, R. M. Hartshorn, and A. T. Hutton, editors. Nomenclature of Inorganic Chemistry − IUPAC Recommendations 2005. The Royal Society of Chemistry, Cambridge, 2005.
and the current (2020) ACS Style Guide, §4.4.6 "Atoms & Molecules" (doi:10.1021/acsguide.40406) states "Stagger the subscript and superscript; do not align them. The subscript comes first with ionic charge." using "PO43-" as an example. DMacks (talk) 17:28, 19 February 2024 (UTC)Reply

Additional abbreviations

edit

Please add these fairly common abbreviations:

  • Me = 'Methyl group',
  • Bu = 'Butyl group',
  • Pn = 'Pentyl group',
  • Cp = 'Cyclopentadienyl',

Looking at Skeletal formula or other list, it's hard to say which other abbreviations should definitely be added. Many are rare. Many clash with atoms (Ac is actinium, so no acetyl. Pr is praseodymium, so no propyl.) -A876 (talk) 23:08, 3 December 2024 (UTC)Reply

  Done Primefac (talk) 14:40, 25 December 2024 (UTC)Reply

Copernicium named Cp not Cn?

edit

Hey, I'm translating the module into Icelandic and I noticed that Copernicium, element 112 is as Cp and not Cn in the module, see this image:

 

I'm putting it as Cn in the Icelandic translation since that's the correct one according to the wikipedia page on copernicium, https://en.wikipedia.org/wiki/Copernicium. Would be cool if somebody would fix this on here also, I can't because of the protection. Thanks :) Huldar98 (talk) 00:02, 18 December 2024 (UTC)Reply

Please change (in module:chem2):

	Cp = "Copernicium",

to

	Cn = "Copernicium",

per last comment and copernicium. Christian75 (talk) 02:33, 26 December 2024 (UTC)Reply

  Completed. P.I. Ellsworth , ed. put'er there 04:49, 26 December 2024 (UTC)Reply

We need to get rid of <br>

edit

Is there a way to get rid of <br> in this template?

  1. It interferes with selecting text using three clicks; see the screenshot from Nitrate#Dietary nitrate:
     
  2. The copied text becomes
    A source of nitrate in the human diets arises from the consumption of leafy green foods, such as spinach and arugula. NO−
    3 can be present in beetroot juice.
    I'm not sure what would be the preferred form of the text when copied (probably a special syntax like LaTeX in math templates), but "NO−[line break]3" makes no sense.

The same applies to {{chem}}. Jack who built the house (talk) 09:16, 11 April 2025 (UTC)Reply