R:移除“章节".部分来自bookdown :: pdf_book中标题,文档类别为:报告 [英] R: Removing the "Chapter" part from the title in bookdown::pdf_book with documentclass: report

查看:117
本文介绍了R:移除“章节".部分来自bookdown :: pdf_book中标题,文档类别为:报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑我的标题和第一部分

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

我要删除自动的第1章"部分,该部分位于实际章节标题的前面(在本例中为简介) 这不起作用

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}{}

也不能使用其他文档类,因为我需要在图形标题中表示我的节/章的数量(例如,图3.1) 我想要得到的标题是 1简介,而不是 2方法,依此类推. 应该不难,但我无法弄清楚. 谢谢 格雷格

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

推荐答案

您可以使用

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

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

preamble.tex中(参见> https://tex.stackexchange.com/questions/10326/如何在报告类中设置章节样式).您必须确保在TeX系统中安装了LaTeX软件包 titlesec .

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.

,因为使用的pandoc LaTeX模板以干扰titlesec的方式重新定义了\paragraph\subparagraph.从那时起,情况发生了变化.至少在rmarkdown版本2.1中,不再需要subparagraph: true.感谢@MarkNeal注意到这一点!

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!

这篇关于R:移除“章节".部分来自bookdown :: pdf_book中标题,文档类别为:报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆