groff
[Top][All Lists]
Advanced

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

Re: [Groff] Coloured equations?


From: Tadziu Hoffmann
Subject: Re: [Groff] Coloured equations?
Date: Mon, 5 Feb 2007 19:42:54 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

> I'd like to have all eqn terms appear in a single colour.
> gfont chooses the eqn font, but there appears no easy way
> to have all eqn terms appear in a specific colour.  Any
> suggestions?

Well, it's kinda possible (see attached PDF), but it involves
some terrible hackery.  I guess it would be preferable to make
eqn color-aware (like it is already font- and size-aware),
but that appears harder than it sounds, because for inlining
equations eqn can save font and size of the surrounding text
with inline register definitions (\R), but color registers
(.m) are string-valued and no corresponding inline-escape
for defining strings exists.  [How did classical eqn save
font and size, if classical troff didn't have \R?]

Anyhow, what I did is the following: make eqn work with
two-digit font positions, and assume that the rest of the
text only uses one-digit font positions (this is just to
make it easier on the following script):

  .fp  1 R  Times-Roman
  .fp  2 I  Times-Italic
  .fp  3 B  Times-Bold
  .fp 10 XR Times-Roman
  .fp 11 XI Times-Italic
  .fp 12 SS Times-Symbol-Slanted
  .fp 13 S  Symbol
  .EQ
  grfont 10
  gfont  11
  chartype "ordinary" .,
  .EN

And then simply mangle the intermediate output like this
(insert your preferred colors):

  groff -Z -e -ww coloreqn.ro |
  sed -e '
    /^m/h
    /^w*f10$/a\
mr 65535 0 0
    /^w*f11$/a\
mr 0 0 65535
    /^w*f12$/a\
mr 65535 0 65535
    /^w*f13$/a\
mr 0 65535 0
    /^w*f[0-9]$/G
  ' |
  grops >coloreqn.ps

[BTW, who the address@hidden defined "." to have chartype "punctuation",
making decimal numbers like "1.0" come out with a little space
after the decimal point?]


Attachment: coloreqn.pdf
Description: Adobe PDF document


reply via email to

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