This is a follow-up to this question on contributing to CTAN, but it applies to the situation when writing ones own package for private use. In brief, the question is:
Is there a way to avoid name-clashes with defining macros?
In a bit more detail, I know that \newcommand
checks this, but I find that I need the flexibility of \def
. Also, I tend to define a lot of internal commands that then get used in various ways in the ones that the user actually uses and I suspect that many others do the same. It's a lot harder to go through every package and check that every command is "clean", especially since many will be defined via the \csname
construction. On the other hand, because most of the commands are internal, I'd be quite happy to simply add a unique prefix to each of them to avoid such a conflict. For example, at the moment all my internal commands are prefixed \my@
and external ones \my
(with the exception of one package that was written specifically for one paper which gets \hopf@
and \hopf
respectively).
So, expanding on my question above:
- Is there a convention on CTAN to avoid conflicting names?
- Is there an automatic way to avoid conflicts when loading a package?
(I should confess that I strongly doubt that there is a positive answer to the second question since so many packages rely on being able to redefine macros defined by other packages; still, the programmers seem to be able to cope with this so I do wonder if TeXperts can as well.)
\my@..
but of course it's not 100% reliable.