# How to scale brackets in Tikz

I am trying to draw a line with a closed interval indicated by square brackets super imposed on top of it. Here is my current code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath, amsfonts, tikz, amssymb}
\usetikzlibrary{arrows}

\begin{document}

\begin{tikzpicture}
\draw[<->, thick] (0, 0) -- (15, 0);
\draw[[-], no marks] (1, 0) -- (14, 0);
\fill[black] (5,0) circle (0.75mm) node[below=2mm] {$p(x_1)$};
\end{tikzpicture}

\end{document}


As you can see, the arrowheads aren't very big at all. The brackets are especially bad. I've tried looking elsewhere but I seem to be unable to fix the brackets.

• Welcome to TeX.SX! You should enclose [-] in braces: \draw[{[-]}, no marks] otherwise you will get some errors. – Phelype Oleinik Sep 28 '18 at 18:56
• Welcome to TeX.SE! Note that arrows is deprecated, use arrows.meta instead. And why are you using no marks here, isn't that pgfplots syntax? – user121799 Sep 28 '18 at 18:58

The arrows library got superseded by arrows.meta. Here, you can freely access all features, including the width, of arrow heads. (As pointed out by Phelype Oleinik, and as written in the manual, you need to enclose the arrow head by curly braces.) Below are twothree examples. The second and third examples are due to Phelype and shows one way of introducing short cuts.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}
\draw[{Latex[width=4mm]}-{Latex[width=4mm]}, thick] (0, 0) -- (15, 0);
\draw[{Bracket[width=4mm]}-{Bracket[width=4mm]}] (1, 0) -- (14, 0);
\fill[black] (5,0) circle (0.75mm) node[below=2mm] {$p(x_1)$};
\end{tikzpicture}

\begin{tikzpicture}[>={Bracket[width=6mm,line width=1pt,length=1.5mm]}]
\draw[{Latex[width=4mm]}-{Latex[width=4mm]}, thick] (0, 0) -- (15, 0);
\draw[<->] (1, 0) -- (14, 0);
\fill[black] (5,0) circle (0.75mm) node[below=2mm] {$p(x_1)$};
\end{tikzpicture}

\begin{tikzpicture}
\draw[>={Latex[width=4mm]},<->, thick] (0, 0) -- (15, 0);
\draw[>={Bracket[width=6mm,line width=1pt,length=1.5mm]},<->] (1, 0) -- (14, 0);
\fill[black] (5,0) circle (0.75mm) node[below=2mm] {$p(x_1)$};
\end{tikzpicture}
\end{document}


• Nice :) I'll intrude myself here and ask one thing: I was trying to do exactly that, but defining [ and ] as shortcuts for Bracket[width=4mm]. Something like \tikzset{]/.style={Bracket[width=1cm]}} so that OP's syntax can still be used. Can that be done? – Phelype Oleinik Sep 28 '18 at 19:06
• @PhelypeOleinik I added a standard way to do that. You can also do that locally, of course, in the first line do it for the Latex head and then for the bracket. That is, you could also do \draw[>={Latex[width=4mm]},<->, thick] (0, 0) -- (15, 0); \draw[>={Bracket[width=6mm,line width=1pt,length=1.5mm]},<->] (1, 0) -- (14, 0); in the last picture. I guess [ might be complicated but I never tried. – user121799 Sep 28 '18 at 19:12
• Ooh, this only works for the < and > characters, right? I was trying with [ :P – Phelype Oleinik Sep 28 '18 at 19:18
• @PhelypeOleinik Yes, [ has a special meaning. As you point out above, it needs to get shielded, so I do not dare to mess around with this character. – user121799 Sep 28 '18 at 19:19