\usepackage{xparse} \usepackage{xspace} % Numbered equation with optional label \NewDocumentCommand\eqn{mo}{% \IfNoValueTF{#2} {\[ #1 \]} {\begin{equation}\label{#2} #1 \end{equation} \expandafter\newcommand\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces} } % Numbered aligned equation with optional label in the vertical middle \NewDocumentCommand\eqna{mo}{% \IfNoValueTF{#2} {\begin{align*} #1 \end{align*}} {\begin{equation}\label{#2}\begin{split} #1 \end{split}\end{equation} \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces} } % Numbered subequations % Two subequations \NewDocumentCommand\twoseqn{momoo}{% \IfNoValueTF{#5} {\begin{subequations}\begin{align} #1\label{#2} \\ #3 \label{#4} \end{align}\end{subequations} \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces} {\begin{subequations}\label{#5}\begin{align} #1\label{#2} \\ #3 \label{#4} \end{align}\end{subequations} \expandafter\def\csname #5\endcsname{\eqref{#5}\xspace}\ignorespaces \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces} } % Three subequations \NewDocumentCommand\threeseqn{momomoo}{% \IfNoValueTF{#7} {\begin{subequations}\begin{align} #1\label{#2} \\ #3 \label{#4} \\ #5 \label{#6} \end{align}\end{subequations} \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces \expandafter\def\csname #6\endcsname{\eqref{#6}\xspace}\ignorespaces} {\begin{subequations}\label{#7}\begin{align} #1\label{#2} \\ #3 \label{#4} \\ #5 \label{#6} \end{align}\end{subequations} \expandafter\def\csname #7\endcsname{\eqref{#7}\xspace}\ignorespaces \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces \expandafter\def\csname #6\endcsname{\eqref{#6}\xspace}\ignorespaces} } % Four subequations \NewDocumentCommand\fourseqn{momomomoo}{% \IfNoValueTF{#9} {\begin{subequations}\begin{align} #1\label{#2} \\ #3 \label{#4} \\ #5 \label{#6} \\ #7\label{#8} \end{align}\end{subequations} \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces \expandafter\def\csname #6\endcsname{\eqref{#6}\xspace}\ignorespaces \expandafter\def\csname #8\endcsname{\eqref{#8}\xspace}\ignorespaces} {\begin{subequations}\label{#9}\begin{align} #1\label{#2} \\ #3 \label{#4} \\ #5 \label{#6} \\ #7\label{#8} \end{align}\end{subequations} \expandafter\def\csname #9\endcsname{\eqref{#9}\xspace}\ignorespaces \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces \expandafter\def\csname #6\endcsname{\eqref{#6}\xspace}\ignorespaces \expandafter\def\csname #8\endcsname{\eqref{#8}\xspace}\ignorespaces} } \newcommand{\rcite}{\cite} \newcommand{\draftmode}{\usepackage[notref,notcite]{showkeys}} \providecommand*\showkeyslabelformat[1]{\normalfont\sffamily\footnotesize#1} \newcommand{\foot}{\footnote} % Sections and subsections \NewDocumentCommand\newsec{mo}{% \IfNoValueTF{#2} {\section{#1}} {\section{#1}\label{#2} \expandafter\gdef\csname #2\endcsname{\ref{#2}\xspace}\ignorespaces} } \NewDocumentCommand\subsec{mo}{% \IfNoValueTF{#2} {\subsection{#1}} {\subsection{#1}\label{#2}\expandafter\gdef\csname #2\endcsname{\ref{#2}\xspace}\ignorespaces} } \NewDocumentCommand\subsubsec{mo}{% \IfNoValueTF{#2} {\subsubsection{#1}} {\subsubsection{#1}\label{#2}\expandafter\gdef\csname #2\endcsname{\ref{#2}\xspace}\ignorespaces} } \makeatletter \renewcommand\section{\@startsection {section}{1}{\z@}% {-6ex \@plus -1ex \@minus -.2ex}% {2.3ex \@plus.2ex}% {\bfseries}} \makeatother \makeatletter \renewcommand\subsection{\@startsection{subsection}{2}{\z@}% {-3.25ex\@plus -1ex \@minus -.2ex}% {1.5ex \@plus .2ex}% {\itshape}} \makeatother \makeatletter \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}% {-3.25ex\@plus -1ex \@minus -.2ex}% {1.5ex \@plus .2ex}% {\itshape}} \makeatother