groff
[Top][All Lists]
Advanced

[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: Tue, 30 May 2023 09:17:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

Dear Thomas,

thank you very much indeed.

Beyond your critical correction of using a genuine tab (0x09) character
instead of \t, it was \c which does the trick.

Furthermore, my setting of tab stops had been flawed.

I now use

.ta T 6m

which works as desired. Yet I still run into a now definitely minor problem.

Given the general syntax .ta T 6mX where X is one of L C R,

I get the same output for any of L C R, the numbers are always adjusted
to the left.

1     2     3     4     5     6
2     4     6     8     10    12
3     6     9     12    15    18

instead of

1     2 3     4     5     6
2     4     6     8    10    12
3     6     9    12    15    18

I think I can tinker with prepending \~.

I produce the output as follows:

$ groff -Tascii table.roff | less

Thank you very much again, best regards,

Oliver.

On 29/05/2023 23:29, Thomas Dupond wrote:
Dear Oliver,

Oliver Corff <oliver.corff@email.de> wrote:

Dear All,

the attached attempt to create a multiplication table was inspired by
https://rosettacode.org/wiki/Multiplication_tables

but I fail to do the right thing with regard to typesetting the computed
output.

I followed the groff manual, section Tabs and Fields, and set up my tab
positions as follows:

.ta 4mR 4mR 4mR 4mR 4mR 4mR 4mR 4mR 4mR 4mR 4mR 4mR

So, 12 tab stops at a distance of 4 m (I never have more than three
digits in my table example), all right-justified.

However, the \t escape seems to be completely ignored.

The alternative, conditionally prepending \~ if \n[p] < 100 and \~\~ if
\n[p] < 10 also seems to fail.

Thank you all for your enlightenment!
Does this example fill some of what you are trying to achieve?

.nf
.ta 4mR 4mR 4mR 4mR 4mR 4mR 4mR 4mR 4mR 4mR 4mR 4mR
.nr x 1 1
.nr y 1 1
.nr p 0
.while (\n[x] <= 12) \{\
.while (\n[y] <= 12) \{\
.nr p \n[x]*\n[y]
\n[p]   \c
.nr y +1
.\}
.br
.nr x +1
.nr y 1 1
.\}

--
Dr. Oliver Corff
mailto:oliver.corff@email.de




reply via email to

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