{"id":436,"date":"2007-08-07T15:04:57","date_gmt":"2007-08-07T13:04:57","guid":{"rendered":"http:\/\/random-thoughts.de\/?p=436"},"modified":"2009-12-09T23:57:48","modified_gmt":"2009-12-09T22:57:48","slug":"tex-makeatletter-and-makeatother","status":"publish","type":"post","link":"https:\/\/arf1.de\/wordpress\/?p=436","title":{"rendered":"TeX: makeatletter and makeatother"},"content":{"rendered":"<p>Ever wondered why some TeX macros have to be put between the makeatletter and makeatother commands? Like this one:<\/p>\n<blockquote><p>\\usepackage{remreset}<br \/>\n\\makeatletter<br \/>\n\\@removefromreset{footnote}{chapter}<br \/>\n\\makeatother<\/p><\/blockquote>\n<p>which allows to keep the footnote counter from being reseted with each chapter, which would be the default behaviour in the book and report document classes.<\/p>\n<p>Radhakrishnan gives an excellent, detailed <a title=\"Makeatletter and Makeatother\" href=\"http:\/\/www.tug.org\/pipermail\/tugindia\/2002-January\/000178.html\">explanation<\/a> from which I&#8217;d like to quote:<!--more--><\/p>\n<blockquote><p>\\makeatletter changes the category code of &#8216;@&#8217; character to 11 (&#8230;)<br \/>\n\\makeatother reverts this to its original catcode of 12.<\/p>\n<p>Knuth [the <a title=\"Donald E. Knuth\" href=\"http:\/\/en.wikipedia.org\/wiki\/Donald_Knuth\">creator of TeX<\/a>] assigns a category code for each and every character like 0 for escape &#8216;\\&#8217;, (&#8230;) 11 for letters, (&#8230;) and 12 for characters other than the above. (&#8230;)<\/p>\n<p>You might have noted that an escape character combined with the characters of catcode 11 becomes a control sequence. As such, all the user defined control sequences or macros will be of this nature.<\/p>\n<p>This raises the problems of risks of an user defined macro having the same name as that of a macro in a package or even LaTeX kernel even. (&#8230;)<\/p>\n<p>In order to circumvent this foreseeable problem, package writers always use the character &#8216;@&#8217; in their control sequences by changing the cat code of `@&#8217; character to 11 which is the catcode of alpha characters. This is accomplished by the command \\makeatletter.<\/p>\n<p>At the end of the package, the author will revert the catcode of `@&#8217; to 12 with the command \\makeatother. So you will find lots of macros<br \/>\nwith `@&#8217; like \\@title, etc., which you cant define in a document without changing the catcode. So novice users will not create macros that might clash with kernal macros.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Ever wondered why some TeX macros have to be put between the makeatletter and makeatother commands? Like this one: \\usepackage{remreset} \\makeatletter \\@removefromreset{footnote}{chapter} \\makeatother which allows to keep the footnote counter from being reseted with each chapter, which would be the default behaviour in the book and report document classes. Radhakrishnan gives an excellent, detailed explanation [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[3,8],"tags":[],"class_list":["post-436","post","type-post","status-publish","format-standard","hentry","category-english","category-uni"],"_links":{"self":[{"href":"https:\/\/arf1.de\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arf1.de\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arf1.de\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arf1.de\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/arf1.de\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=436"}],"version-history":[{"count":1,"href":"https:\/\/arf1.de\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/436\/revisions"}],"predecessor-version":[{"id":1462,"href":"https:\/\/arf1.de\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/436\/revisions\/1462"}],"wp:attachment":[{"href":"https:\/\/arf1.de\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arf1.de\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arf1.de\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}