[racket] Redex typesetting

From: Casey Klein (clklein at eecs.northwestern.edu)
Date: Tue Jul 5 09:43:56 EDT 2011

Scaling:

Use the pict library to scale the result of a non-file call to
render-reduction-relation. Here's an example (though there may be a
simpler way to get EPS):

(require redex
         redex/examples/r6rs/r6rs
         file/convertible
         slideshow/pict)

(define (render-reduction-relation-scaled relation scale-factor output-path)
  (call-with-output-file output-path #:exists 'truncate
    (λ (port)
      (write-bytes
       (convert (scale (render-reduction-relation Basic--syntactic--forms)
                       scale-factor)
                'eps-bytes)
       port)))
  (void))

(render-reduction-relation-scaled Basic--syntactic--forms .5 "basic-forms.eps")

Alternatively, you may be able to scale the EPS in the document that
incorporates it. (And if you're using Scribble, you can just put the
pict-generating expression inline in your document.)

Selecting rules:

Use the render-reduction-relation-rules parameter. Here's an example:

(parameterize ([render-reduction-relation-rules '("6beginc" "6begin0n")])
  (render-reduction-relation-scaled Basic--syntactic--forms .5
"begin-forms.eps"))

Indentation:

In case it wasn't clear from Robby's message, he's suggesting that you
make the resulting pict less wide by putting some line breaks in the
reduction-relation expression that defines the relation. These line
breaks carry through to the resulting pict.

On Tue, Jul 5, 2011 at 8:36 AM, Ismael Figueroa Palet
<ifigueroap at gmail.com> wrote:
> Can you point me to some examples, or where to look in the documentation?
> I searched the documentation but I think is kind of messy
>
> Thanks
>
> 2011/7/5 Robby Findler <robby at eecs.northwestern.edu>
>>
>> There are a number of things you can do; you can scale it, or you can
>> render a subset of the rules, or you can change the indenting of the
>> source to make the resulting rendered thing more compact. Generally
>> you do have to do a little fiddling to get something big to fit well.
>>
>> Robby
>>
>> On Tue, Jul 5, 2011 at 7:14 PM, Ismael Figueroa Palet
>> <ifigueroap at gmail.com> wrote:
>> > Hi all,
>> >
>> > I'm using redex typesetting for the first time, I call
>> >
>> >> (render-reduction-relation rules "rules.eps" #:style 'horizontal)
>> >
>> > but it only renders a postscript of one page that doesn't contain all
>> > the
>> > rules, and it doesn't fit well in the page.
>> >
>> > any ideas why this happens or how to customize it?
>> >
>> > Thanks
>> > --
>> > Ismael
>> >
>> >
>> > _________________________________________________
>> >  For list-related administrative tasks:
>> >  http://lists.racket-lang.org/listinfo/users
>> >
>
>
>
> --
> Ismael
>
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>



Posted on the users mailing list.