Scribble Abbrevs
add-commas
appendix
authors
authors*
oxfordize
sf
sc
exact
$
parag
definition
format-url
integer->word
Integer->word
x-axes
y-axes
x-axis
y-axis
etal
Section-ref
section-ref
6.12

Scribble Abbrevs

Ben Greenman

Helpers for writing Scribble papers — that is, Scribble code that generates LaTeX output.

I think the functions here are useful enough to be online and documented.

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"

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

(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

(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

(parag s ...)  element?

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

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

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

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}