4

I want something like this, but I can't make it in a simple and elegent way.

line segment bounded by ticks at end points[![][1]][1]

A similar picture placed below can be plotted using |-|, so I wonder if there is a similar way.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\draw[|-|] (0,0) -- (2,0);
\end{tikzpicture}
\end{document}

enter image description here

1 Answer 1

6

Use [left] or [right] option for arrow heads; see Page 193 of this pgfmanual (version 3.0.1).

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}
  \draw[{|[right]}-{|[left]}, blue] (0,1) to (1,1);  % for your purpose
  \draw[|-|, red] (0,0) to (1,0);
\end{tikzpicture}
\end{document}

tikz-interval-half

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .