I am using the bookdown package in R to write a gitbook, but I don't want the final book to have the sharing links to facebook, twitter. I am using something like this in the YAML
---
title: "A Minimal Book Example"
author: "SN"
date: "`r Sys.Date()`"
output:
bookdown::gitbook
gitbook_config:
sharing:
facebook: false
twitter: false
documentclass: book
link-citations: yes
description: "This book ... ."
---
but I am getting an error
Error in yaml::yaml.load(enc2utf8(string), ...) :
Scanner error: mapping values are not allowed in this context at line 6, column 19
Calls: <Anonymous> ... yaml_load_utf8 -> mark_utf8 -> <Anonymous> -> .Call
Execution halted
Can anyone help me in setting options in YAML so that no sharing options show up in the final rendering?
thanks!
SN
Two mistakes:
You omitted a colon after bookdown::gitbook;
gitbook_config should be config.
---
title: "A Minimal Book Example"
author: "SN"
date: "`r Sys.Date()`"
output:
bookdown::gitbook:
config:
sharing:
facebook: false
twitter: false
documentclass: book
link-citations: yes
description: "This book ... ."
---
Related
I'm having problems to render a publication in Bookdown. The error message sugests a kind of size problem in some file, but I have no idea how to identify it.
Found these related answers: answer1, answer2, answer3, but none of them solved my problem.
Thanks for any help.
Error in file.exists(f) : file name conversion problem -- name too long? Calls: local ... local_resources -> grep -> is.factor -> unique -> file.exists Interrupted execution Error: bookdown::render_book() failed to render the output format 'bookdown::gitbook'. Interrupted execution Exited with status 1.
This is my _bookdown.yml file configuration:
delete_merged_file: true
new_session: yes
language:
label:
fig: 'Figura '
tab: 'Tabela '
ui:
chapter_name: "Capítulo"
And this is my _output.yml file:
lib_dir: assets
css: style.css
includes:
config:
toc:
before: |
<li>Relatório Geral de Gastos Públicos em 2021"</li>
after: |
<li>Published with bookdown</li>
download: null
sharing:
facebook: no
linkedin: yes
whatsapp: yes
info: no
bookdown::pdf_book:
#pandoc_args: --top-level-division=chapter
keep_text: yes
keep_tex: true
includes:
in_header: preamble.tex
template: template.tex
latex_engine: xelatex
citation_package: natbib
extra_dependencies: ["flafter"]
toc_unnumbered: no
fig_caption: yes
toc_depth: 3
bookdown::epub_book: default
My document is simply this
---
title: "The Visual Speech (VISP) Handbook"
author: "Fredrik Karlsson & Linda Sandström"
site: bookdown::bookdown_site
documentclass: book
output:
bibliography: references.bib
#bookdown::pdf_book: default
bookdown::gitbook: default
biblio-style: "apalike"
link-citations: true
---
# Preface {-}
[#R-base]
and I have a reference file:
> dir(pattern = "*.bib")
[1] "references.bib"
but I am unable to find this bib file when knitting the book:
Error in eval(parse(text = name)) : object 'references.bib' not found
Calls: ... create_output_format ->
create_output_format_function -> eval -> eval Please delete _main.Rmd
after you finish debugging the error. Execution halted
Any ideas on how to set this up properly (in Rstudio)
Thanks!
Fredrik
It's just a location problem in the code (see more information here).
You could try:
---
title: "The Visual Speech (VISP) Handbook"
author: "Fredrik Karlsson & Linda Sandström"
site: bookdown::bookdown_site
documentclass: book
output:
#bookdown::pdf_book: default
bookdown::gitbook: default
bibliography: references.bib
biblio-style: "apalike"
link-citations: true
---
# Preface {-}
[#R-base]
I cannot seem to remove the table of contents from my RMarkdown pdf document. I have tried a number of different things such as.
Changing toc: no to false
using differrent base_format: rticles::ieee_article artiles from the getNamespaceExports("rticles").
removing csl: elsevier-harvard.csl
Nothing seems to work and everytime I compile the table of contents appears - what am I missing?
Markdown:
---
title: some title
author:
- name: some name
email: some email
affiliation: some department
footnote: some footnote
- name: some name
email: some email
affiliation: some department
footnote: 2
footnote:
- code: 1
text: "Corresponding Author"
- code: 2
text: "Corresponding Author"
abstract: |
some abstract here
journal: "An awesome journal"
date: "`r Sys.Date()`"
bibliography: mybibfile.bib
#linenumbers: true
#numbersections: true
csl: elsevier-harvard.csl
output:
bookdown::pdf_document2:
base_format: rticles::ieee_article
number_sections: no
toc: no
tables: true
header-includes:
- \usepackage{floatrow}
- \floatplacement{figure}{H}
- \usepackage{booktabs}
- \usepackage{array}
---
Try to format your output section of the YAML header as follows:
output:
bookdown::pdf_document2:
number_sections: no
toc: no
tables: true
base_format: rticles::ieee_article
Then the TOC should disappear. I hope that the base_format argument will be taken into consideration. Please try and report.
Following this post, I'm trying to put #YihuiXie 's answer in practice with the PLOS template of rticles but it doesn't work. Any help would be very appreciated!
Below in a minimal example:
---
title: Title of submission to PLOS journal
author:
- name: Me
affiliation: Here
# output: rticles::plos_article
output:
bookdown::pdf_document2:
base_format: rticles::plos_article
---
# Introduction
Some text \#ref(fig:fig1)
# References {#references .unnumbered}
The error message reads
Error in pdf_book(..., base_format = rmarkdown::pdf_document) : formal argument "base_format" matched by multiple actual arguments
Calls: <Anonymous> -> create_output_format -> do.call -> <Anonymous>
Execution halted
You cannot change the base_format for bookdown::pdf_document2. You can do so for bookdown::pdf_book, though:
---
title: Title of submission to PLOS journal
author:
- name: Me
affiliation: Here
#output: rticles::plos_article
output:
bookdown::pdf_book:
base_format: rticles::plos_article
---
# Introduction
Some text \#ref(fig:fig1)
# References {#references .unnumbered}
Note to other readers: Make sure that .../rticles/rmarkdown/templates/plos_article/skeleton/PLOS-submission.eps is present in that directory.
I'm using rmarkdown to produce a word (.docx) report. I would like to change the header of the toc. This seems possible as pandoc_args can be passed as options in the yaml header in the case of a doc file (1). But I'm not doing it right. Could anyone provide a working example ?
(1) pandoc.args is included in the rmarkdown possible options and in the pandoc manual, there is a toc-title option
---
title: "yaml header"
author: "cedric"
output:
word_document:
toc: true
pandoc_args: toc-title="Table des matières"
---
# One section
# Another
This produces :
The title of the table of contents is document metadata, so you can set it with YAML metadata block.
---
title: "yaml header"
author: "cedric"
output:
word_document:
toc: true
toc-title: "Table des matières"
---
Or passed it in with the -M command-line flag.
---
title: "yaml header"
author: "cedric"
output:
word_document:
toc: true
pandoc_args: [
"-M", "toc-title=Table des matières"
]
---