[racket] Scribble: how can I produce a straight quote within @racketfont?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Jul 14 01:10:18 EDT 2014

I would have suggested the `literal` pattern, but I see that
`racketfont` and `tt` (the former defined using the latter) are weird
and misdocumented: they apply the 'tt style only to string arguments,
and not uniformly to all given content.

I think that you want

 (define (racketfont* . args)
   (element 'tt args))

This `racketfont*` refrains from calling `decode-content`, which is the
step that converts quotes to curly quotes.

At Sun, 13 Jul 2014 11:11:09 -0700, Matthew Butterick wrote:
> In Scribble, the @racketfont tag decodes its content, so this markup:
> 
> > @racketfont{◊(select 'h1 doc)}
> 
> Will render as this (with a curly quote in front of h1):
> 
> > ◊(select ’h1 doc)
> 
> 
> But I want this (straight quote, not curly)
> 
> > ◊(select 'h1 doc)
> 
> 
> @verbatim is not the answer, because it will create a line break.
> 
> @literal seems like it should be the answer:
> 
> > @racketfont{◊(select @literal{'}h1 doc)}
> 
> But oddly, even though @literal is nested inside @racketfont, the resulting 
> markup doesn't reflect this, and renders as if the Scribble had been written 
> this way:
> 
> > @racketfont{◊(select} @literal{'}@racketfont{h1 doc)}
> 
> 
> Meaning, the @literal content adopts the formatting of the enclosing block, not 
> the @racketfont span.
> 
> Hence the question: how can I force a literal character within @racketfont that 
> actually adopts the formatting of @racketfont.
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users


Posted on the users mailing list.