[racket] Scribble with color-property and background-color-property

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Nov 1 08:57:09 EDT 2013

At Tue, 29 Oct 2013 14:09:03 -0600, Matias Eyzaguirre wrote:
> Hi all,
> When I use color-property and background-color-property in scribble they work 
> as expected when I generate HTML output, but do not seem to have any effect 
> when I generate PDF output. Do they not work with the LaTeX renderer?
> 
> On the other hand, I’m not very familiar with scribble so It’s easily possible 
> I’m doing something wrong. My document looks like this:
> 
> #lang scribble/base
> @(require (only-in scribble/core style color-property 
> background-color-property))
> @(define ugly-style
>    (style 'ugly (list (color-property "red")
>                       (background-color-property "blue"))))
> @para[#:style ugly-style]{Hello, this is incredibly ugly text}

The `color-property` and `background-color-property` style properties
are intended for use on elements, instead of paragraphs.

I'd say it's a bug that it works on paragraphs for HTML output --- but
since documents might rely on that bug, I'll probably adjust the spec,
instead.

The following variant of your program produces ugly text in Latex/PDF
for me:

 #lang scribble/base
 @(require (only-in scribble/core style color-property
                    background-color-property))
 @(define ugly-style
    (style #f (list (color-property "red")
                    (background-color-property "blue"))))
 @elem[#:style ugly-style]{Hello, this is incredibly ugly text}

It's actually not sufficiently ugly when I render and view HTML in my
browser. The generated HTML has two `style` attributes, instead of
putting the foreground and background colors in one `style` attribute.
I'll fix that sometime soon.



Posted on the users mailing list.