如何在Rmarkdown中正确格式化摘要(LaTeX转PDF)
解决Rmarkdown生成PDF时摘要首段缩进问题
问题根源是LaTeX的abstract环境默认会给第一段添加首段缩进,而后续段落自动取消缩进。你的写法中,Premise所在行作为摘要第一段触发了默认缩进,后面两行被识别为新段落,因此显示正常。
以下是两种可行的解决方法:
方法一:手动取消首段缩进
在摘要开头添加LaTeX命令\noindent,直接取消首段的缩进效果:
abstract: | \noindent **Premise:** We did stuff. **Methods and Results:** We used and developed stuff to accomplish stuff. **Conclusions:** You too can do stuff.
方法二:全局修改摘要环境设置
如果需要统一调整所有摘要的格式,可通过header-includes添加LaTeX命令,全局取消abstract环境的段落缩进:
--- title: 'A few people may read this thing' author: | | $^1$Research Institute | $^2$University | Person$^1$^[Author for Correspondence: human@place.org], Other Person$^1$$^,$$^2$ abstract: | **Premise:** We did stuff. **Methods and Results:** We used and developed stuff to accomplish stuff. **Conclusions:** You too can do stuff. keywords: | rmarkdown, latex, weird indent in abstract output: pdf_document: default header-includes: - \usepackage{etoolbox} - \AtBeginEnvironment{abstract}{\setlength{\parindent}{0pt}} --- # Introduction
内容的提问来源于stack exchange,提问作者steppe
相关产品推荐
相关产品推荐

