bump version for cran release but it seems that they are on vacation :P
diff --git a/docs/awesome_table_in_html.html b/docs/awesome_table_in_html.html
index 3bde2c2..e091362 100644
--- a/docs/awesome_table_in_html.html
+++ b/docs/awesome_table_in_html.html
@@ -11,7 +11,7 @@
<meta name="author" content="Hao Zhu" />
-<meta name="date" content="2020-08-19" />
+<meta name="date" content="2020-08-20" />
<title>Create Awesome HTML Table with knitr::kable and kableExtra</title>
@@ -1731,7 +1731,7 @@
<h1 class="title toc-ignore">Create Awesome HTML Table with knitr::kable and kableExtra</h1>
<h4 class="author">Hao Zhu</h4>
-<h4 class="date">2020-08-19</h4>
+<h4 class="date">2020-08-20</h4>
</div>
@@ -6511,7 +6511,7 @@
3
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
<tr>
@@ -6519,7 +6519,7 @@
4
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -6535,7 +6535,7 @@
6
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -6543,7 +6543,7 @@
7
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
<tr>
@@ -6570,7 +6570,7 @@
10
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -6584,7 +6584,7 @@
11
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
diff --git a/docs/awesome_table_in_pdf.Rmd b/docs/awesome_table_in_pdf.Rmd
index db06969..4a2a67f 100644
--- a/docs/awesome_table_in_pdf.Rmd
+++ b/docs/awesome_table_in_pdf.Rmd
@@ -286,7 +286,6 @@
kable_paper("striped", full_width = F)
# You can also do this with dplyr and use one pipe from top to bottom
-# library(dplyr)
# mtcars[1:10, 1:2] %>%
# mutate(
# car = row.names(.),
@@ -543,7 +542,7 @@
Item = c("Hello\nWorld", "This\nis a cat"),
Value = c(10, 100)
)
-dt_lb$Item = linebreak(Item)
+dt_lb$Item = linebreak(dt_lb$Item)
# Or you can use
# dt_lb <- dt_lb %>%
@@ -571,6 +570,28 @@
landscape()
```
+## Decimal Alignment
+Decimal alignment has been a requested feature by many LaTeX users. However, since the syntax for either `siunitx` or `dcolumn` are a little different, it is sort of difficult to integrate them into the pipeline of this package without breaking other features. If you need this feature, Brandon Bertelsen (@1beb) provided a very nice solution on github (https://github.com/haozhu233/kableExtra/issues/174, thanks). Here is a working example.
+
+In the `header-includes` section of the yaml header, include the following settings. If you need different rounding options, you can make changes here.
+
+```
+\usepackage{siunitx}
+\newcolumntype{d}{S[table-format=3.2]}
+```
+
+For your table, you need to modify the column names and use `d` to as the `align` options.
+
+```{r, eval = FALSE}
+# not evaluated
+k <- mtcars[1:10,1:5]
+names(k) <- paste("{", names(k), "}")
+kableExtra::kable(
+ k, "latex", booktabs = TRUE, longtable = TRUE,
+ align = c("l", rep("d", 4)), linesep = "", escape = FALSE) %>%
+ kable_styling(full_width=FALSE)
+```
+
## Use LaTeX table in HTML or Word
If you want to save a LaTeX table to a image, you may consider using `save_kable()`. We also provide an `as_image()` function as a convenience wrapper for `save_kable()`. It will save the image to a temp location. Note that this feature requires you to have [magick](https://github.com/ropensci/magick) installed (`install.packages("magick")`). Also, if you are planning to use it on Windows, you need to install [Ghostscript](https://www.ghostscript.com/). This feature may not work if you are using tinytex. If you are using tinytex, please consider using other alternatives to this function.
diff --git a/docs/awesome_table_in_pdf.pdf b/docs/awesome_table_in_pdf.pdf
index c4841d3..1b60d92 100644
--- a/docs/awesome_table_in_pdf.pdf
+++ b/docs/awesome_table_in_pdf.pdf
Binary files differ
diff --git a/docs/awesome_table_in_pdf.toc b/docs/awesome_table_in_pdf.toc
index 3fcf674..c3af8ce 100644
--- a/docs/awesome_table_in_pdf.toc
+++ b/docs/awesome_table_in_pdf.toc
@@ -21,16 +21,17 @@
\contentsline {subsection}{Conditional logic}{11}{section*.22}%
\contentsline {subsection}{Visualize data with Viridis Color}{12}{section*.23}%
\contentsline {subsection}{Text Specification}{13}{section*.24}%
-\contentsline {section}{Grouped Columns / Rows}{13}{section*.25}%
-\contentsline {subsection}{Add header rows to group columns}{13}{section*.26}%
+\contentsline {section}{Grouped Columns / Rows}{14}{section*.25}%
+\contentsline {subsection}{Add header rows to group columns}{14}{section*.26}%
\contentsline {subsection}{Group rows via labeling}{14}{section*.27}%
\contentsline {subsection}{Row indentation}{16}{section*.28}%
\contentsline {subsection}{Group rows via multi-row cell}{16}{section*.29}%
-\contentsline {section}{Table Footnote}{19}{section*.30}%
-\contentsline {section}{LaTeX Only Features}{22}{section*.31}%
-\contentsline {subsection}{Linebreak processor}{22}{section*.32}%
-\contentsline {subsection}{Table on a Landscape Page}{22}{section*.33}%
-\contentsline {subsection}{Use LaTeX table in HTML or Word}{24}{section*.34}%
-\contentsline {section}{From other packages}{24}{section*.35}%
-\contentsline {subsection}{\texttt {tables}}{24}{section*.36}%
-\contentsline {subsection}{\texttt {xtable}}{24}{section*.37}%
+\contentsline {section}{Table Footnote}{20}{section*.30}%
+\contentsline {section}{LaTeX Only Features}{23}{section*.31}%
+\contentsline {subsection}{Linebreak processor}{23}{section*.32}%
+\contentsline {subsection}{Table on a Landscape Page}{23}{section*.33}%
+\contentsline {subsection}{Decimal Alignment}{25}{section*.34}%
+\contentsline {subsection}{Use LaTeX table in HTML or Word}{25}{section*.35}%
+\contentsline {section}{From other packages}{25}{section*.36}%
+\contentsline {subsection}{\texttt {tables}}{25}{section*.37}%
+\contentsline {subsection}{\texttt {xtable}}{26}{section*.38}%
diff --git a/docs/best_practice_for_newline_in_latex_table.Rmd b/docs/best_practice_for_newline_in_latex_table.Rmd
index f225193..6080be1 100644
--- a/docs/best_practice_for_newline_in_latex_table.Rmd
+++ b/docs/best_practice_for_newline_in_latex_table.Rmd
@@ -32,8 +32,8 @@
If you are only trying stop your texts from "overflowing", you can get it done by setting a fixed width with `kableExtra::column_spec`. This is the most recommanded practice as it's fairly straightforward. The column width controls the width for both table header and table body.
```{r, warning=F, message=F}
-library(kableExtra); library(dplyr)
-dt <- tibble(
+library(kableExtra)
+dt <- data.frame(
Items = c("Item 1", "Item 2", "Item 3"),
Text_1 = c("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vehicula tempor ex. Morbi malesuada sagittis turpis, at venenatis nisl luctus a. ","In eu urna at magna luctus rhoncus quis in nisl. Fusce in velit varius, posuere risus et, cursus augue. Duis eleifend aliquam ante, a aliquet ex tincidunt in. ", "Vivamus venenatis egestas eros ut tempus. Vivamus id est nisi. Aliquam molestie erat et sollicitudin venenatis. In ac lacus at velit scelerisque mattis. "),
Text_2 = c("Duis posuere placerat magna, ac aliquam lorem viverra non. Ut ultrices tempus eros, quis sodales libero commodo non. In non neque ut lacus vestibulum dictum a quis ipsum. ", "Aenean ut justo interdum, laoreet enim nec, viverra eros. Donec vel pharetra nunc. Suspendisse vel ipsum ac lectus semper aliquam ac a orci. Suspendisse libero mauris, egestas semper auctor sit amet, tempor et orci. ", "Phasellus quis neque aliquet, finibus nunc eget, lacinia neque. Sed auctor lectus vel ex scelerisque commodo. ")
@@ -53,15 +53,15 @@
linebreak("a\nb")
```
-When you have `\n` in your data frame, you can either change the value manually or simply use it with `dplyr::mutate_all`.
+When you have `\n` in your data frame, you can either change the value manually or simply use it with `mutate_all`.
```{r}
dt2 <- data.frame(
Item = c("Hello\nWorld", "This\nis a cat"),
Value = c(10, 100)
-)
+)
+dt2$Item <- linebreak(dt2$Item)
dt2 %>%
- mutate_all(linebreak) %>%
kable("latex", booktabs = T, escape = F,
caption = "Main Title\\\\Subtitle",
col.names = linebreak(c("Item\n(Name)", "Value\n(Number)"), align = "c"))
@@ -79,7 +79,6 @@
```{r}
dt2 %>%
- mutate_all(linebreak) %>%
kable("latex", booktabs = T, escape = F,
col.names = linebreak(c("Item\n(Name)", "Value\n(Number)"), align = "c")) %>%
add_header_above(c("Combined\nTitle" = 2)) %>%
diff --git a/docs/legacy_features.Rmd b/docs/legacy_features.Rmd
index a82634c..404f8c5 100644
--- a/docs/legacy_features.Rmd
+++ b/docs/legacy_features.Rmd
@@ -16,7 +16,6 @@
Unless there are significant differences between HTML/LaTeX, I will only keep one copy of documentation in HTML here since most of the functions in this packages share a very similar interface between their HTML and LaTeX ends.
```{r, warning=FALSE}
-library(knitr)
library(kableExtra)
dt <- mtcars[1:5, 1:6]
```