1% File src/library/utils/man/format.Rd
2% Part of the R package, https://www.R-project.org
3% Copyright 1995-2007 R Core Team
4% Distributed under GPL 2 or later
5
6\name{format}
7\alias{formatUL}
8\alias{formatOL}
9\title{Format Unordered and Ordered Lists}
10\description{
11  Format unordered (itemize) and ordered (enumerate) lists.
12}
13\usage{
14formatUL(x, label = "*", offset = 0,
15         width = 0.9 * getOption("width"))
16formatOL(x, type = "arabic", offset = 0, start = 1,
17         width = 0.9 * getOption("width"))
18}
19\arguments{
20  \item{x}{a character vector of list items.}
21  \item{label}{a character string used for labelling the items.}
22  \item{offset}{a non-negative integer giving the offset (indentation)
23    of the list.}
24  \item{width}{a positive integer giving the target column for wrapping
25    lines in the output.}
26  \item{type}{a character string specifying the \sQuote{type} of the
27    labels in the ordered list.  If \code{"arabic"} (default), arabic
28    numerals are used.  For \code{"Alph"} or \code{"alph"}, single upper
29    or lower case letters are employed (in this case, the number of the
30    last item must not exceed 26).  Finally, for \code{"Roman"} or
31    \code{"roman"}, the labels are given as upper or lower case roman
32    numerals (with the number of the last item maximally 3899).
33    \code{type} can be given as a unique abbreviation of the above, or
34    as one of the \acronym{HTML} style tokens \code{"1"} (arabic),
35    \code{"A"}/\code{"a"} (alphabetic), or \code{"I"}/\code{"i"}
36    (roman), respectively.}
37  \item{start}{a positive integer specifying the starting number of the
38    first item in an ordered list.}
39}
40\value{
41  A character vector with the formatted entries.
42}
43\seealso{
44  \code{\link{formatDL}} for formatting description lists.
45}
46\examples{
47## A simpler recipe.
48x <- c("Mix dry ingredients thoroughly.",
49       "Pour in wet ingredients.",
50       "Mix for 10 minutes.",
51       "Bake for one hour at 300 degrees.")
52## Format and output as an unordered list.
53writeLines(formatUL(x))
54## Format and output as an ordered list.
55writeLines(formatOL(x))
56## Ordered list using lower case roman numerals.
57writeLines(formatOL(x, type = "i"))
58## Ordered list using upper case letters and some offset.
59writeLines(formatOL(x, type = "A", offset = 5))
60}
61\keyword{print}
62