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.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
\begin{tikzpicture}[scale=1.5,line width=1]
%
\tikzstyle{a}=[
    decoration={markings,mark=at position 1 with {\arrow[scale=1.5]{>}}},
    postaction={decorate},
    shorten >=9pt, shorten <=9pt,
    ] 
\coordinate (u1) at (1,1);
\coordinate (u2) at (2,2);
\coordinate (u3) at (1,0);
\node[outer sep=10pt,rectangle,draw] at (u1) {\qquad};
\node[outer sep=10pt,rectangle,draw] at (u2) {\qquad};
\node[outer sep=10pt,rectangle,draw] at (u3) {\qquad};
\draw[a] (u1)--(u2);
\draw[a] (u3)--(u1);
\end{tikzpicture}
\end{document}

arrows

share|improve this question

1 Answer 1

up vote 4 down vote accepted

You are shortening the arrows by 9pt and decorating at position 1. Hence arrow tips are at position 1 and the segment is shorter. You have to decorate at appropriate position (like 0.83) which will be ugly anyway. Here is an alternative:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
\begin{tikzpicture}[scale=1.5,line width=1]
%
\tikzstyle{a}=[
    %shorten >=9pt, shorten <=9pt,
    decoration={markings,mark=at position 1 with {\arrow[scale=1.5]{>}}},
    postaction={decorate},    
    ]
%\coordinate (u1) at (1,1);
%\coordinate (u2) at (2,2);
%\coordinate (u3) at (1,0);
\node[outer sep=5pt,rectangle,draw] at (1,1)(u1)  {\qquad};
\node[outer sep=5pt,rectangle,draw] at (2,2) (u2)  {\qquad};
\node[outer sep=5pt,rectangle,draw] at  (1,0) (u3)  {\qquad};
\draw[a] (u1)--(u2);
\draw[a] (u3)--(u1);
\end{tikzpicture}
\end{document}

enter image description here

Here, I have adjusted the outer sep (any way you keep them high) and instead of coordinates I have directly defined nodes so that nodes can be connected (not the coordinates). By adjusting outer sep suitably, you can change the length of arrows. If you have to connect some thing to the center of these nodes, use (u1.center) etc.

share|improve this answer
    
Thanks Harish Kumar that worked perfectly in my larger diagram, but I don't quite understand it. So details would be nice. –  Don Kreher Jan 20 at 2:34
    
@DonKreher Can you be specific on which part you didn't understand? –  Harish Kumar Jan 20 at 2:36
    
@ Harish Kumar. Well what you have added above helps. I guess I don't understand this use of nodes. It seemed to me that defining a node at a coordinate vs associating a coordinate at a node should be the same. Apparently they are not. I must have some fundamental misunderstanding. What should I read? –  Don Kreher Jan 20 at 3:12
    
@DonKreher nodes have inner and outer seperations. while coordinates don't. Read: tex.stackexchange.com/…. –  Harish Kumar Jan 20 at 22:27

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.