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.

Background

Many packages provide commands that have the full name of the package, or an abbreviation, as part of the command name. Sometimes the package name (or abbreviation) is at the beginning of the command name, and sometimes it is later. For example, many packages provide a settings macro. Sometimes this is of the form \set<pkg><param> while in other cases we have \<pkg>set<param>. An example is \setbeamercolor vs. \pgfsetarrowoptions. I believe both pgf and beamer were created by the same author. There are also cases where a package provides a command that does something similar to a built-in command, and thus has a similar name. So we have variants of \input in the forms of \VerbatimInput from fancyvrb and \inputminted from minted.

Question

When the name of a command includes the name of the package (or an abbreviation), are there any conventions for where the package name occurs? I'm primarily thinking about macros that are for the user, rather than internal macros or macros for package writers. Are there advantages to having the package name at the beginning of the command name, versus having the package name later, or is it just a matter of personal preference? Are there reasons to prefer one approach to the other?

Reflections

I can think of some possible reasons that each approach might be beneficial. Putting the package name (abbreviation) first gives a nice uniformity to command names, so it might be beneficial when there are a lot of commands to name (pgf might be an example). At the same time, putting the package name later might result in commands that sound more like natural language or sound more active, and thus might be easier to remember (in the \input case, we want a particular kind of \input).

share|improve this question
2  
I think the naming of a packages commands is a somthing only the author knows about. Surely it would be easy if all had used the same, but nobody can force them. Beside that, I didn't really get your question out of the text. Could you please point it out? –  Stephan Lukasczyk Mar 31 '13 at 20:34
add comment

1 Answer

Personally, I prefer a suffix

\getthemacro@cx \andaddto@cx \checkthereadabilty@cx 

and compare

\cx@getthemacro@cx \cx@andaddto \cx@checkthereadabilty 

for the user maybe GetTheMacro if you follow LaTeX2e conventions, which to be honest I am not very fond of...

Personal preference I guess, and is doomed to disappear if and when I move onto LaTeX3, which has a standard convention.

share|improve this answer
    
It would be great if you could either link to the LaTeX3 conventions and/or give a short intro on them. As those might help people decide on what way to choose (maybe using the l3-way today, even for l2 packages). –  Elrond Mar 31 '13 at 23:05
    
@Elrond \texdoc expl3 see section 3.2. You wouldn't be able to use them for l2 packages due to the underscore and the colon. –  Yiannis Lazarides Mar 31 '13 at 23:13
1  
Since I was going to say just this, I will upvote it. Using a suffix is superior to using a prefix both for readability and also for automated indexing, if you are writing package documentation. For user-visible macros, though, it does hurt readability since the macro name less resembles an English phrase. –  Ryan Reich Apr 1 '13 at 4:13
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.