groff
[Top][All Lists]
Advanced

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

Count number of spaces at beginning of line?


From: Oliver Corff
Subject: Count number of spaces at beginning of line?
Date: Sat, 29 Apr 2023 21:49:18 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0

Dear all,

the weekend is there, and drives me to try silly things (which is a good
way to learn a language).

Is there any possibility to count leading spaces in groff? I use [] to
express spaces in the following mock-up of an outline:

.\" Start of example text

Learning Language X \"should return 0

[] Prerequisites \" should return 1

[][] Tools \" should return 2

[][] Documentation \" same

[] Learning Objectives \" should return 1

[][] Familiarize yourself with typical structures of language X \"
should return 2

[][] Learn to see patterns in your problems for which language X offers
idiomatic solutions

[][] Learn to transform patterns in your problems for wich language X
does not offer an idiomatic solution

.\" End of example text

Ideally, I should by able to replace the leading spaces with some kind
of a counter which I can later re-use, and store it per line.

\n[Text_of_my_line] would contain the level of indentation, like
\n[Tools] and \n[Documentation] whould both return 2 which could be used
to set the section numbering via .NH x.


It is safe to assume that X stands for the macro language of groff.

Best regards,

Oliver.


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




reply via email to

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