I am new to this forum, and obviously a first time poster. I have used Latex for a while, but generally just for typesetting easily done documents. However, I am writing a macro (first time as well) where I need to send pairs of arguments. I know there is a limit of nine for the number of arguments and that the limit can be circumvented through other means. However, I would like to call the macro as follows
\macrocall{n1-m1,n2-m2,n3-m3.}
where my pairs are (n1,m1), (n2,m2), etc. There will most likely be more than simply three pairs.
I wrote the following code to begin:
Code: Select all
\documentclass[11pt]{article}
\usepackage{ifthen}
%%%%%%%%%%%%%%%%%%%%%% Begin macro definition %%%%%%%%%%%%%%%%%%%%%
\def\macrotesting#1{\getPairs#1}
\def\getPairs#1-#2,#3.{
% These are a couple of if statements testing the pairs
% Ultimately I will need to test 26 pairs
% The pair should be in arguments #1 and #2
% The rest of the string should be in argument #3
\ifthenelse{\equal{#1}{0}}{
\ifthenelse{\equal{#2}{1}}{
% Here I will do something else with the pairs, but I am
% just testing to see if I get the right pair
#1 = number 1 (if it got here it should be 0)\\
#2 = number 2 (if it got here it should be 1)\\
#3 = number 3\\
}{
\ifthenelse{\equal{#2}{4}}{
#1 = number 1 (if it got here it should be 0)\\
#2 = number 2 (if it got here it should be 4)\\
#3 = number 3\\}}}{}
}
%%%%%%%%%%%%%%%%%%%%%% End macro definition %%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
% test the macro with a sample pairs string
\macrotesting{0-4,0-1,0-3,3-7,4-16.}
\end{document}
Second, my ifthenelse{} statements are going to get out of control in a hurry. Is there a better way to do this?
Finally, and this just out of curiosity, is there a character limit to a macro argument?
Thank you for any help.
ERM