代码之家  ›  专栏  ›  技术社区  ›  M.Walko

在降价中更改ATX标题的字体大小

  •  0
  • M.Walko  · 技术社区  · 6 年前

    我正在用bookdown写一本书。不幸的是,我不知道如何格式化(例如设置字体大小)ATX Header(#、#、#、#等)。到目前为止,它无法通过 pandoc preamble.tex

    我尝试了以下方法,关于 this

    很遗憾,出现错误消息:

    \usepackage{titlesec}\titleformat{\chapter}[显示]{\normalfont\sffamily\Greg\bfseries\color{blue}}}{\chaptertitlename\\thechapter}{\20pt}{\Greg}

    提前感谢!

    1 回复  |  直到 6 年前
        1
  •  1
  •   Michael Harper    6 年前

    您最好的选择是在文档中添加一个LaTeX前言。在这里,您可以定义所需的LaTeX包。对基础模板进行了两项更改:

    下面是一个简单的示例

    ---
    output: 
      pdf_document:
        includes:
          in_header: header.tex
    subparagraph: true
    ---
    
    
    # Section
    
    ## Subsection
    

    这个 preamble.tex 文件保存在同一目录中:

    \usepackage{titlesec}
    \usepackage{color}
    
    \titleformat*{\section}{\LARGE}
    
    \titleformat{\subsection}[display]
      {\normalfont\sffamily\huge\bfseries\color{blue}} {\chaptertitlename\ \thechapter}{20pt}{\Huge}
    

    enter image description here