short curly braces with tikz
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}
\pgfdeclaremetadecoration{raisedbrace}{initial}{%
\state{initial}[width=\pgfmetadecoratedpathlength]{%
\decoration{brace}%
\pgfsetdecorationsegmenttransformation{%
\pgftransformyshift{\pgfmetadecorationsegmentamplitude}%
}
\beforedecoration{
\pgfpathmoveto{\pgfpointmetadecoratedpathfirst}
\pgfpathlineto{\pgfpointadd{%
\pgfpointmetadecoratedpathfirst%
}{%
\pgfpointpolar{\pgfdecoratedangle+90}{\pgfmetadecorationsegmentamplitude}%
}%
}%
}%
\afterdecoration{%
\pgfpathlineto{\pgfpointmetadecoratedpathlast}%
\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}
This should help you:
\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}