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.

I declare a new arrow in TikZ via:

\pgfarrowsdeclarecombine{combined}{combined}{latex}{latex}{|}{|}

In the first example you see that the left left arrow doesn't end at the coordinate (0,0). How can I avoid this? Next to the first picture you see an example of PSTricks which represented the correct output.

In the second example the arrow produced by tikz looks weird.

%need latex->ps-pdf or xelatex

\documentclass{article}
\parindent0pt
\usepackage{tikz}
\usepackage{pstricks}
\usetikzlibrary{decorations.markings,arrows,calc}
\begin{document}
\par
First example
\par
\begin{tikzpicture}
\pgfarrowsdeclarecombine{combined}{combined}{latex}{latex}{|}{|}%
\draw[decoration={markings,%
                   mark=at position 0 with {\arrowreversed[scale=1]{combined}},
                   mark=at position 1 with {\arrow[scale=1]{combined}},
                   },
    postaction={decorate},line width=3pt,blue] (0,0)  -- (3,0);

\draw[yellow,line width=2pt] (0,0)  -- (3,0);
\end{tikzpicture}
\begin{pspicture}(0,0)(3,1)
 \psline[arrowscale=1.25,linecolor=blue,linewidth=3pt,arrowinset=0]{|<->|}(0,0)(3,0)
 \psline[linecolor=yellow,linewidth=2pt](0,0)(3,0)
\end{pspicture}
\par\kern1cm
Second example
\par
\begin{tikzpicture}
\pgfarrowsdeclarecombine{combined}{combined}{latex}{latex}{|}{|}%
\draw[red,line width=3pt,combined-combined] (0,0)  -- (3,0);
\draw[yellow,line width=2pt] (0,0)  -- (3,0);
\end{tikzpicture}
\begin{pspicture}(0,0)(3,1)
 \psline[linecolor=red,linewidth=3pt,arrowinset=0]{|<->|}(0,0)(3,0)
 \psline[linecolor=yellow,linewidth=2pt](0,0)(3,0)
\end{pspicture}
\end{document}

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

In the pgfmanual p.612 and p.615, this problem is directly addressed. You can simply add an offset to the inner arrow placement via

\pgfarrowsdeclarecombine[-1\pgflinewidth]{combined}{combined}{latex}{latex}{|}{|}

which seems to be working for your examples. But play around with the offset value for further adjustment. Also note that the latex arrow has a rather long tip so it looks like it is misplaced but change the offset to -1.3 and you will see that it is not.

share|improve this answer
    
Do you know how to fixed the problem with the first example? –  Marco Daniel Sep 10 '11 at 15:27
    
Actually, I have some doubts about the possibility of fixing that. The reason is that you use the combine version to obtain the new arrow tip and hence pgf just picks up two already defined arrow tips and simply concatenate them with the problem stated on page 612 in the manual regarding the right extent (which is the void you see in my opinion). If you want to use this combining option then (I think) you have to first modify the inner arrow tip and call it, say, modiftip and then use \pgfarrowsdeclarecombine{combined}{combined}{modiftip}{modiftip}{|}{|} –  percusse Sep 10 '11 at 15:50
add comment

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.