Hello, everybody!
This might seem a very generic question to ask, but I need some help in order to understand what \makeatletter and \makeatother means. From what I read, I guess it should be used only in the preamble, when we need to change specific parameters of class files (.cls). And because we can't change these class files, we should use the piece of code whose behaviour we need changed, between \makeatletter and \makeatother. I also understood that using \makeatletter and \makeatother can be a kind of replacement for some packages. How do I know in which circumstances I should use those commands? Is there any guide you could recommend me to read? Any article on the internet? I haven't found information clear enough for me, about these commands. They seem a little confusing... I have “The LaTeX Companion”, I read it several times and I don’t get much information about this in that book. I’m sorry for such a generic question. I also don’t have a MWE to provide, I’m sorry… But I wanted to understand this; I’m guessing these are very useful commands and I might need them later, when fine-tuning my LaTeX file.
Thank you so much,
Lucia
General ⇒ Makeatletter and makeatother
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Makeatletter and makeatother
The \makeatletter command temporarily defines »@« as a normal character to enable changes to internal LaTeX macros outside packages (STY) or classes (CLS). With \makeatother this process is reversed and the »@« is set to its original character category (other). The »@« is used to protect the internal LaTeX macros. Hence you should be very careful when using these two commands.
Best regards
Thorsten¹
Best regards
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Makeatletter and makeatother
There are a couple of sections on internal commands in the FAQ: \@ and @ in macro names and \spacefactor complaints.Lucia wrote:How do I know in which circumstances I should use those commands? Is there any guide you could recommend me to read? Any article on the internet?
There's also a brief mention on internal commands in my LaTeX tutorial in the section on commands.
I think there tends not to be much mention of \makeatletter and \makeatother in documentation as it's better to discourage people from using internal commands in their document.
Regards
Nicola Talbot
LaTeX Resources: http://www.dickimaw-books.com/latexresources.html
Creating a Minimal Example: http://www.dickimaw-books.com/latex/minexample/
Creating a Minimal Example: http://www.dickimaw-books.com/latex/minexample/
Re: Makeatletter and makeatother
Thank you, localghost and Nicola, for your explanations. The links provided helped me to understand a little more about these commands. However, I still have so much to learn regarding LaTeX, before trying to use \makeatletter and \makeatother.
Thanks again,
Lucia
Thanks again,
Lucia
- Stefan Kottwitz
- Site Admin
- Posts: 10310
- Joined: Mon Mar 10, 2008 9:44 pm
Makeatletter and makeatother
LaTeX.org admin
Re: Makeatletter and makeatother
Hi Stefan.
Indeed, another good explanation.
Thank you so much,
Lucia
Indeed, another good explanation.
Thank you so much,
Lucia