Is it possible to use nested item in .Rd?
Asked Answered
rrd
C

2

9

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.

Casady answered 6/7, 2015 at 3:31 Comment(0)
R
14

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

Raneeraney answered 6/7, 2015 at 3:55 Comment(0)
T
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
Tipper answered 4/1, 2019 at 15:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.