1

Please excuse my poor English.

I have a question regarding a "question - answer" system in latex. I want to create a quiz with 1000+ questions/answers like this:

Question_1
Question_2
...
Question_n

Answer_1
Answer_2
...
Answer_n.

Having all of them in one document does not seem practical to me. It will be to long. Furthermore every answer belongs to one question, and I want to connect them in any way so they "don't get lost" and I don't have to search much if changing the question/answer. For now I have solved the problem by making a textfile for each question and answer (answers can be a page long). Then I just import the questions in the order I want:

\include{Question1}
\include{Question22}
\include{Question7}

\include{Answer1}
\include{Answer22}
\include{Answer7}.

But with this I have so many files and if I want to change a certain thing in all questions, I have to open each file. The search function in texmaker in just one file (or in 4 files with 250 questions each) would be much faster. Another thing is that I want to have lets's say Q1-Q400 in one document and Q200-Q600 in another - I want to use the questions in different documents, but this is not that important and if it is not possible it's ok. Each question should exist only once.

So, what I need: I want to define the order at the end, the answer to a question shall be found easily and be at the right position in the ready document, just as many files as really needed.

One idea to half the quantity of files would be to have a question + answer in the file and make something like this:

\include{Quiz1}{just question} (begin at "\beginquestion" end at "\endquestion"

...

\include{Quiz1}{just answer} (begin at "\beginanswer" end at "\endanswer")

Or even better a file with 30 questions + 30 answers and each question would have a unique name so the input could be done by the name:

Text_document1

  • QuestionBlue
  • AnswerBlue
  • QuestionYellow
  • AnswerYellow
  • QuestionGreen
  • AnswerGreen

Ready latex document

  • \include{Text_document1}{QuestionGreen}
  • \include{Text_document1}{QuestionBlue}
  • \include{Text_document1}{AnswerGreen}
  • \include{Text_document1}{AnswerBlue}

In the ready document the unique Name shall not be seen, instead the Q/A shall be enumerated.

Thank you so much for your help!

Edit: Thanks for the ideas! I found the exsol package, and because I already work with exercise and solution this package is one possible solution for my problem. With this package I can have multiple Q+A in one file and first print all Q and after that the A. But I cannot sort them, therefore I would have to make a file for each pair of Q+A. Or has anyone a solution for this?

  • Welcome to TeX.SX! Have a look at the xsim package. – TeXnician Dec 14 '18 at 10:32
  • Before of invest your time in your ideal Q & A system: (1) AMC (2) If you think you cannot use it (e.g., Linux allergy) or you can do something better for your specific purposes (I doubt that), visit the Exercise topic in CTAN and and weigh carefully your options of not reinvent all the wheels. (3) When you get some idea of the "maybe best system for me" (AMC, other package or even start from scratch) try to make it work (4) In case of trouble, try to ask about single and specific problems. – Fran Dec 14 '18 at 10:47
  • I have no Linux allergy but just don't have a Linux system. Anyways, AMC seems "too big" for my needs. I don't need multiple-choice-answers or shuffled questions. If I am getting it right, the proccess of creating content will switch to AMC, latex files are just an "input". So maybe AMC does not allow some mathematic/graphic functions which work in latex. Edit: "...it is not mandatory anymore to write your questionnaires using LaTeX language" (Page 1 AMC manual). I would like to stay within latex. – DoJohn Dec 14 '18 at 11:24
  • For the Q/A I already use the exercise package. It is just that I have problems "sorting" the Q/A. xsim seems like an alternative to the exercise package. I will take a deeper look at the manual (maybe xsim fits better than exercise) but my main problem is how to store the Q/A efficiently. – DoJohn Dec 14 '18 at 11:24
  • Please take a look at the last part of my question (30 Q/A in 1 File). Is something like that possible? Maybe with something like the tagging package? But tagging is also more with multiple options of showing/hiding within one document. I try to ask a single problem: Is it possible to put only tagged parts of a textfile in? – DoJohn Dec 14 '18 at 11:24
1

This is not a solution but a start. My knowledge lacks on the foreach part. So maybe someone can help you/me with that part.

My thinking: make for every question a quiz1.tex file like this:

\question This is my question
\begin{solution}
This is my answer
\end{solution}

And the main file would be like this:

 \documentclass[11pt,a4paper,addpoints]{exam}
 \usepackage{pgf,tikz}

  \printanswers
  \noprintanswers

  \begin{document}
  \begin{questions}

  %%%% \foreach part works only in \tikzpicture environment :-(
  \foreach \x in {1,2,...,100} \input{quiz\x}

   \end{questions}
   \end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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