0

I am writing a book with bookdown. Unfortunately, I have no clue how to format (e.g. setting font size) ATX-hearder (#, ##, ## etc.). So far, it does not work via pandoc or preamble.tex.

I have tried the following, with regard to this.

Unfortunately, there is an error message :

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

Thanks in advance!

M.Walko
  • 57
  • 1
  • 8
  • What error message do you get? The quoted text above looks more like the commands you might put into `preamble.tex`. – Ralf Stubner Apr 26 '18 at 09:13

1 Answers1

1

Your best bet here is to add a LaTeX preamble to the document. In here, you can define the required LaTeX packages. Two changes are made to the base template:

Here is a minimal example

---
output: 
  pdf_document:
    includes:
      in_header: header.tex
subparagraph: true
---


# Section

## Subsection

The preamble.tex file is saved in the same directory:

\usepackage{titlesec}
\usepackage{color}

\titleformat*{\section}{\LARGE}

\titleformat{\subsection}[display]
  {\normalfont\sffamily\huge\bfseries\color{blue}} {\chaptertitlename\ \thechapter}{20pt}{\Huge}

enter image description here

Michael Harper
  • 14,721
  • 2
  • 60
  • 84