Remarks
I hope, I got your explanation right.
Using a specific \tikzmark
and the calligraphy
TikZ library by Andrew Stacey you can achieve the following output. You will need to rerun latex
several times to get the positioning right.
Implementation
\documentclass{standalone}
\usepackage{amsmath,tikz}
\usetikzlibrary{decorations,calligraphy}
\newcommand\tikzmark[2]{\tikz[remember picture,baseline=(#1.base)]{\node[inner sep=0pt] (#1) {#2};}}
\begin{document}
$
\begin{pmatrix}
c11 & c12 & c13 & c14 & c15 & c16 & c17 & (c18 & c19) \\
c12 & c22 & c23 & c24 & \tikzmark{c25}{$c25$} & \tikzmark{c26}{$c26$} & c27 & c28 & c29 \\
c13 & c32 & c33 & c34 & \tikzmark{c35}{$c35$} & \tikzmark{c36}{$c36$} & c37 & c38 & c39 \\
(c14 & c42 & c43) & c44 & c45 & c46 & c47 & c48 & c49 \\
\end{pmatrix}
$
\begin{tikzpicture}[remember picture,overlay]
\draw[thick,decorate,decoration={calligraphic straight parenthesis}] (c35.south west) -- (c25.north west);
\draw[thick,decorate,decoration={calligraphic straight parenthesis}] (c26.north east) -- (c36.south east);
\end{tikzpicture}
\end{document}
Output
Using the calc
library you can compensate the bad spacing for the TikZ braces by adding an offset of .2em
as in
\begin{tikzpicture}[remember picture,overlay]
\draw[thick,decorate,decoration={calligraphic straight parenthesis}] ($(c35.south west)+(-.2em,0)$) -- ($(c25.north west)+(-.2em,0)$);
\draw[thick,decorate,decoration={calligraphic straight parenthesis}] ($(c26.north east)+(.2em,0)$) -- ($(c36.south east)+(.2em,0)$);
\end{tikzpicture}
which produces
On behalf of Christopher Creutzig's comment, here another solution (still using tikzmark
) which doesn't involve typing parentheses inside the matrix.
\documentclass{standalone}
\usepackage{amsmath,tikz}
\usetikzlibrary{calc,decorations,calligraphy}
\newcommand\tikzmark[2]{\tikz[remember picture,baseline=(#1.base)]{\node[inner sep=0pt] (#1) {#2};}}
\begin{document}
$
\begin{pmatrix}
c11 & c12 & c13 & c14 & c15 & c16 & c17 & \tikzmark{c18}{$c18$} & \tikzmark{c19}{$c19$} \\
c12 & c22 & c23 & c24 & \tikzmark{c25}{$c25$} & \tikzmark{c26}{$c26$} & c27 & c28 & c29 \\
c13 & c32 & c33 & c34 & \tikzmark{c35}{$c35$} & \tikzmark{c36}{$c36$} & c37 & c38 & c39 \\
\tikzmark{c14}{$c14$} & c42 & \tikzmark{c43}{$c43$} & c44 & c45 & c46 & c47 & c48 & c49 \\
\end{pmatrix}
$
\begin{tikzpicture}[remember picture,overlay]
\draw[thick,decorate,decoration={calligraphic straight parenthesis}] ($(c35.south west)+(-.2em,0)$) -- ($(c25.north west)+(-.2em,0)$);
\draw[thick,decorate,decoration={calligraphic straight parenthesis}] ($(c26.north east)+(.2em,0)$) -- ($(c36.south east)+(.2em,0)$);
\node[left=.2em] at (c14) {$($};
\node[left=.2em] at (c18) {$($};
\node[right=.2em] at (c19) {$)$};
\node[right=.2em] at (c43) {$)$};
\end{tikzpicture}
\end{document}