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
![enter image description here](https://i.stack.imgur.com/RpUF2.png)
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
![enter image description here](https://i.stack.imgur.com/EIGlt.png)
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}
![enter image description here](https://i.stack.imgur.com/CGTrj.png)
tabu
seems very powerful but I guess you would only need something fairly simple in this case:
\documentclass{article}
\usepackage{hhline,tabu}
\begin{document}
\newtabulinestyle { mystyle=.5pt on 1.5pt off 1.5pt }
\begin{tabu}{| r || *{3}{c|} c |[mystyle] c |}\hhline{|-||*{5}{-|}}
a & b & e & f & i & j\\\hhline{:=::*{5}{=:}}
c & d & g & h & k & l\\\hhline{|-||*{5}{-|}}
m & n & o & p & q & r\\\hhline{|-||*{5}{-|}}
\end{tabu}
\end{document}
![dashes and gaps with <code>hhline</code> and <code>tabu</code>](https://i.stack.imgur.com/sZGzB.png)
Best Answer
One way to do this is to use an
array
environment and make use of the@{}
intercolumn specifiers to put in some negative space. Here is one piece of example code.