I used to have a separate file where I store my custom macros. It is nothing more than a huge list of \newcommands and \NewDocumentCommands.
Now, I have a little note that I would like to share with a buddy of mine. I would like to send him a selfcontained LaTeX file, where all the custom macros that I use in the this particular note are included in the header. I don't like to copy-paste all the macros in the header, because I use only a small number of them. Is there a better way than to scan manually through my note and include the macros one by one?
For a better understanding here a MWE:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{macros.tex}
\newcommand{\macroA}{A}
\newcommand{\macroB}{B}
\newcommand{\macroC}{C}
\newcommand{\macroD}{D}
\end{filecontents*}
\begin{document}
\input{macros.tex}
\macroA and \macroD
\end{document}
I would like to generate the following list:
\macroA\macroD
\NewDocumentCommandcome from? – daleif Jul 01 '14 at 15:21\NewDocumentCommandcomes from the packagexparse. – crixstox Jul 02 '14 at 10:01\DeclareDocumentCommandwhen usingxparse. Sincexparseis LTX3, there might be a module for it, otherwise ask on the LTX3 list. Though, I've forgotten how I subscribed to it. – daleif Jul 02 '14 at 10:21\NewDocumentCommand, because\DeclareDocumentCommandoverwrites any previous definition (like\def) while\NewDocumentCommandchecks if there is already one defined (like\newcommand). – Henri Menke Jul 31 '14 at 16:30