TikZ libraries in bookdown
It turns out that you can simply put the \usetikzlibrary{...}
command directly before the \begin{tikzpicture}
and everything works fine :)
Using tikz in html_document using RMarkdown
I've just discovered that you can add tikz code in the code chunk of Rmarkdown when you modify the engine option :
---
output: html_document
---
Some picture
```{r,engine='tikz'}
\begin{tikzpicture}
\draw (0,0) circle (2cm);
\end{tikzpicture}
```
The problem is that the figure is pixelized and the scale is not respected. One way to solve this may be to change the extension of the figure output (to pdf) and the width and the height with the chunk options (e.g. equals to 3 inches) :
```{r,engine='tikz',fig.ext='pdf',fig.width=3}
\begin{tikzpicture}
\draw (0,0) circle (2cm);
\end{tikzpicture}
```
I'm sure there are better solutions but it's an easy way to use tikz code for an html output.
Cannot add tikz code snippet in my .Rmd post using blogdown
This turns out to be an issue in knitr which I just fixed on Github (I'm not sure if it is a bug of pdflatex
). You may try
remotes::install_github('yihui/knitr')
Note that you will need to install two additional R packages, magick and pdftools, if they haven't been installed yet.
Related Topics
Screening (Multi)Collinearity in a Regression Model
What Are Some Good Books, Web Resources, and Projects for Learning R
Scale_Color_Manual Colors Won't Change
Which Library Could Be Used to Make a Chord Diagram in R
Shiny Doesn't Show Me the Entire Selectinput When I Have Choices > 1000
Bookmarking and Saving the Bookmarks in R Shiny
R Aggregate Data in One Column Based on 2 Other Columns
Weird As.Posixct Behavior Depending on Daylight Savings Time
Merge Two Dataframes If Timestamp of X Is Within Time Interval of Y
Correlation Between Na Columns
R: How to Get the Last Element from Each Group
R: Expand and Fill Data Frame by Date in Series
Recode Categorical Factor with N Categories into N Binary Columns