groff
[Top][All Lists]
Advanced

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

Comprehension problem with macros


From: Oliver Corff
Subject: Comprehension problem with macros
Date: Sun, 23 Apr 2023 13:51:29 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0

Dear all,

in order to create tables of CJK characters I thought of having groff do
the computation rather than making a huge text file in tabular form.

I thought of a loop that traverses 0x0 to 0xF (i.e., 0 .. 15 in decimal
notation) for writing rows of 16 characters:

.fam Song
.\" Create pseudo hash, rather LUT for hex numbers
.ds 10 A
.ds 11 B
.ds 12 C
.ds 13 D
.ds 14 E
.ds 15 F

.\" The first 16 Chinese characters of Unicode CJK are U+4E00 to U+4E0F.
.\" Loop through positions 0..15 and print character in \[u....] notation.
.\" If the last digit is below 10, use it directly, otherwise convert it
via LUT above.

.nr number 0 1
.while (\n[number] < 16) \{\
.ie (\n[number] < 10) \[u4E0\n[number]]
.el \[u4E0\*[\n[number]]]
.nr number +1
.\}

So far, everything works perfectly.

However, if I wrap this loop in a macro like

.de myline
.\" material as above
..

and try to call with \n[myline] or
.myline

then I run into an infinite loop.

Where is my mistake?

Best regards,

Oliver.


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




reply via email to

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