I'm trying to create a question in RMarkdown, using r-exams
, based on the Venn diagrams package from TikZ https://www.ctan.org/pkg/venndiagram. I can't get it to work properly.
Here part of my code:
grafika01<-'
\\begin{tikzpicture}
\\begin{venndiagram3sets}
\\fillNotABC
\\end{venndiagram3sets}
\\end{tikzpicture}
'
What's more,
```{r grafica01, echo = FALSE, results = "asis"}
include_tikz(grafika01, name = "grafiko1", markup = "markdown",format = typ,library =
c("arrows"),packages =
c("booktabs","tikz","pgfplots","venndiagram","calc","babel","xkeyval","etoolbox"),
width = "7cm")
```
Thank you.
(Note: This is really more about combining {tikz}
and {venndiagram}
and does not have much to do with R/exams.)
If you want to put a {venndiagram3sets}
into a {tikzpicture}
then you need to include it in a \node{...};
:
grafika01 <- '
\\begin{tikzpicture}
\\node{
\\begin{venndiagram3sets}
\\fillNotABC
\\end{venndiagram3sets}
};
\\end{tikzpicture}
'
And this LaTeX code can then be compiled successfully, e.g., using include_tikz()
:
include_tikz(grafika01, name = "grafiko1", markup = "markdown", format = typ,
packages = "venndiagram", width = "7cm")