[racket] [scribble] rendering of fractions

From: Eric Tanter (etanter at dcc.uchile.cl)
Date: Sat Nov 19 11:41:33 EST 2011

I'm trying your first suggestion, and it brings me to an issue I've faced some other time as well. How can I customized an imported parameter for an interaction session?

More precisely here, how can I specify that I want a specific pretty-print-print-hook for the whole evaluator?

If I wrap the expression in the @interaction, it does not work:

@interaction[
(parameterize ([pretty-print-print-hook
                (let ([oh (pretty-print-print-hook)])
                  (λ (value display? port)
                    (cond .... ;; big blob from the file you pointed out
  4/3)
]

Thanks,

-- Éric


On Nov 19, 2011, at 12:20 PM, Matthew Flatt wrote:

> 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.