18

I know how to obtain a brace-decoration using TikZ. However, it has a style that does not match the braces in math-mode: while the latter comprise thicker and thinner line segments, the former is an evenly thick line.

Is it possible to obtain brace-decorations in TikZ that match the default CM braces?

Edit: the following shows the difference between the latex-brace and the TikZ-brace:LaTeX- and TikZ-curly brace

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
$\left\{
    \begin{tikzpicture}[baseline={(0,0)}]
        \draw[decoration={brace}, decorate] (0,-1) node {} -- (0,1);
    \end{tikzpicture}
    \right.$
\end{document}
Bubaya
  • 2,279

1 Answers1

22

The calligraphic brace from the calligraphy TikZ library was designed for just this reason.

\documentclass{article}
%\url{https://tex.stackexchange.com/q/372776/86}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,calligraphy}
\begin{document}
$\left\{
    \begin{tikzpicture}[baseline={(0,0)}]
        \draw[decoration={brace}, decorate] (0,-1) node {} -- (0,1);
        \draw[decoration={calligraphic brace,amplitude=5pt}, decorate, line width=1.25pt] (.2,-1) node {} -- (.2,1);
    \end{tikzpicture}
    \right.$
\end{document}

Produces:

Calligraphic braces

(On some pdf viewers, the ends of the brace look a bit fuzzy but they should print crisply.)

Andrew Stacey
  • 153,724
  • 43
  • 389
  • 751
  • Thank you! Did you estimate the values for amplitude and line width, or are they somehow related to the normal brace? – Bubaya Jun 01 '17 at 19:50
  • @Bubaya I did it by eye, so if you have the time an inclination you may find better "magic numbers". If you do, feel free to edit them in to my answer. – Andrew Stacey Jun 01 '17 at 20:49
  • @LoopSpace, instead of node{} -- shouldn't it be -- node{}? See, e.g. https://tex.stackexchange.com/questions/301888/how-to-position-brace-label – Viesturs Dec 18 '17 at 13:47
  • 1
    @Viesturs The node{} parts actually have nothing to do with this question. They're only in my answer because they were in the question. Moreover, they are empty nodes so only affect the spacing. However, node{} -- and -- node{} place nodes at two different positions so which is correct depends on where you want the node. – Andrew Stacey Dec 18 '17 at 15:57