# short curly braces with tikz

Is there a way to get curly braces with tikz which look more like this one?

At the moment I'm using the following to get curly braces:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\usetikzlibrary{decorations.pathreplacing}

\draw[decorate,decoration={brace,amplitude=0.75cm}]  (0,0) -- (1,0);
\draw[decorate,decoration={brace]  (0,0) -- (1,0);

\end{tikzpicture}
\end{document}


But that results in:

The point is that I need short curly braces with kind of a high amplitude which still look like braces.

Here is a primitive meta-decoration, but it is not as general as the standard brace such as raise,mirror etc. won't work. However, the brace amplitude and other local brace options are passed and would be available as I tried to show below. The new raise amount is controlled with meta-amplitude key.

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.pathreplacing}

\decoration{brace}%
\pgfsetdecorationsegmenttransformation{%
}
\beforedecoration{
}{%
}%
}%
}%
\afterdecoration{%
\pgfusepath{stroke}
}
}
}
\begin{document}
\begin{tikzpicture}
\draw[style=help lines] (-1,-1) grid[step=1cm] (3,3);
\draw[decorate,decoration={raisedbrace,amplitude=2mm,meta-amplitude=4mm}]  (0,1) -- (2,2);
\draw[decorate,decoration={raisedbrace,amplitude=4mm,meta-amplitude=1cm}]  (0,-1) -- (2,-0.5);
\draw[decorate,decoration={raisedbrace,amplitude=1cm,meta-amplitude=5mm}]  (2,3) -- (2,-0.5);
\end{tikzpicture}
\end{document}


• Thank you very much. I can emulate the "raise" option by adjusting the nodes (like \draw... ([yshift=1cm]node.east)...), but how to change the thickness? Do you have another suggestion? Aug 10, 2014 at 15:05
• @antonius Just put \pgfsetlinewidth{\pgflinewidth} before \pgfusepath{stroke} then you can put thick etc. inside \draw options and it should obey. Aug 10, 2014 at 15:54

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\begin{tikzpicture}[scale=1]
\draw [decorate,decoration={brace,amplitude=10pt},xshift=-4pt,yshift=0pt]
(0.5,0.5) -- (5.0,0.5) node [black,midway,xshift=-0.6cm]
{};
\node at (2.65,1.0) {text};
\end{tikzpicture}
\end{document}


The length of the brace can be altered with the values in the \draw command (0.5,0.5) -- (5.0,0.5). Similarly the text position need to be altered.

## Update

Varying the amplitude, we get something like this:

### Code

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\begin{tikzpicture}[scale=1]
\draw [decorate,decoration={brace,amplitude=14pt},xshift=-4pt,yshift=0pt]
(0.5,0.5) -- (5.0,0.5) node [black,midway,xshift=-0.6cm]
{};
\node at (2.65,1.2) {text};
\end{tikzpicture}
\end{document}

• Thanks but for short curly braces it will result in the same mutation as above (e.g. "(0.5,0.5) -- (1.5,0.5)" ) Aug 6, 2014 at 16:52