2

I'm trying to represent the electrons in the bonds between atoms by drawing points at the end of each bond segment. Something like this: CO2 diagram

Is there any way I can do this? I can get something similar with \lewis but the dots don't quite align with the bonds:

\lewis{0:2:6:,O}=\lewis{0:4:,C}=\lewis{2:4:6:,O}

CO2 diagram with dots offset

2
  • 2
    Can you please provide a complete example showing what you have done? May 30, 2020 at 18:57
  • Just added; thanks for pointing that out! My apologies.
    – Gravitron
    May 31, 2020 at 19:49

1 Answer 1

8

You can set the distance between the dots in \lewis with the macro \setlewisdist. Note that this also affects the distance between the electrons above and below the O, but that is probably good in terms of consistency. A distance of 0.2em seems to fit with the bond lines.

Important note: the \lewis macro has been deprecated in current versions of chemfig in favor of the new command \charge. Therefore this answer will not work anymore when the command is removed from the package in the future. However, since the OP already uses the command this answer is based on it.

MWE:

\documentclass{article}
\usepackage{chemfig}
\begin{document}
\setlewisdist{0.2em}
\chemfig{\lewis{0:2:6:,O}=\lewis{0:4:,C}=\lewis{2:4:6:,O}}
\end{document}

Result:

enter image description here

2
  • 1
    Very nice and my compliments.
    – Sebastiano
    May 30, 2020 at 21:21
  • Now: \chemfig{\charge{90=\:,-90=\:,0=\:}{O}=\charge{0=\:,180=\:}{C}=\charge{90=\:,-90=\:,180=\:}{O}} Jun 23, 2022 at 5:50

You must log in to answer this question.

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