I am using bookdown to write a paper, and the zotero bibtex plug in to reference. When I knit, the bibliography is automatically added from my references.bibfile. The YAML in my index is:
site: bookdown::bookdown_site
output:
bookdown::gitbook: default
documentclass: book
bibliography: references.bib
csl: african-online-scientific-information-systems-harvard.csl
link-citations: yes
When I knit, it puts my bibliography at the end, which is great. However I'm not sure how to format the bibliography, at the moment it is just a block of text, I'd like a little more stylish formatting, say an indent on the second line of a specific reference.
Thanks
Related
I am working on a Bookdown project and would like to use Tufte formatting.
I downloaded the Bookdown demo and the tufte package. Then, I simply changed the YAML in index.Rmd to:
---
title: "A Minimal Book Example"
author: "Yihui Xie"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
output:
bookdown::tufte_html_book:
toc: yes
css: toc.css
documentclass: book
bibliography: [book.bib, packages.bib]
biblio-style: apalike
link-citations: yes
github-repo: rstudio/bookdown-demo
description: "This is a minimal example of using the bookdown package to write a book. The output format for this example is bookdown::gitbook."
---
Where the only change is in the output: option, which is specified by the Bookdown book
And then tried both the Knit button and bookdown::render_book(). The demo built successfully.
However, it did not produce Tufte formatting. Instead I get default formatting, with a white background, non-italic section headings, and footnotes instead of margin notes (I added a footnote to the doc on a second run to make this visible):
I also tried this with different spacing before the "bookdown"/"toc" etc. stuff, and with tufte::tufte_html: default instead of any of the "bookdown"/"toc" stuff.
What do I need to do to get Bookdown to recognize the Tufte formatting request? I feel like I am missing something exceedingly simple.
I have made a nice flowchart in DiagrammeR. I have also plotted it into R Markdown and I am able to knitr it into a pdf. As you see in the following screenshot, the figure is not centered (even though I included fig.align = 'center'). But there is also a huge gap between my figure and the following text. How do I "crop" the diagram so I removes the space and center the diagram?
You will find problems generally with markdown problems so you will have to modify manually from your latex code so I would recommend that you put in your yaml:
---
output:
pdf_document:
latex_engine: pdflatex
keep_tex: true
---
I'm writing my dissertation in R markdown. I am using bibtex, pandoc-citeproc, and apa.csl with bookdown. I have new_session: yes in my _bookdown.yml and compiling primarily to PDF (documentclass:book, classoption: oneside).
The system I have is correctly using the full author list in place of "et al." for the first time I cite a 3-6 author work. That said, my adviser wants the full author list for the first time I cite a work per chapter.
Is there an easy way to go about this?
Here is the apa.csl I'm using:
https://github.com/citation-style-language/styles/blob/master/apa.csl
Turns out that a biblatex based solution is indeed very flexible as #moewe showed on TeX.SE. When one combines style=apa with citerest=chapter one gets the effect you are after. In a minimal R-markdown document:
---
output:
pdf_document:
citation_package: biblatex
documentclass: book
bibliography: biblatex-examples.bib
biblio-style: apa
biblatexoptions:
- citereset=chapter
---
# Intro
[#herrmann] and [#yoon]
[#herrmann] and [#yoon]
# Method
[#herrmann] and [#yoon]
[#herrmann] and [#yoon]
# References
Make sure that your TeX system includes the biber program.
I'd like for a chapter to appear before the table of contents (but after the title page) in the pdf_book output of Bookdown.
One way to do this is to add the chapter to a .tex file and and link it using before_body:. However, this means the chapter will not appear in gitbook (which I also need). I'd prefer not to keep both a .tex and .Rmd version of the same chapter.
An ideal solution would be if the chapter could be kept in a .Rmd file, and its contents extracted into the before_body for pdf_book. That way it's still available for gitbook. Though I'm not sure how I might do that, or indeed if it's possible?
Is there a solution? Or is it exceeding the limits of Bookdown's flexibility?
Any help would be greatly appreciated, thanks!
One can trigger ToC creation manually in the document, which gives more control over its placement. Of course, automatic table of contents creation should be disabled:
---
title: "MWE"
output:
bookdown::pdf_book:
toc: False
---
```{r child = 'file-you-want-to-include.Rmd'}
```
```{=latex}
% Trigger ToC creation in LaTeX
\tableofcontents
```
# Rest of your document starts here
The downside is that this only works with PDF output, not HTML.
Hi at all i have the following Problem:
I'm using Rmarkdown to write a Dokument. I'm also using the komadown package to use some bookdown features for referencing and be able to use the scrartcl document Class (Latex Output). I want to specify a citation style using a .csl file.
Normaly a simple csl: FILENAME.csl in the YAML header does the trick. But with the Komadown package this doesn't work.
My YAML Header is as follows, it finds my bibliography but it doesn't find the .csl file :(
---
title: "Komadown Try"
bibliography: library.bib
csl: kaktus.csl
output: komadown::scrartcl
---
Furthermore i want to set the keep_tex option to TRUE or yes but this also doesn't work.
Many thanks in advance. Would be awesome if someone could help me out.
i just got an answer to my questions. Maybe It'll help others that run into the same problem.
I can specify the csl file now. There was a bug in the code and the developer has fixed it. Currently the latest Version isn't on Cran so you have to download the developer Version from Github:
# install.packages("devtools")
devtools::install_github("jolars/komadown")
If you have done that you can specify the csl and the keep_tex argument as follows:
---
title: "Thesis Template"
bibliography: library.bib
output:
komadown::scrartcl:
keep_tex: yes
csl: kaktus.csl
---