electronic configuration of
Answers
no electronic configuration of this question
Answer:
Here's an adaptation of my answer to accommodate both styles (box or underline):
\documentclass{article}
\usepackage{amssymb}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\electron}{smm}
{ % #2 = level, #3 = electron schemes
\IfBooleanTF{#1}
{ \jm_electron:Nnn \underline { #2 } { #3 } }
{ \jm_electron:Nnn \fbox { #2 } { #3 } }
}
\seq_new:N \l_jm_electron_schemes_seq
\seq_new:N \l__jm_electron_schemes_print_seq
\cs_new_protected:Nn \jm_electron:Nnn
{
\cs_set_eq:NN \__jm_electron_highlight:n #1
\seq_clear:N \l__jm_electron_schemes_print_seq
\seq_set_split:Nnn \l_jm_electron_schemes_seq { | } { #3 }
\seq_map_function:NN \l_jm_electron_schemes_seq \__jm_electron_do_scheme:n
% print the schemes
\group_begin:
\setlength{\tabcolsep}{.2em}
\begin{tabular}{ * { \seq_count:N \l_jm_electron_schemes_seq } { c } }
\seq_use:Nn \l__jm_electron_schemes_print_seq { & } \\
\multicolumn { \seq_count:N \l_jm_electron_schemes_seq } { c } { #2 }
\end{tabular}
\group_end:
}
\cs_new_protected:Nn \__jm_electron_do_scheme:n
{
\seq_put_right:Nn \l__jm_electron_schemes_print_seq
{
\__jm_electron_highlight:n
{
\clist_map_inline:nn { #1 }
{
\int_case:nn { ##1 }
{
{1}{$\scriptstyle\upharpoonleft$}
{0}{\phantom{$\scriptstyle\upharpoonleft$}}
{-1}{$\scriptstyle\downharpoonright$}
}
}
}
}
}
\ExplSyntaxOff
\begin{document}
\electron{2s}{1,-1}\quad\electron{2p}{1,0 | 1,0 | 1,0}
\electron*{2s}{1,-1}\quad\electron*{2p}{1,0 | 1,0 | 1,0}
\end{document}