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.

How do I make a custom arrowhead in Tikz having a perpendicular bar before a triangle 45? I would also like to adapt this solution to a bar before a square, open square, etc.

For example, imagine arrow coming from (0,0) to (10,0), then the arrowhead would be a filled triangle roughly (9,1) -- (10, 0) -- (9, -1). I want to add a bar, which is a filled rectangle roughly (8.5,1) -- (8.6, 1) -- (8.6, -1) -- (8.5, -1).

I guess I can use pgfdeclarearrow to declar a bar somehow and then pgfarrowsdeclarecombine* to combine it with existing arrows?

share|improve this question
    
Could you draw a picture using MS paint or something? –  John Kormylo Dec 16 '13 at 16:03
    
I think you may want to have a look to Can I combine arrow tips in TikZ/pgf? –  Claudio Fiandrino Dec 16 '13 at 16:04
    
@JohnKormylo: edited. –  Neil G Dec 16 '13 at 16:24
    
@ClaudioFiandrino: Thanks, I missed that question, so I'm now closer to a solution. –  Neil G Dec 16 '13 at 16:25

1 Answer 1

up vote 12 down vote accepted

With the new arrows.meta library in the CVS version of pgf, combining arrow heads is pretty simple and can be done in advance or in-line:

\documentclass[border=0.125cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\tikzset{%
  tipA/.tip={Bar[sep]Triangle[open,angle=45:4pt]},
  tipB/.tip={Bar[sep]Square[open]}
}
\begin{document}

\begin{tikzpicture}
\draw [-tipA] (0,0)  -- +(1,0);
\draw [-tipB] (0,.5) -- +(1,0);
% in-line
\draw [-{Bar[sep]Triangle[angle=45:4pt]}] (0,1)   -- +(1,0);
\draw [-{Bar[sep]Square[]}]   (0,1.5) -- +(1,0);
\end{tikzpicture} 

\end{document}

enter image description here

Just for Thomas:

\documentclass[border=0.125cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{fadings}
\usetikzlibrary{arrows.meta}
\tikzset{%
  tipA/.tip={Bar[sep]Triangle[open,angle=45:4pt]},
  tipB/.tip={Bar[sep]Square[open]},
  legs/.tip={Straight Barb[reversed]},
  long legs/.tip={Straight Barb[reversed,angle=30:4pt]},
  hat/.tip={Bracket[reversed,sep=-1pt]Rectangle[]},
  arms/.tip={Bar[sep]},
  head/.tip={Circle[]},
  skirt/.tip={Triangle[reversed]},
  arms down/.tip={Straight Barb[angle=35:4pt]},
  long hair/.tip={Arc Barb[length=9pt,width=6pt,sep=-9pt]Arc Barb[length=9pt,width=5pt,sep=-9pt]Arc Barb[length=9pt,width=7pt]}
}

\begin{document}



\begin{tikzpicture}[x=0.5cm,y=0.5cm]
\draw [legs-tipA] (0,0)  -- +(0,1);
\draw [legs-tipB] (1,0) -- +(0,1);
% in-line
\draw [legs-{Bar[sep]Triangle[angle=45:4pt]}] 
  (2,0)   -- +(0,1);
\draw [legs-{Bar[sep]Square[]}]   
  (3,0) -- +(0,1);
\draw [legs-{arms[]head[sep=-1pt]hat[]}]   
  (4,0) -- +(0,1);
\draw [{long legs[]skirt[sep=-2pt]}-{arms down[]head[sep=-8.5pt]long hair[]}]   
  (5,0) -- +(0,1);
\end{tikzpicture} 

\end{document} 

enter image description here

share|improve this answer
    
installation of arrows.meta –  Neil G Dec 16 '13 at 18:05
    
if you bend your head to the right, you will see a bunch of tall people with short arms. –  Thomas Dec 16 '13 at 19:25
1  
@Thomas and possibly with a hat. –  Mark Wibrow Dec 16 '13 at 19:53
2  
Your edit is awesome ! –  Thomas Dec 16 '13 at 19:57
    
Got it working, thank you!! Your people example is not only cute, but it's very instructive. –  Neil G Dec 16 '13 at 22:33

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.