I have a R file running a Rmd file to generate a pdf (rmarkdown::render
).
I use fancyhdr to tune the layout, header,...
As it is dynamic, I also use parameters (params
).
My question is, which command should I use to split the title in two lines ?
I refer to that post, but none of the proposed solutions work. And I don't know if it is a question for R people or for those of Latex/Lualatex...
Here is my code in R, you may use your own path
and fname
(figure name) if you want to reproduce the code.
rmarkdown::render("your path/Fig_generator.Rmd",
output_file = file.path(your path, paste("test",".pdf", sep = "")),
encoding = "native.enc",
params = list(
dyntitle = "This is a very very very very long line that I would like | to split where the | is",
dynsubtitle = "Some subtitle text",
dynfigno = "Fig. xx-x",
dynprojectname ="xxx / xxx",
dynimage = paste("your path/",fname,".","pdf",sep = "")))
Here is the code in Rmd:
---
#knit: (function(inputFile, encoding) { rmarkdown::render(inputFile, ) })
template: default-1.17.0.2.tex
output:
pdf_document:
latex_engine: lualatex
keep_tex: true
documentclass: article
mainfont: Arial
fontsize: 12pt
params:
dyntitle: !r dyntitle
dynsubtitle: !r dynsubtitle
dynfigno: !r dynfigno
dynprojectname: !r dynprojectname
dynimage: !r dynimage
title: "`r params$dyntitle`"
subtitle: "`r params$dynsubtitle`"
figureno: "`r params$dynfigno`"
projectname: "`r params$dynprojectname`"
image: "`r params$dynimage`"
---
\includegraphics[width=7.27in]{`r params$dynimage`}
Can someone help me with that, please ?