2

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:

\documentclass{article}

\usepackage{etoolbox}
\usepackage{tikz}
\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);}}

\begin{document}
\listoffigures

\section{Sample}
This is a triangle \mytriangle{mycolor}.

\begin{figure}[htp]
  \centering
  A figure
  \caption{A triangle \mytriangle{mycolor}.}
\end{figure}

\end{document}
3

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.