groff
[Top][All Lists]
Advanced

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

Re: [Groff] Groff conversion with 190 characters in each line


From: Denis M. Wilson
Subject: Re: [Groff] Groff conversion with 190 characters in each line
Date: Tue, 15 Jan 2013 09:46:36 +0000

In this situation I would use a a pair of macros to enclose text to be
rendered verbatim.  For example

.BeginVerbatim
text
.EndVerbatim

The following version of these macros may be instructive (the code
cannot be commented for obvious reasons...):

\# From -markup
.de BeginVerbatim
.eo
.de verb-mac EndVerbatim
..
.
.de EndVerbatim
.ec
.nf
.in 0
.eo
.di verb-div
.c2 
.cc 
verb-mac
cc
.br
.di
.c2
.ec
.rm verb-mac
.in
.verb-div
.fi
.rm verb-div
..
.
\# Here is the code repeated with added comments (^X means ctrl-X)
\# At .EndVerbatim we have just reached the end of defining
\# the macro verb-mac which contains the verbatim text.
\# Now to print it.
.
\# .de EndVerbatim
\# .ec                  || Turn on escapes so that .nf and .in work
\# .nf                  || No filling, obviously
\# .in 0                || No indents
\# .eo                  || Turn off escapes
\# .di verb-div         || Div to avoid interrupts, which won't work (esc off)
\# .c2 ^E               || Change ' control char to other (CTRL-E is unlikely!)
\# .cc ^G               || Change the ordinary control char . to something else
\# ^Gverb-mac           || Invoke the verb text which is now copied formatted.
\# ^Gcc                 || Restore the proper control character
\# .br                  || Break
\# .di                  || End diversion
\# .c2                  || Restore no-break control char.
\# .ec                  || Turn on escape again
\# .rm verb-mac         || Remove the macro as it has been copied
\# .in                  || Original indent
\# .verb-div            || Output the diversion (still in no-fill)
\# .fi                  || Restore filling
\# .rm verb-div         || Remove the diversion
\# ..                   ||

Denis




reply via email to

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