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

如何在papaja撰写的PDF稿件中设置标题与单位左对齐(标题加粗)

解决方案

要实现标题左对齐(加粗)、作者单位左对齐的需求,可通过在YAML配置中添加自定义LaTeX前置代码,覆盖papaja默认的APA格式排版规则。以下是修改后的完整配置及说明:

修改后的YAML配置

---
title             : "The paper title"
shorttitle        : "running head"

author: 
  - name          : "First Author"
    affiliation   : "1"
  
affiliation:
  - id            : "1"
    institution   : "Department of Science"

floatsintext      : no
figurelist        : yes
tablelist         : no
footnotelist      : no
linenumbers       : no
mask              : no
draft             : no
documentclass     : "apa6"
classoption       : "doc, donotrepeattitle" # suppresses title on 1st page of MS
output: papaja::apa6_pdf
header-includes:
  - \usepackage{titlesec}
  - \titleformat{\title}[block]{\bfseries\Large\raggedright}{}{0em}{}
  - \makeatletter
  - \renewcommand{\@maketitle}{%
      \begin{flushleft}%
        \bfseries\@title\\[1em]%
        \@author\\[1em]%
        \@affiliation%
      \end{flushleft}%
    }
  - \makeatother
---

关键代码说明

  • \usepackage{titlesec}:加载用于自定义标题格式的LaTeX包
  • \titleformat{\title}[block]{\bfseries\Large\raggedright}{}{0em}{}:将主标题设置为加粗(\bfseries)、大号字体(\Large)、左对齐(\raggedright)
  • \renewcommand{\@maketitle}:重新定义标题生成逻辑,将标题、作者、单位整体放在左对齐环境(flushleft)中,确保所有元素左对齐

效果验证

编译后,标题会以加粗左对齐的形式呈现,作者及所属单位也会同步左对齐,完全覆盖papaja默认的居中排版规则。

内容的提问来源于stack exchange,提问作者Emilio M. Bruna

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.15 06:52:40