Additional formatting inside @CP

"Valeriy E. Ushakov" <[email protected]>
Newsgroups gmane.comp.type-setting.lout
Message-ID <[email protected]>
While we are on this topic...  I recently needed to highlight bits of
code inside @CP without manual editing of prg2lout output and without
additional filtering (corporate laptop with windows, so @Filter is a
problem). 

I came up with the following quick hack that someone might also find
useful (or at least it's archived for my own future reference :).

@CP @Begin
...
      do_stuff();
/*@@ShowBackground { @ASTRUT# */
#ifdef SPECIAL
      do_special_stuff();
#endif/*@#
@ZSTRUT}*/
      do_more_stuff();
...
@End @CP

Where

macro @ASTRUT { 0.8w @VShift 1f @High {} //0io "" }
macro @ZSTRUT { 0.3w @VShift 1f @High {} }

and @ShowBackground is bog standard @Graphics to fill background:

def @ShowBackground
  named @BG { 0.90 }
  right x
{
  { 0 0 moveto xsize 0 lineto xsize ysize lineto 0 ysize lineto
    closepath @BG setgray fill
  } @Graphic x
}

The /*@ comments should be used *exactly* as shown, with embedded lout
comments (to deal with "lines" @Break vs. leading whitespace) and the
closing /*@ comment split.

It's sort of nasty, but keeps the source code in the main document in
the form pretty close to original.

-uwe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.