blob: a491d3127d620583fee0aca380164947293df039 [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",
Hao Zhua31e97f2017-06-08 14:55:41 -04009 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 Zhu971d89f2017-06-07 19:22:47 -040022`basic`, `striped`, `hold_position`, `scale_down` & `repeat_header`.
23`striped` will add alternative row colors to the table. It will imports
24`LaTeX` package `xcolor` if enabled. `hold_position` will "hold" the floating
25table to the exact position. It is useful when the `LaTeX` table is contained
26 in a `table` environment after you specified captions in `kable()`. It will
27 force the table to stay in the position where it was created in the document.
Hao Zhuf7994dd2017-02-27 16:58:42 -050028`scale_down` is useful for super wide table. It will automatically adjust
Hao Zhu971d89f2017-06-07 19:22:47 -040029the table to page width. `repeat_header` in only meaningful in a longtable
30environment. It will let the header row repeat on every page in that long
31table.}
Hao Zhue10cfd32017-02-21 16:41:14 -050032
Hao Zhu26234122017-02-22 15:34:33 -050033\item{full_width}{A `TRUE` or `FALSE` variable controlling whether the HTML
Hao Zhuf7994dd2017-02-27 16:58:42 -050034table should have 100\% width. Since HTML and pdf have different flavors on
35the preferable format for `full_width`. If not specified, a HTML table will
36have full width by default but this option will be set to `FALSE` for a
37LaTeX table}
Hao Zhu94956582017-02-21 18:18:29 -050038
Hao Zhuf7994dd2017-02-27 16:58:42 -050039\item{position}{A character string determining how to position the table
40on a page. Possible values include `left`, `center`, `right`, `float_left`
41and `float_right`. Please see the package doc site for demonstrations. For
42a `LaTeX` table, if `float_*` is selected, `LaTeX` package `wrapfig` will be
43imported.}
Hao Zhu94956582017-02-21 18:18:29 -050044
45\item{font_size}{A numeric input for table font size}
Hao Zhua31e97f2017-06-08 14:55:41 -040046
47\item{...}{extra options for HTML or LaTeX}
Hao Zhue10cfd32017-02-21 16:41:14 -050048}
49\description{
Hao Zhu26234122017-02-22 15:34:33 -050050This function provides a cleaner approach to modify the style
51of HTML tables other than using the `table.attr` option in `knitr::kable()`.
52Currenly, it assumes the HTML document has boot
Hao Zhue10cfd32017-02-21 16:41:14 -050053}
Hao Zhu78e61222017-05-24 20:53:35 -040054\examples{
55x_html <- knitr::kable(head(mtcars), "html")
56kable_styling(x_html, "striped", position = "left", font_size = 7)
57
58x_latex <- knitr::kable(head(mtcars), "latex")
59kable_styling(x_latex, latex_options = "striped", position = "float_left")
60
61}