I have seen some other postings about related electron configurations, but nothing that matched what I was looking for. I am pretty comfortable with a lot of LaTeX, except when it comes to stuff like using TikZ which I'm sure is what I'm needing here.
I'm wanting to create the following image:
I do not always need to create both the "2s" and "2p" sections at the same time. Ideally wrapping it in a function since I will be needing to create many of these images.
\electron{2s}{1}{{1,-1}}
This would be the {label}{number of lines}{{array of electrons}}
- where in the array (which I'm not sure how easy that is to implement), I can provide the arrows needed. 1
is an up arrow, 0
is no arrow, -1
is a down arrow (just as an example).
The 2p would be drawn as:
\electron{2p}{3}{{1,0},{1,0},{1,0}}
Then I could string them together if wanted, defining the space between them:
\electron{}{}{}$\qquad$\electron{}{}{}
Or something like that
Since I don't know the actual TikZ to use, I thought I'd at least provide pseudocode/markup to show what I would think would happen:
\newcommand{\electron}[3]{
\newcounter{lines}
\forloop{lines}{0}{\value{lines} < #2}{
draw line
if array[\value{lines}][0] = -1; draw down line %first entry
if array[\value{lines}][0] = 1; draw up line %first entry
if array[\value{lines}][1] = -1; draw down line %second entry
if array[\value{lines}][1] = 1; draw up line %second entry
}
%place text of #1 cenetered under created lines
}