# can I write this configuration for valence bond theory in latex?

It would be really helpful if someone could tell me how to write this electronic configuration in LaTeX.

\documentclass{article}
\usepackage{modiagram}
\usetikzlibrary{positioning}

\newcommand{\annotation}[3][Cl]{\draw[<-,shorten >=5pt, latex-, thick] (#2.-90) -- ++ (0,-0.75) node {\bfseries #1};\node[above=-12pt of #2] {#3};}
\newcommand{\orbitaltitle}[2]{\node[above=5pt of #1] {\bfseries #2};}

\begin{document}

\begin{modiagram}[style=square]
\AO[A](0pt){p}{0;pair, pair,pair}
\AO[B](60pt){s}{0;up}
\AO[C](80pt){s}{0;up}
\orbitaltitle{Az}{3d\textsuperscript{8}}

\AO[D](120pt){s}{0;}
\annotation{D}{:}
\orbitaltitle{D}{4s}

\AO[E](160pt){p}{0;, ,}
\annotation{Ex}{:}
\annotation{Ey}{:}
\annotation{Ez}{:}
\orbitaltitle{Ey}{4p}

\end{modiagram}

\end{document}


Here is a modified version without horizontal gaps between the individual orbitals of a set:

\documentclass{article}
\usepackage{modiagram}
\usetikzlibrary{positioning}

\newcommand{\annotation}[3][Cl]{\draw[<-,shorten >=5pt, latex-, thick] (#2.-90) -- ++ (0,-0.75) node {\bfseries #1};\node[above=-12pt of #2] {#3};}
\newcommand{\orbitaltitle}[2]{\node[above=5pt of #1] {\bfseries #2};}

\begin{document}

\begin{modiagram}[style=square]
\AO[A1](0pt){s}{0;pair}
\AO[A2](12pt){s}{0;pair}
\AO[A3](24pt){s}{0;pair}
\AO[A4](36pt){s}{0;up}
\AO[A5](48pt){s}{0;up}
\orbitaltitle{A3}{3d\textsuperscript{8}}

\AO[B](100pt){s}{0;}
\annotation{B}{:}
\orbitaltitle{B}{4s}

\AO[C1](148pt){s}{0;}
\AO[C2](160pt){s}{0;}
\AO[C3](172pt){s}{0;}
\annotation{C1}{:}
\annotation{C2}{:}
\annotation{C3}{:}
\orbitaltitle{C2}{4p}

\end{modiagram}

\end{document}

• Very nice ...the modiagram package: interesting. Jul 18 at 11:46
• Thank you so much. But if I wanted to cancel the distance between the same group of orbital (5 squares, one squere then 3 square). Jul 18 at 15:18
• @GhassanHamad: I just updated my answer accordingly. Jul 18 at 15:48
• Thank you so much. Jul 18 at 19:57

Looks like the answer is "yes", you can write this bond diagram in Latex. Problem is to find the one most suitable to you.

I suggest scanning ctan.org, perhaps best via google, like this: ctan valence bond . Also switch to the image-search, which sometimes better narrows down to what you are after.

If you search directly at CTAN e.g. for chemistry, it can be a bit overwhelming: https://ctan.org/topic/chemistry?lang=en .

Searching for bond at CTAN directly yields the bondgraph package, which might provide, what you want: please check its documentation. https://ctan.org/pkg/bondgraph Or bondgraphs: https://ctan.org/pkg/bondgraphs .

Expanding the google search term above into ctan latex valence bond electrons resulted in chemfig, https://mirror.marwan.ma/ctan/macros/generic/chemfig/chemfig-en.pdf . It also may appear overwhelming, but to me looks like it provides the building blocks you need.

If all this turns out to bee too much, you still can fall back to package tikz and just draw it. Or you do an old layout-trick, use a table for positioning and hide all its rules ... which might not be the best way to do it.

From a tactical point of view perhaps it's good to start with a bad solution, e.g. even as plain text in ugly presentation, just to continue, and replace later by a much better representation.

P.S.: Also try entering 'chem' into the tag-search ... it might give you further hints.