groff
[Top][All Lists]
Advanced

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

Re: AW: Macro's for making an exam.


From: Oliver Corff
Subject: Re: AW: Macro's for making an exam.
Date: Thu, 10 Jun 2021 22:36:24 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1

Hi Keith,

thank you for the correction.

I apologize for the erroneous information I offered. I clearly confused
that with the use of requests within tbl cells; they must be positioned
at the beginning of the line.

Please accept my apologies.

Best regards,

Oliver.


On 10/06/2021 00:28, Keith Marshall wrote:
On 09/06/2021 19:35, Oliver Corff wrote:
All .dot requests MUST be at the beginning of the line; in your code
example, the dot is not recognized.
No, that is not so.  The issue with Hans' example, (apart from the under
escaping of register references within his macro definitions, as Peter
has already noted), is that he is not specifying the appropriate end
marker for his .ig request.  Since the effect of his SOLUTION macro ends
with a following SOLEND macro rather than:

.de SOLUTION
.if (\n[s] == 0) .ig ++
.br
..
.de SOLEND
.++
..
he should have:

    .de SOLUTION
    .   if (\\n[s] == 0) .ig SOLEND
    .   br
    ..
    .de ENDSOL
    .   \" Any clean-up required, at end of solution.
    ..

This toy example does, for me, what I believe Hans is trying to achieve:

    $ cat foo.roff
    .pl 10
    .in 5m
    .nr QNR 0 1
    .de QUESTION
    .   br
    .   ti -5m
    .   nop \Z'Q\\n+[QNR].'\h'5m'\c
    ..
    .de SOLUTION
    .   ie '\\$1'' .ds SOLHT 3v
    .   el .ds SOLHT \\$1
    .   el '
    .   if !\\n[SOLUTIONS] .ig SOLEND
    .   br
    .   ti -5m
    .   nop \Z'A.'\h'5m'\c
    ..
    .de SOLEND
    .   \" Insert any required code here,
    .   \" to adjust state after a solution;
    .   \" (e.g. to insert blank space,
    .   \" when solutions are hidden).
    .   ie \\n[SOLUTIONS] .sp
    .   el .sp \\*[SOLHT]
    ..
    .QUESTION
    Solutions are not normally shown.
    How can they be made visible?
    .SOLUTION 5v
    Run the formatter,
    specifying the "-rSOLUTIONS=1" register assignment,
    on the command line.
    .SOLEND
    .
    .in 0
    .pl 1
    Here is some arbitrary text, following the Q&A section.

    $ nroff foo.roff
    Q1.  Solutions  are  not  normally  shown.   How can they be made
         visible?




    Here is some arbitrary text, following the Q&A section.

    $ nroff -rSOLUTIONS=1 foo.roff
    Q1.  Solutions  are  not  normally  shown.   How can they be made
         visible?
    A.   Run the formatter, specifying the  "‐rSOLUTIONS=1"  register
         assignment, on the command line.

    Here is some arbitrary text, following the Q&A section.




reply via email to

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