sorawee
2021-10-10 21:29:28

@dvanhorn IIUC the default current-print simply uses racket/pretty

So you should be able to adjust pretty-print-columns on the evaluator that you are using


sorawee
2021-10-10 21:30:21

Here’s an example:

@examples[#:eval evaluator #:label #f (range 20) ] results in:


sorawee
2021-10-10 21:31:03

@(evaluator '(require (only-in racket/pretty pretty-print-columns))) @(evaluator '(pretty-print-columns 10)) @examples[#:eval evaluator #:label #f (range 20) ] results in:


dvanhorn
2021-10-10 23:38:32

perfect — thanks!


dvanhorn
2021-10-11 04:26:00

Hmm, @sorawee actually I’m not getting the same result. Here’s the complete example on my end: #lang scribble/manual @(require racket/sandbox scribble/examples) @(define ev (call-with-trusted-sandbox-configuration (lambda () (parameterize ([sandbox-output 'string] [sandbox-error-output 'string] [sandbox-memory-limit 50]) (make-evaluator 'racket))))) @(ev '(require (only-in racket/pretty pretty-print-columns))) @(ev '(pretty-print-columns 10)) @examples[#:eval ev #:label #f (range 20)] then I see the following when rendered:


dvanhorn
2021-10-11 04:26:20

How are you constructing the evaluator?


sorawee
2021-10-11 04:27:06

Let me try yours, but my evaluator is simple (make-base-eval)


sorawee
2021-10-11 04:28:07

Yep, I confirm that I get the same output as yours. Hmm.



sorawee
2021-10-11 04:29:20

So make-base-eval sets the current print to pretty-print-handler


sorawee
2021-10-11 04:29:33

If you have a custom evaluator, I guess you need to do that yourself


dvanhorn
2021-10-11 04:31:23

Thanks — I don’t remember why the evaluator is set up this way, so maybe I can just switch to make-base-eval, or set the printer as you suggest.


dvanhorn
2021-10-11 04:33:42

oh, because I need racket, not raket/base.


sorawee
2021-10-11 04:34:33

Couldn’t you have make-base-eval and then (ev '(require racket))?


dvanhorn
2021-10-11 04:49:39

It seems like (define ev (make-base-eval #:lang 'racket)) works fine for my purposes and lets me adjust the width of results. I don’t know why I had made it more complicated. Anyway, thanks for your help.