[racket] [scribble] rendering of fractions

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Nov 19 10:20:15 EST 2011

At Fri, 18 Nov 2011 12:30:48 -0300, Eric Tanter wrote:
> In the interaction window, 4/3 is rendered as "1 1/3" (with nice
> formatting), but in a scribble @interaction, it is rendered as "4/3".
> Is there a way to get the nicer output in scribble?

There are two obstacles:

 * The number conversion is wired into DrRacket at the moment --- in
   "collects/drracket/private/language.rkt"'s parameterization of
   `pretty-print-print-hook'. 

   You could set up pretty printing and a print hook in the same way
   within a Scribble evaluation sandbox.

 * Number snips currently do not draw themselves as evaluation results.

   It might be a good idea to make snips in general display themselves
   within Scribble documents (i.e., by having `snip%' implement the
   `file/convertible' protocol), but I'm not sure. It sounds easier to
   make fraction snips specifically support `file/convertible'. Either
   way, it's a change to the existing code.

So, yes in principle, but it's difficult at the moment.



Posted on the users mailing list.