Currently working on corrosion of CaCO3:



\chemfig{O - C (=[6]O) (-[8]O) }] + 2 \chemfig{H-Cl|}   \hspace{4em}|\Delta H<0

CaCO3 typesetting

But I need some help to fix some issues:

  • Where did the Cl in HCl go?
  • How do I draw the electron pairs around the O-atoms (see picture below)?
  • Can I vertically center the lewis structure of CO3 inside the formula somehow?

How I want CO3 to look like

  • 2
    Welcome to TeX.SX! Please don't post code fragments. Instead, put your fragments into a complete compilable document that shows the problem.
    – BambOo
    Oct 13, 2018 at 10:57
  • 2
    You probably want to have a look at the \Lewis command in the chemfig documentation and the commands on typesetting chemical equations.
    – TeXnician
    Oct 13, 2018 at 11:41
  • Should be complete now @BambOo Oct 13, 2018 at 11:41
  • 2
    Unrelated to the question, but perhaps worth to keep in mind: The carbonate anion does according to the VSEPR theory, exhibit a trigonal planar molecular geometry, while the sketch in your question shows a T-shaped geometry.
    – leandriis
    Oct 13, 2018 at 12:23
  • @leandriis I love it when people talk dirty ^^
    – BambOo
    Oct 13, 2018 at 16:17

2 Answers 2


enter image description here



    \chemfig{Ca^{2+}} \arrow{0}[,0] \hspace{5mm}
    \chemfig{{\chemabove[-0.5pt]{\lewis{246,O}}{\scriptstyle\hspace{-7mm}\ominus}}- C (=[6]O) -[8]{\chemabove[-0.5pt]{\lewis{026,O}}{\scriptstyle\hspace{7mm}\ominus}}{}}}
+2 \chemfig{HCl}
$|\Delta H<0$


In the above example, I have made use of the \lewis command in order to add the free electron pairs to the oxygen atoms. For the circled charges, I have used \ominus as described in this answer and on page 42 (section 12.2 Add a superscript without modifying a bond) of the chemfig manual. In order to vertically center the formula, I have used an invisible \arrow as described in this answer. For the square brackets, I have used \chemleft[ and \chemright] as described on page 54 (8 Subscheme) of the chemfig manual.


To answer your questions :

  • The Cl disappeared because the | has seemingly no sense for chemfig at least in that position, which probably leads to a non warned error.
  • Drawing the electron pairs can be achieved using the \lewis command as pointed out by TeXnician. Please see section 8 p 30 of the chemfig manual

Please see the modified (although incomplete) example below.



Ca^{2+}; & 
\lewis{2 4 6,\chemabove[0.8pt]{O}{\scriptstyle\hspace{-6mm}\ominus}}-
C (=[6]\lewis{7 5,O})-
\lewis{0 2 6,\chemabove[0.8pt]{O}{\scriptstyle\hspace{6mm}\ominus}}}\quad
\end{bmatrix} + 2 \chemfig{H-\lewis{0,Cl}}   \hspace{4em}|\Delta H<0
  • Thank you a lot, but I have another question: if I render your solution, I am missing the [ before the Ca2+. How do I fix this? Oct 13, 2018 at 15:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .