I'm trying to draw a simple equilateral triangle with rounded corners in Tikz.
However, I can't get the rounded corners correct.
I have the following MWE which draws the triangle:
\documentclass{article}
\usepackage{pgf}
\usepackage{tikz}
\usepackage{xcolor}
\usetikzlibrary{arrows,shapes,snakes,automata,backgrounds,petri}
\begin{document}
\begin{tikzpicture}
\draw [fill=gray!20] (0,0)--(1,0)--(0.5,1)--cycle;
\end{tikzpicture}
\end{document}
I've tried this to get rounded corners, but it has a very strange result:
\documentclass{article}
\usepackage{pgf}
\usepackage{tikz}
\usepackage{xcolor}
\usetikzlibrary{arrows,shapes,snakes,automata,backgrounds,petri}
\begin{document}
\begin{tikzpicture}
\draw [rounded corners=10mm,fill=gray!20] (0,0)--(1,0)--(0.5,1)--cycle;
\end{tikzpicture}
\end{document}
Any idea how to get simple rounded corners for the three corners of the triangle?
P.S. I'm not sure which libraries are needed, so I've left them all for now but I know this is probably not needed.
Best Answer
Make the radius of the
rounded corners
smaller. Remove=10mm
and you will see the instant effect. Also, in your case, I find no need to load thexcolor
package since it is used internally bytikz
, unless, as noted by Alain Matthes, you use some of its options for naming your colors. You can uncomment it if you like. The libraries are not needed here, too, so I commented them out.Here is your figure when the
10mm
is dropped.And here is one with scaling (not really necessary, just for demonstration purposes).
Here I have scaled the figure up to 3 since your figure is too small.
To make a point, see what happens when I scale the figure up by 5 and set
rounded corners=10mm
.