r - 附录部分表格乱码(R-markdown)
问题描述
我正在用 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)
解决方案
好吧,为了停止将表格放在字幕下,我必须添加
- \usepackage{flafter}
然后表格出现在下一页中,为了避免这种情况,我添加了
kbl(data)%>%
kable_styling(latex_options = "hold_position")
就这样。
推荐阅读
- pandas - 在服务器上脱机运行 Python、Anaconda、Pandas、Numpy,出现依赖错误
- hibernate-search - 使用 Hibernate Search 5 在关键字查询中搜索数字字段
- python - 如何从给定数组中找到子集的最大和。(子集不能没有大于任何两个元素之和的元素)
- excel - Robot框架中表格和excel的列表长度不同
- java - 如何使用 gradle 创建环境特定的 Spring Boot jar 文件名
- android - 如何在 Android TV 的 ListItemPresenter 中删除默认阴影
- laravel - Vuex/Laravel 将参数传递给动态 url
- javascript - 为什么按钮对象不能使用 onclick() 函数?
- mysql - 查询mysql总是返回重复的结果
- google-cloud-platform - 如何在调用时间序列 API 时获取 GCP 资源(如 VM 实例)的自定义标签