Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My question is similar to this one, but I am trying to draw a simple black filled diamond at the beginning of a path, just like in the UML aggregate notation. Here is a minimal working example:

\documentclass{standalone}
\usepackage{tikz}

\usetikzlibrary{shapes, arrows, chains, decorations.markings,intersections,calc}

\begin{document}
    \begin{tikzpicture}
        \node (a) at (0,0) {a};
        \node (b) at (2,0) {b};
        \path (a.east) to node [near start, yshift=1em] {} (b.west); 
        \draw [<-,>=diamond] (a.east) -- (b.west);
    \end{tikzpicture}
\end{document}

but this produces a path with a diamond that has an arrow at the front, how do I get rid of the arrow?

E.g. turn <>----> into <>----

Update:

It seems I this behaviour is caused by the tikzset from this question, which I still had in my code. After removing it, I got the desired behaviour. So I change my question: What causes the arrow had to appear or disappear, and how can I change between both versions?

Update 2: I have updated the question with a MWE and changed the explanation to avoid some of the confusion. The MWE actually produces the desired result of my original question and I am not able to reproduce the problem which I described in the cancelled text. Given all the confusion I think the actual question is this:

How can I produce each of the following UML variants for aggregation see here:

  • <>---- (this is produced by my MWE)
  • <>---> (arrow at right end)
  • <>---* (circle at right end)
share|improve this question
1  
Please turn this into a MWE including \documentclass and the appropriate packages that sets up the problem as I can't reproduce the problem you are experiencing. That is \draw [<-, >=diamond] (0,0) -- (0,1); produces the desired results. –  Peter Grill Feb 12 at 21:23
    
@lanoxx have you had a chance to make a MWE yet? –  Paul Gessler Mar 2 at 4:59
    
@lanoxx The link to "[this]" question is missing. –  Stefan Kottwitz Mar 3 at 11:13
    
Fixed the this link. @Paul: For MWE: Just take the \tikzset{} part from the accepted answer under 'this one' and combine it with my sample. You will see that the arrow head will appear. –  lanoxx Mar 3 at 13:48
    
@lanoxx, I have done that, and I get ! Package pgf Error: No shape named a is known. amongst other errors. Please provide a proper MWE so we aren't left guessing. –  Paul Gessler Mar 29 at 23:20

1 Answer 1

up vote 6 down vote accepted

You can make use of the arrows and arrows.meta libraries of TikZ. See section 16 in the TikZ Manual. Using this approach you can customize the length, width etc. of the arrow tips as well.

\documentclass[tikz,border=2pt]{standalone}
\usepackage{tikz}

\usetikzlibrary{arrows,arrows.meta}

\begin{document}
  \begin{tikzpicture}
    \node (a) at (0,0) {a};
    \node (b) at (2,0) {b};
    \draw [{Diamond}-] (a.east) -- (b.west);

    \begin{scope}[yshift=-1cm]
      \node (a) at (0,0) {a};
      \node (b) at (2,0) {b};
      \draw [{Diamond}-{Stealth}] (a.east) -- (b.west);
    \end{scope}

    \begin{scope}[yshift=-2cm]
      \node (a) at (0,0) {a};
      \node (b) at (2,0) {b};
      \draw [{Diamond}-{Circle}] (a.east) -- (b.west);
    \end{scope}
  \end{tikzpicture}
\end{document}

This gives the output

Output

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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