8

I can use \item to make a list in .Rd files.

\item{blah}{blah}

But it seems that I can not create a nested list by put \item within another \item as in

\item{blah}{
\item{blah1}{some}
\item{blah2}{thing}
}

Does anybody know a way to generate a nested list in R documentation? Thanks.

user1424739
  • 11,937
  • 17
  • 63
  • 152

2 Answers2

13

Here's an example (ignore the #' if you don't use roxygen):

#' \itemize{
#'   \item First level, itemize, first item
#'     \itemize{
#'       \item Second level, itemize, first item
#'       \item Second level, itemize, second item
#'         \enumerate{
#'           \item Third level, enumerate, first item
#'           \item Third level, enumerate, second item
#'         }
#'     }
#'   \item First level, itemize, second item
#' }

Which results in (I used it in a Description block):

enter image description here

hrbrmstr
  • 77,368
  • 11
  • 139
  • 205
1

If you use roxygen to generate your documentation, this can be accomplished simply using rmarkdown. The below code produces the same output as displayed in hrbrmstr's answer.

#' * First level, itemize, first item
#'   * Second level, itemize, first item
#'   - Second level, itemize, second item (- and * are equivalent)
#'     1. Third level, enumerate, first item
#'     2. Third level, enumerate, second item
#' * First level, itemize, second item
Martin Smith
  • 3,687
  • 1
  • 24
  • 51