« Phabricator LDAP (and other) account integration table | Home | Make fails silently »
LaTeX macros ending in numbers
By admin | February 13, 2016
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:
1 2 | \expandafter\def\csname xR1\endcsname{-3} \expandafter\def\csname xR2\endcsname{9} |
Now, create a command which takes in one variable argument, and simply expands it to call the appropriate macro (“xR” + variable) defined above.
1 | \newcommand{\xR}[1]{\expandafter\csname xR#1\endcsname} |
And to use the macros:
1 | The first is \xR1 and the second is \xR2. |
If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!
Topics: Linux | 9 Comments »
March 25th, 2025 at 18:44
… [Trackback]
[…] Read More Info here on that Topic: compdigitec.com/labs/2016/02/13/latex-macros-ending-in-numbers/ […]
March 27th, 2025 at 22:13
… [Trackback]
[…] Read More here to that Topic: compdigitec.com/labs/2016/02/13/latex-macros-ending-in-numbers/ […]
April 25th, 2025 at 23:17
… [Trackback]
[…] Read More Info here on that Topic: compdigitec.com/labs/2016/02/13/latex-macros-ending-in-numbers/ […]
April 28th, 2025 at 20:54
… [Trackback]
[…] Info to that Topic: compdigitec.com/labs/2016/02/13/latex-macros-ending-in-numbers/ […]
May 9th, 2025 at 06:36
… [Trackback]
[…] There you can find 8589 additional Info on that Topic: compdigitec.com/labs/2016/02/13/latex-macros-ending-in-numbers/ […]
May 16th, 2025 at 21:39
… [Trackback]
[…] Information to that Topic: compdigitec.com/labs/2016/02/13/latex-macros-ending-in-numbers/ […]
June 12th, 2025 at 21:10
… [Trackback]
[…] Read More here to that Topic: compdigitec.com/labs/2016/02/13/latex-macros-ending-in-numbers/ […]
June 18th, 2025 at 17:12
… [Trackback]
[…] Information to that Topic: compdigitec.com/labs/2016/02/13/latex-macros-ending-in-numbers/ […]
July 19th, 2025 at 12:28
… [Trackback]
[…] Read More Information here to that Topic: compdigitec.com/labs/2016/02/13/latex-macros-ending-in-numbers/ […]