blob: 09893d67f4e348a8ac39312b9bc03bc04102f3ab [file] [log] [blame]
Hao Zhue10cfd32017-02-21 16:41:14 -05001% Generated by roxygen2: do not edit by hand
Hao Zhuc1f38412017-02-23 12:13:48 -05002% Please edit documentation in R/kable_styling.R
3\name{kable_styling}
4\alias{kable_styling}
Hao Zhue10cfd32017-02-21 16:41:14 -05005\title{HTML table attributes}
6\usage{
Hao Zhua3fc0c42017-02-27 12:04:59 -05007kable_styling(kable_input, bootstrap_options = "basic",
Hao Zhu1fc48a62017-03-01 14:07:54 -05008 latex_options = "basic", full_width = NULL, position = "center",
9 font_size = NULL)
Hao Zhue10cfd32017-02-21 16:41:14 -050010}
11\arguments{
Hao Zhuf7994dd2017-02-27 16:58:42 -050012\item{kable_input}{Output of `knitr::kable()` with `format` specified}
13
14\item{bootstrap_options}{A character vector for bootstrap table options.
Hao Zhu1fc48a62017-03-01 14:07:54 -050015Please see package vignette or visit the w3schools'
Hao Zhuf7994dd2017-02-27 16:58:42 -050016\href{https://www.w3schools.com/bootstrap/bootstrap_tables.asp}{Bootstrap Page}
17for more information. Possible options include `basic`, `striped`,
18`bordered`, `hover`, `condensed` and `responsive`.}
19
20\item{latex_options}{A character vector for LaTeX table options. Please see
Hao Zhu1fc48a62017-03-01 14:07:54 -050021package vignette for more information. Possible options include
Hao Zhuf7994dd2017-02-27 16:58:42 -050022`basic`, `striped`, `hold_position`, `scale_down`. `striped` will add
23alternative row colors to the table. It will imports `LaTeX` package `xcolor`
24if enabled. `hold_position` will "hold" the floating table to the exact
25position. It is useful when the `LaTeX` table is contained in a `table`
26environment after you specified captions in `kable()`. It will force the
27table to stay in the position where it was created in the document.
28`scale_down` is useful for super wide table. It will automatically adjust
29the table to page width.}
Hao Zhue10cfd32017-02-21 16:41:14 -050030
Hao Zhu26234122017-02-22 15:34:33 -050031\item{full_width}{A `TRUE` or `FALSE` variable controlling whether the HTML
Hao Zhuf7994dd2017-02-27 16:58:42 -050032table should have 100\% width. Since HTML and pdf have different flavors on
33the preferable format for `full_width`. If not specified, a HTML table will
34have full width by default but this option will be set to `FALSE` for a
35LaTeX table}
Hao Zhu94956582017-02-21 18:18:29 -050036
Hao Zhuf7994dd2017-02-27 16:58:42 -050037\item{position}{A character string determining how to position the table
38on a page. Possible values include `left`, `center`, `right`, `float_left`
39and `float_right`. Please see the package doc site for demonstrations. For
40a `LaTeX` table, if `float_*` is selected, `LaTeX` package `wrapfig` will be
41imported.}
Hao Zhu94956582017-02-21 18:18:29 -050042
43\item{font_size}{A numeric input for table font size}
Hao Zhue10cfd32017-02-21 16:41:14 -050044}
45\description{
Hao Zhu26234122017-02-22 15:34:33 -050046This function provides a cleaner approach to modify the style
47of HTML tables other than using the `table.attr` option in `knitr::kable()`.
48Currenly, it assumes the HTML document has boot
Hao Zhue10cfd32017-02-21 16:41:14 -050049}
Hao Zhu78e61222017-05-24 20:53:35 -040050\examples{
51x_html <- knitr::kable(head(mtcars), "html")
52kable_styling(x_html, "striped", position = "left", font_size = 7)
53
54x_latex <- knitr::kable(head(mtcars), "latex")
55kable_styling(x_latex, latex_options = "striped", position = "float_left")
56
57}