TeX - LaTeX Asked on July 14, 2021
I have two file 1. index.rmd file and the other is 2.Preamble.tex file
I want to delclare a variable in index.rmd i.e.
a <- 'Start and end with single quote'
I want to pass the above variable in preamble.tex
usepackage{fancyhdr}
newcommandCenterHeader{>>>>**a(variable)**<<<<<}
It can be an rmd file or a r file
how do I achieve this
First, create preamble.Rnw
:
usepackage{fancyhdr}
newcommandCenterHeader{Sexpr{a}}
Then in index.Rmd
, compile preamble.Rnw
after you have created a
:
```{r}
a <- 'Start and end with single quote'
```
```{r, include=FALSE}
xfun::Rscript_call(function() {
knitr::knit('preamble.Rnw', envir = list(a = a)
})
```
This will generate preamble.tex
.
Answered by Yihui Xie on July 14, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP