ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* luatex "success story"
       [not found] <mailman.1.1190973605.19329.ntg-context@ntg.nl>
@ 2007-09-28 21:41 ` Vyatcheslav Yatskovsky
  2007-09-28 21:57   ` Mojca Miklavec
  0 siblings, 1 reply; 2+ messages in thread
From: Vyatcheslav Yatskovsky @ 2007-09-28 21:41 UTC (permalink / raw)
  To: ntg-context-request@ntg.nl

Hello all,

Let me share my luatex "success story".   I teach computer science, and current topics I deliver are Numbering Systems and Data Representation. Yesterday, I needed to prepare about twenty test papers with 10 questions per a paper. Examples: "1. convert Dec 36 into Hex",  "2. convert Bin 10010101 into Dec", etc. The wording of every question has not to be changed through papers, only numbers had.

Instead of filling in numbers manually, I took more intelligent approach and (with Hans' help) wrote simple lua scripts to generate random numbers right inside my document:

% question involving random decimal number 
 Convert \ctxlua{n=math.random(30,60) ; tex.print(n) ;}\low{10} into Bin.
 
% question involving random binary number 
 Convert  
  \startluacode 
    for c = 1, 16 do    
      n = math.random(0,1)
      tex.sprint(n) 
    end
  \stopluacode\low{2} into Hex.

and so on... I specified the lower and upper limits as two arguments of random function, and that was very easy indeed.

Then I copied my finished test text and pasted it many-many times. (It was probably not very wise approach, but I'm not familiar with looping TeX commands at the moment.) Luatex did the rest of the job perfectly, and in minute I had test papers with identical questions but all different figures! I only had to cut papers apart and hand out to my students.

Best regards,
Vyatcheslav Yatskovsky

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: luatex "success story"
  2007-09-28 21:41 ` luatex "success story" Vyatcheslav Yatskovsky
@ 2007-09-28 21:57   ` Mojca Miklavec
  0 siblings, 0 replies; 2+ messages in thread
From: Mojca Miklavec @ 2007-09-28 21:57 UTC (permalink / raw)
  To: Yatskovsky, mailing list for ConTeXt users

On 9/28/07, Vyatcheslav Yatskovsky wrote:
> Hello all,
>
> Let me share my luatex "success story".   I teach computer science, and current topics I deliver are Numbering Systems and Data Representation. Yesterday, I needed to prepare about twenty test papers with 10 questions per a paper. Examples: "1. convert Dec 36 into Hex",  "2. convert Bin 10010101 into Dec", etc. The wording of every question has not to be changed through papers, only numbers had.

Nice :)

> Then I copied my finished test text and pasted it many-many times. (It was probably not very wise approach, but I'm not familiar with looping TeX commands at the moment.) Luatex did the rest of the job perfectly, and in minute I had test papers with identical questions but all different figures! I only had to cut papers apart and hand out to my students.

\dorecurse{30}{\page
... problems ...
}

Mojca
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-28 21:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.1.1190973605.19329.ntg-context@ntg.nl>
2007-09-28 21:41 ` luatex "success story" Vyatcheslav Yatskovsky
2007-09-28 21:57   ` Mojca Miklavec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).