I want to draw a TikZ matrix with its border and I would like to define the distance between most external matrix nodes and matrix border. Something like a matrix inner sep. If I change inner sep in matrix options declaration, all nodes inside the matrix also change its inner separation.

I know how to do it with fit library. I just want to know if its possible without it.


The inner sep for the matrix can be set and then nodes={inner sep=...} can be reset individually for the inner nodes.

\matrix[draw,matrix of nodes,inner sep=2mm,nodes={draw,inner sep=5mm}](a){

\draw[->,thick](a-1-1.base) -| ++(2cm,-5mm) node [right] {5mm};
\draw[->,thick](a.north)    -| ++(2cm,-2mm) node [right] {2mm};

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.