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.

When I place reversed arrow heads as decorations I can do it in two different ways. The two ways place then at different positions, none of them is correct. In the following code I use both of them, to make you see the different placements, but none of the placements is the symmetric version of the non-reversed arrowhead. You can see it on the vertical axis.

I want the picture to be symmetric. I can do it with breaking the paths in two parts. Is there a slight modification of this code, that would make it symmetric? (manually changing .25 is not a good idea, since the paths have different lengths)

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}

\begin{tikzpicture}[decoration={markings,
  mark=at position .25 with {\arrowreversed{latex}},
  mark=at position .25 with {\arrow{latex reversed}},
  mark=at position .75 with {\arrow{latex}}}]
\clip (-3.2,-2.2) rectangle (3.2,2.2);
\draw[help lines] (-3.2,-2.2) grid (3.2,2.2);
\draw[thick,postaction={decorate}] (0,-2) -- (0,2);
\foreach \c in {-2,-1.5,-1,-.2,1}{
  \pgfmathparse{.33*exp(\c/-6)}
  \draw[x=\pgfmathresult cm,postaction={decorate},smooth,samples at={-9,-7,...,9}] plot
  (\x,{\x*(ln(abs(\x)*\pgfmathresult)*2 + \c)*\pgfmathresult});}
\end{tikzpicture}

\end{document}

Here is the picture


(Added by Andrew Stacey): Here's a minimal working example of the problem

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}

\begin{tikzpicture}
\draw[thick,postaction={decorate},decoration={markings, mark=at position .25 with {\arrowreversed{latex}}}] (0,0) -- (2,0);
\draw[thick,postaction={decorate},decoration={markings, mark=at position .25 with {\arrow{latex reversed}}}] (0,-.2) -- (2,-.2);
\draw[thick,postaction={decorate},decoration={markings, mark=at position .75 with {\arrow{latex}}}] (2,-.4) -- (0,-.4);


\end{tikzpicture}

\end{document}

with result:

reversed arrows

The question is to get a syntax which lines up one of the first two arrows with the third (note the direction of drawing of the lines in each case: the third is in the reverse direction to the other two).

share|improve this question
    
Welcome to tex.sx! You can always provide a link to your picture. –  Hendrik Vogt Feb 23 '11 at 10:48
    
It's usually a good idea to provide a full minimum working example (MWE) that can be directly compiled without modification. I edited the code for you to add the preamble: if you notice some discrepancies you can always revert back to the original version. See also this question for more information on MWEs: meta.tex.stackexchange.com/questions/228/… –  Martin Tapankov Feb 23 '11 at 10:55
    
Tamas: I've taken the liberty of simplifying your code to get to the heart of the issue, but I added it rather than modifying what is already there. Hope that's okay! –  Loop Space Feb 23 '11 at 11:21

1 Answer 1

up vote 5 down vote accepted

You can declare a new arrow that's a combination of your original arrow head and an "empty arrow". That makes PGF throw away the \pgfarrowsrightextend and \pgfarrowsleftextend lengths that cause the offset with the original arrow heads. If you use these new arrow heads at the end of a line, they won't look very good because arrow heads need to extend a bit to fully cover the line underneath them (that's what the right and left extend is for).

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}

\begin{tikzpicture}

\pgfarrowsdeclarecombine{newlatex}{newlatex}{latex}{latex}{}{}

\draw[gray,thick,postaction={decorate},decoration={markings, mark=at position .75 with {\arrow{latex}}}] (2,0)  -- (0,0); % Original arrow
\draw[thick,postaction={decorate},decoration={markings, mark=at position 0.25 with {\arrowreversed{newlatex}}}] (0,-.4)--  (2,-.4);
\draw[thick,postaction={decorate},decoration={markings, mark=at position 0.75 with {\arrow{newlatex}}}] (2,-.6)-- (0,-.6);

\end{tikzpicture}

\end{document}

lines with arrow markings

share|improve this answer

Your Answer

 
discard

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