groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Macro's for making an exam.


From: Hans Bezemer
Subject: Macro's for making an exam.
Date: Mon, 7 Jun 2021 15:37:22 +0200

Dear all,

I've started working with groff recently.
Being a teacher I have three types of documents I mainly create:
1. Articles;
2. Presentations;
3. Exams.

I'm using LaTeX (article, beamer, exam) for those documents at the moment.

To get my feet wet with groff I want to create a set of macros for making a 
test.

Goal is to make it compatible with the mm, ms and mom macrosets.
The macro's have to be able to print the number of questions, the sum of the 
points when called for.
the format of question is simple and should be:
<numberofpointS>        <Question>
whereas the <numberofpoints> are placed in the margin.

I would like to be able to toggle between printing the solution or space to 
answer the question, thus
something along these lines (with arbitrary choosen macronames):
****

Introduction on the question 

.Q1 2 
.\" 2 is the number of points
Question...
.Q2
.A1 
.\" start of answer block
All sorts of formatting to use to answer the question:
lines, grid, drawing.
.A2
.S1 
.\"start of solution block
Block to explain the answer to the question
.S2

And when a variable `a' is set 0 then A1/A2 block is printed
and S1/2 block is ignored. 
When `a' is 1 then the other way around.

I would like to get a few pointers.
What would be a good way to conditional ignore a specific block of text?
It could be done with sed of course, letting it delete anything between and 
including S1 and S2 before piping the text into groff, but I would like to do 
it within groff.

Secondly, I want to put the sum of the points and number of questions on the 
first page.
Is it needed to run groff twice to get does values?
 
Thanks in advance.

Kind regards,

Hans Bezemer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]