{"id":397,"date":"2016-02-13T23:35:24","date_gmt":"2016-02-14T04:35:24","guid":{"rendered":"http:\/\/www.compdigitec.com\/labs\/?p=397"},"modified":"2016-02-13T23:35:24","modified_gmt":"2016-02-14T04:35:24","slug":"latex-macros-ending-in-numbers","status":"publish","type":"post","link":"http:\/\/www.compdigitec.com\/labs\/2016\/02\/13\/latex-macros-ending-in-numbers\/","title":{"rendered":"LaTeX macros ending in numbers"},"content":{"rendered":"<p>Only <a href=\"http:\/\/www.tex.ac.uk\/FAQ-whatmacros.html\">letters are directly permitted in macro names<\/a>, but by using csname to create definitions along with a variable command, we can simulate them.<\/p>\n<p>First, define the macros with numbers using \\csname:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\\expandafter\\def\\csname xR1\\endcsname{-3}\r\n\\expandafter\\def\\csname xR2\\endcsname{9}\r\n<\/pre>\n<p>Now, create a command which takes in one variable argument, and simply expands it to call the appropriate macro (&#8220;xR&#8221; + variable) defined above.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\\newcommand{\\xR}[1]{\\expandafter\\csname xR#1\\endcsname}\r\n<\/pre>\n<p>And to use the macros:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nThe first is \\xR1 and the second is \\xR2.\r\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>Only letters are directly permitted in macro names, but by using csname to create definitions along with a variable command, we can simulate them. First, define the macros with numbers using \\csname: Now, create a command which takes in one variable argument, and simply expands it to call the appropriate macro (&#8220;xR&#8221; + variable) defined [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts\/397"}],"collection":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/comments?post=397"}],"version-history":[{"count":0,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts\/397\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/media?parent=397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/categories?post=397"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/tags?post=397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}