1

Can a MWE be given showing the difference, relationship and usage of \makeatletter and \makeatother ? The existing answer explain these commands but do not provide a useful MWE which would show the usage of them. They say

\makeatletter % changes the catcode of @ to 11
<your changes here>
\makeatother % changes the catcode of @ back to 12
user2925716
  • 1,940
  • 2
    See https://tex.stackexchange.com/questions/8351/what-do-makeatletter-and-makeatother-do, – Steven B. Segletes Jul 21 '20 at 17:35
  • 2
    Many LaTeX "internal" macros contain a @ in the name, as a form of protection...users cannot accidentally oveerwrite a macro of the same name or accidentally use it, since in your normal code, a macro name with @ in it is forbidden. Thus, the \makeatletter...\makeatother technique is a way to override the protection, allowing the ... code, as it appears in a normal LaTeX document, to access macros that have @ in their name. – Steven B. Segletes Jul 21 '20 at 18:28
  • 1
    What part of that linked answer is confusing you? I agree that the code snippet by itself could be confusing, but I feel like the three paragraphs opening that answer are pretty clear. Is there some part that you're still wondering about? Is there some example of \makeat... that you're confused about? – Teepeemm Jul 21 '20 at 18:30
  • @Teepeemm I'm not confused by any particular example. Rather I'd like to see a good example instead of <your changes here> in my OQ. – user2925716 Jul 21 '20 at 18:31
  • But I feel like any example combined with the three paragraphs opening that answer would be self explanatory. What is it about those three paragraphs that is leaving you confused? – Teepeemm Jul 21 '20 at 18:33
  • 1
    A search on this site for \makeatletter will provide any number of concrete examples of use. Just this morning, I gave this answer, https://tex.stackexchange.com/questions/554444/defining-a-new-command-using-a-conditional/554455#554455, in which I wrote a user macro that needed to take advantage of the internal macro \@ifnextchar. In order to access the macro, I had to surround the definition with \makeatletter and \makeatother. Important: you generally want the whole definition (not just some inner part) encased in the \makeat.., so that the argument is absorbed with @_11 catcode – Steven B. Segletes Jul 21 '20 at 18:39
  • 1
    the search box suggests there are over 30 thousand examples on this site, in addition to that specific answer explaining what they do. It's hard to think of how to make another generic example. If there is something specific that you need to ask about feel free to edit the question but in this generality it's surely a duplicate. – David Carlisle Jul 21 '20 at 18:40
  • @DavidCarlisle I'm happy with the comments under my (now Duplicate) question. – user2925716 Jul 21 '20 at 18:45

0 Answers0