19

I want to draw a Lewis structure as in the picture. I tried to do with chemfig but does not perform the separation of the points and a minus in the superscript.

Lewis structures

  • Do you also need the electronic configuration beneath the element symbols? – Thorsten Donig Oct 10 '13 at 9:08
  • Not now, but in the near future I need it. – Kiyoshi Oct 10 '13 at 10:06
17

Here are a different versions using different chemistry packages. Which one you want to use is up to you...

  • chemfig, provides \startscheme, \stopscheme, \chemfig, \lewis, \Lewis, \chemname ... ;
  • mhchem, provides \ce{};
  • chemformula, provides \ch{} with the !(<below>)(<formula>) syntax and \chlewis;
  • elements, provides \elconf and \writeelconf.
\documentclass{article}
\usepackage{chemfig}
\usepackage[version=4]{mhchem}
\usepackage{chemformula}
\usepackage{elements}

\newcommand*\pkg[1]{\texttt{#1}}

\begin{document}

\section*{Version 1 -- \pkg{chemfig} and \pkg{mhchem}}
\ce{
  \Lewis{4.,Li} + \Lewis{0.2:4:6:,F}
   ->
  Li+ + \Lewis{0:2:4:6:,F}-
}

\section*{Version 2 -- \pkg{chemfig} and \pkg{elements}}
\schemestart
  \chemname[1.5ex]{\lewis{4.,Li}}{\scriptsize\elconf{Li}}
  \+{1.5em,1.5em}
  \chemname[1.5ex]{\lewis{0.2:4:6:,F}}{\scriptsize\elconf{F}}
  \arrow(.mid east--.mid west)
  \chemname[1.5ex]{Li$^+$}{\scriptsize\writeelconf{2}}
  \+{1em,1em}
  \chemname[1.5ex]{\lewis{0:2:4:6:,F}$^-$}{\scriptsize\writeelconf{2,2+6}}
\schemestop

\section*{Version 3 -- \pkg{chemformula}}
\ch{
  "\chlewis{180.}{Li}" + "\chlewis{0.90:180:270:}{F}"
   ->
  Li+ + "\chlewis{0:90:180:270:}{F}" {}-
}

\section*{Version 4 -- \pkg{chemformula} and \pkg{elements}}
\ch{
  !(\elconf{Li})( "\chlewis{180.}{Li}" ) +
  !(\elconf{F})( "\chlewis{0.90:180:270:}{F}" )
   ->
  !(\writeelconf{2})( Li+ ) +
  !(\writeelconf{2,2+6})( "\chlewis{0:90:180:270:}{F}" {}- )
}

\end{document}

enter image description here

  • Very useful. I like this answer because use the package that I already use and I don't need others packages. – Kiyoshi Oct 10 '13 at 22:00
16

I introduce \lewis with 7 arguments, and I apologize that I don't know the precise naming conventions for chemistry. (EDITED to specify valence in only one place).

Arguments:

#1 Core atom

#2 Top electrons

#3 Right electrons

#4 bottom electrons

#5 left electrons

#6 valence

#7 inner electron shells

\documentclass{article}
\usepackage{stackengine}
\usepackage{graphicx,ifthen}
\begin{document}
\newcommand\lewis[7]{%
  \ifthenelse{\equal{#3}{}}%
    {\def\RHS{}\def\RRHS{\hspace{.5ex}}}%
    {\def\RHS{~\rotatebox{90}{\makebox[1.5ex]{#3}}\,}\def\RRHS{}}%
  \stackengine{5ex}{%
  \rotatebox{90}{\makebox[1.5ex]{#5}}~%
  \stackengine{1.1ex}{%
  \stackengine{2.4ex}{#1}{#2}{O}{c}{F}{F}{L}%
  }{#4}{U}{c}{F}{F}{L}%
  \RHS$^{#6}$\RRHS%
  }{$#7$}{U}{c}{F}{F}{L}%
}
\lewis{Li}{}{}{}{.}{}{1s^22s^1} +
\lewis{F}{..}{.}{..}{..}{}{1s^22s^22p^5}
$\longrightarrow$
\lewis{Li}{}{}{}{}{+}{1s^2}
\lewis{F}{..}{..}{..}{..}{-}{1s^22s^22p^6}
$\quad$(o LiF)
\end{document}

enter image description here

  • It's a great solution for my problem. Thank you. – Kiyoshi Oct 10 '13 at 12:09
  • \longrightarrow would look a little nicer. (and is what is used in the original example.) – barbara beeton Oct 10 '13 at 14:30
  • @barbarabeeton Thanks. I didn't have it on the tip of my tongue, and was focused on the \lewis part. Fixed. – Steven B. Segletes Oct 10 '13 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.