From what I gather (I don't use them, and have never actually managed to get it to work - though this is not my issue), bibtex/biber uses a database of references, alongside an ancillary file created by TeX, to produce a bibliography, creating a file which only has references to the citations used in the core myfile.tex document.
Correct or not in my understanding of bibtex itself, I'd like to do something similar, but with a database of macros; I have rather a large file full of miscellaneous macros that I've used in various projects over the years. I'm about to submit a paper to the arXiv (my first, yay!), and it occurred to me that I don't really want to send them my whole massive, redundant macros list, nor do I want to go through it looking for the ones I've used in this document. I'd prefer if there were a package that generated a myfile.macro or something similar, that contains the macros out of the database I've called - preferably with dependencies, that I could plug-in to myfile.tex on a second run.
My question is whether someone has written a package or piece of additional software to do this? A cursory google search hasn't turned up anything, although of course I really don't know what I'm looking for, and "latex macros" is a pretty large topic. I'll be happy to do it myself, as it seems like a noble cause and a useful piece of software to have, but figured it's better to ask around than duplicate someone else's efforts and probably do a worse job at solving the problem.
\input), rather than always loading a massive set of mostly useless commands. You can still have a “macro repository”, but just for storing definitions to be retrieved (and pasted in the current document) from. A paper I had to manage contained 250 lines of preamble; after removing the unused ones, it became about 25-30 lines. – egreg Feb 26 '14 at 07:51