how do I add delimiters to both sides of a tikz node?

Here is a simple document which does not seem to display properly:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\tikz \node[matrix of nodes] { |[left delimiter=(, right delimiter=)]| x \\ };
\end{document}


This document renders as . When I include just a left delimiter or just a right delimiter, it seems to work okay; namely, I get and , respectively. How can I get both of those delimiters to appear in the appropriate positions?

• Don't you want the delimiters for the matrix itself? I.e. \tikz \matrix[matrix of nodes,left delimiter=(, right delimiter=)] { x \\ };. Jun 10 '14 at 22:09
• @TorbjørnT. Nope, I want delimiters on each node in the matrix. I'm using the matrix library primarily to simplify positioning, rather than to typeset an actual matrix. Jun 10 '14 at 22:09
• Ok. Your code compiles fine here by the way, with an updated TeX Live 2013. Jun 10 '14 at 22:10
• @TorbjørnT. Strange. I'm also using TeXLive 2013, specifically 0.1.20130608_r30832.fc19. I wonder what the difference is. Jun 10 '14 at 23:36
• I don't know. You don't have any old versions of pgf/TikZ lying around somewhere, do you? By adding \listfiles before \documentclass you'll get a list of packages used and their versions printed near the end of the log-file. I have pgf 3.0. Jun 11 '14 at 5:54

I propose the following approach. It uses the tikz-styles and keeps your code that places the nodes clean.

With the outer sep option you can fine tune the position of your right delimiter and left delimiter. You also can use the draw option here to show the node's size for debugging your styles.

I prefer doing it this way, because you can define your styles with heavy fine tuning while keeping your \matrix / \node-placing code clean.

The following example contains some additional outer seps to show the impact of this option to the rendered image.

\documentclass[border=6mm, 11pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}
\tikzset{
braces/.style = {
outer sep=-1pt,
left delimiter=(,
right delimiter=),
align=center,
},
}

\begin{tikzpicture}
\matrix {
\node [braces] (a) {A}; &
\node [braces, outer sep=0pt] (b) {B}; \\
\node [braces, outer sep=5pt] (c) {C}; &
\node [braces, outer sep=-2pt] (d) {D}; \\
};
\end{tikzpicture}
\end{document}


Rendered image: