[OS X TeX] Numerical commands

Michael Sharpe msharpe at ucsd.edu
Thu Jul 8 20:24:53 EDT 2010


On Jul 8, 2010, at 3:51 PM, Alain Schremmer wrote:

> This is half off-topic:
> 
> With arrayjobx, I am defining commands such as, for instance, in 4.sty:
> 
> \newarray\IV            %4
> \readarray{IV}          %Chapter 4. From Local Graphs to Global Graphs
> 	{% begin array
> 		%4-1
> 			CheckableItem1
> 		&4-2
> 			CheckableItem2
> 	[...]
> 		&%4-50
> 			CheckableItem50
> 	}%end array
> 
> I am using these commands as below and things work well but I was wondering if there might be a way to generate automatically the command names from the file names, for instance the command
> 	\IV
> from the file name
> 	4
> 
> But the only thing I could think of, namely using
> 	\Roman{\jobname}
> naturally does not work.
> 

This is more latexish, and more like what you asked for.

\newcounter{numjob}
\setcounter{numjob}{\jobname}
\edef\xx{\Roman{numjob}}% eg, if \jobname expands to 4, \xx expands to IV
\expandafter\newarray\csname\xx \endcsname% same effect as \newarray\IV
\expandafter\let\expandafter\XX\csname\xx \endcsname% \XX is synonym for \IV
%example
\readarray{\xx}{A&B&C}
\XX(3) % expands to C

Michael





More information about the MacOSX-TeX mailing list