Template talk:Chem

Protection & charges
This template should be protected soon, since almost 150 articles allready use it. Also, I would like to have a feature for writing charges (something like if you start the number with a + or a -, it will put it automatically as sup instead of sub). Or possibly add another option such as the link one, say charge, which will come automatically at the end as a superscript. Thanks, and great template. Nergaal (talk) 04:49, 30 January 2008 (UTC)
 * There's a version in the sandpit which can handle charges. If there is no objection, I'll put it in after a bit of testing.  It can also handle atomic number & mass number. P.S. not if it starts but if it ends with a + or - (hyphen not a minus sign).
































 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }


 * It's working. J IM ptalk·cont 00:42, 15 July 2009 (UTC)

No-subscript (implied 1) breaks rest of formula
I just noticed someone correcting mis-rendering on noble gas. Having to play special games to make the formula display correctly goes against the point of having the template to do it automatically. Say we want "XeF8". The page previously had. I assume that worked at one time.[cite needed] But now the result of that is just "Xe". None of the other likely chemically correct approaches work either:  breaks the template badly, but one shouldn't expect it to work once one reads the template docs, and   actually displays the 1, which again makes sense with respect to parsing.

The "solution" was, but that's weird from a chemistry standpoint. "XeF" isn't anything real except a text string (suppose some day we want to enable auto-linking to each element's webpage?). Is it possible to make  work correctly? The template syntax appears to use an undefined parameter to indicate the end of the formula...could it look ahead a second position as well. Or could fix  by having subscript be omitted if it's "1" (which could be over-ridden by some   template parameter if there are cases where one wants to see it).


 * I reverted it to the previous setup. Nergaal (talk) 22:56, 16 July 2009 (UTC)


 * Hmm, was it intended for every atom to be specifically delineated in this manner? Perhaps I came late to the scene, but I had assumed that the formula only needed to be separated when subscripts (or superscripts) are needed, i.e., rather than , which seems to be a very cumbersome way to type a formula. Besides, I question the value of autolinking every element in a formula, especially if the same elements occur multiple times (IMHO that would qualify as a case of WP:overlink).&mdash;Tetracube (talk) 01:02, 17 July 2009 (UTC)
 * Linking is not necessary. The problem with Xe||F|4 typw formulas is that this template was started quite a while ago and that way worked well; so in many instances it is used like that. Is it hard to fix that? Can't you say to ignore the fields that have nothing in them? Nergaal (talk) 01:38, 17 July 2009 (UTC)
 * I don't know how hard it is to fix that, since I wasn't the one who made the changes. Just sayin' that many articles use the template the other way, including some that are now broken because they use the new superscript feature. Maybe User:Jimp could fix the new version of the template to ignore empty arguments, then we'll both be happy. :-)&mdash;Tetracube (talk) 15:46, 17 July 2009 (UTC)
 * Linking indeed is not necessary, was more of a "future idea" supporting why I thought keeping it "chemistry-like" was worthwhile. Another future-feature that relies on keeping each element distinct is the ability to automatically color each one using standard colors (a style used in some infoboxes). Again, "I wouldn't want it that way in many cases" and I don't think the limited present us of this format makes it worth implementing in such a potentially widely used template. DMacks (talk) 19:43, 18 July 2009 (UTC)

It seems to be fixed. I'm putting the new version in before we get people wondering what's going on. J IM ptalk·cont 17:17, 17 July 2009 (UTC)
 * sweet! Nergaal (talk) 17:53, 17 July 2009 (UTC)
 * I saw that the new addition is a minor one; I am pretty sure it does not fix all the instances: I remember putting myself formulas like "{chem|C|x|H|y|N||O|}". Can you make sure the instances get fixed for all empty spots in use? Nergaal (talk) 18:01, 17 July 2009 (UTC)
 * Or request a bot to fix those uses. Nergaal (talk) 18:02, 17 July 2009 (UTC)


 * Here are some tests:
 * Looks OK to me. Thanks Jimp!&mdash;Tetracube (talk) 18:32, 17 July 2009 (UTC)
 * Looks OK to me. Thanks Jimp!&mdash;Tetracube (talk) 18:32, 17 July 2009 (UTC)
 * Looks OK to me. Thanks Jimp!&mdash;Tetracube (talk) 18:32, 17 July 2009 (UTC)
 * Looks OK to me. Thanks Jimp!&mdash;Tetracube (talk) 18:32, 17 July 2009 (UTC)
 * Looks OK to me. Thanks Jimp!&mdash;Tetracube (talk) 18:32, 17 July 2009 (UTC)
 * Looks OK to me. Thanks Jimp!&mdash;Tetracube (talk) 18:32, 17 July 2009 (UTC)

The new addition you saw was a minor one. The dozen or so which you didn't see were also minor. As for linking individual elements, does a fine job. Optionally colouring the elements in standard colours is also possible. As for the case of using lower case letter in place of numbers, I'm afraid it would probably be best to fix these by bot. It's not that it's not possible to accommodate this; the software can tell a lower case from an upper case & so could treat the lower case as a plain number. The problem is that if we have give us "CxHy", then people are going to expect  to give "Fea+" and come here complaining that the template is broken when they get "Fea+" (we can't read the "+" after a letter, same goes for a "-") ... then there's $A Z$X. J IM ptalk·cont 09:41, 25 July 2009 (UTC)


 * Make sure these tips go into the documentation of the template. Nergaal (talk) 16:52, 25 July 2009 (UTC)


 * Is there a way to make italicized subscripts (e.g. )? Last I checked, this doesn't produce the expected result.&mdash;Tetracube (talk) 17:17, 27 July 2009 (UTC)


 * It's working. J IM ptalk·cont 20:09, 29 July 2009 (UTC)


 * Thanks!!&mdash;Tetracube (talk) 14:35, 30 July 2009 (UTC)

Not quite working with italicized subscripts
The formula S$2&minus; n&minus;1$ isn't quite working:. No idea how to fix it, though. Jimp? :-)&mdash;Tetracube (talk) 00:03, 18 September 2009 (UTC)


 * Hmm, the above formula is now working, but something seems to have been broken in Tetrafluoroammonium (template error halfway down the article).&mdash;Tetracube (talk) 16:56, 23 September 2009 (UTC)

Is it working all right now? J IM ptalk·cont 21:06, 24 September 2009 (UTC)


 * Let's see:
 * Hmm, better than before, for sure, but not quite there yet. The last case is messed up; and also, variable charges like Sin+ aren't working, with or without simultaneous subscripts (is it too hard to do variable charges?).&mdash;Tetracube (talk) 21:48, 24 September 2009 (UTC)
 * Hmm, better than before, for sure, but not quite there yet. The last case is messed up; and also, variable charges like Sin+ aren't working, with or without simultaneous subscripts (is it too hard to do variable charges?).&mdash;Tetracube (talk) 21:48, 24 September 2009 (UTC)
 * Hmm, better than before, for sure, but not quite there yet. The last case is messed up; and also, variable charges like Sin+ aren't working, with or without simultaneous subscripts (is it too hard to do variable charges?).&mdash;Tetracube (talk) 21:48, 24 September 2009 (UTC)
 * Hmm, better than before, for sure, but not quite there yet. The last case is messed up; and also, variable charges like Sin+ aren't working, with or without simultaneous subscripts (is it too hard to do variable charges?).&mdash;Tetracube (talk) 21:48, 24 September 2009 (UTC)
 * Hmm, better than before, for sure, but not quite there yet. The last case is messed up; and also, variable charges like Sin+ aren't working, with or without simultaneous subscripts (is it too hard to do variable charges?).&mdash;Tetracube (talk) 21:48, 24 September 2009 (UTC)
 * Hmm, better than before, for sure, but not quite there yet. The last case is messed up; and also, variable charges like Sin+ aren't working, with or without simultaneous subscripts (is it too hard to do variable charges?).&mdash;Tetracube (talk) 21:48, 24 September 2009 (UTC)

NuclideTemplates
I was building similar functionality when I noticed this template. It seems some of the work on Category:Nuclide templates could be merged with this template into one set of templates. Reusing code reduces the time it takes to maintain these templates and maybe there are some features in one that could benefit the other and vice versa. For instance, I think this template could benefit from the automatic linking in NuclideTemplates (you specify only the element's name or symbol and the "link" argument and the right link for that element is automatically added). — SkyLined (talk) 12:30, 27 November 2009 (UTC)


 * There are a couple of things to sort out but I think it's very doable. J IM ptalk·cont 06:30, 23 December 2010 (UTC)

IE6 support?
Someone using the very old and antiquated IE6 browser noted that simultaneous sub/superscripts (like ) don't show up correctly. Any hope of making this work? Or is IE6 just too outdated and too non-standards-compliant?&mdash;Tetracube (talk) 00:13, 1 April 2010 (UTC)


 * That's probably me you're talking about. But IE 7 did not come out until 2006 and IE 6 still runs on 29% of the computers out there, so it's not like this is just me, the last holdout: IE 6 is being killed off slowly by Twitter and a videosites that don't support it any more (as of last month) but I think it's completely ridiculous that I have to give it up because somebody decided some new chem template on Wikipedia looks "slightly better" than using the simple wiki-markup down at the bottom of your screen that we all already know how to use. That's madness. And why yes, I can hope that the next version of Windows doesn't screw up my files the way Vista did. Or I can change to some other browser in which I cannot read all my old email, which I had the bad fortune (due to not having a TIME MACHINE) to have sent and recieved with MS Outlook, way back when that was the best email program. So I'll have to upgrade and lose stuff at some point, but I'm not going to do it because somebody decided some weenie templates on Wikipedia were "a little cooler", and forgot to make them backwards compatible. The "dusty child in Africa" really doesn't appreciate this. Oh, wait-- I forgot. He's running the latest version of Ubuntu, right? Or at least IE 8.  S  B Harris 21:43, 21 April 2010 (UTC)


 * That wasn't you I was talking about (it was another user who encountered the same problem), but the problem stands: IE6 doesn't properly display whatever it is the physics template is being used to do that simultaneous super/subscript thingy. I think it looks neat when it does work, but we really should implement a fallback mechanism so that it doesn't fail horribly when it doesn't work. Whatever happened to graceful degradation in HTML and all that?&mdash;Tetracube (talk) 16:33, 22 April 2010 (UTC)


 * I have just discovered the same problem. This is serious. It means that anyone using a system that they are not allowed to update will get the wrong formulas. Q Science (talk) 21:16, 20 December 2010 (UTC)


 * The superscript output for parameter {3} is supposed to occur in Template:Su as parameter {p}, but only the subscript output for parameter {2} as {b} is appearing, such as "4". As a quick fix, I can edit Template:Su to display parameter {p} as a superscript in typical wiki-format:
 * undefined
 * Using the font-size as 98% will match the font size of the subscript "4" which seems like a logical fix. The result will appear as: "undefined. I realize that some prefer the aligned superscript+subscript format, but it does not work in IE6. Are there any objections to supporting users of Internet Explorer 6 with this change? -Wikid77 03:24, 21 December 2010 (UTC)
 * Here's one hearty vote of encouragement! It looks fine to me. Now if they should just fix the fonts, so that IE6 users see the correct rams-horn upsilon (ϒ) as a letter that is different from a Y, without having to resort to LaTeX. S  B Harris 03:45, 21 December 2010 (UTC)
 * su is used by many other templates, please do not make random changes to it without checking the consequences.    — SkyLined  (talk) 10:02, 22 December 2010 (UTC)


 * The whole point of using here was to align the subscripts and superscripts.  I think that's the whole point of 's existence. J IM ptalk·cont 01:38, 23 December 2010 (UTC)
 * This issue has been resolved in su, see the talk page for details.    — SkyLined  (talk) 08:40, 23 December 2010 (UTC)

Problem with CH3F and CH4
Such uses as and  do not work. I changed what I thought to be a bug, but this does not help. Incnis Mrsi (talk) 21:23, 28 February 2012 (UTC)


 * You say the edits you made don't work. I've reverted them (at least till we figure out what's going wrong). J IM ptalk·cont 00:34, 29 February 2012 (UTC)


 * This is not actually a bug, though. If you use  (i.e. no pipe between letters like in the sulphate example on the doc), everything should be fine. I guess we should make this more clear. J IM ptalk·cont 04:35, 29 February 2012 (UTC)


 * However, if you must separate them, a double pipe, e.g., will work. J IM ptalk·cont 04:50, 29 February 2012 (UTC)
 * Thanks. I did not consider a possibility that such intricate code may be not ready to handle Symbol-Symbol sequences. Such intended syntax for, say, SO2 as &#123;{chem|SO|2}} is absolutely counter-intuitive to me and undermines the legitimation of this template because makes future semantic-based customization unlikely. Why not recommend to use a double separation for this case? Incnis Mrsi (talk) 04:58, 29 February 2012 (UTC)


 * I see where you're coming from. Yes, it is somewhat counter intuitive. I'll see what can be done to remedy this. J IM ptalk·cont 05:18, 29 February 2012 (UTC)


 * I've completely rewritten the template. The version in the sandbox handles .  I've also made an adjustment so that it will handle metastable isomers e.g. . J IM ptalk·cont 05:55, 1 March 2012 (UTC)


 * This version has problems; Uranium, for example: fails on sup-tags. Alarbus (talk) 12:45, 1 March 2012 (UTC)


 * Alarbus was referring to sup tags within the template parameter. These actually shouldn't have been there; superscripting is automatic (one of the main points of the template).  I fixed that. The other problem was that it would stumble when there was non-numeric input to be superscripted (e.g. ).  That's also been fixed. J IM ptalk·cont 16:35, 1 March 2012 (UTC)

Parentheses
→ but should be similar to Th(NO3)4 - see. -- Red rose64 (talk) 22:38, 3 March 2012 (UTC)
 * Fixed. J IM ptalk·cont 16:23, 4 March 2012 (UTC)
 * Square brackets work too thanks to Headbomb. J IM ptalk·cont 16:24, 5 March 2012 (UTC)
 * Smashing. -- Red rose64 (talk) 19:39, 5 March 2012 (UTC)

Subscripts not working
Based on some edits on March 20, there appears to be a problem with how subscripts in formulas are displayed for some users. The specific example there is the "2" in generated by. The editor who inserted the explicit  tag left the following note on my talkpage:


 * Yeah, {{tchem| without the {{sub|}} tags is not causing my browser (Firefox 3.6.28 with a bunch of add-ons on Windows 2000) to render the formulae properly. It does render correctly in Chrome. I'm too security-conscious to even launch IE. St John Chrysostom {{sup|Δόξα}}{{sub|τω{{sup| Θεώ}}}} 17:52, 20 March 2012 (UTC)

The results look correct for me (Firefox 11.0 OS X, and also tried Firefox 3.6.28 (an X11 manual build) on OS X). The actual subscripting happens via {{tl|su}}, which uses small fontsize and shifted baseline rather than "actual" HTML subscript, so maybe simply a stylesheet platform-portability issue (or conflict with third-party browser extensions? DMacks (talk) 15:06, 21 March 2012 (UTC)


 * I tried disabling Noscript, Requestpolicy, Adblock, Tamperdata, and Ghostery (stuff that can potentially interfere with rendering using JS, CSS, etc., even though it's all set to allow Wikipedia's operation) and still receive the same result. I tried a clean install of Firefox 11.0 (ugh! what an interface! that's why I stick with 3.x.x) in process sandbox, with no add-ons. It renders correctly. On some formulae (it seems that H2O renders correctly, as does H2O2, but CH3, CH4 and TiO2 don't - maybe something to do with two letters back-to-back?). A clean install of 3.6.28 does not render correctly. The latest version of Chrome renders correctly as well. (So it's not my archaic Windows install - at least it doesn't seem to be). St John Chrysostom {{sup|Δόξα}}{{sub|τω{{sup| Θεώ}}}} 23:43, 21 March 2012 (UTC)

It would have been more useful...
if we had made this template to produce, Now this template has no meaning than just being an alternative to the  and undefined syntax, I think. It might be complex and hard to do, but would be of great use. V ani s che nu mTalk 11:46, 13 July 2012 (UTC)
 * simple reactions
 * represent polymers


 * What  &   can't do is align the sub- & superscripts.  What exactly were you hoping for? J IM ptalk·cont 06:02, 9 June 2013 (UTC)

Inconsistent subscript size
Viewing

in IE 9 the subscript "9" is much smaller than the "4". It looks ugly. —DIV (138.194.11.244 (talk) 00:49, 24 July 2012 (UTC))
 * The template now uses for all sub- & superscripts (instead of only where you have both). This should fix the problem. J IM ptalk·cont 05:58, 9 June 2013 (UTC)

Superscripts are a bit too tall
This template is wonderful (perhaps the only template in all Wikipedia that is actually good). However it has a bad effect on line spacing, because the formulas come out a bit too tall. This problem does not occur with ordinary ... See:
 * Lorem ipsum blabla gallia omnia Lorem ipsum blabla gallia omnia Lorem ipsum blabla gallia omnia Lorem ipsum gallia omnia Lorem ipsum blabla gallia omnia Lorem ipsum blabla CH+ omnia Lorem ipsum blabla gallia omnia

I can provide a screenshot if you can't see the problem above. (I am using Chrome with the default "vector" skin for Wikipedia.) Would it be possible to reduce the font size of sub/sup scripts, and/or push them closer together, and/or lie to the browser about the height of the result to avoid this problem? (I have just left this request on the  talk page, but perhaps it is just a matter of setting some parameter?) Thanks, and all the best, --Jorge Stolfi (talk) 01:04, 22 February 2013 (UTC)


 * I don't think this template is that helpful. I think sub and super script make more sense to the untrained reader than knowing this template.  And it messes up line spacing (I had to delete on in an article and do it the old fashioned way).  Kind of a solution looking for a problem.TCO (talk) 01:58, 7 June 2013 (UTC)


 * It's nice if you are writing reactions (could use math text also), but definitely causes problems when in lined text. (Like using math text in regular prose would.)TCO (talk) 19:57, 8 June 2013 (UTC)


 * What this template does that can't be done simply with  and   is align the super- and subscripts.  This is done using  so if there's a problem to be fixed, it'll obviously have to be tackled over there. I'm afraid I can't really help much. My knowledge of the workings of this template only expends as far as its own subpages (i.e. not as far as the workings of ). J IM ptalk·cont 05:42, 9 June 2013 (UTC)

I get that, that is what it does. But it messes up the line spacing. That is a much worse reading faux pas than SO42-. People type all the time in Word or the like and never notice an issue with it. This template is like cramming LaTex into regular prose lines. You can't do it. Needs to be on a separate line. Well, if you keep it there, then fine.

Actually part of the main problem is that Wiki has such tight line spacing from line to line and then between paras. Look how much nicer the space is between paras in edit mode as compared to display mode. This, I think, is similar to the way over-tiny font. It is because Wikipedia thinks it makes them look smarter.TCO (talk) 06:43, 9 June 2013 (UTC)


 * Well, we can only hope they get it right someday. Of course, in the meantime do we use the template and hope for the best, wait till things are fixed and then go through and start adding it or what?  J IM ptalk·cont 07:01, 9 June 2013 (UTC)


 * I would get rid of it. It is OK only when in reactions (on separate lines).  But people are using it in regular text as if it were a convert template.  And the damage from messing up the line spacing, to the eye, is much more than SO42-.  Honest, people never even notice that being off.  I just went and culled all the tempates out of an article that I am sweating over.  They make it look worse.  Sorry, man.  :-(  TCO (talk) 07:29, 9 June 2013 (UTC)

In the subtemplate su of chem, I have changed the default sub/superscript size to 70% from 85%, eliminating the extra line spacing. Also fixed passing the fontsize parameter, in case this appears too small for other applications. &minus;Woodstone (talk) 09:04, 22 July 2013 (UTC)

Wikipedia API
This template break something for the wikipedia API. See [ http://en.wikipedia.org/w/api.php?action=query&prop=description&titles=Water&prop=extracts&exintro&explaintext&exsentences=10&format=xml query of the first sentence]. And query of the lead section. Yug (talk)  23:45, 17 October 2013 (UTC)


 * Agreed. the Chem template isn't properly parsing in the Wikipedia API.  It appears that in some cases, subscript markup is converted into line breaks. --  Preston stone (talk) 19:30, 4 December 2013 (UTC)

In the article on eclampsia, the magnesium ion appears to absorb the following space, like so.

Perhaps this effect is specific to my browser, which is IE.

99.247.1.157 (talk) 03:25, 16 December 2013 (UTC)

Electron?
How to write an electron? Instead of "e−" (or "e−"),  produces a very strange result "" ( - e  ), and   produces "" ( e  −   ). — Mikhail Ryazanov (talk) 22:10, 20 December 2013 (UTC)
 * Use Subatomic particle, for an electron use Electron which gives Electron. If a link is wanted add the parameter link=yes Christian75 (talk) 14:00, 5 February 2014 (UTC)

Using subscript and superscript characters
Maybe spacing problems can be resolved using subscript characters as ₁₂₃₄₅₆₇₈₉₀ instead of characters in subscript tag (1234567890), the same for superscript (¹²³⁴⁵⁶⁷⁸⁹⁰⁺⁻ instead of 1234567890+-)? --Sbisolo (talk) 09:55, 4 April 2014 (UTC)

Recent undo
I undid the recent change to the font size for superscript characters; the change meant that linespacing is increased in text using this template. To see an example, preview radiocarbon dating with the version I reverted from. Mike Christie (talk - contribs - library) 17:02, 30 December 2014 (UTC)

Line spacing?
This template still seems to have the problems with line spacing mentioned in the above discussions - see, for example, Tungsten carbide. Have there been any recent changes that might have reintroduced the problem, or was the problem not fixed in the first place? I'm seeing the issue in both Monobook and Vector, using IE11 and Chrome. Tevildo (talk) 19:18, 25 August 2015 (UTC)
 * Pinging as active contributors. Tevildo (talk) 22:14, 30 August 2015 (UTC)

Examples

 * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Using - . Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.


 * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Using - H 2SO4. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Tevildo (talk) 19:29, 25 August 2015 (UTC)

I thought it was fixed some time ago but if not, the problem is probably with su. Jimp 06:28, 9 September 2015 (UTC)


 * It was fixed at the cost of too small font sizes, which makes it inconsistent and illegible. Using su has inherent spacing requirements, but should generally not be noticable (especially since the typography update). If you do notice increased line height, your default font may be at fault, or too small.  13:46, 28 February 2016 (UTC)
 * I see you reverted the font size change. Take a look at radiocarbon dating, which looks to me much worse now; the line spacing is visibly erratic.  I'm using Vector on Chrome, if that makes a difference. Mike Christie (talk - contribs -  library) 16:15, 28 February 2016 (UTC)
 * The more important issue is legibility. At default font sizes, 70% beccomes unreadable. What I could do is tweak the lineheight, asuming only numbers are used in the sub/sup values. But readability should not suffer because of a purely aesthetic reason.  18:59, 28 February 2016 (UTC)
 * I'm tweaking su to allow for a vertical-align parameter. Please stand by.  19:32, 28 February 2016 (UTC)
 * Are you still tweaking? I have to say it still looks ugly to me.  Is there more that can be done? Mike Christie (talk - contribs -  library) 10:57, 1 March 2016 (UTC)
 * Yes, but need a little help in LUA syntax.  19:24, 1 March 2016 (UTC)

Should be fixed now. 17:05, 28 March 2016 (UTC)
 * That looks good. Thank you!  Mike Christie (talk - contribs -  library) 17:31, 28 March 2016 (UTC)

Right superscript and subscript alignment rationale
Why is the aligned style used when so many other resources, as far as I've researched, don't (SO42- )? Is there a standard form? Fizzwhiz (talk) 13:57, 11 November 2016 (UTC)

Prospects for adding a latex or readable text option?
A latex option would be pretty obvious:

{chem|H|2|O|latex=true} → H_2 O < /math> → $$H_2 O$$

A readable text option would be:

{chem|H|2|O|text=true} → H Subscript 2 O

I'm not going to touch it unless I get a go-ahead. Is this an acceptable idea?

Akiva.avraham (talk) 12:35, 15 November 2016 (UTC)


 * A more appropriate tag than for using LaTeX would be . For example:
 * H_2O →
 * while
 * H_2O → $$H_2O$$.
 * See Help:Displaying a formula. —Kri (talk) 15:23, 25 June 2017 (UTC)

How to write this?
How do I write (i.e. a positively charged beta particle) with this template? I've tried β and β but they result in β and β (i.e. the same, incorrect notation). —Kri (talk) 14:58, 25 June 2017 (UTC)


 * Looking at the source code, chem tests for the mass number being higher than the atomic number. Instead, you could try $0 +1$β --> $0 +1$β, which is what chem uses anyway.  Stepho  talk 03:06, 2 January 2022 (UTC)

COinS
The documentation says to not use this template in citations. triggers dire warnings when used with but chem doesn't. Is this a solved problem that is waiting for documentation to catch-up or is it a hidden problem waiting to catch us out?  Stepho  talk 03:11, 2 January 2022 (UTC)


 * It is still a problem as far as I can tell; if you render the COinS (starting  ) contains a lot of mangled HTML from this template which shouldn't be there. User:GKFXtalk 19:09, 27 November 2022 (UTC)

Isotopes
Tried this: or  It did not go well. Help! Lfstevens (talk) 20:41, 15 June 2022 (UTC)


 * You are meant to use the chemical symbols, not the chemical names. Try or  to give  or  .  Stepho  talk  11:34, 16 June 2022 (UTC)

Breaking triple-click mouse paragraph selection
In nitromethane, when I triple-click to section the entire lead paragraph, an instance of {chem} is dividing the paragraph into three pieces: before chem, inside chem, and after chem.

This particular box has a somewhat outdated FF installed, but use of triple-click is near universal across many browsers and OSes and it's rare in my experience to see this not work as expected. &mdash; MaxEnt 21:20, 19 August 2022 (UTC)

deprecated?
, if I understand your edits well, should we declare this template Deprecated/use formally? I could support. Or are there technical/usage issues to be resolved? DePiep (talk) 08:13, 26 November 2022 (UTC)


 * There are a couple of outstanding issues before I would look to fully deprecate &#123;&#123;chem&#125;&#125;. It doesn't stack super- and subscripts if they are done with the syntax for letters and there is a MediaWiki bug with using it in links (T200704, although you can use the link= parameter as a substitute). In most other cases yes I would switch to &#123;&#123;chem2&#125;&#125;. User:GKFXtalk 18:58, 27 November 2022 (UTC)
 * ok thx. DePiep (talk) 19:01, 27 November 2022 (UTC)

Ionic Formluae: Rendering and Copy/Paste Issues (using iOS Safari, but likely in all browsers)
I’ve just come across multiple issues related to this template while browsing using iOS Safari, both in Google’s reprinting of Wikipedia content in infoboxes (e.g. a search for “sulfite” returns a Wikipedia infobox for Sulfite beside Google search results), but also on the Wikipedia pages themselves. Yes, Google is not Wikipedia, but the content they are reproducing comes directly from Wikipedia, and though I’m not privy to Wikipedia’s web analytics, I would wager that a huge amount of contemporary traffic comes straight from Google, specifically the Wikipedia infoboxes I am talking about, and therefore the preview of content that is shown in these boxes is of utmost importance to the project. In case it is important to know, I have observed these unexpected and unwanted behaviors while using an iPad with a slightly older version of iOS/iPadOS, 15.6.1. I have yet to test this in other browsers, but as you may gather from the behaviors described below, this is almost certainly also occurring in all browsers, because it must be related to the way the template itself is encoded into display content.

Actual Behavior


 * 1) (image) The charge/superscript appears after the final subscript in chemical formulae of ions displayed in Google infoboxes that reprint content from Wikipedia.  Additionally, there appears to be extra space between the superscript and subscript.  I thought the spacing issue may be a bug either on Google’s end or on Apple’s in iOS Safari, but as explained below in (3), the space is present when copying /pasting directly from Wikipedia as well.  Thus both the incorrect order in which the superscripts/subscripts appear and the extra space is obviously encoded incorrectly in the first place, in the Wikipedia content itself. The backwards ordering is exacerbated by the presence of this extra space, which has the charge/superscript directly adjacent to the final element, with that element’s subscript orphaned and distanced from it.
 * 2) (image) Copying and pasting a chemical formula of an ion from Wikipedia content reproduced in Google’s infoboxes results in a backwards ordering of charge/superscript and any formula-final subscript, along with the aforementioned extra space. (e.g. copying and pasting the chemical formula for the sulfite ion gives “SO²⁻ ₃”).
 * 3) (image) Even worse, copying and pasting the chemical formula of an ion directly from its Wikipedia article results in both the same backwards ordering of charge/superscript followed by formula-final subscript (which proves that the template itself on Wikipedia is encoding the order of formula-final subscripts and charge/superscript incorrectly, and it isn’t merely a rendering issue on Google or iOS Safari—even the extra space is present when pasting directly from Wikipedia), but additionally the complete loss of the subscripts themselves, such that they cannot be copied and pasted at all (e.g. copying and pasting the chemical formula for the sulfite ion directly from Wikipedia text gives the terrible result “SO2− 3”). I feel that users would hope and expect that Wikipedia be a resource they can trust and successfully use to quickly copy a chemical formula to use in their own work, for example a student who needs to write a science paper and can’t be bothered, doesn’t have the capability, or doesn’t know how to manually format chemical formulae on whatever device they happen to be using.

Expected Behavior

Both the display and the result of copying and pasting chemical formulae accessed from Wikipedia content using this template should be accurate, standardized, and consistent, no matter where the Wikipedia content was originally displayed. The order, spacing, and superscripts/subscripts should correct and consistent.

Recommended Fix

The template itself, by the order in which it accepts arguments, seems to acknowledge the proper order of formula-final subscript followed by an ion’s charge/superscript, so it is clear that it is rather the way in which the template is being parsed and encoded to display text, whether that is by using Unicode superscripts/subscripts or undefined/undefined HTML tags, that is the actual problem. However it is being rendered should be reversed, and the extra space removed. Also, if this is a problem for ions, I imagine there are related problems with this template for other types of chemical formulae that end in both subscripts and superscripts.

Hermes Thrice Great (talk) 07:02, 31 May 2023 (UTC)

Staggered Charges
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) 06:57, 19 February 2024 (UTC)


 * Interesting. I would support a change to stagger the charge.  It would also reduce complexity of the processing of this template, as it would remove several invocations of the su template (or module).  This processing complexity seems to be a problem presently.  —Quondum 18:03, 18 July 2024 (UTC)