| 1 |
%% orbitals-doc.tex -- user manual for the orbitals package |
| 2 |
%% Compile with pdfLaTeX (twice). |
| 3 |
\documentclass[11pt]{article} |
| 4 |
\usepackage[a4paper,margin=2.6cm]{geometry} |
| 5 |
\usepackage{orbitals} % the package being documented |
| 6 |
\usepackage{xcolor} |
| 7 |
\usepackage{listings} |
| 8 |
\usepackage{hyperref} |
| 9 |
\hypersetup{colorlinks=true,linkcolor=blue!55!black,urlcolor=teal!60!black, |
| 10 |
pdftitle={The orbitals package},pdfauthor={Your Name}} |
| 11 |
|
| 12 |
% ---- code listing style ---- |
| 13 |
\definecolor{codebg}{gray}{0.96} |
| 14 |
\lstset{ |
| 15 |
basicstyle=\ttfamily\small, |
| 16 |
backgroundcolor=\color{codebg}, |
| 17 |
frame=single,framerule=0pt, |
| 18 |
xleftmargin=6pt,xrightmargin=6pt, |
| 19 |
breaklines=true, |
| 20 |
columns=fullflexible, |
| 21 |
keepspaces=true, |
| 22 |
} |
| 23 |
% show "code -> result" pairs |
| 24 |
\newcommand{\result}{\par\smallskip\noindent\textit{Result:}\quad} |
| 25 |
|
| 26 |
\title{\textbf{The \texttt{orbitals} package}\\[2pt] |
| 27 |
\large Atomic subshell / orbital-box diagrams with automatic electron filling} |
| 28 |
\author{Faris Hameed\\\small\texttt{[email protected]}} |
| 29 |
\date{Version 1.0\quad--\quad 2026/05/24} |
| 30 |
|
| 31 |
\begin{document} |
| 32 |
\maketitle |
| 33 |
\hrule |
| 34 |
\begin{abstract} |
| 35 |
\noindent |
| 36 |
\texttt{orbitals} draws the familiar ``box-and-arrow'' notation for atomic |
| 37 |
subshells ($s$, $p$, $d$, $f$). You supply only the principal quantum number, |
| 38 |
the subshell type and the number of electrons; the package places the |
| 39 |
electrons automatically following \emph{Hund's rule} (maximum multiplicity) |
| 40 |
and the \emph{Pauli principle}. It can draw a single subshell, a sequence of |
| 41 |
subshells, a complete valence configuration with a noble-gas core, or an empty |
| 42 |
transition-series template. Every diagram can be scaled and dropped inline |
| 43 |
inside running text. |
| 44 |
\end{abstract} |
| 45 |
\hrule |
| 46 |
\tableofcontents |
| 47 |
\bigskip |
| 48 |
|
| 49 |
% ============================================================ |
| 50 |
\section{Requirements and installation} |
| 51 |
The package requires a TeX system no older than 2020 and the |
| 52 |
\textsf{TikZ}/\textsf{pgf} bundle. It works with pdf\LaTeX, Xe\LaTeX{} and |
| 53 |
Lua\LaTeX. \textsf{TikZ}, \textsf{xcolor} and \textsf{graphicx} are loaded |
| 54 |
automatically; \textsf{mhchem} is loaded only if present (used by the optional |
| 55 |
\verb|\chem| helper). |
| 56 |
|
| 57 |
\paragraph{Manual installation.} |
| 58 |
Place \texttt{orbitals.sty} either in the same folder as your document or in |
| 59 |
your local \texttt{texmf} tree, e.g. |
| 60 |
\begin{lstlisting} |
| 61 |
TEXMFHOME/tex/latex/orbitals/orbitals.sty |
| 62 |
\end{lstlisting} |
| 63 |
then run \texttt{texhash} (for a TDS tree). Load it with: |
| 64 |
\begin{lstlisting} |
| 65 |
\usepackage{orbitals} |
| 66 |
\end{lstlisting} |
| 67 |
|
| 68 |
% ============================================================ |
| 69 |
\section{Quick start} |
| 70 |
\begin{lstlisting} |
| 71 |
\suborbital{4}{p}{5} |
| 72 |
\end{lstlisting} |
| 73 |
\result\suborbital{4}{p}{5} |
| 74 |
|
| 75 |
\medskip |
| 76 |
The three mandatory arguments are always \emph{principal quantum number}, |
| 77 |
\emph{subshell letter} and \emph{number of electrons}. The number of boxes is |
| 78 |
chosen from the letter: $s\to1$, $p\to3$, $d\to5$, $f\to7$. |
| 79 |
|
| 80 |
% ============================================================ |
| 81 |
\section{Command reference} |
| 82 |
|
| 83 |
% --------------------------------------------- |
| 84 |
\subsection{\texttt{\textbackslash suborbital} -- a single subshell} |
| 85 |
\begin{lstlisting} |
| 86 |
\suborbital[<scale>]{<n>}{<type>}{<electrons>} |
| 87 |
\end{lstlisting} |
| 88 |
The optional \texttt{<scale>} defaults to the global scale (Section |
| 89 |
\ref{sec:scale}). |
| 90 |
|
| 91 |
\begin{lstlisting} |
| 92 |
\suborbital{4}{s}{1} \suborbital{4}{s}{2} \suborbital{3}{d}{6} |
| 93 |
\end{lstlisting} |
| 94 |
\result\suborbital{4}{s}{1}\quad\suborbital{4}{s}{2}\quad\suborbital{3}{d}{6} |
| 95 |
|
| 96 |
% --------------------------------------------- |
| 97 |
\subsection{\texttt{\textbackslash electronconfig} -- a sequence} |
| 98 |
\begin{lstlisting} |
| 99 |
\electronconfig[<scale>]{<n><type><electrons>, ...} |
| 100 |
\end{lstlisting} |
| 101 |
Each item uses the compact form \texttt{4p5} (one digit for $n$, one letter |
| 102 |
for the type, the rest for the electron count, so \texttt{3d10} is fine). |
| 103 |
|
| 104 |
\begin{lstlisting} |
| 105 |
\electronconfig{3d6,4s2,4p0} |
| 106 |
\end{lstlisting} |
| 107 |
\result\electronconfig{3d6,4s2,4p0} |
| 108 |
|
| 109 |
% --------------------------------------------- |
| 110 |
\subsection{\texttt{\textbackslash atomconfig} -- configuration with a core} |
| 111 |
\begin{lstlisting} |
| 112 |
\atomconfig[<core>][<gap-cm>][<scale>]{<list>} |
| 113 |
\end{lstlisting} |
| 114 |
\begin{itemize}\itemsep2pt |
| 115 |
\item \texttt{<core>}: text of the noble-gas core (default: empty). |
| 116 |
\item \texttt{<gap-cm>}: horizontal space (in cm) reserved before the first |
| 117 |
box (default \texttt{1}). |
| 118 |
\item \texttt{<scale>}: scale factor (default: the global scale). |
| 119 |
\end{itemize} |
| 120 |
\textbf{Important:} if the core text itself contains a closing bracket |
| 121 |
\verb|]| (as in \verb|[Ar]|), wrap the whole core in braces so \LaTeX{} does |
| 122 |
not end the optional argument early: |
| 123 |
\begin{lstlisting} |
| 124 |
\atomconfig[{\textsubscript{18}[Ar]}][1.2]{3d6,4s2,4p0} |
| 125 |
\end{lstlisting} |
| 126 |
\result\atomconfig[{\textsubscript{18}[Ar]}][1.2]{3d6,4s2,4p0} |
| 127 |
|
| 128 |
\medskip |
| 129 |
Wide cores simply need a larger gap: |
| 130 |
\begin{lstlisting} |
| 131 |
\atomconfig[{\textsubscript{54}[Xe]\,4f14}][2.7]{5d6,6s2,6p0} |
| 132 |
\end{lstlisting} |
| 133 |
\result\atomconfig[{\textsubscript{54}[Xe]\,4f14}][2.7]{5d6,6s2,6p0} |
| 134 |
|
| 135 |
% --------------------------------------------- |
| 136 |
\subsection{\texttt{\textbackslash transitionseries} -- empty templates} |
| 137 |
\begin{lstlisting} |
| 138 |
\transitionseries[<scale>]{<1|2|3>} |
| 139 |
\end{lstlisting} |
| 140 |
Draws an empty $d$/$s$/$p$ frame for the first ($1$), second ($2$) or third |
| 141 |
($3$) transition series, with the appropriate noble-gas core. |
| 142 |
\begin{lstlisting} |
| 143 |
\transitionseries{1} |
| 144 |
\end{lstlisting} |
| 145 |
\result\transitionseries{1} |
| 146 |
|
| 147 |
% ========================== 4 ============================== |
| 148 |
\section{Customisation}\label{sec:custom} |
| 149 |
|
| 150 |
% ========================== 4-1 ============================= |
| 151 |
\subsection{Scaling}\label{sec:scale} |
| 152 |
Two mechanisms are available. A \emph{per-call} optional argument: |
| 153 |
\begin{lstlisting} |
| 154 |
\suborbital[0.5]{4}{p}{5} \suborbital[1.4]{4}{p}{5} |
| 155 |
\end{lstlisting} |
| 156 |
\result\suborbital[0.5]{4}{p}{5}\quad\suborbital[1.4]{4}{p}{5} |
| 157 |
|
| 158 |
\medskip |
| 159 |
\noindent and a \emph{global} setting applied to all subsequent diagrams: |
| 160 |
\begin{lstlisting} |
| 161 |
\setOrbitalScale{0.7} % everything afterwards is 70% |
| 162 |
\setOrbitalScale{1} % back to normal |
| 163 |
\end{lstlisting} |
| 164 |
|
| 165 |
% ========================== 4-2 ============================= |
| 166 |
\subsection{Inline placement and vertical alignment} |
| 167 |
Diagrams are vertically centred on the text line by default, so they sit |
| 168 |
naturally at the beginning, middle or end of a sentence. Switch the alignment |
| 169 |
with: |
| 170 |
\begin{lstlisting} |
| 171 |
\setOrbitalAlign{center} % centred on the line (default) |
| 172 |
\setOrbitalAlign{bottom} % sitting on the baseline |
| 173 |
\end{lstlisting} |
| 174 |
For example, the Fe$^{3+}$ ion has a |
| 175 |
\suborbital[0.38]{3}{d}{5} half-filled configuration.\\ |
| 176 |
\setOrbitalAlign{bottom} |
| 177 |
Here it sits on the line For example, the Fe$^{3+}$ ion has a \suborbital[0.4]{4}{s}{2} like this. |
| 178 |
|
| 179 |
% ========================== 4-3 ============================= |
| 180 |
\subsection{Colours, box size and spacing} |
| 181 |
\begin{lstlisting} |
| 182 |
\setElectronColor{blue} % arrow colour (default red) |
| 183 |
\setOrbitalBox{0.8}{1.0} % {box width}{box height} in cm |
| 184 |
\setOrbitalGap{0.9} % gap between subshells in cm |
| 185 |
\end{lstlisting} |
| 186 |
|
| 187 |
\textbf{Default:}\\ |
| 188 |
\suborbital{3}{d}{7}\quad\electronconfig{3d6,4s2,4p0} |
| 189 |
|
| 190 |
\bigskip |
| 191 |
\textbf{arrow colour} \verb|\setElectronColor{blue}|\\ |
| 192 |
\setElectronColor{blue} |
| 193 |
\suborbital{3}{d}{7}\quad\electronconfig{3d6,4s2,4p0} |
| 194 |
|
| 195 |
\bigskip |
| 196 |
\textbf{box size} \verb|\setOrbitalBox{0.8}{1.0}|\\ |
| 197 |
\setOrbitalBox{0.8}{1.0} |
| 198 |
\suborbital{3}{d}{7}\quad\electronconfig{3d6,4s2,4p0} |
| 199 |
|
| 200 |
\bigskip |
| 201 |
\textbf{gap} \verb|\setOrbitalGap{0.9}|\\ |
| 202 |
\setOrbitalGap{0.9} |
| 203 |
\electronconfig{3d6,4s2,4p0} |
| 204 |
|
| 205 |
\bigskip |
| 206 |
\textbf{all three together:}\\ |
| 207 |
\setElectronColor{teal}\setOrbitalBox{0.6}{0.8}\setOrbitalGap{1.4} |
| 208 |
\electronconfig{3d6,4s2,4p0} |
| 209 |
|
| 210 |
\newpage |
| 211 |
|
| 212 |
% ========================== 4-4 ============================= |
| 213 |
\subsection{Arrow shape} |
| 214 |
Electrons are drawn as half-arrows (\textsf{TikZ} \texttt{pics} |
| 215 |
\texttt{halfarrowup} / \texttt{halfarrowdown}). Adjust them with: |
| 216 |
\begin{lstlisting} |
| 217 |
\setElectronArrow{<stem length>}{<line width>} % e.g. {0.5}{1.2pt} |
| 218 |
\end{lstlisting} |
| 219 |
|
| 220 |
% ========================== 4-5 ============================= |
| 221 |
\subsection{The \texttt{\textbackslash chem} helper} |
| 222 |
If \textsf{mhchem} is available, \verb|\chem{Fe^3+}| typesets a formula via |
| 223 |
\verb|\ce|. |
| 224 |
|
| 225 |
% ========================== 5 ============================== |
| 226 |
\section{How electrons are placed} |
| 227 |
For a subshell with $k$ boxes and $N$ electrons the package computes the number |
| 228 |
of doubly occupied boxes as $\max(0,N-k)$ and fills the remaining electrons as |
| 229 |
single ``spin-up'' arrows. This reproduces the high-spin (free-atom) ground |
| 230 |
state expected from Hund's rule and the Pauli principle. Low-spin (complex) |
| 231 |
fillings are not produced automatically. |
| 232 |
|
| 233 |
% ========================== 6 ============================== |
| 234 |
\section{Command summary} |
| 235 |
\begin{tabular}{@{}ll@{}} |
| 236 |
\verb|\suborbital[s]{n}{t}{e}| & one subshell\\ |
| 237 |
\verb|\electronconfig[s]{list}| & a row of subshells\\ |
| 238 |
\verb|\atomconfig[core][gap][s]{list}|& configuration with a core\\ |
| 239 |
\verb+\transitionseries[s]{1|2|3}+ & empty transition template\\[4pt] |
| 240 |
\verb|\setOrbitalScale{f}| & global scale\\ |
| 241 |
\verb+\setOrbitalAlign{center|bottom}+& inline alignment\\ |
| 242 |
\verb|\setElectronColor{c}| & arrow colour\\ |
| 243 |
\verb|\setOrbitalBox{w}{h}| & box size (cm)\\ |
| 244 |
\verb|\setOrbitalGap{g}| & subshell gap (cm)\\ |
| 245 |
\verb|\setElectronArrow{stem}{lw}| & arrow geometry\\ |
| 246 |
\end{tabular} |
| 247 |
|
| 248 |
% ============================================================ |
| 249 |
\section{License and version history} |
| 250 |
This package is distributed under the \LaTeX{} Project Public License |
| 251 |
(LPPL) version 1.3c . \\[4pt] |
| 252 |
\textbf{v1.0} (2026/05/24): first public release. |
| 253 |
|
| 254 |
\end{document} |