2.1Modules
2.2#langs
2.3.1Procedures
2.4Syntax
2.5Others
8.18
top
← prev up next →

Scribble CheatsheetπŸ”— i

a11ce


Dr. Racket-Emailhaver <dontemailme@racket-lang.org>

@title [#:tag"scribble-cheatsheet"]{ScribbleCheatsheet}

@author {a11ce}

@author [(author+email "Dr.Racket-Emailhaver""dontemailme@racket-lang.org")]

1Section HeaderπŸ”— i

@section {SectionHeader}

1.1Subsection HeaderπŸ”— i

@subsection {SubsectionHeader}

1.1.1Subsubsection headerπŸ”— i

@subsubsection {Subsubsectionheader}

Non-numbered header (doesn’t show up in table of contents)
@subsubsub*section {Non-numberedheader(doesn'tshowupintableofcontents)}

2Documenting codeπŸ”— i

Remember that {} converts to a string and [] doesn’t.

2.1ModulesπŸ”— i

@defmodule [racket/positronics]

racketblock s require S-expressions and normalize terms (including formatting).

(map (λ (x)(+ 1x))'(11/2345))

(map
(λ (x)
(+ 1x))' (12/4
345))
]

2.2#langsπŸ”— i

@defmodulelang [mechanized-loom]

codeblock s typeset verbatim, allow non-S-expression syntax, and don’t normalize terms.

@italic{me
ow}
#langscribble/manual
@italic{me
ow}
}|

2.3Procedures and FormsπŸ”— i

Names defined with defproc , defform , or defthing will be linked to from within racket s.

2.3.1ProceduresπŸ”— i

default is procedure

(proc-namearg...[#:kwargkwarg-val])result-type

arg:arg/c
kwarg-val:kwarg/c=default
Within this block, things like arg will be typeset to match the definition (but will error within code).
@defproc [#:kind"defaultisprocedure"
(proc-name[argarg/c]...
[#:kwargkwarg-valkwarg/cdefault])
result-type]{
Withinthisblock,thingslike@racket [arg]willbetypesettomatch
thedefinition(butwillerrorwithin@code {code}).
}

Use defproc* to describe related procedures or procedures with multiple calling cases.

procedure

(multi-proc)result-type-one

(multi-procarg)result-type-two
arg:arg/c
@defproc* [([(multi-proc)result-type-one]
[(multi-proc(argarg/c))result-type-two])]

2.4SyntaxπŸ”— i

defform can specify which identifier it’s defining, typeset literals, or include a grammar.

default is syntax

(something-specialform-namemath)

math = (opnumnum)
op = plus
| minus
@defform [#:kind"defaultissyntax"
#:idform-name
#:literals(define )
(something-specialform-namemath )
#:grammar
[(math (opnumnum))
(opplus
minus)]]

Use defform* for multiple forms using the same identifier.

syntax

(define (proc-namearg...)body...+)

(define var-namebody)
@defform* [((define (proc-namearg... )body...+)
(define var-namebody))]

2.5OthersπŸ”— i

Use defthing to describe non-procedure identifiers.

value

horse:animal?

Everyone knows what a horse is.
@defthing [horseanimal?]{
Everyoneknowswhatahorseis.
}

Use deftech to define vocabulary and tech to link to it.

A technical term is a term that is technical. An example of a technical term is number.
A@deftech {technicalterm}isatermthatistechnical.
Anexampleofa@tech {technicalterm}is
@tech [#:doc' (lib "scribblings/guide/guide.scrbl")]{number}.

3FormattingπŸ”— i

Margin note (not actually in the margin)

@margin-note {Marginnote(notactuallyinthemargin)}

Margin note* (actually in the margin)
@margin-note* {Marginnote*(actuallyinthemargin)}

Italic
@italic {Italic}
Bold
@bold {Bold}
woah nesting
@italic {@bold {woahnesting}}

More: subscript , subscript , larger , smaller .

AAAAAAAAAAAA
@larger {AAA@larger {AAA@larger {AAA@larger {AAA}}}}

4LinksπŸ”— i

@link ["https://racket-lang.org"]{normallink}

@seclink ["scribble-cheatsheet"]{backtotop(sectionlinkwithinthesamemodule)}

@seclink ["first-example"#:doc' (lib "scribblings/scribble/scribble.scrbl")]{
use@racket [#:doc]tolinksomewhereelse
}

secref is like seclink but you can’t change the text: A First Example
@secref ["first-example"#:doc' (lib "scribblings/scribble/scribble.scrbl")]

tech links to a term defined with deftech : technical term
@tech {technicalterm}

other-doc links to the top of a document: Scribble: The Racket Documentation Tool
@other-doc [' (lib "scribblings/scribble/scribble.scrbl")]

top
← prev up next →

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /