Skip to content

Added front-matter parameter to #algo().#30

Open
nervecenter wants to merge 3 commits intoplatformer:mainfrom
nervecenter:front-matter
Open

Added front-matter parameter to #algo().#30
nervecenter wants to merge 3 commits intoplatformer:mainfrom
nervecenter:front-matter

Conversation

@nervecenter
Copy link

Added front-matter parameter to #algo() which places given content below the header, but above the algorithm table and line numbers.

Example:

#algo(
  title: "Fib",
  parameters: ("n",),
  front-matter: [
    *Input*: The number in the Fibonacci sequence $n$ to generate.\
    *Output*: The $n$th number in the Fibonacci sequence.
  ]
)[
  if $n < 0$:#i\
    return null#d\
  if $n = 0$ or $n = 1$:#i\
    return $n$#d\
  \
  let $x <- 0$\
  let $y <- 1$\
  for $i <- 2$ to $n-1$:#i\
    let $z <- x+y$\
    $x <- y$\
    $y <- z$#d\
    \
  return $x+y$
]

Outputs the following:
typst_alg_fib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant