Tell me more ×
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.

I have an ellipse in a TikZ diagram and I would like to indicate a direction using an arrow head, but do not wish to draw the path leading up to the arrow head.

I currently have

\draw[->] (0,2) arc (90:45:1 and 2);
\draw (0,0) ellipse (1 and 2);

but I'd like the arc leading up to the arrow to be invisible (so it is not redrawing over the ellipse), so that it's just the head showing.

What is the best way to achieve this?

share|improve this question

2 Answers

up vote 7 down vote accepted

You can use path decorations:

\documentclass{article}
\usepackage{tikz}

\usetikzlibrary{decorations.markings}

\begin{document}

\begin{tikzpicture}[decoration={
  markings,
  mark=at position 0.2 with {\arrow{<}}}
]
  \draw[postaction={decorate}] (0,0) ellipse (1 and 2);
\end{tikzpicture}

\end{document}
share|improve this answer

Any easy to type but slightly hackish solution is to use a very small path for the arrow:

\begin{tikzpicture}
    \draw (0,0) ellipse (1 and 2);
    \draw[->] (0,0) ++ (45:1 and 2) arc (45:44.9:1 and 2);
\end{tikzpicture}

To get a flexible "clean" solution one can use markings:

\usetikzlibrary{decorations.markings}
\begin{tikzpicture}
    \draw (0,0) ellipse (1 and 2);
    \draw[decoration={markings,mark=at position 1 with {\arrow{>}}},decorate]
        (0,2) arc (90:45:1 and 2);
\end{tikzpicture}

The marking can also be directly applied to the ellipse (which is drawn counterclockwise from 0 degrees):

\begin{tikzpicture}
    \draw [decoration={markings,mark=at position 1/8 with {\arrowreversed{>}}},postaction={decorate}] 
        (0,0) ellipse (1 and 2);
\end{tikzpicture}

See Section 27.6 of the TikZ manual for the general syntax of the mark option.

share|improve this answer
Yes, that should work, but it doesn't seem like a clean solution (not that I currently have one). Another non-clean solution is to just remove the ellipse command and get tikz to draw an arc the entire perimeter of the ellipse, but I'd like to know a general solution to my problem of drawing arrow heads. – bryn Aug 7 '10 at 9:52
I added a second solution that is more flexible. – Caramdir Aug 7 '10 at 10:12

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.