Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R: Removing the "Chapter" part from the title in bookdown::pdf_book with documentclass: report

consider my header and first section

---
title: "asdf"
author: "asdf"
date: "13 Januar 2018"
documentclass: report
output:
  bookdown::pdf_book:
    citation_package: biblatex
    latex_engine: pdflatex
    number_sections: yes
    fig_caption: yes
---

# Introduction
Here begins my introduction

I want to remove the automatic "Chapter 1" part, thats sits in front of the actual chapter title (in this case Introduction) This does not work

header-includes:
  \renewcommand{\chaptername}{}

Also using another documentclass does not work, because I need the number of my sections/chapters be represented in the figure captions (e.g Figure 3.1) What I would like is to end up with a Title 1 Introduction , than 2 Methods and so on. Should not be to hard, but I can't figure it out. Thanks Greg

like image 528
Gregor Avatar asked Jan 15 '18 22:01

Gregor


1 Answers

You can use

subparagraph: true
output:
  bookdown::pdf_book:
    includes:
      in_header: preamble.tex

together with

\usepackage{titlesec}
\titleformat{\chapter}
  {\normalfont\LARGE\bfseries}{\thechapter}{1em}{}
\titlespacing*{\chapter}{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}

in preamble.tex (c.f. https://tex.stackexchange.com/questions/10326/how-to-set-the-chapter-style-in-report-class). You have to make sure that the LaTeX package titlesec is installed in your TeX system.

At the time of writing subparagraph: true was needed since the used pandoc LaTeX template redefined \paragraph and \subparagraph in a way interfering with titlesec. This has changed since then. at least with rmarkdown version 2.1 one no longer needs subparagraph: true. thanks @MarkNeal for noticing this!

like image 177
Ralf Stubner Avatar answered Nov 05 '22 04:11

Ralf Stubner