Building on the helpful suggestions offered by @moewe both here and here, I wanted seek assistance for a more complex footnote citation command that would allow the user to include page numbers as well. Long story short, I'm helping a colleague with an old project that uses natbib.
Minimal working example as follows,
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{A01,
author = {Author Name},
publisher = {Publisher Co.},
title = {Title of the Book},
year = {2022}}
\end{filecontents}
\listfiles
\documentclass{article}
\usepackage{natbib}
\begin{document}
\NewDocumentCommand{\footcite}{om}{\footnote{\IfNoValueTF{#1}{\cite{#2}}{\cite[#1]{#2}}}}
Test function of footnote citation without page number.\footcite{A01}
Test function of footnote citation with page number.\footcite[2]{A01}
\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}
Unfortunately the command \NewDocumentCommand{\footcite}{om}{\footnote{\IfNoValueTF{#1}{\cite{#2}}{\cite[#1]{#2}}}} results in undefined control sequence errors.
Any guidance or suggestions would be greatly appreciated!