# Controlling delimiters in matrices typeset with TiKZ

This question is directly related to Loop Space user's answer to question Broken matrix - gaps in brackets, in which an alternative TiKZ method to amsmath matrix typesetting is provided.

The following requests have to do with delimiters:

1. Could it be possible to have some code that allows typesetting only one of the delimiters? (I've figured out how to "blank" the unwanted delimiter, but not how to make it have no typesetting effects at all.)

2. Can the distance between the matrix box and the delimiter be controlled or specified when using calligraphy delimiters (or delimiters in general)?

UPDATE: After much tweaking and experimenting, I've come up with a working but clearly not very elegant solution to both problems. When tikz matrix delimiter type is selected ---which triggers use of calligraphy delimiters for typesetting---, e.g. via

\begin{tikzpicture}[matrix delimiter type={tikz}]%
\matrix (my_tikz_matrix) [matrix of math nodes,%
delimiters={\lbrace,\rbrace},%
ampersand replacement=\&]%


issue #2 can be "solved" by placing additional columns at the beginning and/or at the end (as required) of the first row of the matrix, and then changing horizontal spacing with the [spacing_expression] syntax after the new column command (here \&). If the relevant columns are the 2nd and the 3rd, we could write this to control horizontal spacing of braces:

\&[0.5ex] \& foo \& bar \&[-0.2ex]\\


This way we can also address issue #1 (for example, by placing the left delimiter rightwards enough, "invading" thus the body of the matrix), as long as we have "blanked" the unwanted delimiter. This can be done for example by locally redefining, inside a \tikzset{} command placed before \begin{tikzpicture}..., the render left tikz delimiter/.style option from the original code:

\tikset{%
render left tikz delimiter/.style={}%
}%


Please note that this option can also be specified within my_tikz_matrix options.

(P.S.: For the sake of completeness, assuming that if we are using tikz to typeset matrices there are good reasons to do that, let me add that if you are having trouble to horizontally align the = sign in math mode, e.g. when setting up a system of linear equations or simply stacking solutions, you can put the equal sign as a node label to obtain proper alignment:

x\&\node(){=};\&6\\
y\&        =  \&12\\


)

• On that code there are many commands to control some distances. Change them accordingly. – Sigur Oct 30 '14 at 17:55
• I think tikz 3.00 has a bug (that I couldn't find yet). Otherwise these should work (was working previously) tex.stackexchange.com/a/53100/3235 and tex.stackexchange.com/a/48289/3235 with every left right delimiter options. – percusse Oct 31 '14 at 14:05
• @percusse As I suggested, if you select the ams option to typeset the matrix, every right|left delimiter/.style works as expected, but the problem arises when you use the tikz option, which, as @Loop Space suggests, draws the delimiter and/or makes use of the calligraphy package and then every right|left delimiter/.style won't work. But I don't know enough pgf-tikz to be aware of what's really going on with the code he supplied. – Joan Sanz Oct 31 '14 at 15:34