So, I'm a university student and thus I'm often tasked to write short reports (usually a couple of pages) on different topics. Admittedly, using MS Word would be more than sufficient in most cases. However, I still like to give these short documents a nice layout so currently I am using LuaLaTeX and Overleaf with a bit of customization:
\documentclass[11pt]{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{german}
\usepackage[vmargin=1in,hmargin=1.25in]{geometry}
\usepackage{xcolor}
\usepackage{titlesec}
\setmainfont{merriweather}
\setsansfont{Montserrat}
% Define blue colours
\definecolor{Blue}{HTML}{2F5496}
% Set formats for each heading level
\titleformat{\section}{\Large\sffamily\color{Blue}}{}{0pt}{}
\titleformat{\subsection}{\large\sffamily\color{Blue}}{}{0pt}{}
\titlespacing\section{0pt}{24pt plus 4pt minus 2pt}{6pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{2pt plus 2pt minus 2pt}
\usepackage{parskip}
\title{Example}
\author{N N}
\date{\today}
\begin{document}
\section{Part 1}
\subsection{whats the answer to life the universe and everything?}
Lorem ipsum...
I usually tweak the headings a bit, depending on use case (the example above was used for a sort of "Q&A" document).
Now I am being tasked to write a short statistical analysis which I chose to do using R. The document is required to contain part of the source code as well graphs/plots. So my first thought was using an R notebook / R markdown.
Crucially though, I'd like to keep my current TeX-template as described above. Ideally, the created plots (ggplot2) should also follow along (e.g. using the merriweather font).
So, what would be the best way to integrate a (Lua)LaTeX template in R markdown? And what would be the best solution if one wanted to scale this issue up (i.e. writing a larger thesis were graphs, text and code are combined)?
On the other hand: Maybe the best way to do this, is to export the R-created graphs and insert them manually in LaTeX and copy&paste the source code.. I'm not sure.

