乳胶输出的 kableExtra::kbl 脚注中没有缩进
No indentation in footnote with kableExtra::kbl for latex output
我正在尝试删除使用 kableExtra 创建的 table 脚注部分中的缩进。我假设缩进来自音符开始之前的 \item
函数(请参阅乳胶输出)。任何人都可以帮助删除这个缩进 resp。注释中的 \item
前缀?
library(dplyr)
library(kableExtra)
data(mtcars)
tab_data <- mtcars[1:5, 1:3]
cat(
kbl(
x = tab_data,
format = "latex",
booktabs = TRUE,
) %>%
kable_styling(full_width = FALSE) %>%
footnote(
general = "Here is a note of the table. It is very long and I would want to remove this ugly indention on the left side of the table notes. ",
general_title = "",
threeparttable = TRUE
)
)
这是乳胶输出:
\begin{table}
\centering
\begin{threeparttable}
\begin{tabular}[t]{lrrr}
\toprule
& mpg & cyl & disp\
\midrule
Mazda RX4 & 21.0 & 6 & 160\
Mazda RX4 Wag & 21.0 & 6 & 160\
Datsun 710 & 22.8 & 4 & 108\
Hornet 4 Drive & 21.4 & 6 & 258\
Hornet Sportabout & 18.7 & 8 & 360\
\bottomrule
\end{tabular}
\begin{tablenotes}
\item Here is a note of the table. It is very long and I would want to remove this ugly indention on the left side of the table notes.
\end{tablenotes}
\end{threeparttable}
\end{table}
以及 PDF 的打印屏幕,缩进:
您可以添加 footnote_as_chunk = T
:
library(dplyr)
library(kableExtra)
data(mtcars)
tab_data <- mtcars[1:5, 1:3]
kbl(
x = tab_data,
format = "latex",
booktabs = TRUE,
) %>%
kable_styling(full_width = FALSE) %>%
footnote(
general = "Here is a note of the table. It is very long and I would want to remove this ugly indention on the left side of the table notes. ",
general_title = "",
threeparttable = TRUE,
footnote_as_chunk = T
)
-输出
如果您不介意更换软件包,可以使用 huxtable。然后,您可以根据需要自定义填充、边框等:
library(huxtable)
tab_data <- cbind(model = rownames(tab_data), tab_data)
huxtable(tab_data) |>
set_width(0.5) |>
theme_article() |>
add_footnote("Here is a note of the table. It is very long and I would want to remove this ugly indention on the left side of the table notes. ") |>
theme_
set_left_padding(everywhere, 1, 0.1) # change 0.1 to whatever you prefer
quick_pdf()
需要注意的一件事:这只是在 table 的底部添加了一个单元格。它不使用 TeX 脚注或 tablenote。
我正在尝试删除使用 kableExtra 创建的 table 脚注部分中的缩进。我假设缩进来自音符开始之前的 \item
函数(请参阅乳胶输出)。任何人都可以帮助删除这个缩进 resp。注释中的 \item
前缀?
library(dplyr)
library(kableExtra)
data(mtcars)
tab_data <- mtcars[1:5, 1:3]
cat(
kbl(
x = tab_data,
format = "latex",
booktabs = TRUE,
) %>%
kable_styling(full_width = FALSE) %>%
footnote(
general = "Here is a note of the table. It is very long and I would want to remove this ugly indention on the left side of the table notes. ",
general_title = "",
threeparttable = TRUE
)
)
这是乳胶输出:
\begin{table}
\centering
\begin{threeparttable}
\begin{tabular}[t]{lrrr}
\toprule
& mpg & cyl & disp\
\midrule
Mazda RX4 & 21.0 & 6 & 160\
Mazda RX4 Wag & 21.0 & 6 & 160\
Datsun 710 & 22.8 & 4 & 108\
Hornet 4 Drive & 21.4 & 6 & 258\
Hornet Sportabout & 18.7 & 8 & 360\
\bottomrule
\end{tabular}
\begin{tablenotes}
\item Here is a note of the table. It is very long and I would want to remove this ugly indention on the left side of the table notes.
\end{tablenotes}
\end{threeparttable}
\end{table}
以及 PDF 的打印屏幕,缩进:
您可以添加 footnote_as_chunk = T
:
library(dplyr)
library(kableExtra)
data(mtcars)
tab_data <- mtcars[1:5, 1:3]
kbl(
x = tab_data,
format = "latex",
booktabs = TRUE,
) %>%
kable_styling(full_width = FALSE) %>%
footnote(
general = "Here is a note of the table. It is very long and I would want to remove this ugly indention on the left side of the table notes. ",
general_title = "",
threeparttable = TRUE,
footnote_as_chunk = T
)
-输出
如果您不介意更换软件包,可以使用 huxtable。然后,您可以根据需要自定义填充、边框等:
library(huxtable)
tab_data <- cbind(model = rownames(tab_data), tab_data)
huxtable(tab_data) |>
set_width(0.5) |>
theme_article() |>
add_footnote("Here is a note of the table. It is very long and I would want to remove this ugly indention on the left side of the table notes. ") |>
theme_
set_left_padding(everywhere, 1, 0.1) # change 0.1 to whatever you prefer
quick_pdf()
需要注意的一件事:这只是在 table 的底部添加了一个单元格。它不使用 TeX 脚注或 tablenote。