I am writing a thesis template according to very specific University rules, and RMarkdown won't let me include a page with the bibliography pdflatex + bibtex + pdflatex with a regular .tex file
So far I have this:
output:
pdf_document:
latex_engine: pdflatex
template: formato-uchile.tex
keep_tex: no
citation_package: biblatex
bibliography: bibliografia.bib
---
Here is the full document https://github.com/pachamaltese/template-tesis-uchile/blob/master/tesis-rmarkdown.Rmd
How can I include that bibliography page?
You do not have to indent bibliography line in the YAML section.
---
output:
pdf_document:
latex_engine: pdflatex
template: formato-uchile.tex
keep_tex: no
citation_package: biblatex
bibliography: bibliografia.bib
biblio-style: path/to/your/style-file-without-file-extention
---
As mentioned here, your bibliography will be shown in the end of the section. This is automatic, so you may need TeXing to change the order of the bibliography and appendices. If you want to do so, I highly recommend you to set keep_tex: yes so that you can get .tex file to edit.
Related
I am knitting a pdf file from Rmd.. My working dir includes the .Rmd file and pdf output. Knitr sends all figures to the figure folder because I set the figure path to fig.path <- "figure/". But when I knit the pdf file, it gives me an error: ! LaTeX Error: File `figure/figure-1' not found. although all figures are in the figure folder. Something is wrong with my directories but I cannot figure out what exactly.
Here is my setting:
---
title: "Paper"
subtitle: "\\textsc{Online Paper}"
df_print: paged
author: "Anonymous"
output:
pdf_document:
extra_dependencies: flafter
includes:
# in_header: Helper/header.tex
latex_engine: xelatex
number_sections: yes
link-citations: yes
html_document:
df_print: paged
# bibliography: Helper/bibtex.bib
biblio-style: apa6
link-citations: yes
linkcolor: blue
urlcolor: blue
---
Quick question: how can I render an R Script (so, a set of function) with R Markdown, using the tufte style?
Let's say that "myscript.R" is the file in which I have my chunk of code.
Currently I use this syntax to generate a pdf:
rmarkdown::render("myscript.r", "pdf_document")
How can I pass to this string the info to format the pdf document according to the tufte style?
You could have the tufte style Rmarkdown document as a template, and then source in your Rscript.R in order to PDF from the console.
tufte.Rmd That was Rstudio Tufte Template.
---
title: "A Tufte Handout Example"
runningheader: "Tufte Handout with R Markdown" # only for pdf output
subtitle: "An implementation in R Markdown" # only for html output
author: "test"
date: "`r Sys.Date()`"
output:
tufte::tufte_html: default
tufte::tufte_handout:
citation_package: natbib
latex_engine: xelatex
tufte::tufte_book:
citation_package: natbib
latex_engine: xelatex
bibliography: skeleton.bib
link-citations: yes
---
```{r, results='asis'}
source('myscript.R')
```
myscript.R
library(knitr)
print(kable(mtcars))
And with both of these files in the same exact directory, I can run the
rmarkdown::render("tufte.Rmd", output_format = "pdf_document")
The tufte template has a lot of formatting, but this was a simple example.
I have a large bookdown project. My YAML header below.
My only desired output is a PDF. However, bookdown by default produces a HTML as well. This makes compilation take more time, and also uses more caching space on my disk. Any chance I can disable producing HTML output? I have tried to play around with the site parameter in the YAML heading, but no luck.
title: "Title"
subtitle: "Subtitle"
author:
- "Name"
- "Institution"
date: "September 2020"
output:
bookdown::pdf_book:
toc: false
includes:
in_header: preamble.tex
keep_tex: yes
latex_engine: xelatex
citation_package: natbib
fontsize: 12pt
linestretch: 1.5
site: bookdown::bookdown_site
documentclass: book
bibliography: [references.bib]
biblio-style: "apalike"
geometry: "left=2.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm"
bookdown doesn't really have a "default" output format. If it produces HTML, the output format must have been provided somewhere. Check if you have a _output.yml under the root directory of your book project. If you do, you may delete it. Then bookdown will use the output field that you specified in the YAML frontmatter of your Rmd document.
I'm not getting a pdf output from my rnotebook.
My header in my "index.Rmd" is:
---
title: "some title"
author: "me"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
documentclass: book
bibliography: [book.bib, packages.bib]
biblio-style: apalike
link-citations: yes
description: "Notes on a Leasing Company busines risk and opportunities."
---
I'm rendering the book in the console with the following code:
bookdown::render_book("index.rmd", output_format = "bookdown::pdf_book")
Output is:
Error: Functions that produce HTML output found in document targeting latex output.
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:
always_allow_html: yes
Note however that the HTML output will not be visible in non-HTML formats.
How do I go about changing the output type?
My file "_output.yml" file is:
toc:
before: |
<li>A Minimal Book Example</li>
after: |
<li>Published with bookdown</li>
download: ["pdf", "epub"]
bookdown::pdf_book:
includes:
in_header: preamble.tex
latex_engine: xelatex
citation_package: natbib
keep_tex: yes
bookdown::epub_book: default
I want to change the bibliographystyle in R Markdown but nothing I found could help.
I do not want any "and"s in the bibliography (before the last author).
My preferred option was if I could use alphadin (bst-file here) but I could not get it to work.
Here is my YAML so far:
---
output:
pdf_document
bibliography: literatur.bib
biblio-style: alphadin.bst
header-includes:
- \usepackage{graphicx}
- \usepackage{float}
- \usepackage[ngerman]{babel}
- \usepackage{fancyhdr}
- \usepackage{hyperref}
- \pagenumbering{gobble}
- \usepackage{booktabs}
- \usepackage{natbib}
---
The bst-file is in the same directory as the R Markdown file.
If you want to set the bibliography style to use a bst file, you need to force R Markdown to use natbib or biblatex as the citation manager. By default, it will use pandoc to build the citation. This article explains the behaviour more.
Secondly, once you have that working, you need to change the citation style of the file. By default, natbib will use author-year citations, but the bst file you provided does not work with these. So I have change the citation styles to numbers.
Below is a minimal example. It will create a bibliography file test.bib but you need to make sure the alphadin.bst file is in the same directory.
---
output:
pdf_document:
citation_package: natbib
bibliography: test.bib
biblio-style: alphadin
header-includes:
- \setcitestyle{numbers}
---
[#R-rmarkdown]
```{r}
knitr::write_bib(x = "rmarkdown", file = "test.bib")
```
There is another way to set the citation style of natbib: natbiboptions: round in YAML. The combination of citation_package: natbib and natbiboptions: round is equivalent to \usepackage[round]{natbib}. Note that natbiboptions: round comes outside of the output key.
(In the following example, I used biblio-style: apalike but the example should work with any biblio-style.)
---
output:
pdf_document:
citation_package: natbib
bibliography: test.bib
biblio-style: apalike
natbiboptions: round
---
[#R-rmarkdown]
```{r}
knitr::write_bib(x = "rmarkdown", file = "test.bib")
```