Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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

\documentclass[tikz]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix[draw,matrix of nodes,inner sep=2mm,nodes={draw,inner sep=5mm}](a){
A\\
B\\
C\\
};

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

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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