\documentclass[12pt, a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{color}
\usepackage{listings}
\usepackage{hyperref}
\usepackage{etoolbox}
\usepackage{float}
\usepackage[version=4]{mhchem}
\usepackage[
    top=2cm, 
    bottom=3cm, 
    left=2cm, 
    right=2cm
]{geometry}


\usepackage{mohelper}

% dddddddddddddddddddddddddddddddddddddddd

\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}

\lstdefinestyle{mystyle}{
    language=[LaTeX]TeX,
    backgroundcolor=\color{backcolour},
    commentstyle=\color{codegreen},
    numberstyle=\tiny\color{darkgray},
    stringstyle=\color{codepurple},
    basicstyle=\ttfamily\footnotesize,
    breakatwhitespace=false,         
    breaklines=true,                 
    captionpos=b,                    
    keepspaces=false,
    showspaces=false,                                
    tabsize=4,
    classoffset=0,
    keywordsprefix=\\,
    morekeywords={begin,end,documentclass,usepackage,fragment},
    keywordstyle=\color{magenta}\bfseries,
}

\hypersetup{
    colorlinks=true,
    linkcolor=black,
    filecolor=magenta,      
    urlcolor=blue,
    }

\lstset{style=mystyle}

\makeatletter
\newcommand{\degeneratelabel}{\degener@telabel}
\makeatother
\AddToHook{shipout/background}{%
  \put(0.5\paperwidth, -0.96\paperheight){% 
    \makebox(0,0)[b]{%
       \footnotesize \color{gray} © 2026 modiagram-latex-integration. Licensed under \href{https://www.gnu.org/licenses/gpl-3.0.html}{GPL v3}.%
    }%
  }%
}
% dddddddddddddddddddddddddddddddddddddddd



\title{Reference Manual for mohelper \\[1ex] \large \colorbox{green}{v1.0}}

\author{Viktor Altergott}
\date{\today}


\begin{document}

\maketitle

\begin{figure}[H]
    \centering
    \fbox{
        \begin{mohelper}
            \def\columndistance{3}
            \def\diagrammode{compact}
            \fragment{
                \addOrbital{energy=0,sym={t2g,eg},config={,,,,},labels=3d}
                \addOrbital{energy=3,sym=a1g,labels=4s}
                \addOrbital{energy=4.5,sym=t1u,config={,,},labels=4p}
                \addLabel{$Me^{n+}$}{0}
            }
            \fragment{
                \addOrbital{energy=-4,sym=a1g}
                \addOrbital{energy=-3,sym=t1u,config={,,}}
                \addOrbital{energy=-2,sym=eg,config={,}}
                \addOrbital{energy=0,sym=t2g,config={,,}}
                \addOrbital{energy=1,sym=eg,config={,}}
                \addOrbital{energy=6,sym=a1g}
                \addOrbital{energy=6.5,sym=t1u,config={,,}}
            }
            \fragment{
                \addOrbital{energy=-1,sym={a1g,t1u,eg},config={,,,,,},labels=SALCs}
                \addLabel{6L}{0}
            }
            \addEnergyScale{0}
        \end{mohelper}
    }
    \caption{Octahedral Complex}
    \label{fig:modiagram0}
\end{figure}


\newpage

\tableofcontents

\newpage


\section{Introduction}
Stop fighting with pure TikZ. mohelper is a LaTeX package designed to create professional Molecular Orbital (MO) diagrams with minimal code. It handles the positioning, electron population, and dashed connection lines automatically, so you can focus on the chemistry, not the coordinates.
Have a look:

\newcommand{\showfigureone}{
    \begin{mohelper}
        \def\columndistance{3}
        \def\diagrammode{normal}
        \degenerate{0}{1s/up}{0}
        \degenerate{-2}{$\sigma$/pair}{1}
        \degenerate{2}{$\sigma^*$/empty}{1}
        \degenerate{0}{1s/up}{2}
        \connectorbital{0}{1}{-2}{1}{0}
        \connectorbital{0}{1}{2}{1}{0}
        \connectorbital{-2}{1}{0}{1}{2}
        \connectorbital{2}{1}{0}{1}{2}
        \addenergyscale{0}
    \end{mohelper}
}

\begin{figure}[h]
    \centering
    \begin{mohelper}
        \fragment{
            \addOrbital{energy=0,label=1s,config=up}
        }
        \fragment{
            \addOrbital{energy=-2,label=$\sigma$,config=pair}
            \addOrbital{energy=2,label=$\sigma^*$}
        }
        \fragment{
            \addOrbital{energy=0,label=1s,config=up}
        }
        \addEnergyScale{0}
    \end{mohelper}
    \caption{Hydrogen Molecule}
    \label{fig:modiagram1}
\end{figure}


\begin{lstlisting}
\begin{mohelper}
    \fragment{
        \addOrbital{energy=0,label=1s,config=up}
    }
    \fragment{
        \addOrbital{energy=-2,label=$\sigma$,config=pair}
        \addOrbital{energy=2,label=$\sigma^*$}
    }
    \fragment{
        \addOrbital{energy=0,label=1s,config=up}
    }
    \addEnergyScale{0}
\end{mohelper}
\end{lstlisting}

\section{Quick Start}
To use the diagrams generated by this tool in your LaTeX project, follow these steps:
\subsection{Include the Package}
\subsubsection{From CTAN}
\label{subsub:fromctan}
\begin{lstlisting}
\usepackage{mohelper}
\end{lstlisting}
Include this into your preamble. Note that this might not be the newest version. In case you depend on using a newer version go to \ref{subsub:fromlocal}.
\subsubsection{From Local}
\label{subsub:fromlocal}
Download the package and include it into your project. To do so download the \texttt{mohelper.sty} file from
\begin{enumerate}
    \item \href{https://github.com/thevicraft/modiagram-latex-integration/releases}{Releases} (recommended, stable)
    \item \href{https://thevicraft.github.io/modiagram-latex-integration/}{Repository} (only if you know what you are doing)
\end{enumerate}
and paste the file into your project's root directory. Ensure you have the mohelper package included in your preamble:
\begin{lstlisting}
\usepackage{mohelper}
\end{lstlisting}
If you put \texttt{mohelper.sty} into a subdirectory, you must specify its path. Therefore, have this example shown:
\begin{lstlisting}
\usepackage{./lib/mohelper}
\end{lstlisting}
{\textcolor{red}{Note that this method will throw a compiler warning because it is trying to find a package called \texttt{/lib/mohelper}. However, it still finds the package and it should work. Still, to avoid this warning put the package into your project's root directory, and input only through package name.}}

\subsection{Configure your Diagram}
Open the \href{https://thevicraft.github.io/modiagram-latex-integration/}{Web Helper} and set up your orbitals, energies, and labels.

\subsection{Copy and Paste}
Copy the generated LaTeX code and paste it into your \texttt{figure} environment or document body.

\section{Dependencies}
\texttt{mohelper} uses some other pakets which are listed here:
\begin{itemize}
    \item \texttt{tikz}, and some \texttt{tikzlibraries}
          \begin{itemize}
              \item \texttt{arrows.meta}
              \item \texttt{backgrounds}
          \end{itemize}
    \item \texttt{xstring}
    \item \texttt{etoolbox}
\end{itemize}

\section{Basic Usage}
The heart of the package is the \texttt{mohelper} environment. It follows a \textcolor{red}{multi}-column logic:

\begin{figure}[H]
    \centering
    \begin{mohelper}[scale=0.7]
        \def\columndistance{5}
        \def\diagrammode{normal}
        \fragment{
            \addOrbital{config={e,e,e,e,e},sym={t2g,eg},energy=0}
        \addLabel{\color{blue}{column 0}}{0}
        }
        \fragment{
            \addOrbital{energy=-0.8,sym=t2g,config={e,e,e}}
            \addOrbital{energy=1.2,sym=eg,config={e,e}}
            \addLabel{\color{blue}{column 1}}{0}
        }
        \fragment{
            \addOrbital{energy=1.5,sym={eg,a},config=e}
            \addOrbital{energy=0.9,sym={eg,b},config=e}
            \addOrbital{energy=-0.2,sym={t2g,c},config={e}}
            \addOrbital{energy=-1.1,sym={t2g,d},config={e,e}}
            \addLabel{\color{blue}{column 2}}{0}
        }

        \fragment{
            \addOrbital{energy=1.9,sym=a,config=e}
            \addOrbital{energy=0,sym=b,config=e}
            \addOrbital{energy=1.0,sym=c,config={e}}
            \addOrbital{energy=-1.5,sym=d,config={e,e}}
            \addLabel{\color{blue}{column 3}}{0}
        }

    \end{mohelper}
    \caption{Ligand Field Splitting in Octahedral, Jahn-Teller, Square Planar}
    \label{fig:modiagram2}
\end{figure}

\noindent The package therefore extends above normal MO diagrams. \texttt{mohelper} allows having indefinite columns. They are not hard-coded to \texttt{left}, \texttt{middle} and \texttt{right}.

\section{Macro Reference}

\subsection{The Environment}

\begin{lstlisting}
\begin{mohelper}[options]
    ...
\end{mohelper}
\end{lstlisting}

Wraps a \texttt{tikzpicture}. You can pass standard TikZ options like \texttt{[scale=0.8]}.

\subsection{Defining Fragments}

Each MO diagram consists of fragments. Each fragment is represented by a column. A standard MO diagram has 3 fragments.
\begin{itemize}
    \item Left Atom
    \item Molecule
    \item Right Atom
\end{itemize}
Figure \ref{fig:modiagram2} has 4 fragments. It is quite easy when you forget the fragment part and just think about columns.

\paragraph{}

\begin{lstlisting}
\fragment{
    ... % draw orbitals, etc.
}
\end{lstlisting}

\noindent The \texttt{\textbackslash fragment} command builds a new column into your diagram. It acts as a shell in which you have to define orbitals etc. All important definitions are done within these scopes.

\subsubsection{Orbitals}

\begin{lstlisting}
\addOrbital{ [attributes] }
\end{lstlisting}

\noindent Adding orbitals is easier than you think. Between the scopes you need to set attributes. The syntax\footnote{It is managed using an external library called \texttt{pgfkeys}.} looks like this:

\begin{lstlisting}
\addOrbital{
    attribute1=value1,
    attribute2=value2,
    ...
}
\end{lstlisting}

\noindent The following table shows all attributes and their corresponding values.

\newcommand{\previewdegeneratelabel}[1]{
    \colorbox{lightgray}{
        \begin{mohelper}[scale=0.6]
            \fragment{
                \addOrbital{labelposition=#1,label=$\color{blue}{a_{1g}}$,config={up,up}}
            }
        \end{mohelper}
    }
}

\begin{center}
    \begin{tabular}{|c| p{8cm} |p{5cm}|}
        \hline
        Attribute              & Description                                                                                      & Example                                                                                                                                                                                                                                                \\ [0.5ex]
        \hline%\hline
        \texttt{energy}        & \textbf{Y-Level} (Energy)                                                                        & \texttt{-2.5}                                                                                                                                                                                                                                          \\
        \hline
        \texttt{sym}           & \textbf{Symmetry Group} (irreducible representation)                                             & \texttt{t2g}, \texttt{a1}, \texttt{eg} \newline(no special characters allowed!)
        \\
        \hline
        \texttt{config}        & \textbf{Electron Configuration}, Array of spin values (Format: \texttt{\{spin1, spin2, spin3\}}) & \begin{tabular}{p{3.5cm}}

                                                                                                                                        \texttt{up}, \texttt{down} or \texttt{pair} (any other value will result in an empty orbital) \\  \hline example:\newline\texttt{\{pair, up, up\}}\newline \colorbox{lightgray}{\begin{mohelper}[scale=0.6]\fragment{\addOrbital{config={pair,up,up}}}\end{mohelper}}  \\
                                                                                                                                    \end{tabular}
        \\
        \hline
        \texttt{labels}        & \textbf{Individual Labels Array}: label each orbital of the degenerated group individually       & \texttt{\{\$p\_x\$, \$p\_y\$, \$p\_z\$\}}     \newline \colorbox{lightgray}{\begin{mohelper}[scale=0.6]\fragment{\addOrbital{config={pair,up,up},labels={$p_x$,$p_y$,$p_z$}}}\end{mohelper}}                                                      \\
        \hline
        \texttt{label}         & \textbf{Single Label}: a single label for all degenerated orbitals                               & \texttt{\$a\_\{1g\}\$}                                                                                                                                                                                                                                 \\
        \hline
        \texttt{labelposition} & \textbf{Position of Label}: this affects only the single label, individual labels are untouched  & \begin{tabular}{p{1.5cm}| c}

                                                                                                                                        \texttt{left} & \previewdegeneratelabel{left} \\  \hline\texttt{right} & \previewdegeneratelabel{right}\\ \hline                  \texttt{bottom} & \previewdegeneratelabel{bottom}\\  \hline             \texttt{top} & \previewdegeneratelabel{top}  \\
                                                                                                                                    \end{tabular}
        \\[1ex]
        \hline
    \end{tabular}
\end{center}

% energy=0,
% sym=a1,
% config={empty},
% labels={},
% label=,
% labelposition=bottom,
% column=,
\noindent{\color{red}{Note: It is possible to execute \texttt{\textbackslash addOrbital} outside of \texttt{\textbackslash fragment}. To do so, you must specify the additional attribute \texttt{column} with a corresponding number. However, drawing fragment labels (\ref{fragmentlabels}) or energy difference arrows (\ref{energydifference}) is not possible outside of \texttt{\textbackslash fragment}. It is not recommended to do that, as it will result in strange bugs!}}

\paragraph{Important~Attributes}

\subparagraph{energy} comes in pakets, quants. Therefore all states are quantized and $E=h\cdot\nu$. You know this theorem very well. This means for the diagram that the energy level you specify will mark the y-coordinate in the diagram. The diagram does not use any fancy scale like \texttt{$eV$}. Instead it uses paper units whereas $1\text{unit} \approx  1cm$. It is as if you would draw the diagram on paper. \textcolor{red}{If not specified the standard value is \texttt{0}.}

\subparagraph{sym(metry)} is quite intuitive when you understand it. This irreducible representation ($\Gamma$) is meant to help \texttt{mohelper} (yes, we help the helper) to choose which orbitals are actually overlapping. These orbitals are then connected with dotted lines. Only orbitals with the same symmetry ($\Gamma_{\psi_1}=\Gamma_{\psi_2}$) have a relevant constructive interference.
\newline Note, that the \texttt{string} or \texttt{string array} you set for the \texttt{sym} attribute is only required for internal calculations within the \texttt{mohelper} package. Therefore it is disallowed to use special characters. Styling or math formula is supposed to be done in labels. Instead of \texttt{\$t\_\{2g\}\$} just type \texttt{t2g}. It is fast, no one will see it except you, and if you read the code, you still know it means $t_{2g}$.
\newline And yes, you can specify more than one symmetry group. Put them in these brackets \texttt{\{\}} and separate them by comma.
\newline This is very helpful when you initialize degenerated Ligand Group Orbitals (LGO) as Symmetry Adapted Linear Combinations (SALCs). \textcolor{red}{If not specified the standard value is \texttt{a1}.}

\begin{figure}[H]
    \centering
    \fbox{
        \begin{mohelper}[scale=0.5]
            \def\columndistance{4}
            \fragment{
                \addOrbital{energy=-1,sym=a1,config={pair},label=$\color{blue}{a1}$,labelposition=right}
                \addOrbital{energy=4,sym=a1,label=$\color{blue}{a1}$,labelposition=right}
                \addOrbital{energy=0,sym=t2,config={pair,pair,pair},label=$\color{blue}{t2}$,labelposition=right}
                \addOrbital{energy=5,sym=t2,config={e,e,e},label=$\color{blue}{t2}$,labelposition=right}
            }
            \fragment{
                \addOrbital{energy=3,sym={a1,t2},config={up,up,up,up},label=$\color{blue}{a_1,t_2}$,labelposition=right}
            }
        \end{mohelper}
    }
\end{figure}

\subparagraph{config(uration)} attribute is what defines the degeneration and electron configuration of the orbital. In this \texttt{array} you specify the spin values. \texttt{up}, \texttt{down} or \texttt{pair} are the allowed values, every other string value will be treated as if there is no electron.
\newline This excited electron configuration \texttt{\{pair,up,\}} will result in three degenerated orbitals. Empty spaces separated by comma are treated as empty orbitals. \newline\textcolor{red}{If not specified the standard value is \texttt{\{empty\} which will result in a non-degenerated empty orbital.}.}

\paragraph{Example}
Have a look at this nice example ...
\begin{figure}[H]
    \centering
    \fbox{
        \begin{mohelper}[scale=0.8]
            \def\columndistance{4}
            \fragment{
                \addOrbital{energy=2,sym=t2,config={up,up,e},labels={$p_x$,$p_y$,$p_z$},label=$\color{blue}{t_2}$,labelposition=left}
                \addOrbital{energy=0,sym=a1,config={pair},labels={2s},label=$\color{blue}{a_1}$,labelposition=left}
            }
            \fragment{
                \addOrbital{energy=-1,sym=a1,config={pair},label=$\color{blue}{1a_1}$,labelposition=bottom}
                \addOrbital{energy=4,sym=a1,label=$\color{blue}{1a_1^*}$,labelposition=bottom}
                \addOrbital{energy=0,sym=t2,config={pair,pair,pair},label=$\color{blue}{1t_2}$,labelposition=bottom}
                \addOrbital{energy=5,sym=t2,config={e,e,e},label=$\color{blue}{1t_2^*}$,labelposition=bottom}
            }
            \fragment{
                \addOrbital{energy=3,sym={a1,t2},config={up,up,up,up},label=$\color{blue}{a_1,t_2}$,labelposition=right}
            }
        \end{mohelper}
    }
\end{figure}
... and its code:
\begin{lstlisting}
\begin{mohelper}
    \fragment{
         \addOrbital{
            energy=2, sym=t2, config={up,up,e},
            labels={$p_x$,$p_y$,$p_z$},
            label=$\color{blue}{t_2}$, labelposition=left
        }
         \addOrbital{
            energy=0, sym=a1, config={pair},
            labels={2s},
            label=$\color{blue}{a_1}$, labelposition=left
        }
    }
    \fragment{
        \addOrbital{
            energy=-1, sym=a1, config={pair},
            label=$\color{blue}{1a_1}$, labelposition=bottom
        }
        \addOrbital{
            energy=4, sym=a1,
            label=$\color{blue}{1a_1^*}$, labelposition=bottom
        }
        \addOrbital{
            energy=0, sym=t2, config={pair,pair,pair},
            label=$\color{blue}{1t_2}$, labelposition=bottom
        }
        \addOrbital{
            energy=5, sym=t2, config={e,e,e},
            label=$\color{blue}{1t_2^*}$, labelposition=bottom
        }
    }
    \fragment{
        \addOrbital{
            energy=3, sym={a1,t2}, config={up,up,up,up},
            label=$\color{blue}{a_1,t_2}$, labelposition=right
        }
    }
\end{mohelper}
\end{lstlisting}
You see, it's not so difficult when you get an example. By the way this is supposed to be methane (\ce{CH4}).

\paragraph{Manually Drawing Orbitals}~\\~\\
Aside of \texttt{fragments} and \texttt{symmetry groups} you can manually declare orbitals. Note, they will not connect to other orbitals as they are not included into the auto-connection process.

\begin{lstlisting}
\orbital{x}{y}{label}{spin}
\end{lstlisting}

\noindent \texttt{\textbackslash orbital} manually draws a single orbital at the specified coordinates. For standard orbital diagrams it should not be necessary to use this macro. Only use \texttt{\textbackslash addOrbital} inside of \texttt{\textbackslash fragment\{\}}.

\begin{center}
    \begin{tabular}{|c| p{7cm} |p{3cm}|}
        \hline
        Parameter    & Description                    & Example                                                                                       \\ [0.5ex]
        \hline%\hline
        \texttt{\#1} & \textbf{x} coordinate          & \texttt{4.2}                                                                                  \\
        \hline
        \texttt{\#2} & \textbf{y} coordinate (energy) & {2.0}
        \\
        \hline
        \texttt{\#3} & Label                          & \texttt{1s}                                                                                   \\
        \hline
        \texttt{\#4} & Spin                           & \texttt{up}, \texttt{down} or \texttt{pair} (any other value will result in an empty orbital) \\ [1ex]
        \hline
    \end{tabular}
\end{center}

\subsubsection{Fragment Labels}
\label{fragmentlabels}

\begin{lstlisting}
\fragment{
    ... % draw orbitals
    \addLabel{text}{offset}
}
\end{lstlisting}
Labels a fragment. All fragment labels are horizontally aligned under the diagram.
\newline \texttt{offset} (number) specifies the additional vertical offset from the diagram. As a default, just set it to \texttt{0}. \textcolor{red}{\texttt{\textbackslash addLabel} has to be executed inside \texttt{\textbackslash fragment} or the anchor of the label will be set completely wrong.}

\begin{figure}[H]
    \centering
    \fbox{\begin{mohelper}[scale=0.5]
            \def\columndistance{4}
            \def\diagrammode{normal}
            \fragment{
                \addOrbital{config={e,e,e,e,e},sym={t2g,eg},energy=0}
            }
            \fragment{
                \addOrbital{energy=-0.8,sym=t2g,config={e,e,e}}
                \addOrbital{energy=1.2,sym=eg,config={e,e}}
                \addLabel{\color{blue}{Octahedral}}{0}
            }
            \fragment{
                \addOrbital{energy=1.5,sym={eg,a},config=e}
                \addOrbital{energy=0.9,sym={eg,b},config=e}
                \addOrbital{energy=-0.2,sym={t2g,c},config={e}}
                \addOrbital{energy=-1.1,sym={t2g,d},config={e,e}}
                \addLabel{\color{blue}{Jahn-Teller}}{0}
            }

            \fragment{
                \addOrbital{energy=1.9,sym=a,config=e}
                \addOrbital{energy=0,sym=b,config=e}
                \addOrbital{energy=1.0,sym=c,config={e}}
                \addOrbital{energy=-1.5,sym=d,config={e,e}}
                \addLabel{\color{blue}{Square Planar}}{0}
            }
        \end{mohelper}}
    \label{fig:modiagram4}
\end{figure}

\begin{center}

    \begin{tabular}{|c p{9cm}|}
        \hline
        \textcolor{blue}{Tipp}: & To color the label you can use standard macros like \texttt{\textbackslash color\{color\}\{text\}} in the \texttt{text} argument of \texttt{\textbackslash addLabel} \\ [0.5ex]
        \hline
    \end{tabular}
\end{center}

\subsection{Miscellaneous}

\subsubsection{Adding Energy Scale}

\begin{lstlisting}
\fragment{ ... }
% other fragments, other stuff
\addEnergyScale{offset}
\end{lstlisting}
Adds an energy scale. \texttt{offset} (number) specifies the additional horizontal offset from the diagram. As a default, just set it to \texttt{0}.
{\color{red}{This macro has to be executed after the last fragment is defined. Otherwise the scale's size and position will be calculated incorrect.}}



\subsubsection{Showing Energy Difference}
\label{energydifference}

\begin{lstlisting}
\fragment{
    ... % draw orbitals & labels
    \showEnergyDifference{energy1, energy2}{offset}{text}
}
\end{lstlisting}

\noindent Draws a double-sided red arrow pointing out an energy difference. \texttt{offset} (number) specifies an additional horizontal offset. As a default, just set it to \texttt{0} which will center it. \textcolor{red}{This macro has to be executed inside \texttt{\textbackslash fragment} or the horizontal position will be completely wrong.}

\begin{center}
    \begin{tabular}{|c| p{7cm} |c|}
        \hline
        Parameter    & Description                                               & Example                                           \\ [0.5ex]
        \hline%\hline
        \texttt{\#1} & \textbf{Energy Array} (Format: \texttt{energy1, energy2}) & \texttt{2.0, 4.0}                                 \\

        \hline
        \texttt{\#2} & \textbf{Horizontal offset}, moves the arrow along x-axis  & \texttt{0} (centered)                             \\
        \hline
        \texttt{\#3} & \textbf{Label}                                            & \texttt{\$\textbackslash Delta\_O\$ ($\Delta_O$)} \\ [1ex]
        \hline
    \end{tabular}
\end{center}

\begin{figure}[H]
    \centering
    \fbox{\begin{mohelper}[scale=0.8]
            \fragment{
                \addOrbital{energy=0,config={,,},label=$\color{blue}{t_{2g}}$,labelposition=right}
                \addOrbital{energy=1.4,config={,},label=$\color{blue}{e_{g}^*}$,labelposition=right}
                \showEnergyDifference{0, 1.4}{0}{$\Delta_O$}
            }
        \end{mohelper}}
    \label{fig:modiagram45}
\end{figure}



\subsection{Customization}
You can tweak the look for each diagram by redefining these values:

\begin{itemize}
    \item \texttt{\textbackslash def\textbackslash columndistance\{value\}}: Set \texttt{value} to a number. It defines space between the AO und MO columns.
    \item \texttt{\textbackslash def\textbackslash diagrammode\{compact\}}: Switches to vertical stacking for degenerate orbitals (perfect for large systems).
          \newcommand{\previewcompact}[1]{
              \begin{mohelper}[scale=0.6]
                  \def\diagrammode{#1}
                  \ifstrequal{#1}{compact}{\def\electroncolor{red}}{}

                  \fragment{
                      \addOrbital{energy=-0.5,sym=a1,config=pair,labels=2s}
                      \addOrbital{energy=2,sym={a1,b1,b2},config={pair,up,up},labels=2p}
                      \addLabel{$\ce{O}$}{0.5}
                  }
                  \fragment{
                      \addOrbital{energy=-3,sym=a1,config=pair,labels=$\sigma$}
                      \addOrbital{energy=-1,sym=b1,config=pair,labels=$\pi$}
                      \addOrbital{energy=1,sym=a1,config=pair}
                      \addOrbital{energy=2,sym=b2,config=pair}
                      \addOrbital{energy=4,sym=b1,labels=$\pi^*$}
                      \addOrbital{energy=6,sym=a1,labels=$\sigma^*$}
                      \addLabel{$\ce{H2O}$}{0.5}
                  }
                  \fragment{
                      \addOrbital{energy=3,sym={a1,b1},config={pair,}}
                      \addLabel{$\ce{H2}$}{0.5}
                  }
              \end{mohelper}
          }
          \begin{center}
              \begin{tabular}{|c c|}
                  \hline
                  \texttt{normal}                & \texttt{compact}         \\
                  \hline
                  \previewcompact{normal} \vline & \previewcompact{compact} \\
                  \hline
              \end{tabular}
          \end{center}
    \item \texttt{\textbackslash def\textbackslash electroncolor\{color\}}: Set \texttt{color} to a valid color value. Changes the electron color to a specified one. The redefining has to stand before the relevant orbital is created using \texttt{\textbackslash degenerate}.
\end{itemize}

\section{Example}
\begin{figure}[H]
    \centering
    \begin{mohelper}[scale=0.8] % scale it to 0.8 of original size to fit on page
        \def\columndistance{5.4} % set column distance to 5.4
        \def\diagrammode{normal} % draw in normal mode
        \fragment{
            \addOrbital{energy=0,sym={t2g,eg},config={pair,pair,pair,up,up},label=3d}
            \addOrbital{energy=3,sym=a1g,label=4s}
            \addOrbital{energy=4.5,sym=t1u,config={,,},label=4p}
            \addLabel{$Ni^{2+}$}{0}
        }
        \fragment{
            \addOrbital{energy=-4,sym=a1g,config=pair,label=$\color{blue}{1a_{1g}}$,labelposition=right}
            \addOrbital{energy=-3,sym=t1u,config={pair,pair,pair},label=$\color{blue}{1t_{1u}}$,labelposition=right}
            \addOrbital{energy=-2,sym=eg,config={pair,pair},label=$\color{blue}{1e_g}$,labelposition=right}
            \addOrbital{energy=0,sym=t2g,config={pair,pair,pair},label=$\color{blue}{1t_{2g}}$,labelposition=right}
            \addOrbital{energy=1,sym=eg,config={up,up},label=$\color{blue}{2e_g^*}$,labelposition=right}
            \addOrbital{energy=6,sym=a1g,label=$\color{blue}{2a_{1g}^*}$,labelposition=right}
            \addOrbital{energy=6.5,sym=t1u,config={,,},label=$\color{blue}{2t_{1u}^*}$,labelposition=right}
            \showEnergyDifference{0,1}{2.5}{$\Delta_O$} % show ligand field splitting
            \addLabel{$[Ni(H_2O)_6]^{2+}$}{0}
        }
        \fragment{
            \addOrbital{energy=-1,sym={a1g,t1u,t2g,eg},config={pair,pair,pair,pair,pair,pair},label=SALCs}
            \addLabel{$6 \times H_2O$}{0}
        }
        \addEnergyScale{0} % add the energy scale
    \end{mohelper}
    \caption{$[Ni(H_2O)_6]^{2+}$ complex}
    \label{fig:modiagram3}
\end{figure}

\begin{lstlisting}
\begin{mohelper}[scale=0.8] % scale it to 0.8 of original size to fit on page
    \def\columndistance{5.4} % set column distance to 5.4
    \def\diagrammode{normal} % draw in normal mode
    \fragment{
        \addOrbital{energy=0,sym={t2g,eg},config={pair,pair,pair,up,up},label=3d}
        \addOrbital{energy=3,sym=a1g,label=4s}
        \addOrbital{energy=4.5,sym=t1u,config={,,},label=4p}
        \addLabel{$Ni^{2+}$}{0}
    }
    \fragment{
        \addOrbital{energy=-4,sym=a1g,config=pair,label=$\color{blue}{1a_{1g}}$,labelposition=right}
        \addOrbital{energy=-3,sym=t1u,config={pair,pair,pair},label=$\color{blue}{1t_{1u}}$,labelposition=right}
        \addOrbital{energy=-2,sym=eg,config={pair,pair},label=$\color{blue}{1e_g}$,labelposition=right}
        \addOrbital{energy=0,sym=t2g,config={pair,pair,pair},label=$\color{blue}{1t_{2g}}$,labelposition=right}
        \addOrbital{energy=1,sym=eg,config={up,up},label=$\color{blue}{2e_g^*}$,labelposition=right}
        \addOrbital{energy=6,sym=a1g,label=$\color{blue}{2a_{1g}^*}$,labelposition=right}
        \addOrbital{energy=6.5,sym=t1u,config={,,},label=$\color{blue}{2t_{1u}^*}$,labelposition=right}
        \showEnergyDifference{0,1}{2.5}{$\Delta_O$} % show ligand field splitting
        \addLabel{$[Ni(H_2O)_6]^{2+}$}{0}
    }
    \fragment{
        \addOrbital{energy=-1,sym={a1g,t1u,t2g,eg},config={pair,pair,pair,pair,pair,pair},label=SALCs}
        \addLabel{$6 \times H_2O$}{0}
    }
    \addEnergyScale{0} % add the energy scale
\end{mohelper}
\end{lstlisting}

\section{License}

Distributed under the GPL-3.0 License. See \texttt{LICENSE} for more information.

\end{document}