In order to integrate a legend into the text of my pdf file, I want to extend the answer of a previous question on this site https://tex.stackexchange.com/a/196784/15140 in order to add in front of the diamond a line which is either dotted or dashed. Something looking:

prices are represented as -----<> and weights as - - -<>

How can I achieve this ?


Add an extra line and argument like:

\draw[#2] (-3,0.5) -- (0,0.5);

The extra argument can be used to control how the line is drawn. Change -3 as you wish so as to change the length of the line.


\newcommand{\sqdiamond}[2][fill=black]{\tikz [x=1.2ex,y=1.85ex,line width=.1ex,line join=round, yshift=-0.285ex]{ \draw  [#1]  (0,.5) -- (.5,1) -- (1,.5) -- (.5,0) -- (0,.5) -- cycle;
\draw[#2] (-3,0.5) -- (0,0.5);}}%

prices are represented as \MyDiamond[draw=red,fill=cyan]{dashed} and weights as \MyDiamond[draw=olive,fill=magenta]{loosely dashed}


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.