Document ClassesWhy put @ in command names

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
benjibloublou
Posts: 6
Joined: Wed Sep 26, 2012 6:56 pm

Why put @ in command names

Post by benjibloublou »

Often in class definitions, authors define commands with an "@" in their name, like :

Code: Select all

\rule@vpos
\fromlieu@let@hpos
Does this have a special function? Or is it just the way they separate words in command names?

Thx,
- B.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Why put @ in command names

Post by Stefan Kottwitz »

The @ character is not allowed in commands defined and used in normal LaTeX documents. However, it's possible to use that character in command names in style files and classes. That's why it's commonly been used for internal macros, which should not be used by authors - it's prevented as it causes an error. However, if you know what you are doing, you can use macro names with @ if you write \makeatletter before and \makeatother afterwards, which makes the @ character legal and the latter switches back to the default.

Stefan
LaTeX.org admin
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Why put @ in command names

Post by cgnieder »

I'd like to quote David Carlisle here:
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.
Regards
site moderator & package author
Post Reply