附录目前给我一个只有标题的空白页 - R Markdown
appendix currently giving me a blank page with just title - R Markdown
我正在尝试将 table 放在 R Markdown 附录的第一页中,按照:
\newpage
# References {-}
<div id="refs"></div>
\newpage
# Appendix {-}
\setcounter{table}{0}
\renewcommand{\thetable}{A\arabic{table}}
```{r pre_table_appendix, message=FALSE, warning=FALSE, echo=FALSE, include=FALSE, fig.pos="H"}
tab <- matrix(c("text1", "text2", "text3", "text4",
"text1", "text2", "text3", "text4",
"text1", "text2", "text3", "text4",
"text1", "text2", "text3", "text4"), ncol=4, byrow=TRUE)
colnames(tab) <- c('Variable','Variable','Variable','Variable')
rownames(tab) <- NULL
tab <- as.table(tab)
table_appendix <- kbl(tab, longtable = T, booktabs = T, row.names = 0, caption = "Title.") %>%
kable_styling(latex_options = c("repeat_header"))
```
\begin{landscape}
```{r table_appendix_f, echo=FALSE}
table_appendix
```
\end{landscape}
然而,因为我的 table_appendix 是横向的,所以我最终得到一个只有“附录”的空白页,然后是另一个包含实际 table 的页面。谁知道如何将 table 与 Appendix 放在一起?
如果我没看错的话...
添加到我们的页眉:
- \usepackage{pdflscape}
- \newcommand{\blandscape}{\begin{landscape}}
- \newcommand{\elandscape}{\end{landscape}}
LaTeX 引擎应该是 pdflatex
。
你的问题代码:
\newpage
# References {-}
<div id="refs"></div>
\newpage
\blandscape
# Appendix {-}
\setcounter{table}{0}
\renewcommand{\thetable}{A\arabic{table}}
```{r pre_table_appendix, message=FALSE, warning=FALSE, echo=FALSE, include=FALSE, fig.pos="H"}
library(kableExtra)
tab <- matrix(c("text1", "text2", "text3", "text4",
"text1", "text2", "text3", "text4",
"text1", "text2", "text3", "text4",
"text1", "text2", "text3", "text4"), ncol=4, byrow=TRUE)
colnames(tab) <- c('Variable','Variable','Variable','Variable')
rownames(tab) <- NULL
tab <- as.table(tab)
table_appendix <- kbl(tab, longtable = T, booktabs = T, row.names = 0, caption = "Title.") %>%
kable_styling(latex_options = c("repeat_header"))
```
```{r table_appendix_f, echo=FALSE}
table_appendix
```
\elandscape
\newpage
ccontent
content
content
content
content
P.S。关于页码的问题,你知道的,我想。
没有这个问题:
添加到您的页眉:- \usepackage[paper=A4]{typearea}
\newpage
\KOMAoptions{paper=landscape,DIV=current}
\recalctypearea
# Appendix {-}
*** your code***
```{r table_appendix_f, echo=FALSE}
table_appendix
```
\newpage
\KOMAoptions{paper=portrait,DIV=current}
\recalctypearea
ccontent
content
瞧瞧:)
!!! 但是请记住,它会影响您的利润率。在打印文档之前更好地检查。
我正在尝试将 table 放在 R Markdown 附录的第一页中,按照:
\newpage
# References {-}
<div id="refs"></div>
\newpage
# Appendix {-}
\setcounter{table}{0}
\renewcommand{\thetable}{A\arabic{table}}
```{r pre_table_appendix, message=FALSE, warning=FALSE, echo=FALSE, include=FALSE, fig.pos="H"}
tab <- matrix(c("text1", "text2", "text3", "text4",
"text1", "text2", "text3", "text4",
"text1", "text2", "text3", "text4",
"text1", "text2", "text3", "text4"), ncol=4, byrow=TRUE)
colnames(tab) <- c('Variable','Variable','Variable','Variable')
rownames(tab) <- NULL
tab <- as.table(tab)
table_appendix <- kbl(tab, longtable = T, booktabs = T, row.names = 0, caption = "Title.") %>%
kable_styling(latex_options = c("repeat_header"))
```
\begin{landscape}
```{r table_appendix_f, echo=FALSE}
table_appendix
```
\end{landscape}
然而,因为我的 table_appendix 是横向的,所以我最终得到一个只有“附录”的空白页,然后是另一个包含实际 table 的页面。谁知道如何将 table 与 Appendix 放在一起?
如果我没看错的话...
添加到我们的页眉:
- \usepackage{pdflscape}
- \newcommand{\blandscape}{\begin{landscape}}
- \newcommand{\elandscape}{\end{landscape}}
LaTeX 引擎应该是 pdflatex
。
你的问题代码:
\newpage
# References {-}
<div id="refs"></div>
\newpage
\blandscape
# Appendix {-}
\setcounter{table}{0}
\renewcommand{\thetable}{A\arabic{table}}
```{r pre_table_appendix, message=FALSE, warning=FALSE, echo=FALSE, include=FALSE, fig.pos="H"}
library(kableExtra)
tab <- matrix(c("text1", "text2", "text3", "text4",
"text1", "text2", "text3", "text4",
"text1", "text2", "text3", "text4",
"text1", "text2", "text3", "text4"), ncol=4, byrow=TRUE)
colnames(tab) <- c('Variable','Variable','Variable','Variable')
rownames(tab) <- NULL
tab <- as.table(tab)
table_appendix <- kbl(tab, longtable = T, booktabs = T, row.names = 0, caption = "Title.") %>%
kable_styling(latex_options = c("repeat_header"))
```
```{r table_appendix_f, echo=FALSE}
table_appendix
```
\elandscape
\newpage
ccontent
content
content
content
content
P.S。关于页码的问题,你知道的,我想。
没有这个问题:
添加到您的页眉:- \usepackage[paper=A4]{typearea}
\newpage
\KOMAoptions{paper=landscape,DIV=current}
\recalctypearea
# Appendix {-}
*** your code***
```{r table_appendix_f, echo=FALSE}
table_appendix
```
\newpage
\KOMAoptions{paper=portrait,DIV=current}
\recalctypearea
ccontent
content
瞧瞧:)
!!! 但是请记住,它会影响您的利润率。在打印文档之前更好地检查。