Hidden points of editing you probably didn't know

Making a good edit is hard. On Chem.SE, we (would/should/could) care about the finest points of formatting. There are basic points of editing many editors know about: Put some fancy MathJax/ $$\mathrm\LaTeX$$-syntax in, some paragraphing, bullet points for "points", embolden instead of capitalize, etc.

However, there are certain features only the best editors know. This post is a collection of those finer points, which may give a better push to the learning curve of the newer editors and people who want to try editing on chemistry.SE.

This post is a community effort, hence it is community wiki. That means, that everybody who has more than 100 reputation points can freely edit it. If you see that anything is missing in this list, please add a new answer and also link to it in the Overview.

For basic editing for beginners please see: How can I format math/chemistry expressions here?

Sizing for images

If you post to Imgur (the default host for StackExchange) you can use URL suffix codes to change the size of the image in your answer or question:

$$\small \begin{array}{clcc} \hline \text{Thumbnail Suffix} & \text{Thumbnail Name} & \text{Thumbnail Size} & \text{Keeps Image Proportions} \\ \hline \text{s} & \text{Small Square} & 90\times90 & \text{No} \\ \text{b} & \text{Big Square} & 160\times160 & \text{No} \\ \text{t} & \text{Small Thumbnail} & 160\times160 & \text{Yes} \\ \text{m} & \text{Medium Thumbnail} & 320\times320 & \text{Yes} \\ \text{l} & \text{Large Thumbnail} & 640\times640 & \text{Yes} \\ \text{h} & \text{Huge Thumbnail} & 1024\times1024 & \text{Yes} \\ \hline \end{array}$$

So http://imgur.com/12345.jpg becomes http://imgur.com/12345t.jpg:

The default now is to insert a link to open the picture in a new tab. It has by default the form of

[![(please really do) enter image description here][1]][1]
[1]: http://imgur.com/12345.jpg

To make your high resolution image available to the public you should edit this default template to

[![(please really do) enter image description here][1]][2]
[1]: http://imgur.com/12345t.jpg
[2]: http://imgur.com/12345.jpg

Alternatively

You may size images with ?s=Xat the end of the image URL, but the value of X may be a power of 2 only (16, 32, 64, 128, 256, and 512)

[![(please really do) enter image description here][1]][2]
[1]: http://imgur.com/12345.jpg?s=256
[2]: http://imgur.com/12345.jpg

If it fails

On rare occasions, the rescaling will not work. One of these is when the source picture is a png with transparent background. The resize procedure of imgur transforms this into a black background.
If you cannot change the source file to a different format or size, you still have the option to use plain HTML.

<img src="http://i.stack.imgur.com/12345.png" width="160" alt="(please really do) enter image description here">

Also, resizing to a small square (s) may cut off the vertical/horizontal parts of the image, because - as seen in the table above - it does not keep image proportions. So, again in this case, you'd have to use the HTML image insertion method shown above.

Note: the order of attributes in the HTML method of inserting an image must exactly be src, width and then height/alt. Any extra spacing in between or misplaced attributes will fail to display the image entirely. So, <img src="" width=""> would work while <img src="" width=""> won't.

• This is really one of the most terrifically useful things ever. – hBy2Py Dec 29 '15 at 15:53

Units formatting

Units should always be upright, and be separated by value with a space. This can be achieved best in MathJax with the sequence ~\mathrm{ place unit here }. The tilde generates the space, \mathrm{...} makes sure the text is upright. If your units are a product and/or with superscripts, separate them with a small space \,.

Nice additional feature: You can put an entire fraction into \mathrm{...} as shown above by typing \mathrm{\frac{numerator}{denominator}}

123~\mathrm{J\,mol^{-1}} \quad 123~\mathrm{\frac{J}{mol}} $$123~\mathrm{J\,mol^{-1}} \quad 123~\mathrm{\frac{J}{mol}}$$

The mhchem package offers a shortcut to this.

\pu{123 J mol^-1} \quad \pu{123 J//mol} \quad \pu{345K} \quad \pu{1.2E3 kJ} $$\pu{123 J mol^-1} \quad \pu{123 J//mol} \quad \pu{345K} \quad \pu{1.2E3 kJ}$$

For degrees Celsius, Fahrenheit or angles, the encouraged way to typeset is ^\circ. Use ~\mathrm{^\circ C} for $\mathrm{^\circ C}$. Note that angle degrees take no space, $\mathrm{^\circ C}$ or $\mathrm{^\circ F}$ do, and $\mathrm{K}$ has no degree symbol.

\mathrm{345~K} \quad 72~\mathrm{^\circ C} \quad 90^\circ $$\mathrm{345~K} \quad 72~\mathrm{^\circ C} \quad 90^\circ$$

NB: While it definitely works, you should not use \ce{...} to force units to be displayed in upright type. It can have unforseen effects and it is syntactically wrong.

Clean, descriptive titles improve searching.

Martin mentioned it in a comment, but I will summarize here. Good titles help make questions about chemistry experiments, exercises, and problems more searchable. Titles help people find questions, and not just using the internal search. Good question titles will show up in Google (and other search engine) searches. Bad ones will, too, but only if I search something close to the exact title. The links in the this paragraph are to various meta posts decrying the overuse of buzzwords in question titles. For more on each buzzword, go and look. Those meta posts also link to search queries that return questions with those words in the title.

Compare:

Now, lets look at those two Chem.SE questions that turned up in the Google searches.

https://chemistry.stackexchange.com/questions/42642/chemical-mixing-question

Looking at just the title, we do not know what we are in for. This a really broad question where the OP basically wants to know the result of every possible combination of reactants in the entire chemical space. The title could be improved (but the question probably cannot be saved - see my other answer). Anyone searching for "mixing chemicals" will probably have something more specific in mind.

Regioselectivity of acid-catalyzed ring-opening of epoxides

This title is very specific to the question and makes searching for it easy. It tells you exactly what you are in for if you open the question.

Remove MathJax / $\mathrm{\LaTeX}$ markup in question titles.

The extra characters needed to make things typeset nicely are difficult to search and cause problems both internally and externally.

Try replacing chemical formulas with compound names - although our font is such that a formula without markup (H2O) does not look terrible. Especially replace more complex markup with words. If your question title has $$\log\left(\dfrac{[\ce{A}]^{2}]}{[\ce{B}]^2}\right)$$ in it, yes you will get some nicely typeset maths,

but you will not having something as easily searchable as

If you find yourself editing questions, clean up the title. Make it descriptive of the question's content. Remove markup.

• Who was the other Norris? Your sibling? ;) – Jan Dec 25 '15 at 1:04
• Unknown. Perhaps my evil twin? I just thought it presumptuous to invent an equation named after only me. – Ben Norris Dec 25 '15 at 3:22
• I thought Chuck O.o – Martin - マーチン Dec 25 '15 at 8:51
• That reminds me of Paul Dirac, who refused to say Fermi-Dirac statistics, but insisted on saying "Fermi statistics". The Wikipedia article on him writes: 'While lecturing later in life, Dirac [...] referred to [Bose-Einstein statistics] as "Einstein statistics" for reasons, he explained, of "symmetry".' – orthocresol Jan 7 '16 at 17:59
• "Question about mixing chemicals - A Chem.SE question is the #1 hit, but the question is so vague it might not be what the searcher is looking for." That's no longer true. Now we only get two Math.SE hits on page two :P – Gaurang Tandon May 8 '18 at 2:32

Be judicious when editing questions that are [on hold] or [closed].

Editing posts bumps them back to the top of the main page. Only edit closed questions that you think you can improve them to the point that they can be reopened. There is little benefit to the site when low-quality questions with minor edits are bumped to the top pushing more recent questions down (or worse, off) the main page before they get enough attention. Cleaning up the spelling, grammar, and formatting are minor edits because they do not improve the substance of the question.
Questions that are closed might also be deleted (automatically) and if you submitted an edit that gets approved, you will still lose the awarded reputation when it does get deleted.

Editing a question that is [on hold] automatically places that question in the review queue to be considered for reopening (see meta.se).
If you edit an [on hold] question, make it worth reopening. This is especially important since a question only gets placed once in the reopen queue with an edit, so the first edit must be substantial. If you edit a closed question to the point where it should be reopened, please flag or vote for reopening.

This is also relevant if you are reviewing suggested edits. Take a quick look at the question’s title and feel free to reject the edit if the question is [on hold] and the edit does not make it reopen-worthy.

Likewise with old questions.

In any event, do not edit lots of old or low-quality posts at the same time so as to flood the main page with old stuff and hide newer content.

• Oh +1000 for this! I see much editor and reviewer time here on Chem that could be spent on something better. – M.A.R. Dec 23 '15 at 19:42

Don't let the broad tag be

Tags help define categories for questions and thus they make searching easier. Occasionally I see posts — from relatively new users especially — that contain only one broad tag like

Please editors! Pay some attention to the tags and try to improve them as much as possible without introducing irrelevant tags.

$\ldots$ and, in particular, homework should be REMOVED.

It is one of the few meta tags we had historically let remain on Chem.SE, but are now in the process of removing from the site.

However, don't edit tags when the question is on-hold/closed, since as mentioned in this answer, it's just not worth it.

• Note that homework is being deprecated/burninated/nuked/destroyed with fire so don't use it, remove it. Same with reaction; see this meta post for more information. – heather Apr 1 '17 at 18:40

Use mhchem to format chemical expressions

(For people out there who don’t know this … yet.)

We have the wonderful mhchem package which comes with the even more wonderful \ce{...} command. What this command basically does, is take plaintext input like you would put it in a chat message, and transforms it into beautiful chemical expressions. (It only works in Maths environment, so enclose the entire thing in $.) For a little more extensive guide have a look at our introduction and our style cheat sheet. Examples • \ce{CuSO4 . 5H2O}$\ce{CuSO4 . 5H2O}$• \ce{H2 + CO2 <=> H2O + CO}$\ce{H2 + CO2 <=> H2O + CO}$• \ce{K3[Fe(CN)6]}$\ce{K3[Fe(CN)6]}$• \ce{1/2 O2 + H2 -> H2O}$\ce{1/2 O2 + H2 -> H2O}$• \ce{NO^{.}}$\ce{NO^{.}}$• \ce{R-CH2-C#C-C(=O)-CH2Li}$\ce{R-CH2-C#C-C(=O)-CH2Li}$• \ce{2 H+ + 2CrO4^- <<=> H2O + Cr2O7^2-}$\ce{2 H+ + 2CrO4^- <<=> H2O + Cr2O7^2-}$Please do not enclose every single MathJax expression in \ce{...}. Mathematical equations usually require italics which would be suppressed by \ce{...} and it can have unexpected results with full stops, minus signs and many others. Use \ce{...} if and only if you are dealing with chemical expressions, and if the chemical expression is a small part of a larger mathematical formula, confine the \ce{...} bit to the actual chemical part. • \ce{yeah I agree.} \ce{But it feels fun to \ce{} everything.} – M.A.R. Mar 6 '16 at 18:34 Use display style maths wherever possible Inline maths mode should be only used for short introductions of terms, a sum formula of a compound. For more complex terms, like fractions or sums, it messes with the spacing of the body and it might become unreadable. Examples Using inline maths environment to produce a rather complicated term with a fraction looks quite odd, since it produces weird interline spacing. We could for example be talking about entropy and state that the change in entropy$\Delta S$of a system was originally defined for a thermodynamically reversible process as$\int \frac{\mathrm{d}Q_\mathrm{rev}}{T}.$Then we should state that$T$is the absolute temperature of the system. And an incremental reversible transfer of heat into that system is called$\mathrm{d}Q$. And the last sentences are just here to fill the lines. The following equation is set with$
\log_b\left(\frac{\prod_{i=1}^{Q} a_i}{\prod_{j>i}^{R} a_j}\right)
=  \sum_{i=1}^Q \log_b\left(a_i\right)
- \sum_{j>i}^R \log_b\left(a_j\right)
$and produces:$ \log_b\left(\frac{\prod_{i=1}^{Q} a_i}{\prod_{j>i}^{R} a_j}\right) = \sum_{i=1}^Q \log_b\left(a_i\right) - \sum_{j>i}^R \log_b\left(a_j\right) With displaymode the equation becomes more readable and centred. Thus, the following code \begin{align} \log_b\left(\frac{\prod_{i=1}^{Q} a_i}{\prod_{j>i}^{R} a_j}\right) &= \sum_{i=1}^Q \log_b\left(a_i\right) - \sum_{j>i}^R \log_b\left(a_j\right) \end{align} produces: \begin{align} \log_b\left(\frac{\prod_{i=1}^{Q} a_i}{\prod_{j>i}^{R} a_j}\right) &= \sum_{i=1}^Q \log_b\left(a_i\right) - \sum_{j>i}^R \log_b\left(a_j\right) \end{align} The indices now can be actually read. Forcing display style in inline maths In rare occasions, one needs to use inline maths because of the limitations of MathJax. One of the most prominent cases is when using an enumerated or a simple list. One can force the use of display style maths with \displaystyle. Here is a code snipped, that compares the possibilities -\Delta S = \int_0^\infty \frac{\mathrm{d}Q_\mathrm{rev}}{T}$- versus -$\displaystyle \Delta S = \int_0^\infty \frac{\mathrm{d}Q_\mathrm{rev}}{T}$(neat, isn't it) - versus - $$\Delta S = \int_0^\infty \frac{\mathrm{d}Q_\mathrm{rev}}{T}$$ - &uarr; where centering really does not make any sense &uarr; which produces the following: •$\Delta S = \int_0^\infty \frac{\mathrm{d}Q_\mathrm{rev}}{T}$• versus •$\displaystyle \Delta S = \int_0^\infty \frac{\mathrm{d}Q_\mathrm{rev}}{T}$(neat, isn't it) • versus • $$\Delta S = \int_0^\infty \frac{\mathrm{d}Q_\mathrm{rev}}{T}$$ • ↑ where centering really does not make any sense ↑ Text and spaces in MathJax Trying to put a short phrase in your MathJax, but your spaces keep disappearing? There are a few ways to explicitly insert spaces. For a short phrase it is best to use the \text{...} command like $$\Delta x\, \Delta p \ge \frac{\hbar}{2} , \text{with } \hbar=\frac{h}{2\pi}$$ which produces $$\Delta x\, \Delta p \ge \frac{\hbar}{2} , \text{with } \hbar=\frac{h}{2\pi}$$ You can also escape those spaces with a backslash or a tilde:$\mathrm{This has spaces}\mathrm{This\ has\ spaces}\mathrm{This~has~spaces}$which produces$\mathrm{This has spaces}\mathrm{This\ has\ spaces}\mathrm{This~has~spaces}$See also here and here. A number of other commands also produce spaces; in a list of well-known ones the next is probably \,, which gives a 'thin' space:$\mathrm{This\,uses\,comma\,spaces.}\mathrm{This~uses~tilde~spaces.}$which produces$\mathrm{This\,uses\,comma\,spaces.}\mathrm{This~uses~tilde~spaces.}$Other options include: \: (medium width) \> (medium width) \; (wide) \enspace (wider) \quad (yet wider) \qquad (even yet wider) as well as the 'negative space', \!, for mashing characters together. Head-to-Head Comparison$\mathrm{A\!A\!A\!A\!A\!A\!A\!A\!A\!A}$: \!$\mathrm{AAAAAAAAAA}$: (no space)$\mathrm{A\,A\,A\,A\,A\,A\,A\,A\,A\,A}$: \,$\mathrm{A\ A\ A\ A\ A\ A\ A\ A\ A\ A}$: \[space]$\mathrm{A~A~A~A~A~A~A~A~A~A}$: ~$\mathrm{A\:A\:A\:A\:A\:A\:A\:A\:A\:A}$: \:$\mathrm{A\>A\>A\>A\>A\>A\>A\>A\>A\>A}$: \>$\mathrm{A\;A\;A\;A\;A\;A\;A\;A\;A\;A}$: \;$\mathrm{A\enspace A\enspace A\enspace A\enspace A\enspace A\enspace A\enspace A\enspace A\enspace A}$: \enspace$\mathrm{A\quad A\quad A\quad A\quad A\quad A\quad A\quad A\quad A\quad A}$: \quad$\mathrm{A\qquad A\qquad A\qquad A\qquad A\qquad A\qquad A\qquad A\qquad A\qquad A}$: \qquad Sample use cases • \! (negative space): Removing that annoying space between function names and their parentheses when using resizeable enclosures:$f\left(x\right)f\left(x\right)f\!\left(x\right)f\!\left(x\right)$• \, (short space): Spreading out the summation variable and its initial value (using Martin's excellent \displaystyle tip):$\displaystyle \sum_{n=1}^\infty{1\over n}\displaystyle \sum_{n=1}^\infty{1\over n}\displaystyle \sum_{n\,=\,1}^\infty{1\over n}\displaystyle \sum_{n\,=\,1}^\infty{1\over n}$• \enspace: A bit cumbersome to type, but nice for spreading out the content around a reaction arrow:$\ce{A->B}\ce{A->B}\ce{A\enspace ->\enspace B}\ce{A\enspace ->\enspace B}• \quad: If you need to align a formula that spans over multiple lines, this space comes in handy, because it has the same width as an equals sign and you don't have to work around that using \phantom{=}: \begin{align} \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}\,(x-a)^{n} &= f(a) +\frac{f'(a)}{1!}(x-a) +\frac{f''(a)}{2!}(x-a)^2\\ &\quad +\frac{f'''(a)}{3!}(x-a)^3 +\frac{f''''(a)}{4!}(x-a)^4 +\cdots. \end{align} \begin{align} \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}\,(x-a)^{n} &= f(a) +\frac{f'(a)}{1!}(x-a) +\frac{f''(a)}{2!}(x-a)^2\\ &\quad +\frac{f'''(a)}{3!}(x-a)^3 +\frac{f''''(a)}{4!}(x-a)^4 +\cdots. \end{align} Comprehensive editing I’d like to add another issue that I see not happening way too often: When editing for any of the other points, do a simple check of the text and the MathJax involved, too. Oftentimes I see someone edit the title but not touch the body even though it could be greatly improved by a simple two-minute check, revising capitalisation, improving punctuation etc. Or someone adds mhchem markup to a specific subset of chemical equations but leaves other badly done MathJax alive. Or someone revised the MathJax to perfection but totally ignores a set of three exclamation marks/extraneous spaces/missing apostrophes. It’s really not worth it to edit the same post twice just because you decided to only check the title. Yes, I’m aware that this is practically the complement to this. Add relevant keywords to images Many questions and answers make good use of images (e.g. chemical structures or reaction mechanisms). However, the content of images cannot be found by search engines. In order to improve the search results, the post should include relevant keywords. Such keywords are also useful for ﬁnding duplicate questions. Note that the alt attribute, which speciﬁes an alternate text for an image if the image cannot be displayed, can be found by Google but not by the search function of this site. Therefore, it is preferable to place relevant keyword in the visible text. Typical candidates for the addition of keywords are expressions like “[this / the following][compound / structure / molecule / reaction / equation]” when appearing in combination with images. For example, instead of Which is the most acidic hydrogen atom of the following compound? write Which is the most acidic hydrogen atom of cyclohexene? However, be careful that your edit does neither deviate from the original intent of the post nor invalidates the question. For example, do not change What is the name of this compound? to What is the name of benzoic acid? • So what is the name of benzoic acid? 8D – Jan Jan 18 '16 at 13:59 • Would it make sense to write (in your example) "this aromatic molecule with an carboxyl group", instead of leaving it unchanged? – caconyrn Aug 3 '16 at 23:37 • @caconyrn Yes, when you are convinced that the original author of the question actually knows that the given compound contains an aromatic ring and a carboxyl group (this is not always obvious), your proposal could a be a sensible edit. – Loong Aug 4 '16 at 10:09 Grammar, spelling, and style I go heavy on grammar, spelling, and style. Editors tend to ignore blatant abuse of apostrophes (and lack thereof). Capitalization is another minefield (people love to capitalize element names, for instance). One item that comes up a lot is can vs. could, and other variants which are more complex (but I know them when I see them): Could lithium blow my laboratory up when I mix it with water? instead of If lithium is mixed with water, can an explosion result? Another one is personification of physical things a la: Do the electrons bond with each other to make a covalent bond? instead of Are covalent bonds formed by the interaction of electrons? There are constantly issues with the use of active and passive voice, which I won't repeat here but instead link a precis. Using the proper voice is critical for communicating scientific concepts to general and/or non-professional audiences. • While I tend to agree with that one, it certainly is difficult for non-native speakers to sometimes find the right expressions, tenses, etc. || On the issue with can and could, those are two words that should in general be avoided. In the first case it would probably be more to the point to ask: Under what conditions does the mixing of water and lithium result in an explosion. – Martin - マーチン Dec 26 '15 at 16:32 • I'm a native speaker of English with some experience with grammar and composition. I have no idea why you think there is an issue with can vs. could, at least not based on your example sentences. Which one do you think it wrong and why? – Curt F. Jan 6 '16 at 13:46 • Could is the past tense of can. Can infers something happening with greater certainty than could does. See this blog post for a pretty comprehensive explanation. – Todd Minehardt Jan 6 '16 at 13:51 • @Todd Minehardt: But could is also the conditional of can. Isn't that what is referred to here (not a rhetorical question)? – Peter Mortensen yesterday Remove salutations, stick to the point This deserves a place on its own, since it seems to be being ignored a lot. Simply put, don't forget to remove these when you see them in the post while editing: • Any kind of thanks, mostly found in questions, e.g. Thanks. or Many thanks. or Any help is appreciated. or Thanks in advance. or Thank you. or <any other kind of "thank you"> • Any kind of greeting, also quite common in questions. Some of them are already removed auto magically, but the system can't find them all. E.g. Hi all! or Hello! or Howdy! or Greetings Earthlings or <any kind of greeting> • Expressions of hope and clearness, more often found in answers, but sometimes in question, too. E.g. Hope that helps! or I hope it's clear now. or I hope this is enough of a hint. … • Any kind of irrelevant background,1 e.g. • Today I wanted to self-study NMR and spectroscopy and the book had some exercises I have to solve. • i iz new in chemistery and no no high skewl knolege pls speak engish • Edit statements. There was a comment that requested clarification, so the the offending part should be rewritten. It must not be indicated as an edit, that's what the edit history is for. E.g. EDIT : the question was that … or EDIT #2: I need to report … or Edit: As X. pointed out, … or any other spelling, bolding combination of 'edit' 1: Actually, sometimes in toning down the level of answers, a "I'm no expert in chemistry" is useful and relevant info. Use your common sense, and if you see it fit, don't remove it. • Why the fuss over saying thanks? – Archer Feb 19 '18 at 15:27 • @Abcd you can express your gratitude to the answerers by upvoting or accepting their answer. You can even add a bounty if they saved your life or something. But adding "thank you" and similar taglines just distracts from your post, and has no real user to the answerers. Your post would actually help answerers if it contains no fuss and sticks to the point concisely. – M.A.R. Feb 19 '18 at 17:44 When you want to edit a post in a thread with several long answers that contain many MathJax formulas, the process can be very slow. Furthermore, the scrolling (back and forth between the edit box and the end of the post) can be a nuisance. Sometimes, the situation can be improved when you open only the concerned post and not the entire thread. In order to do this, right click the “edit” link and select “open in new tab” or “open in new window”. After that, you can close the original tab that contains the entire thread in order to save some space. If your browser does not offer such an “open in new tab/window” feature, you can manually enter the web address of the edit page as follows. For example, instead of editing this post: https://chemistry.stackexchange.com/a/37832/ on this page, which shows the entire thread: May I treat units (e.g. joules, grams, etc.) in equations as variables? you can use this edit page, which only shows the affected post: https://chemistry.stackexchange.com/posts/37832/edit In other words, the URL for editing a post is https://chemistry.stackexchange.com/posts/[post-ID]/edit. Replace [post-ID] with the unique post number (37832 in the example above). • Noice. I knew about it, but never used it when I should have for some reason. – M.A.R. Aug 20 '16 at 16:17 • I also wonder whether /a/[PID]/edit and /q/[PID]/edit would work. – M.A.R. Aug 20 '16 at 16:26 • @DEAD Probably not, because afaik, timeline only works with the post URL, too. – Jan Aug 21 '16 at 16:57 • You can use this script for easy access of the revision history and edit any revision directly from that page. No need to open a new tab/window in that case. Also worth mentioning is the manual turning on/off of MathJax for tediously MathJax heavy posts - bookmarklets are probably the easiest option, but there are more. – Martin - マーチン Aug 25 '16 at 1:32 • @Martin (or Loong) -- Is there a good way to do something similar to this for posting new answers? Or, do you have to post a placeholder answer and then use this trick on the stub? – hBy2Py Dec 19 '16 at 3:54 • @hBy2Py Not that I'm aware of, but you could just open a clean q&a, write your answer and copy the text back to the question you intended to answer. – Martin - マーチン Dec 19 '16 at 4:56 • @Martin-マーチン Ahhh, yes, that would have been better than posting a placeholder answer... *sigh*. – hBy2Py Dec 19 '16 at 5:05 Above and below in mathematical (or chemical) expressions I will fully admit that this post is also a personal memo of how I do it, but it is also a great feature I wish to share. The problem Sometimes, you may wish to signalise formal charges, oxidation states or other things within an inline structural formula typeset by mhchem. Or you may want to add a description to different reactants and products to show what has happened. This can strech out the rendered formula badly if done inline and may require additional (not beautiful) line breaks such as in these examples: $$\ce{2 Mn^{+VII}O4- + 6 H3O+ + 5 S^{+IV}O3^2- -> 2 Mn^{2+(+II)} + 5 S^{+VI}O4^2- + 9 H2O}$$ $$\ce{HA (\text{acid}) + H2O (\text{base}) <--> H3O+ (\text{conjugate acid}) + A- (\text{conjugate base})}$$ $$\ce{2 Mn^{+VII}O4- + 6 H3O+ + 5 S^{+IV}O3^2- -> 2 Mn^{2+(+II)} + 5 S^{+VI}O4^2- + 9 H2O}$$ $$\ce{HA (\text{acid}) + H2O (\text{base}) <--> H3O+ (\text{conjugate acid}) + A- (\text{conjugate base})}$$ The solution MathJax comes with the two awesome commands \overset{<1>}{<2>} and \underset{<1>}{<2>}. These: • take the second argument and typeset it normally according to the given rules (e.g. upright in \ce{...}) • take the first argument and place it above (\overset) or below (\underset) the second argument. • The first argument is typeset in a smaller typeface and both are centred with respect to one another. Thus, the above expressions can be turned into the much better readable following ones: $$\ce{2 \overset{{+VII}}{Mn}O4- + 6 H3O+ + 5 \overset{{+IV}}{S}O3^2- -> 2 \overset{{+II}}{Mn}^2+ + 5 \overset{{+VI}}{S}O4^2- + 9 H2O}$$ $$\ce{\underset{(\text{acid})}{HA} + \underset{(\text{base})}{H2O} <--> \underset{(\text{conjugate acid})}{H3O+} + \underset{(\text{conjugate base})}{A-}}$$ $$\ce{2 \overset{{+VII}}{Mn}O4- + 6 H3O+ + 5 \overset{{+IV}}{S}O3^2- -> 2 \overset{{+II}}{Mn}^2+ + 5 \overset{{+VI}}{S}O4^2- + 9 H2O}$$ $$\ce{\underset{(\text{acid})}{HA} + \underset{(\text{base})}{H2O} <--> \underset{(\text{conjugate acid})}{H3O+} + \underset{(\text{conjugate base})}{A-}}$$ I’ll admit that the underlying code is slightly longer but the result is worth it. Though note that you don't need \overset/\underset for writing stuff above/below the reaction arrows. mhchem has built in support for that (via simple sweet square brackets). Read the guide, under "Reaction arrows". • I wish I compiled a list of stuff to write in an answer before starting this post, so that we didn't miss great stuff like this. – M.A.R. Jan 25 '17 at 19:42 • @M.A.R. Well, that’s the point of carrying on as you go along. If something hits your mind, just add another answer =D – Jan Jan 25 '17 at 19:43 Use environments to cluster mathematical expressions MathJax provides a basic subset of environments for clustering mathematical expressions. For a complete list, see here, but be warned it is a very big page. Environments are entered with the following syntax, some of them do not need to be explicitly entered with mathmode, but it is no harm doing so. \begin{<environment>} ... \end{<environment>} In such environments a double backslash \\ or a carriage return \cr separates rows. The environments can be used in conjunction with the mhchem commands. The most basic one is gather which is essentially the same as using mathmode without an environment. The only difference is that this environment allows multiple uses of \tag{...}. If you use gathered instead, then only one tag for the whole cluster will be created; it does not matter where the tag is placed. This environment comes without alignment possibilities. Most of the time the typeset can actually benefit from alignment, so this environment is maybe not the best to choose. See here for example uses. Basic alignment for multiple equations Probably the most useful environment is align. It can be used to align equations vertically, but also horizontally. Ampersands & indicate the desired alignment position. Everything left of an odd instance is shoved to the right, and everything to the right is shoved to the left. Even uses of ampersands therefore can be used to separate equations on the same line. Note that alignment characters also work inside chemical expressions \ce{...}. The following example code (% ... produces a comment and everything following it will be ignored by MathJax, cannot be used within \ce{...}. & is the alignment character.) \begin{align} \ce{2H2 + O2 &<=> 2H2O} & %no line break K & % align here =\frac{a(\ce{H2O})^2}{a(\ce{H2})^2\,a(\ce{O2})} \tag{1}\\ % break line here \ce{3H2 + N2 &<=> 2NH3} & %no line break K & %align here =\frac{a(\ce{NH3})^2}{a(\ce{H2})^3\,a(\ce{O2})} \tag{2} % no \\ required \end{align} yields: \begin{align} \ce{2H2 + O2 &<=> 2H2O} & %no line break K & % align here =\frac{a(\ce{H2O})^2}{a(\ce{H2})^2\,a(\ce{O2})} \tag{1}\\ % break line here \ce{3H2 + N2 &<=> 2NH3} & %no line break K & %align here =\frac{a(\ce{NH3})^2}{a(\ce{H2})^3\,a(\ce{O2})} \tag{2} % no \\ required \end{align} You can use this environment to separate equations on the same line. The code \begin{align} c^2 &= a^2 + b^2 & % separate here &\implies& c &= \pm\sqrt{a^2 + b^2} \end{align} yields: \begin{align} c^2 &= a^2 + b^2 & % separate here &\implies& c &= \pm\sqrt{a^2 + b^2} \end{align} Equations too long for one line Occasionally you have an equations that are too long for one line. Her the environment multline comes in handy. In this the first line will be aligned to start at the left margin, while the last line will be aligned to end at the right margin. Lines between those will be centered. A \tag{...} will be produced for the whole set, the placement does not matter. The following code \begin{multline}\tag{3} \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}\,(x-a)^{n} = \\ % aligned left f(a) +\frac{f'(a)}{1!}(x-a) +\frac{f''(a)}{2!}(x-a)^2\\ % centred +\frac{f'''(a)}{3!}(x-a)^3 +\frac{f''''(a)}{4!}(x-a)^4 +\cdots. % right \end{multline} yields \begin{multline}\tag{3} \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}\,(x-a)^{n} = \\ % aligned left f(a) +\frac{f'(a)}{1!}(x-a) +\frac{f''(a)}{2!}(x-a)^2\\ % centred +\frac{f'''(a)}{3!}(x-a)^3 +\frac{f''''(a)}{4!}(x-a)^4 +\cdots. % right \end{multline} A different possibility is tweaking the align environment, like it is shown at the end of this answer. Alternatively you can use the split environment, which works almost the same; however, it does not allow a tag. The following code \begin{split} \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}\,(x-a)^{n} &= f(a) +\frac{f'(a)}{1!}(x-a) +\frac{f''(a)}{2!}(x-a)^2\\ &\quad +\frac{f'''(a)}{3!}(x-a)^3 +\frac{f''''(a)}{4!}(x-a)^4 +\cdots. \end{split} yields: \begin{split} \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}\,(x-a)^{n} &= f(a) +\frac{f'(a)}{1!}(x-a) +\frac{f''(a)}{2!}(x-a)^2\\ &\quad +\frac{f'''(a)}{3!}(x-a)^3 +\frac{f''''(a)}{4!}(x-a)^4 +\cdots. \end{split} This environment can be encased in an align environment if necessary. It might be beneficial if you want to sort terms. Entries before the first alignment character will be oriented to the right, but in every other instance it will be oriented to the left. In this environment multiple tags are allowed, hence the following code \begin{align} f(x):&= (1+x)\mathrm{e}^x \tag{4}\\ % first line & = \mathrm{e}^x + x\mathrm{e}^x \tag{4a}\\ & = \sum_{n=0}^\infty \frac{x^n}{n!} % + \sum_{n=0}^\infty \frac{x^{n+1}}{n!} \tag{4b}\\ & = \left(% \begin{split} % the following counts as one line & 1 &+ x &+ \frac{x^2}{2!} &+ \frac{x^3}{3!} &+ \cdots\\ +~& x &+ x^2 &+ \frac{x^3}{2!} &+ \frac{x^4}{3!} &+ \cdots\\ \end{split}\right)\tag{4c}\\ & = \sum_{n=0}^\infty \frac{n+1}{n!}x^n \tag{4d}\\ % last line \end{align} yields: \begin{align} f(x):&= (1+x)\mathrm{e}^x \tag{4}\\ % first line & = \mathrm{e}^x + x\mathrm{e}^x \tag{4a}\\ & = \sum_{n=0}^\infty \frac{x^n}{n!} % + \sum_{n=0}^\infty \frac{x^{n+1}}{n!} \tag{4b}\\ & = \left(% \begin{split} % the following counts as one line & 1 &+ x &+ \frac{x^2}{2!} &+ \frac{x^3}{3!} &+ \cdots\\ +~& x &+ x^2 &+ \frac{x^3}{2!} &+ \frac{x^4}{3!} &+ \cdots\\ \end{split}\right)\tag{4c}\\ & = \sum_{n=0}^\infty \frac{n+1}{n!}x^n \tag{4d}\\ % last line \end{align} Adding labels and referring to them In a maths environment you can add labels \label to tags \tag, which then can be referred \eqref or \ref to later. For example the following code The equilibrium constant is defined by the expression $$K_x=\prod_{\ce{B}} x_{\ce{B}}^{\nu_{\ce{B}}}. \tag{5}\label{equ-constant}$$ [...] As seen in equation \ref{equ-constant} [...] [...] insert into \eqref{equ-constant} [...] produces the following output: The equilibrium constant is defined by the expression $$K_x=\prod_{\ce{B}} x_{\ce{B}}^{\nu_{\ce{B}}}. \tag{5}\label{equ-constant}$$ [...] As seen in equation \ref{equ-constant} [...] [...] insert into \eqref{equ-constant} [...] These references can be inserted directly without signs, but they can also be used in conjunction with them.

Labels can be applied wherever tags can also be applied. They will also insert a link that brings you back to where the label was defined.
Since MathJax is rendered per page and not per post, the labels will affect other posts, too. If you get an error, try a different label.

Conclusion

Especially aligning equations can be very beneficial to the readability of a post.
There are quite a few environments that might be useful to achieve this. In most cases, however, you don't need such extensive maths and the align environment is quite sufficient.

Want to show how a molecule proceeds through a series of reactions? Be judicious and think about the color-blind

\color{[color]}{[text]} will generate colored text as follows

• $\color{pink}{\ce{Co^2+}}$ yields $\color{pink}{\ce{Co^2+}}$
• $\color{magenta}{\ce{Cr^2+}}$ yields $\color{magenta}{\ce{Cr^2+}}$
• $\color{salmon}{\ce{Se}}$ yields $\color{salmon}{\ce{Se}}$ (yes even salmon)
• $\color{red}{\ce{CO2}}$ yields $\color{red}{\ce{CO2}}$
• $\color{yellow}{\ce{H2S}}$ yields $\color{yellow}{\ce{H2S}}$ (avoid)
• $\color{orange}{\ce{Fe2O3}}$ yields $\color{orange}{\ce{Fe2O3}}$
• $\color{green}{\ce{Cr^3+}}$ yields $\color{green}{\ce{Cr^3+}}$
• $\color{cyan}{\ce{SiO2}}$ yields $\color{cyan}{\ce{SiO2}}$ (avoid)
• $\color{blue}{\ce{H2O}}$ yields $\color{blue}{\ce{H2O}}$
• $\color{PURPLE}{\ce{KMnO4-}}$ yields $\color{PURPLE}{\ce{KMnO4-}}$
• $\color{gray}{\ce{Ni}}$ yields $\color{gray}{\ce{Ni}}$
• $\color{brown}{\ce{I2}}$ yields $\color{brown}{\ce{I2}}$
• $\color{white}{\ce{TiO2}}$ yields $\color{white}{\ce{TiO2}}$ (perhaps don't use this one either)

There are other colors that I will list below when discovered, but the ones above should more than suffice.

$\color{lightgreen}{\text{lightgreen}}$ (avoid), $\color{darkgreen}{\text{darkgreen}}$, $\color{lightblue}{\text{lightblue}}$, $\color{skyblue}{\text{skyblue}}$, $\color{tan}{\text{tan}}$, $\color{maroon}{\text{maroon}}$, $\color{silver}{\text{silver}}$, $\color{violet}{\text{violet}}$, $\color{plum}{\text{plum}}$, $\color{goldenrod}{\text{goldenrod}}$, $\color{teal}{\text{teal}}$, $\color{gold}{\text{gold}}$ (avoid), $\color{lavender}{\text{lavender}}$ (lavender; avoid), $\color{lime}{\text{lime}}$, $\color{darkred}{\text{darkred}}$, $\color{darkblue}{\text{darkblue}}$, $\color{navy}{\text{navy}}$, $\color{darkorange}{\text{darkorange}}$, $\color{darkcyan}{\text{darkcyan}}$, $\color{}{\text{(reserved)}}$

• – Martin - マーチン Aug 28 '18 at 13:27
• $$\color{red}{\Huge{\text{ꙮ_ꙮ}}$$ – Avyansh Katiyar Mar 12 '19 at 2:57
• I understand why to avoid yellow, but why pick on cyan? I can see it quite clearly on my screen. – Rafael Mar 22 '19 at 2:03
• @Rafael mostly contrast issues, probably should have suggested against pink too. Keep in mind, no one has yet died and made me king on the matter. – A.K. Mar 22 '19 at 2:21
• @AvnishKabaj $\color{red}{\Huge{\text{ꙮ_ꙮ}}}$ $\color{red}{\Huge{\text{ꙮ_ꙮ}}}$ – smileycreations15 May 3 '19 at 10:27

Write short \newcommands for complex terms

Typing out $\ce{Na4[Cu6(S2O3)5]}$ a dozen times in a single post will not only introduce chances of a typo, but also make it difficult to introduce changes later. It may be much better to introduce a global acronym once, at the top of your post, and then use it everywhere else.

Basics: (adapted from the TeX meta post by Alan Munn)

The syntax of \newcommand without an optional argument is the following:

\newcommand{<name>}[<args>]{ <code> }

Where <name> is the short acronym that we assign. <args> is a single integer denoting the arguments (1-9). The <code> part is the larger expansion of the short acronym.

Example: Typing $\newcommand{\chem}{\ce{Na4[Cu6(S2O3)5]}}$ and then reusing it as \chem produces:

Definition (invisible): $\newcommand{\chem}{\ce{Na4[Cu6(S2O3)5]}}$
Use $\chem$: $\chem$

Use of arguments in \newcommand

Within the <code> part of the definition, each of the arguments is marked with a # sign: so the first argument is #1 the second is #2 etc.

Example: The macro \reverseconcat, which has three obligatory arguments, concatenates them in reverse order, is defined with $\newcommand{\reverseconcat}[3]{#3#2#1}$, and used as $\reverseconcat{A}{B}{C}$, which outputs "CBA".

Definition (invisible): $\newcommand{\reverseconcat}[3]{#3#2#1}$
Use $\reverseconcat{A}{B}{C}$: $\reverseconcat{A}{B}{C}$

\define short acronyms for complex terms

Example: write $\def\fun{\ce{Na4[Cu6(S2O3)5]}}$ at the top of your post.$\def\fun{\ce{Na4[Cu6(S2O3)5]}}$ Note that it does not get rendered out. Then, as soon as you type $\fun$, the output will be $\fun$. You can do this as many times as you wish to, throughout the post.

Caveat: the \definition is applied not just to the post you write, but instead to the entire web page from the point below where you wrote \def. So, chances are - if you aren't paying attention - you will break something. This means comments can also use $\fun$, and so can the answers below your post. So, be careful in choosing a name for your acronym, it may affect the rendering of the content below, in case the acronyms clash. Moreover, the vote count will reorder posts over time, and affect the MathJax render as well.

Also, self-referential acronyms are NOT allowed: using $\def\ce{\ce{NaCl}}$ will yield a MathJax error: "MathJax internal buffer size exceeded; is there a recursive macro call?"("recursive"="self-referential") This will not only mess up the formatting of your own post, but also of others' posts, so be careful!

Use HTML entities to insert Greek symbols

Want to insert that fancy Greek symbol into your post just once? Like π-orbitals or α-carbon. Then you needn't use MathJax for that!

The SE Markdown supports HTML entities - a character sequence of the form &[code]; - which can be used to insert all sorts of characters into the post. The [code] is standardized as a hex number, but some special characters get their own English names as well:

1. &pi; - π
2. &alpha; - α
3. &beta; - β
4. &gamma; - γ
5. &micro; - µ
6. &psi; - ψ
7. &omega; - ω
8. &chi;- χ
9. &phi;- φ
10. &upsilon;- υ
11. &hbar;- ℏ

As you can observe, the names are pretty memorable and as easy to use as basic Mathjax. There's a huge list of such entities over on the official W3 page, but these are the ones most relevant to us.

• This one's nice! – M.A.R. Apr 26 '18 at 17:53
• Doesn't work in comments – Avyansh Katiyar Aug 26 '18 at 8:32

Hiding text in a post

There are two ways to hide text in a post. The first is using >! which gives the quote style rendering but hides the text until moused over. For example >! Spoiler Alert! renders as:

The other way to completely hide text in the post is to use <!-- [text] --> this has no value for an answer but is helpful if you want to save material for later such as if you anticipate expanding your answer or adding material back or you have simplified your answer and would like to save the text of a more sophisticated answer. For example <!-- the moon is just a man made of cheese --> renders as:

Different font sizes in MathJax

You may sometimes run into the problem of unreadable tiny double subscripts, or tiny expressions inside square roots, especially when doing time-consuming physical chemistry calculations. Well, here's how to increase the font size! This is especially useful when  isn't usable, and \displaystyle math doesn't help.

Adapted from the very well-written Hypertext Help with LaTeX:

The following type size commands, in order of increasing font size, are supported by LaTeX.

• \tiny
• \scriptsize
• \small
• \normalsize (default)
• \large
• \Large (capital "L")
• \LARGE (all caps)
• \huge
• \Huge (capital "H")

The default for \normalsize is 10-point, but it may differ for some Document Styles or their options.

Here are all fonts in order:

• $\tiny \ce{HCl}$
• $\scriptsize\ce{HCl}$
• $\small\ce{HCl}$
• $\normalsize\ce{HCl}$ (default)
• $\large\ce{HCl}$
• $\Large\ce{HCl}$
• $\LARGE\ce{HCl}$
• $\huge\ce{HCl}$
• $\Huge \ce{HCl}$

And here's some example texts and their corresponding outputs:

• Normal size text
• $\ce{HCl + NH3}$ = $\ce{HCl + NH3}$
• \tiny text
• $\tiny\ce{HCl + NH3}$ = $\tiny\ce{HCl + NH3}$
• \Large text
• $\Large\ce{HCl + NH3}$ = $\Large\ce{HCl + NH3}$
• \Large only the latter half of your text
• $\ce{HCl \Large + NH3}$ = $\ce{HCl \Large + NH3}$
• \Large only the initial half of your text
• $\Large\ce{HCl}\normalsize + \ce{NH3}$ = $\Large\ce{HCl}\normalsize + \ce{NH3}$

Also, even if you place \Large inside \ce or \mathrm - it won't be any issue - and work as shown in second-last bullet above.

Note that \footnotesize is not present in the above list, because it only works in TeX, not MathJax.

• I find varying sizes of fonts rather obnoxious, and I don't see any wide-spread applicability for it on this website. It has to be very special and highly complicated maths to be used in a meaningful way. In any case: $\Large\ce{NO}\normalsize\ce{(NO)2}$ $\Large\ce{NO}\normalsize\ce{(NO)2}$. And MathJax is not LaTeX, so most of what works for the latter will not work here. – Martin - マーチン Apr 19 '18 at 8:30
• @Martin-マーチン I agree, it isn't very common. But, in case of double subscripts, it sometimes becomes useful to use \Large to display then while maintaining readability. I'm sure I remember editing an answer to include \Large within the past week, but cannot find the example at the moment. "And MathJax is not LaTeX, so most of what works for the latter will not work here" hmm, I didn't check all the font sizes, let me include the ones that work then. – Gaurang Tandon Apr 19 '18 at 8:57
• @Martin-マーチン Interestingly, all of the font sizes work except \footnotesize... – Gaurang Tandon Apr 19 '18 at 9:05
• People who use double subscripts belong in a special place... – Martin - マーチン Apr 19 '18 at 9:26
• I'll only say that I am out of example usages at this moment, even though I've used this a couple of times this year. When I come across an example, I'll keep in mind to add it to this post. – Gaurang Tandon Apr 19 '18 at 9:32
• @Martin-マーチン Here's an example, finally chemistry.stackexchange.com/posts/98830/revisions I'll admit these instances are pretty rare, but when they do occur, I hope you'll agree that varying the font size is useful :) – Gaurang Tandon Jun 28 '18 at 10:24
• I respectfully disagree. I believe it should have been resolved by applying the proper display style instead of messing with the sizing: Formatting Sandbox II: please test stuff here – Martin - マーチン Jun 28 '18 at 13:25
• @Martin-マーチン Hmm... the subscripted $s$ in $T_s$ in displaystyle mode is almost unreadable on my machine. See i.stack.imgur.com/9jlJm.png But it is readable in the \Large mode. Why would you then prefer the former method in this case? – Gaurang Tandon Jun 28 '18 at 13:33
• I find the 1 over something construct disturbing in the first place, but I find that larger 1 unnerving. In proper LaTeX it doesn't even compile (Size commands do not work in mathmode), and without the correct environment it looks very, very ugly. And the subscripts are not better readable before. MathJax is a crutch; I don't really want to spend more time thinking about stuff that simply works wrong or not at all. – Martin - マーチン Jun 28 '18 at 14:15