Harald's idea sounds like a great one, so I tried to implement it.  I have 
no problem creating Python objects with arbitrary _latex_() methods, but 
then there's no way to insert them into the document.  The only way to get 
Sage output into the document is with the \sage{...} command, which seems 
to be built only for inline and in math mode.  You can't, for example, 
create an object whose LaTeX representation is several paragraphs long, 
with display math and so on in it, and then try to do \sage{thatObject}. 
 You get a ton of errors of various kinds, including ones about paragraph 
breaks in places they shouldn't be.

Doing it this way (creating Python objects to store the problems) was 
important to me, because I hoped to create a solution that didn't just 
generate random problems each time the document was compiled, but also (a) 
automatically generate several versions of the exam/worksheet in the same 
LaTeX document (concatenated), and (b) permute the problems differently in 
each version.  Is this hopeless or does someone here know a relevant 
SageTeX trick that I don't?

Thanks!

Nathan


On Tuesday, August 4, 2009 2:10:46 PM UTC-4, Harald Schilly wrote:
>
> On Aug 4, 4:58 pm, "M.Olson" <[email protected]> wrote: 
> > I have a very SIMPLE example of generating random dyadic 
> > operations ... let's use addition. ... 
>
> Hi, I would tackle this entirely different. I would code the randomness 
> +the solutions in python, part of sagetex, and just insert markers 
> into the latex code where the example should go (an example is 
> basically a map of "ID"s <-> problem-data-structure). coding the 
> random generation inside the latex document is bad, because you cannot 
> reuse the code and as you say you don't get the solutions. 
> In detail, you could parameterize each generated latex document with a 
> number (serving as a random seed). then, there is an option to print 
> the question, question+answer or just the answer. in the latex code is 
> something like "\insertProblem{ID_STRING}" and that calls a python 
> function that generates the latex code and does everything else. Of 
> course, I never thought this through but i think it might work very 
> well. 
>
> H

-- 
You received this message because you are subscribed to the Google Groups 
"sage-edu" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-edu?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to