【问题标题】:Tables appears in disorder in appendix section (R-markdown)附录部分表格乱码(R-markdown)
【发布时间】:2021-05-04 16:25:37
【问题描述】:

我正在用 R markdown 写我的 Ms 论文,但附录部分有问题。我需要在附录部分中放置一些表格,但是当我渲染它时,该小节的标题出现在表格下方。像这样:

我想知道有没有办法解决这个问题。

我写代码的方式是:


# Appendix {-}

## Subsection title

chunk with table 

R-markdown 块:

title: "Title of my thesis"
subtitle: 
author: 
 - "Student :"
 - "Director: "
output: 
 pdf_document:
  number_sections: true
 latex_engine: xelatex
 template: NULL
 word_document: default
degree: Ms Biology
field: Experimental biology
year: 2021
geometry: left=2cm,right= 2 cm,top=2 cm, bottom=2 cm
papersize: a4
header-includes: 
 - \usepackage{amsmath} 
 - \usepackage{booktabs}
 - \usepackage{pdflscape}
 - \usepackage[justification=raggedright,labelfont=bf,singlelinecheck=false]{caption}
 - \usepackage{setspace}
bibliography: library.bib
csl: apa7.csl
fontsize: 11 pt
indent: true
spacing: 1.5

和块选项

knitr::opts_chunk$set(
      echo = FALSE, 
      warning = FALSE, 
      message = FALSE,
      error =FALSE)

【问题讨论】:

  • 能否包含 rmarkdown 块的详细信息,包括您正在使用的块选项;大概输出是pdf?表是如何创建的?
  • 尝试在小节标题前添加\clearpage
  • 仍然无法正常工作:c

标签: r r-markdown


【解决方案1】:

好吧,为了停止在字幕下放置表格,我必须添加

 - \usepackage{flafter}

然后表格出现在下一页,为了避免这种情况,我添加了

kbl(data)%>%
kable_styling(latex_options = "hold_position")

就是这样。

【讨论】:

    猜你喜欢
    • 2020-01-30
    • 2019-05-20
    • 1970-01-01
    • 1970-01-01
    • 2014-02-19
    • 1970-01-01
    • 1970-01-01
    • 2016-04-21
    • 2021-05-16
    相关资源
    最近更新 更多