You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 18:39:56