kableExtra changing format of whole latex pdf? #667
Answered
by
haozhu233
mthompson89
asked this question in
Q&A
Replies: 1 comment 4 replies
-
The default one generates a markdown table and pandoc converts it to a
latex table. Loading kableExtra forcing it to be rendered as latex.
To fix it, add booktabs = T in kable and add "hold_position" to
latex_options in kable_classic
…On Tue, Oct 26, 2021 at 2:29 PM mthompson89 ***@***.***> wrote:
Hello,
I am writing a report in rMarkdown and everything looks great except when
I load the library library(kableExtra). After loading the library whether
I use the functions from kableExtra or not it changes the format of my
kable tables and moves all my figures around my pdf.
the code before loading the kableExtra library looks like this:
kable(SummaryTree,
align = c(rep('c',5)),
col.names = c("Deg","BA AGS","BA UGS","TPA AGS","TPA UGS","QMD AGS","QMD UGS"),
caption = "Summary by Degradation Category")
and the table look like this
[image: PrettyKable]
<https://user-images.githubusercontent.com/80464903/138938168-ac32dfbd-4684-43b5-a000-1fa72a9c21ef.png>
after I load the kableExtra library the table code is:
kable(SummaryTree,
align = c(rep('c',5)),
col.names = c("Deg","AGS","UGS","AGS","UGS","AGS","UGS"),
caption = "Summary by Degradation Category")%>%
kableExtra::add_header_above(c(" ","Basal Area (ft2/acre)" = 2, "Trees Per Acre" = 2, "Quadratic Mean Diameter" = 2))%>%
kableExtra::kable_classic(latex_options = "striped", position = "center")
and the table looks like this
[image: uglyKableExtra]
<https://user-images.githubusercontent.com/80464903/138938211-f3a1382b-8b8b-4511-9dc1-f2b33fa07cf4.png>
but I am also curious about why it is changing the formatting of my whole
document.
without kableExtra it looks like this
Overview
Paragraph of text
study site
paragraph of text
Table 1
figure 1
iNaturalist
paragraph of text
figure 2
summary stats
paragraph
trees
Table 2
After loading kableExtra it looks like this
Overview
Paragraph of text
study site
paragraph of text
figure 1
Table 1
Table 2
iNaturalist
paragraph of text
summary stats
paragraph
trees
figure 2
What is going on?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#667>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABVQRPUYKQT7KHU6KPGOUODUI3XPNANCNFSM5GYO567Q>
.
|
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
haozhu233
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am writing a report in rMarkdown and everything looks great except when I load the library
library(kableExtra)
. After loading the library whether I use the functions fromkableExtra
or not it changes the format of my kable tables and moves all my figures around my pdf.the code before loading the
kableExtra
library looks like this:and the table look like this
after I load the
kableExtra
library the table code is:and the table looks like this
but I am also curious about why it is changing the formatting of my whole document.
without
kableExtra
it looks like thisOverview
Paragraph of text
study site
paragraph of text
Table 1
figure 1
iNaturalist
paragraph of text
figure 2
summary stats
paragraph
trees
Table 2
After loading
kableExtra
it looks like thisOverview
Paragraph of text
study site
paragraph of text
figure 1
Table 1
Table 2
iNaturalist
paragraph of text
summary stats
paragraph
trees
figure 2
What is going on?
Beta Was this translation helpful? Give feedback.
All reactions