Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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
1  
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

2 Answers 2

up vote 3 down vote accepted

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}
  \newread\myread
  \openin\myread=text.dat
  \newcount\questcount
  \makeatletter
  \noindent
  \@whilesw\unless\ifeof\myread\fi{%
    {\endlinechar=-1 \global\readline\myread to \temp}%
    %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.
      \advance\questcount by 1%
      \textbf{Question \number\questcount.} \temp\\%
    \fi%
  }
  \closein\myread
  \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:

questions from file

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

share|improve this answer
    
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...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.