On this page:
schemeblock
SCHEMEBLOCK
schemeblock0
SCHEMEBLOCK0
schemeinput
schememod
scheme
SCHEME
schemeresult
schemeid
schememodname
litchar
verbatim
schemefont
schemevalfont
schemeresultfont
schemeidfont
schemevarfont
schemekeywordfont
schemeparenfont
schememetafont
schemeerror
procedure
var
svar
Version: 4.1

11.1 Typesetting Code

(schemeblock datum ...)

Typesets the datum sequence as a table of Scheme code inset by two spaces. The source locations of the datums determine the generated layout. For example,

  (schemeblock

   (define (loop x)

     (loop (not x))))

produces the output

  (define (loop x)

    (loop (not x)))

with the (loop (not x)) indented under define, because that’s the way it is idented the use of schemeblock.

Furthermore, define is typeset as a keyword (bold and black) and as a hyperlink to define’s definition in the reference manual, because this document was built using a for-label binding of define (in the source) that matches a definition in the reference manual. Similarly, not is a hyperlink to the its definition in the reference manual.

Use unsyntax to escape back to an expression that produces an element. For example,

  (schemeblock

    (+ 1 #,(elem (scheme x) (subscript "2"))))

produces

  (+ 1 x2)

The unsyntax form is regonized via free-identifier=?, so if you want to typeset code that includes unsyntax, you can simply hide the usual binding:

  (schemeblock

    (let ([unsyntax #f])

      (schemeblock

        #'(+ 1 #,x))))

Or use SCHEMEBLOCK, whose escape form is UNSYNTAX instead of unsyntax.

A few other escapes are recognized symbolically:

(SCHEMEBLOCK datum ...)

Like schemeblock, but with the expression escape UNSYNTAX instead of unsyntax.

(schemeblock0 datum ...)

Like schemeblock, but without insetting the code.

(SCHEMEBLOCK0 datum ...)

Like SCHEMEBLOCK, but without insetting the code.

(schemeinput datum ...)

Like schemeblock, but the datum are typeset after a prompt representing a REPL.

(schememod lang datum ...)

Like schemeblock, but the datum are typeset inside a #lang-form module whose language is lang.

(scheme datum ...)

Like schemeblock, but typeset on a single line and wrapped with its enclosing paragraph, independent of the formatting of datum.

(SCHEME datum ...)

Like scheme, but with the UNSYNTAX escape like schemeblock.

(schemeresult datum ...)

Like scheme, but typeset as a REPL value (i.e., a single color with no hyperlinks).

(schemeid datum ...)

Like scheme, but typeset as an unbound identifier (i.e., no coloring or hyperlinks).

(schememodname datum)

Like scheme, but typeset as a module path. If datum is an identifier, then it is hyperlinked to the module path’s definition as created by defmodule.

(litchar str)  element?

  str : string?

Typesets str as a representation of literal text. Use this when you have to talk about the individual characters in a stream of text, as as when documenting a reader extension.

(verbatim [#:indent indent] str ...)  flow-element?

  indent : integer? = 0

  str : string?

Typesets str as a table/paragraph in typewriter font with the linebreaks specified by newline characters in str. “Here strings” are often useful with verbatim.

(schemefont pre-content ...)  element?

  pre-content : any/c

Typesets decoded pre-content as uncolored, unhyperlinked Scheme. This procedure is useful for typesetting things like #lang, which are not readable by themselves.

(schemevalfont pre-content ...)  element?

  pre-content : any/c

Like schemefont, but colored as a value.

(schemeresultfont pre-content ...)  element?

  pre-content : any/c

Like schemefont, but colored as a REPL result.

(schemeidfont pre-content ...)  element?

  pre-content : any/c

Like schemefont, but colored as an identifier.

(schemevarfont pre-content ...)  element?

  pre-content : any/c

Like schemefont, but colored as a variable (i.e., an argument or sub-form in a procedure being documented).

(schemekeywordfont pre-content ...)  element?

  pre-content : any/c

Like schemefont, but colored as a syntactic form name.

(schemeparenfont pre-content ...)  element?

  pre-content : any/c

Like schemefont, but colored like parentheses.

(schememetafont pre-content ...)  element?

  pre-content : any/c

Like schemefont, but colored as meta-syntax, such as backquote or unquote.

(schemeerror pre-content ...)  element?

  pre-content : any/c

Like schemefont, but colored as error-message text.

(procedure pre-content ...)  element?

  pre-content : any/c

Typesets decoded pre-content as a procedure name in a REPL result (e.g., in typewriter font with a #<procedure: prefix and > suffix.).

(var datum)

Typesets datum as an identifier that is an argument or sub-form in a procedure being documented. Normally, the defproc and defform arrange for scheme to format such identifiers automatically in the description of the procedure, but use var if that cannot work for some reason.

(svar datum)

Like var, but for subform non-terminals in a form definition.