I have a tikz triangle to which I am trying to add the border. For some reason, I see the black border on two sides but not on the third. Can you please help me figure out why?

Below is the MWE:


\definecolor{mycolor}{RGB}{255,255,0}       % use mycolor to give a specific color to tikz

%\newrobustcmd*{\mytriangle}[1]{\tikz{\filldraw[draw=red,fill=#1] (0,0) --
%(0.2cm,0) -- (0.1cm,0.2cm);}}

\newrobustcmd*{\mytriangle}[1]{\tikz{\draw[thick, fill=mycolor] (0,0) -- (0.2cm,0) -- (0.1cm,0.2cm);}}


This is a triangle \mytriangle{mycolor}.

  A figure
  \caption{A triangle \mytriangle{mycolor}.}


Close the path:

(0,0) -- (0.2cm,0) -- (0.1cm,0.2cm) -- cycle;

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.