# chemfig: lewis structure

Currently working on corrosion of CaCO3:

\documentclass[a4paper]{article}
\usepackage{chemfig}

\begin{document}

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


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?

• 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 '18 at 10:57
• 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 '18 at 11:41
• Should be complete now @BambOo – writzlpfrimpft Oct 13 '18 at 11:41
• 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 '18 at 12:23
• @leandriis I love it when people talk dirty ^^ – BambOo Oct 13 '18 at 16:17

\documentclass{article}
\usepackage{chemfig}

\begin{document}

\schemestart
\chemleft[
\subscheme{
\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}}{}}}
\hspace{5mm}
\chemright]
+2 \chemfig{HCl}
\hspace{4em}
$|\Delta H<0$
\schemestop

\end{document}


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.

• 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.

\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{chemfig}

\begin{document}

$\begin{bmatrix} Ca^{2+}; & \chemfig{ \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$
\end{document}

• 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? – writzlpfrimpft Oct 13 '18 at 15:58