r - Using both in_header and header_includes in Rmarkdown and knitr -
i have long .txt file contains packages , settings want used in rmarkdown file. want add statements header, based on output of r calculations. in particular case want add titlegraphic located in directory, this:
working directory |--- reports |----| my_report.rmd |--- www |----| image.png
so header of rmarkdown file like:
output: beamer_presentation: keep_tex: true includes: in_header: header.txt header-includes: - \titlegraphic{\includegraphics[width=0.3\paperwidth]{`r paste0("dirname(getwd()),"image.png")`}}
if 1 of statements included (in_header or header-includes), work fine. when use them both, the content of header-includes seems overwritten. example given in files below, upon inspecting resulting .tex file, find \usepackage{fancyhdr}
in header, there no mention of `\titlegraphic' expression.
header.txt
\usepackage{fancyhdr}
example.rmd
title: example 1 output: beamer_presentation: keep_tex: true includes: in_header: header.txt header-includes: \titlegraphic{\includegraphics[width=0.3\paperwidth]{`r paste0("just_an_example_","logo.png")`}} --- ### test
i think put in header-includes
:
--- title: example 1 output: beamer_presentation: keep_tex: true header-includes: - \titlegraphic{\includegraphics[width=0.3\paperwidth]{`r paste0("just_an_example_","logo.png")`}} - \input{header.txt} ---
does work? can't reproduce example.
Comments
Post a Comment