I am looking to produce a tikz figure with a node triangle. Most ressources I have found online use \usetikzlibrary{shapes}
and its regular polygon
. Rmarkdown seems unable to use it.
This will work in overleaf :
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\node [draw, circle,minimum size=1cm,thick] (cir) at (0,0) {Test};
\node [draw,regular polygon, regular polygon sides=3, inner sep=0pt, minimum size=1cm,thick] (tri) at (0, -2) {Test};
\end{tikzpicture}
\end{figure}
\end{document}
but not in Rmarkdown.
---
title: "Untitled"
author: "My name"
output: pdf_document
header-includes:
- \usepackage{tikz}
- \usetikzlibrary{shapes}
---
```{tikz}
\begin{tikzpicture}
\node [draw, circle,minimum size=1cm,thick] (cir) at (0,0) {Test};
\node [draw,regular polygon, regular polygon sides=3, inner sep=0pt, minimum size=1cm,thick] (tri) at (0, -2) {Test};
\end{tikzpicture}
```
I received this error.
processing file: tests.Rmd
! Package pgfkeys Error: I do not know the key '/tikz/regular polygon' and I am
going to ignore it. Perhaps you misspelled it.
Quitting from lines 11-15 (tests.Rmd)
Erreur : LaTeX failed to compile tikz2b045722257b.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See tikz2b045722257b.log for more info.
shapes.geometric
instead ofshapes
?