"papaja": "Author Note" heading placed at bottom of title page - r-markdown

When rendering my .Rmd file as a pdf the heading for "Author Note" is the last line of the cover page, with the text then starting on p2. Where do I go to insert a \newpage command? Or is there a better way to force the "author note to start on p. 2?

As mentioned here you could put it in the note field of the YAML front matter:
note: "\newpage"
If you also have a note text try
note: |
This is my note.
\newpage

Related

Unnumber chapters in the TOC are not shown as active with bookdown::gitbook

I am currently writing a manuscript using Bookdown and the GitBook format.
My first and last chapters (Introduction and Conclusion) are unnumbered, whereas the 2nd and 3rd chapters are numbered.
However, when rendering the book and navigating throughout the different pages, the unnumbered chapters are never displayed as “active” in the Table of Contents (left-side bar).
Instead, the 1st numbered chapter (named "Chapter1" in the following code) is displayed as active (highlighted) when the current page is either the "Introduction" or "Conclusion".
When navigating to any numbered chapter ("Chapter1" or "Chapter2"), they are correctly displayed as active, as expected.
This can be verified by inspecting the elements in the TOC: the numbered chapters have the chapter class, and the 1st numbered chapter has both chapter and active when reading the unnumbered chapters. Unnumbered chapters do not have the chapter nor active classes.
I have tried adding the "chapter" class by using {- .chapter}, to no effect. Making all chapters numbered effectively makes the correct one displayed as active, but is not optimal (since I would like to use unnumbered chapters).
How can I make Bookdown correctly display the correct chapter as active, without making all of them numbered?
Here is the minimal example, the result is the same whether I put all code in the index.Rmd or in separated index.Rmd, 01-chap1.Rmd, 02-chap2.Rmd, ..., files.
Also, we can notice that using {-} or {.unnumbered} results in the same behaviour.
index.Rmd
---
title: "A Minimal Book Example"
author: "John Doe"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
output:
bookdown::gitbook: default
---
# Introduction {-}
Lorem ipsum
# Chapter1
## Section 1
# Chapter 2
## Section 1
# Conclusion {.unnumbered}
I also include an image to demonstrate the problem: we can clearly see that the current page is the "Introduction" chapter, however the highlighted ("active") chapter is "Chapter1".
Thank you in advance!
Try using the option to split by chapter.
In my experience it works as long as the chapters are not on the same HTML page.

How do I remove DOI from R-markdown bibliography?

I would like to remove the DOI from the bibliographic references in my markdown script. Is there a way I can do this?
Here is my markdown file:
---
title: "my paper"
author: "name"
date: \today
header-includes:
output:
pdf_document:
number_sections: yes
toc: yes
keep_tex: yes
fig_caption: yes
word_document:
toc: yes
latex_engine: xelatex
indent: yes
bibliography: library.bib
references:
link-citations: yes
linkcolor: blue
hyperfootnotes: yes
---
I would like to remove the DOI from this reference #Wallace2005
# Bibliography {-}
::: {#refs}
:::
The output of this file is the following:
And here is the .bib file
#article{Wallace2005,
abstract = {Constantly evolving, and with far-reaching implications, European Union policy-making is of central importance to the politics of the European Union. From defining the processes, institutions and modes through which policy-making operates, the text moves on to situate individual policieswithin these modes, detail their content, and analyse how they are implemented, navigating policy in all its complexities. The first part of the text examines processes, institutions, and the theoretical and analytical underpinnings of policy-making, while the second part considers a wide range of policy areas, from economics to the environment, and security to the single market. Throughout the text, theoreticalapproaches sit side by side with the reality of key events in the EU, including enlargement, the ratification of the Lisbon Treaty, and the financial crisis and resulting euro area crisis, exploring what determines how policies are made and implemented. In the final part, the editors consider trendsin EU policy-making and look at the challenges facing the EU. Exploring the link between the modes and mechanisms of EU policy-making and its implementation at national level, Policy-Making in the Europe Union helps students to engage with the key issues related to policy. Written by experts, for students and scholars alike, this is the most authoritative andin-depth guide to policy in the European Union.},
author = {Wallace, Helen and Wallace, William and Pollack, Mark A},
doi = {10.1177/0010414013516917},
file = {:Users/aguasti/Desktop/Mendely Organized Library/Wallace, Wallace, Pollack/Wallace, Wallace, Pollack - 2005 - Policy-Making in the European Union.pdf:pdf},
isbn = {0199689679},
issn = {0010-4140},
pages = {574},
pmid = {130137987},
title = {{Policy-Making in the European Union}},
url = {https://books.google.com/books?id=w6SbBQAAQBAJ&pgis=1},
year = {2005}
}
If anyone knows how I could remove the DOI from the bibliographic reference I would be extremely grateful
I am assuming that you want to have this done on the fly while knitting the PDF.
The way the references are rendered is controlled by the applied citation styles.
So, one way would be to change the citation style and in the YAML header to a style that does not include the DOI (note that for the PDF output you would need to add the natbib line).
bibliography: library.bib
citation_package: natbib
csl: somethingelse.csl
Alternatively, if you have to stick to a certain style, you could [modify the CSL-file] (https://www.zotero.org/support/dev/citation_styles/style_editing_step-by-step).
Example for elsevier-harvard.csl
You could just comment the relevant line in the CSL-file:
<if variable="DOI">
<!--<text variable="DOI" prefix="https://doi.org/"/> -->
</if>
Save this under a new name (e.g., elsevier-harvard_mod.csl)
and then re-run your example (here shortened)
---
title: "my paper"
author: "name"
date: \today
output: pdf_document
bibliography: library.bib
citation_package: natbib
csl: elsevier-harvard_mod.csl
---
I would like to remove the DOI from this reference #Wallace2005
# Bibliography {-}

Creating two table of contents with different depths in R Markdown

I created my lecture notes in pdf format using RMarkdown but it has many subheaders. Because of this, I want to create two different table of contents: first table of contents with 1 depth, then table of contents in 4 depth respectively.
Adding both toc_depth: 1 and toc_depth: 4 did not work.
My YAML header:
---
title: "Lecture Notes"
author: "x"
output:
pdf_document:
highlight: tango
toc: true
toc_depth: 4 #depth table of contents
number_sections: true
documentclass: article
classoption: a4paper
fontsize: 12pt
geometry: "right=1cm, left=1cm, top=1cm, bottom=3cm"
---
As far as I am aware, I don't believe two Table of Contents is possible. One thing you can try is if you don't want a certain heading numbered, you can do
## Including Plots {-}
Which heads it has a header, but doesn't number it in the TOC. Here is the two output differences
without {-}
with {-}
These can be used in places like the Preface, about the authors, etc.
This is not a perfect solution (maybe some with more knowledge could automate this).
The solution works if the intermediate latex file is kept and a short table of contents is manually added using the shorttoc package.
Adding shortdoc:
...
\documentclass[
]{book}
\usepackage{shorttoc}
...
And than adding it between title and TOC:
\shorttableofcontents{〈title 〉}{〈depth 〉}

Unable to force left align text in rmarkdown document

I'm using R markdown for a university assignment. I'd like to have questions number/letters left aligned on my document, but rmarkdown is adding spaces before "a)" and "b)", which I'd like to be aligned with the rest of my text.
---
title: "Untitled"
author: "dsn084"
date: "26 March 2017"
output: pdf_document
---
This is a paragraph.
a) this is part a.
b) this is part b.
And my output ...
As you are using output: pdf_document, the rmarkdown document will be converted into latex before pdf, so you can use latex instructions to accomplish that.
flushleft will do it. Example:
This is a paragraph.
\begin{flushleft}
a) this is part a.
b) this is part b.
\end{flushleft}

How can I import and use labels from one Stata file to the current?

I have file aa with a variable x which is labeled with value label x_lab. I would like to use this value label on the variable x of Stata file bb:
use bb, clear
label value x x_lab
How can I import the value label x_lab?
You can use label save, which saves value labels in a do-file:
label save x_lab using label.do
use bb, clear
do label.do
See Stata help for label.
This answer technique didn't work for me as I wanted the variable labels created with e.g. label var connected "connected household", not the value labels.
Instead I used this advice: http://statalist.1588530.n2.nabble.com/st-How-to-export-variables-window-td3937733.html
*************
sysuse auto, clear
log using mylog, name(newlog) replace
foreach var of varlist _all{
di _col(3) "`var'" _col(20) "`:var label `var''"
}
log close newlog
//translate from proprietary format
translate mylog.smcl mylog.txt, replace
!start mylog.txt
*************
To fix the labels that extended over multiple lines so they just used a single one, I then replaced the \n > for the oversized labels with nothing (in regex mode in atom). I could easily save into TSV from there.
Specifically:
Clean up header and footer text in the logfile output.
On Mac: use "\n" instead of "\r\n".
On Windows: first "\r\n -> ""
then whitespace at beginning "\r\n " --> "\r\n"
then convert whitespace with 3 or more spaces in middle to tabs " +" --> "\t"
(Edit manually additional errors on tab if there are still some left)
save as mylog.tsv
open in Excel, and use table of labels as needed.