Exporting examples for use in other applications



Jaime Villate <villate at fe.up.pt> writes:

> [1:text/plain Hide]
>
> On 11/12/2012 04:09 PM, Christian Stengg wrote:
>> Hello,
>>
>> I use Maxima for automatically generating exercises for my students. 
>> For some type of exercise, Maxima produces a list of examples, e.g. a 
>> list of equations that should be solved by the students. I'd like to 
>> epxort these equations automatically for use in other applications, 
>> e.g. for presentation in a webbrowser or for insertion as pictures in 
>> some document or for filing in a database. Is it possible to get this 
>> done by Maxima? If yes, what different options are there?
> Hi,
> I do something similar for my students. I have several files with 
> multiple-choice questions such as the two sample questions in the 
> attached file questions.mac.
>
> Notice that each question has the following structure:
>     question (id, param, txt, answers, [aux])
> where id is a string, param is a list with one or more lists of possible 
> values for each of the parameters in the question, txt is a list of 
> substrings which concatenated will form the text of the question, 
> answers is the list of the multiple choice answers (the first-one given 
> is always the correct one, but they will be shuffled) and [aux] is one 
> or more auxiliary expressions (or it can be omitted).
>
> I then parse the questions to produce latex files that I print for the 
> quizes and xml files that I import into Moodle's database (Moodle is an 
> e-learning program). The attached file quiz.mac parses the questions 
> into Latex. It should be used like this:
>
> First, load quiz.mac with load("quiz.mac")
> Then, load the file with the sample questions using: load("questions.mac")
> At that point some arrays have been created with the information on the 
> questions. You can then print the latex output of one of the two 
> questions available, with random parameters, using their ids:
>
> quiz_question("q1");
> quiz_question("q2");
>
> If you repeat those commands you can see the random changes introduced.
> The array v[1], v[2],... referred in the text of the questions and in 
> the answers refer to the values assigned to the parameters and aux[1], 
> aux[2],... referred to the auxiliary expressions.
>
> I hope this will serve you as an example for what you want to do. I 
> intend to make some contributed module for Maxima at sometime whenever 
> the code becomes more stable.
>
> Regards,
> Jaime

Jaime, This is more a daydream than anything: I have been wanting for
some time now to have a cleaner way of doing mixing Maxima and TeX. In
your case, your Maxima code drives the LaTeX; in my case, I embed all my
Maxima code in LaTeX files. In both ways, there is no 2-way
communication between the CAS and typesetter and there is generally a
kludgy step where language X code is prepared by language Y. I feel that
it would be nice to have TeX, or a substitute, inside a Lisp language
with a shared state. Perhaps luatex will open up enough of TeX to make
it feasible to do this; though it would have been nice if those guys had
used a Lisp language to extend TeX rather than using Lua.

-- 
Leo Butler                <l_butler at users.sourceforge.net>
SDF Public Access UNIX System -   http://sdf.lonestar.org