[OS X TeX] Variable

Alain Schremmer Schremmer.Alain at gmail.com
Sat May 13 04:59:07 CEST 2006


Christopher Allen wrote:

> On May 3, 2006, at 3:40 PM, Alain Schremmer wrote:
>
>> Up to now, I have just assigned them as i=question number in  
>> question folder, j = variant number in the file. So, for instance,  
>> Q22-5 is the fifth variant in file 22 in the question folder. But  
>> when I enter this by hand—so far I haven't been able to write a  
>> single Apple script both for lack of time and lack of ability. (The  
>> programmer's mind is something different or at least so I fathom  
>> when I listen to my Software Engineer son)
>
>
> Hmmm... I see possibilities. If I understand the commands properly,  
> \value{counter} is read as an integer while \arabic{counter} is read  
> as a string.
>
> My biggest hang-up at the moment is understanding exactly what you  
> want done with 22 and with 5 here.
>
>>    \newproblem{Qi-j}{\includegraphics{Qi-j}}{Answer ij}
>>
>> What I would like is something like
>>
>>    \newproblem{Qi-j}{\includegraphics{=first argument this
>>    \newproblem}}{Answer ij}
>>
>> or better yet
>>
>>    \newproblem{= argument \includegraphics in second argument of this
>>    \newproblem}{\includegraphics{Qi-j}}{Answer ij}
>
>
> If I understand correctly, you have a file named 22.tex within  
> question (question/22.tex) that contains several variants each  
> labeled as Q22-1, Q22-2, etc. Here 22.tex and Q22-1, Q22-2, etc. are  
> all strings. As they're strings, I'm wondering if we can somehow use  
> \arabic{counter} to insert a variable into the string... And now that  
> I'm looking at probsoln.pdf, I'm noting exactly that is shown as a  
> possibility on page 6.
>
> Now, what are we trying to get probsoln to do? I think where I'm  
> confused is I don't know  what you want to pass via \doforrandN or  
> \selectrandomly or whatever else you're using that you want to show  
> up in the problem. Is it that you want to avoid writing all the j  
> variants, the idea being to pass j as a parameter that internally  
> changes a single question that has been written? (Basically, j being  
> used for <nargs>.) And then your problem is using j when naming a  
> file in \includegraphics? If so, you ought to be able to set a  
> counter equal to j. Then use \arabic{that counter} in the string in  
> \includegraphics. Or maybe I have no idea what you're trying to do.

I must confess that page 6 of probsoln is beyond me in that it would 
take me an inordinate amount of time to figure it out. Let me try to 
describe better what I would like to do.

I would like to generate 25 files, called 1.tex, 2.tex, … 25.tex to be 
used as forms in which to enter the actual variants of the questions.

In each file, say file i.tex, I must therefore have

    \newproblem{Qi-j}{Blank for question}{Blank for Answer}

with j ranging from 1 to, say, 10 to provide blanks in which to place 
the 10 variants.

What I do right now is create one form, 1.tex, make 24 copies and then 
change the filename of the copies to 2.tex, 3.tex, … 25.tex and then, in 
each file, replace "1-" by "filenumber-".

That is a lot of stuff to do by hand even before filling the text of the 
questions—and for finals, I would need at least 75 files—not to mention 
the errors.

The ideal would be for 1.tex to be such that when I make the copies, the 
numbering for i automatically equals the file names.

In the more complicated version, the one I gave above, the text of the 
variant comes from \includegraphics{Qi-j} because I also have to convert 
old data bases and the easiest way is to convert each variant of each 
question into a cropped pdf that sits in a file called Qi-j.

Hopeful regards
--schremmer








------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the macostex-archives mailing list