[racket] Images in Scribble?

From: Prabhakar Ragde (plragde at uwaterloo.ca)
Date: Fri Jul 1 21:48:09 EDT 2011

Sam Tobin-Hochstadt wrote:

> You can see examples of using images in scribble examples in the
> documentation for the `2htdp/image' teachpack:
>   https://github.com/plt/racket/blob/master/collects/teachpack/2htdp/scribblings/image.scrbl
> and the results:
>   http://docs.racket-lang.org/teachpack/2htdpimage.html

I want to underline how awesome this is. I've already used this to 
prepare summaries for my early lectures, one of which involves a demo of 
universe.ss. I wrote this in my Scribble file:

@(define img-eval (make-base-eval))
@(interaction-eval #:eval img-eval (require racket))
@(interaction-eval #:eval img-eval (require 2htdp/image))

@interaction[#:eval img-eval
(place-image (circle 20 "solid" "red")
              (empty-scene 300 200))

and the resulting output, rendered perfectly in both HTML and PDF (via 
LaTeX), pretty-prints the code followed by the image that results from 
evaluating the code. This is going to make maintaining these summaries 
through various course offerings much easier than before. --PR

Posted on the users mailing list.