我有一个 tikz 三角形,我想给它添加边框。不知为何,我看到两边都有黑色边框,但第三边却看不到。你能帮我找出原因吗?
以下是 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}
答案1
关闭路径:
(0,0) -- (0.2cm,0) -- (0.1cm,0.2cm) -- cycle;