44

Is there a preferred or generally accepted idiom for naming user defined macros? I notice that in the change from Tufte 3.5.0 to 3.5.2, for example, the names of the debugging macros have change, for example from

\TufteDebugInfoNL

to

\@tufte@debug@info@noline

Does this correspond to some agreed to practice?

lockstep
  • 250,273
orome
  • 10,459
  • 7
    Don't think there is agreed standard, but using the prefix @tufte (but just as good as Tufte) is a good idea to help avoid name collisions, and the use of @ signs makes it even less likely to have name collisions as that requires special handling in regular code (i.e., \makeatletter ... \makeatother). – Peter Grill Mar 16 '12 at 00:39

1 Answers1

52

LaTeX does try to encourage a naming scheme

Document level commands (\section) lowercase.

Package interface commands (\DeclareTextCommandDefault) CamelCase.

Package or kernel internal commands (\@text@composite@) lower@case@with@.

Expl3 programming layer commands (\cs_new:NN) module_name_words:argspec.

TeX primitives (\expandafter) lowercase.

Mostly this convention is not enforced, and of course one might notice that the top and bottom layer using the same convention makes enforcing anything difficult. LaTeX3 addresses this by renaming all the commands at the bottom layer.

So the command you mention has changed from using a "package interface name" to an "internal name" but whether that is appropriate in this case I couldn't judge, not knowing that class.

David Carlisle
  • 757,742