[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: An example of a multiplication table: some unresolved questions
From: |
Oliver Corff |
Subject: |
Re: An example of a multiplication table: some unresolved questions |
Date: |
Wed, 31 May 2023 08:53:49 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 |
Dear Thomas,
that works like a charm. Thank you indeed!
On 30/05/2023 10:09, Thomas Dupond via wrote:
Dear Oliver,
Using .nf is also important but I think it is not clear from the
manual (either info or groff(7)) that this is needed, if only for
getting rid of the 'cant break line' errors.
I think this achieves the desired result:
.nf
.ta 2mR T 2mR
.nr x 1
.nr y 1
.nr p 0
.while (\n[x] <= 12) \{\
.while (\n[y] <= 12) \{\
.nr p \n[x]*\n[y]
.nr y +1
\n[p] \c
.\}
.br
.nr x +1
.nr y 1
.\}
As you can see I added a tab character before and after \n[p] to
achieve this. The previous example did not work because I did not
remember that you should begin with a tab character.
For this kind of thing I tend to rely on the Unix Text Processing book
more and more. A very similar example of what you are trying to
achieve is described on page 66 (4. nroff and troff > Page Layout >
Setting tabs). You can get this book here:
http://chuzzlewit.co.uk/utp_book-1.1.pdf
This book has long been known to me, but unfortunately I never consulted
the mentioned section before.
Also there is no need to specify the steps x or y should take if auto
incremented because we don't use that here. The step value is
interesting if you use \n+[x] or \n+[y] somewhere in your code. There
are more examples in section 5.6.3 of the info manual.
You are right, the increment steps for x and y are not needed. They were
left-overs from earlier experiments with steps and counters, I left them
in the code as they did no harm.
Thank you again!
Best regards,
Oliver.
--
Dr. Oliver Corff
Mail:oliver.corff@email.de