Scribble Abbrevs
1 General Scribble Utilities
add-commas
authors
authors*
oxfordize
sf
parag
format-url
integer->word
Integer->word
x-axes
y-axes
x-axis
y-axis
etal
2 La  Te  X Renderer Utilities
appendix
sc
exact
$
definition
Section-ref
section-ref
3 Documentation Renderer Utilities
tech/  guide
tech/  reference
racketfile
4 Pict Utilities
codeblock-pict/  numbers
add-border
7.0

Scribble Abbrevs

Ben Greenman

Helpers for making Scribble documents. The scribble-abbrevs module provides all the bindings documented on this page.

1 General Scribble Utilities

General utilities, for any Scribble document.

procedure

(add-commas r)  string?

  r : real?
Similar to number->string, but adds commas to numbers with more than three digits.

Examples:
> (add-commas 42)

"42"

> (add-commas 42000)

"42,000"

procedure

(authors s ...)  (or/c string? element?)

  s : string?
Renders a sequence of author names (with Oxford comma).

Examples:
> (authors "Charles Darwin")

"Charles Darwin"

> (authors "Thomas Jefferson" "Alexander Hamilton")

'("Thomas Jefferson" " and " "Alexander Hamilton")

> (authors "Ed" "Ed" "Eddy")

'("Ed" ", " "Ed" ", and " "Eddy")

procedure

(authors* s*)  element?

  s* : (listof string?)

procedure

(oxfordize s*)  element?

  s* : (listof string?)
Same as (apply authors s*).

procedure

(sf x)  element?

  x : pre-content?
Renders the given content in "sfstyle" (serif-style).

procedure

(parag s ...)  element?

  s : string?
Renders the given strings as a paragraph title.

procedure

(format-url url)  element?

  url : string?
Renders a clickable URL. Strips prefixes like "www." and "http://".

procedure

(integer->word i [#:title? title?])  string?

  i : exact-nonnegative-integer?
  title? : boolean? = #false
Returns the English word for the given integer.

Examples:
> (integer->word 0)

"zero"

> (integer->word 42)

"forty-two"

> (integer->word -8675309)

"negative-eight-million-six-hundred-seventy-five-thousand-three-hundred-nine"

The current implementation fails unless (abs i) is less than 1 quadrillion.

procedure

(Integer->word i)  string?

  i : exact-nonnegative-integer?
Alias for (integer->word i #:title? #true).

syntax

x-axes

syntax

y-axes

syntax

x-axis

syntax

y-axis

syntax

etal

Each identifier id renders like the string "id", except that it might be prettier (avoid bad line breaks, bad spacing).

2 LaTeX Renderer Utilities

Utilities for Scribble code that generates LaTeX output.

syntax

appendix

Typesets \appendix in a paragraph with the 'pretitle style. In LaTeX, this marks the current "section" as the start of an appendix.

procedure

(sc x)  element?

  x : pre-content?
Renders the given content in small caps style.

procedure

(exact s ...)  element?

  s : string?
Renders the given strings as-is in the output.

Example:
> (exact  "\\frac{2}{3}")

(element (style "relax" '(exact-chars)) '("\\frac{2}{3}"))

procedure

($ s ...)  element?

  s : string?
Same as (exact "$" s ... "$").

procedure

(definition term def-elem* ...)  paragraph?

  term : string?
  def-elem* : pre-content?
Renders an un-numbered definition for a technical term.

Example:
> (definition "rose"  "A rose is a rose is a rose is a rose.")

(paragraph

 (style #f '())

 (list

  (element (style "relax" '(exact-chars)) '("\\vspace{1ex}\n"))

  (element 'bold '("Definition"))

  (list

   (element #f (list " (" (element 'italic '("rose")) ") "))

   "A rose is a rose is a rose is a rose.")

  (element (style "relax" '(exact-chars)) '("\\vspace{1ex}\n"))))

This usually looks good to me.

procedure

(Section-ref tag)  element?

  tag : string?

procedure

(section-ref tag)  element?

  tag : string?

NOTE: This function is deprecated; use secref, instead.

Renders the section number for tag prefixed with the word "Section" (respectively, "section").

These functions assume that the following LaTeX command appears somewhere between the definition of Scribble’s SecRef (see Base Latex Macros) and the first occurrence of section-ref:

\renewcommand{\SecRef}[2]{#1}

3 Documentation Renderer Utilities

Utilities for Scribble code that generates Racket documentation.

procedure

(tech/guide pre-content ...)  element?

  pre-content : pre-content?
Similar to tech, but links to The Racket Guide.

procedure

(tech/reference pre-content ...)  element?

  pre-content : pre-content?
Similar to tech, but links to The Racket Reference.

procedure

(racketfile filename)  element?

  filename : path-string?
Typesets the contents of the given file as if its contents were wrapped in a racketblock.

4 Pict Utilities

 (require scribble-abbrevs/pict)
  package: scribble-abbrevs

procedure

(codeblock-pict/numbers code    
  #:title title    
  #:start start    
  #:keep-lang-line? keep-lang)  pict?
  code : string?
  title : #f
  start : 1
  keep-lang : #t
Similar to codeblock, but with line numbers.

procedure

(add-border p    
  #:margin-top margin-top    
  #:margin-bottom margin-bottom    
  #:margin-left margin-left    
  #:margin-right margin-right)  pict?
  p : pict?
  margin-top : 2
  margin-bottom : 2
  margin-left : 2
  margin-right : 2
Adds a thin black border around the given pict.