I have encountered this problem. I don't have a real solution, but maybe my
hacky solution will be good enough.

On Wed, Sep 23, 2020 at 7:37 PM Sorawee Porncharoenwase <
sorawee.pw...@gmail.com> wrote:

> I think Scribble uses source location equipped with syntax objects to
> figure out spacing. Since you generate stuff on the fly, there’s no source
> location, so the rendered text is screwed up.
>
This is indeed the explanation. My hacky solution (you can see it here
<https://github.com/DigitalRicoeur/pydrnlp/blob/666c1e00b67c0cc1ee6b5e3fbcfbec498b3173ac/support/python-lang/stx.rkt#L201-L208>)
is to build up term for Scribble to typeset—the equivalent of what you do
here
<https://github.com/zyrolasting/xiden/blob/cb60c9d3ad06b60097b38e19d2d6f565ff9738c0/docs/reference/settings.scrbl#L37-L42>,
I think—using `syntax` rather than `quasiquote`. IIRC (I haven't touched
this code in a while), it didn't work to use `quasisyntax`/`unsyntax`, so I
used `define/syntax-parse` to bind pattern variables to the generated
sub-terms. This way, Scribble picks up the source locations from the
template and uses spaces as it should.

This is a hack, though: in my case, I'm building a `let*` expression with
potentially several binding pairs, and they will run off the margin of the
page. There are probably various other problems: I remember this code being
a bit annoying to write.

-Philip

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/01000174bd6f57cc-a40851c2-a167-4790-b636-b43d9cf21e97-000000%40email.amazonses.com.

Reply via email to