RMarkdown placement of in_header code and package imports (citation)

Hi,

I am writing a seminar paper for a course at my university using R Markdown.
For citation I use biblatex and the authoryear-icomp citation style.
The (shortened) YAML header of my .Rmd file looks like this:

output:
  bookdown::pdf_document2:
    includes:
      in_header: "tex/preamble.tex"
      before_body: "tex/before_body.tex"
    citation_package: biblatex
    toc: false
    keep_tex: true
bibliography: ["bib/references.bib", "bib/packages.bib"]
biblio-style: authoryear-icomp
documentclass: scrartcl

I would like to increase the space between the single entries in the bibliography, for which I have found possible solutions here.
The issue is that I cannot simply paste the code in the preamble.tex file because of the way RMarkdown or Pandoc create the .tex file.

The following is a snippet from the resulting .tex file:

% --- other stuff --- %
\newcommand{\iid}{\overset{\text{i.i.d.}}{\sim}}
\newcommand{\ind}{\overset{\text{ind.}}{\sim}}
% preamble.tex ends here


\usepackage{booktabs}
\usepackage{longtable}
\usepackage{array}
\usepackage{multirow}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{colortbl}
\usepackage{pdflscape}
\usepackage{tabu}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage[normalem]{ulem}
\usepackage{makecell}
\usepackage{xcolor}
\ifLuaTeX
  \usepackage{selnolig}  % disable illegal ligatures
\fi
\usepackage[style=authoryear-icomp,backend=biber,maxbibnames=999,maxcitenames=2,uniquelist=false,dashed=false,isbn=false,doi=false,eprint=false]{biblatex}
\addbibresource{bib/references.bib}
\addbibresource{bib/packages.bib}
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same} % disable monospaced font for URLs
\hypersetup{
  hidelinks,
  pdfcreator={LaTeX via pandoc}}

\author{}
\date{\vspace{-2.5em}}

\begin{document}

Thus, if I added e.g. \setlength\bibitemsep{1.5\itemsep} to preamble.tex, this line of code would be added before the import of the biblatex package.
But the command needs to be placed after the import and before \begin{document}.

Does anyone have an idea of how to deal with this problem?

Cheers,
David

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.