> > > a request that would print its argument with all
> > > hyphenation points visible
> 
> I think this is not necessary.
> 
> > [...] single word. That is trivially handled by
> >     groff -a
> >     .ll 1u
> >     recapitulation
> 
> Exactly.  Based on that a simple macro can be constructed:
>
> [...]

That's quite ingenious!
(Also, turning off the warnings for the duration of processing
to suppress the "can't break line" messages.)


I tried prettyprinting this with dots instead of hyphens
(like in the original example), and this turns out to be a
bit more complex, because we have to chop off the hyphens
to replace them with dots.  (I fiddled around with .shc
as well, but that still leaves getting rid of the spaces.
Unfortunately, asciifying the hidden spaces brings them
back.)  Also, if we want to process more than one word
at a time, we have to distinguish between inter-word
and intra-word divisions.

Nevertheless, it's still possible to do this with the help of
a few diversions and traps, as in the attached example macros.
It's somewhat hackish and perhaps not the most compact code
possible, but at least it's reasonably easy to understand
and to modify.


.\"
.\" ----------------------------------------------------------------
.\" Return argument with hyphenation points in string HX.
.de HY
.ds HX
.nr HY \\n[.warn]
.warn 0
.ev HY
.ll 0
.HY1 \\$@
.chop HX
.chop HX
.chop HX
.ev
.warn \\n(HY
..
.\" ----------------------------------------------------------------
.\" Split into words.
.de HY1
.nh
.di HX1
.dt 1v HY1a
\\$*
.di
..
.\" ----------------------------------------------------------------
.\" Word helper.
.de HY1a
.di
.asciify HX1
.chop HX1
.HY2
.chop HX
.as HX " ¬ \"
.nh
.di HX1
.dt 1v HY1a
..
.\" ----------------------------------------------------------------
.\" Hyphenate word.
.de HY2
.hy
.di HX2
.HX1
\&
.di
.HY3
..
.\" ----------------------------------------------------------------
.\" Process syllables.
.de HY3
.di HX3
.dt 1v HY3a
.HX2
.di
..
.\" ----------------------------------------------------------------
.\" Syllable helper.
.de HY3a
.di
.asciify HX3
.chop HX3
.chop HX3
.as HX \\*[HX3]·
.di HX3
.dt 1v HY3a
..
.\" ----------------------------------------------------------------
.char \(sc \v'.55n'\(de\v'-.55n'
.tr ¬\(sc
.sp 3
.ad l
.ds word "Collect power under the guise of economical improvement
The hyphenation points of ``\*[word]'' are:
.br
.HY \*[word]
``\m[red]\*[HX]\m[]''.
.sp
\(emThe End\(em

Reply via email to