LaTeX forum ⇒ GeneralMakeatletter and makeatother

LaTeX specific issues not fitting into one of the other forums of this category.
Lucia
Posts: 36
Joined: Wed Dec 31, 2008 9:03 pm

Makeatletter and makeatother

Postby Lucia » Sat Jan 17, 2009 7:02 pm

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

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net
LaTeX Beginner's Guide LaTeX Cookbook
User avatar
localghost
Site Moderator
Posts: 9203
Joined: Fri Feb 02, 2007 12:06 pm

Makeatletter and makeatother

Postby localghost » Sat Jan 17, 2009 7:15 pm

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¹
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Makeatletter and makeatother

Postby nlct » Sun Jan 18, 2009 1:16 pm

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 are a couple of sections on internal commands in the FAQ: \@ and @ in macro names and \spacefactor complaints.

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

Lucia
Posts: 36
Joined: Wed Dec 31, 2008 9:03 pm

Re: Makeatletter and makeatother

Postby Lucia » Sun Jan 18, 2009 8:21 pm

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 9804
Joined: Mon Mar 10, 2008 9:44 pm

Makeatletter and makeatother

Postby Stefan Kottwitz » Sun Jan 18, 2009 9:49 pm

Hi Lucia,

here's another good explanation on the TUGlist.

Stefan
LaTeX.org admin

Lucia
Posts: 36
Joined: Wed Dec 31, 2008 9:03 pm

Re: Makeatletter and makeatother

Postby Lucia » Sun Jan 18, 2009 11:50 pm

Hi Stefan.

Indeed, another good explanation.

Thank you so much,
Lucia


Return to “General”

Who is online

Users browsing this forum: cgnieder and 8 guests