Usually, when drawing a path with an arrow tip in TikZ, we want the tip to end precisely at the last point of the path, and this is what TikZ does by default. However, with some specific arrow tips, one may wish to control a little more precisely the position of the arrow tip: for instance you may want the base of the arrow to be positioned at the last point of the past instead of the tip.
Here is an example drawing an interval on the real line:
\documentclass{article}
\usepackage{tikz,amssymb}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}
\draw (-3,0) -- (3,0) node[anchor=south] {$\mathbb{R}$};
\foreach \x in {-1,0,1} \draw (\x,2pt) -- (\x, -2pt) node[anchor=north] {$\x$};
\draw[thick,blue,[-[] (-1,0) -- (1,0);
\end{tikzpicture}
\end{document}
Is it possible to make sure that the closing square bracket [
is positioned on the tick corresponding to x=1
? Of course, it is possible to adjust it manually but this does not seem to be a satisfactory solution.
Best Answer
I would declare a new arrow tip based on the old one but setting
\pgfarrowsleftextend
to0pt
.The syntax for defining arrow tips is explained in section 74 "Arrow Tips" of the PGF manual.
For use in a plot (either using PGFPlots or the
\draw plot
command), you might want a plot mark instead of an arrow tip: