Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
5  
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 0:39
add comment

1 Answer

up vote 27 down vote accepted

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@.

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.

share|improve this answer
2  
How does that work out, to just decide that all commands on the bottom layer are to be rewritten? It feels like that means a lot of rewriting of packages and classes. –  StrawberryFieldsForever Jun 15 '12 at 9:26
    
I think "renaming" in this case means defining aliases. –  marczellm Sep 6 '13 at 17:01
    
@marczellm defining aliases and undefining the original names –  David Carlisle Nov 11 '13 at 22:21
1  
@DavidCarlisle Can you undefine a primitive? –  marczellm Nov 11 '13 at 22:23
1  
@marczellm \let\def\undefined –  David Carlisle Nov 11 '13 at 22:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.