Hi Oliver, > .\" Start of example text > > Learning Language X \"should return 0 > > [] Prerequisites \" should return 1 > > [][] Tools \" should return 2 ... > \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.
Unlike TeX, where everything is written in TeX, troff favours using a preprocessor which produces troff, e.g. pic(1) and tbl(1). These can be quite simple, say an awk script which processes what it recognises and passes through the rest. chem and dformat are both awk scripts: https://troff.org/prog.html#chem Whilst it's interesting to wonder how it can be done in troff, longer term you'll probably write preprocessors for this kind of thing. :-) It's common to create ‘little languages’ particular to you using Unix programs. -- Cheers, Ralph.