► |  | Scribble: PLT Documentation Tool

1 | How to Scribble Documentation
2 | Scribble Layers
3 | @-Reader
4 | Structures And Processing
5 | Renderer
6 | Decoding Text
7 | Document Language
8 | Document Reader
9 | Basic Document Forms
10 | Scheme
11 | Manual Forms
12 | Evaluation and Examples
13 | BNF Grammars
14 | Cross-Reference Utilities
15 | Text Preprocessor
| Index

▼ | 11 | Manual Forms

11.1 | Typesetting Code
11.2 | Documenting Modules
11.3 | Documenting Forms, Functions, Structure Types, and Values
11.4 | Documenting Classes and Interfaces
11.5 | Documenting Signatures
11.6 | Various String Forms
11.7 | Links
11.8 | Indexing
11.9 | Images
11.10 | Bibliography
11.11 | Miscellaneous
11.12 | Index-Entry Descriptions

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.4
top← prev up next →

#### 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:

- (code:line datum ...) typesets as the sequence of datums (i.e., without the code:line wrapper).

- (code:comment datum) typesets like datum, but colored as a comment and prefixed with a semi-colon. A typical datum escapes from Scheme-typesetting mode using unsyntax and produces a paragraph using t:

  (code:comment #, @t{this is a comment})

- code:blank typesets as a blank space.

- _id typesets as id, but colored as a variable (like schemevarfont); this escape applies only if _id has no for-label binding and is not specifically colored as a subform non-terminal via defform, a variable via defproc, etc.

(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. The source location of lang (relative to the body datums) determines the relative positioning of the #lang line in the typeset output.

(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.

top← prev up next →