# Exam poll generator?

I need a recomendation for some good LaTeX document generator.

I have two lists of questions - I want the Generator - to make a given number of exam polls which will have first question from the first list, and second question from the second list.

I'm on Kubuntu 11.10 and a fan of Emacs - but the more general the solution - the better. Preferably - the solution should be requiring tex/latex installation only.

Of course I could write it myself in Python - but I'm sure something similar in functionality is implemented in many ways already - the question is - what is better/easier to do - to learn an existing package (I don't know one) - or to write it from scratch in Python.

-
It would be helpful to have an example of what you mean by "lists of questions". –  Peter Grill Nov 28 '11 at 17:24
By a list of questions I mean a file, where qustions will be separated by a blank line, quesions could have images and formulas, and in result - I want to have an a4 document containing exam tickets: each ticket should have Affiliation, number, date, 2 random questions, question should not be breaken across the pages (even if they have images). –  Adobe Nov 28 '11 at 17:53
Ok, can you provide an actual example of the file instead of describing it. –  Peter Grill Nov 28 '11 at 18:00
Have a look at the Acrotex Education Bundle: acrotex.net/aeb_index.php?page=what –  Vivi Nov 29 '11 at 0:45
@Vivi: It looks like AcroTeX tries to make use of electronic forms. That is nice, but at the moment - I just want to generate a printable poll. But thank You anyway. –  Adobe Nov 29 '11 at 14:20

Assuming each question is some sort of item and you can put the questions on one line in the input files and they have matching braces in the input. You can use the \read primitive. It works by reading lines from a stream and assigning them to some command. If you simply want a list of questions you can generate them one at a time using this command. The code might look something like this:

\documentclass{article}
\begin{document}
\newcount\questcount
\makeatletter
\noindent
%This is to avoid an additional space at the end of each line
\if\temp\par\else%
%An extra line is added to the end of extra stream.
%According to TeX by topic it is equivallent with \par, so check for it.
\textbf{Question \number\questcount.} \temp\\%
\fi%
}
\makeatother
\end{document}


While the input (text.dat) could look like this:

What is the square root of 144?
Show that any simple graph with smallest degree greater or equal to 2 contains a cycle.


and the result would look like:

Naturally you could then do something similar for the second file.

-
Thanks - it is something I could work - and try to fit it to my needs. You solution though lacks random question feature. –  Adobe Nov 28 '11 at 17:53

You could also try the exsheets package. Possibility to input random questions from a file is included. I'm afraid the file with questions will need some formatting, though...

-