[racket] a few small Scribble questions

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Nov 7 08:40:39 EST 2011

None of the things that you want are directly available, I think. For
many of them, you can use `make-element-id-transformer' to set the way
that an identifier is typeset by `racketblock', etc. (in which cae
you'll probably want to use the various `racket...font' functions).

Here's an example:

 #lang scribble/manual
 @(require (for-syntax racket)
           scribble/racket)

 @; `tree' as a syntactic form:
 @(define-syntax tree
    (make-element-id-transformer
     (lambda (stx)
      #'@racketkeywordfont{tree})))

 @; `leaf' as a variable:
 @(define-syntax leaf
    (make-element-id-transformer
     (lambda (stx)
      #'@racketvarfont{leaf})))

 @racketblock[
  (+ x (tree leaf leaf leaf))
 ]


At Sun, 06 Nov 2011 11:46:56 -0500, Prabhakar Ragde wrote:
> If I use `racketgrammar' to define a grammar, and then want to refer to 
> one of the non-terminals within it in subsequent text, can I get it to 
> appear in the same font?
> 
> When using `racketblock', can I get an identifier typeset in the same 
> style as a syntactic form without having previously documented it using 
> `defform'?
> 
> (These two questions arise when writing about toy interpreters. I want 
> to discuss grammars and give examples for the language to be 
> interpreted, which is typically a close cousin of Racket.)
> 
> Is there a way to typeset unbalanced code fragments? (That's asking a 
> lot, I know.)
> 
> Having required for-label bindings to get hyperlinks, can I turn them 
> off selectively? (E.g., when talking about something I want students to 
> implement using a teaching language that happens to have the same name 
> as something in full Racket.)
> 
> Thanks. --PR



Posted on the users mailing list.