Re: How to go back to last word end

Matteo Bini <[email protected]> Fri, 31 Jul 2026 13:38:30 +0200
Newsgroups gmane.comp.printing.groff.general
Message-ID <[email protected]>
Thank you for the clear answer Branden,

after reading your email and the groff manual I came up with the
following solution.

.de ADD_SPACE

.  lsm
..
.de B
.  it 2 RESET_LSM
.  ft B
.  lsm ADD_SPACE
\\$*\c
.  ft
..
.de RESET_LSM
.  lsm
..

Maybe it's a bit of a hack, but it allows me to write this

.B my bold words
,
not so bold words

and get the desired output

*my bold words*, not so bold words

Moreover, if I need to add a space I can write this way

here's a small paragraph where I need only one
.B bold
 word,
then I can continue styling as usual

Output:

here's a small paragraph where I need only one *bold* word, then I can
continue styling as usual

Why can't you just use macro arguments, you may ask?

Well I find they make the roff source harder to read, especially when
you have a macro with already several arguments, like the .NOTE one
I use in this little tool [1] I've written to craft the HTML for my
website.

> .NOTE https://github.com/Elbullazul/Chicago95 "Chicago95 by Elbullazu" Chicago95

Here I would need to add two additional arguments, to have text attached
before and after the macro. As you can see it's already crowded.
Besides, the text before and after the macro isn't really related to the
macro purpose, so I like my way better.

Of course suggestions are welcome.

Thank you for the support.


1. https://git.golem.linux.it/matteobin/srohtml

-- 
Matteo Bini