# How to make a chemical diagram with mhchem

I need to write two symbols one below the other, and I referred to the following posts:

How to write something vertically below another math symbol

How to write below/above the text in LaTeX?

However, using \underset{}{} or \stackrel{}{} decreases the size of one symbol with respect to the other. underset{}{} makes the bottom symbol smaller, and \stackrel{}{} makes the top smaller (Go to the bottom of the page here to test it out)

My Question: Is there any LaTeX or MathJax command that stacks two things symbols but does not change the size of either one?

My Use: I want to use it to make a simple organic chemistry molecule (2-methyl 2-chloro propane). The closest I have come to rendering it approximately the same size is

\ce{CH3\bond{1}}
{\stackrel{
\;\;\;\large\ce{CH3}
}{\stackrel{|}{\underset{\underset{\huge\ce{Cl}}{|}}{\ce{C}}}}}\ce{-CH3}


(Go to the bottom of the page here to test it out)

It is extremely messy, but still not the same size. Please don't ask me to use chemfig, there are a few reasons I don't want to use it.

• You can replace both the \large and \huge commands by \displaystyle, that will set the symbols to the math font's natural size. – Phelype Oleinik Jan 24 '18 at 11:39
• For something so simple (I mean no strangely tilted lines) you could use a simple array. – campa Jan 24 '18 at 12:50
• Welcome to TeX.SX. When you post a question, please provide a "Minimal Working Example" (MWE) that starts with \documentclass, includes all relevant \usepackage commands, ends with \end{document} and compiles without errors, even if it does not produce your desired output. – Sandy G Jan 24 '18 at 16:19

There are several packages in LaTeX that will produce chemical diagrams. See this post and its answers for an overview.

As an example, using chemfig (even though you want to avoid it) the diagram can be produced using the following code:

\documentclass{article}
\usepackage{chemfig}

\begin{document}

\chemfig{CH_3-C(-[2]CH_3)(-[6]Cl)-CH_3}

\end{document}


The chemfig user manual explains this and many other constructions.

But it seems that you are really asking about how to typeset this in MathJax. MathJax is usually considered off topic at TeX.SX. However, the MathJax extension mhchem is also a package in LaTeX, so here is a possible solution using mhchem. It is my understanding that mhchem is designed for chemical equations, not structure diagrams, so you may need to use an array to get this to work:

\documentclass{article}
\usepackage{mhchem}

\begin{document}

\begin{array}{c} \ce{\phantom{H_3}CH_3}\\% phantom to get the bond aligned with the C | \\ \ce{CH_3-C-CH_3}\\ | \\ \ce{Cl} \end{array}

\end{document}


This produces (in LaTeX)

or in Chrome with MathJax:

• I took the liberty of changing the title of your question so other users can find this more easily. I hope that's ok. – Sandy G Jan 24 '18 at 17:40