I have want to draw square-tile in tikz like the following picture: iwant

I use matrix styles and put thing in.

My code:


\usetikzlibrary{shapes.geometric, arrows}
\tikzstyle{sq} = [rectangle, minimum width=0.7cm, minimum height=0.7cm, text centered, draw=black ]
\tikzstyle{sqvec} = [matrix,draw=black,thick] 

\node [sqvec] (v7) at (2.5,4) {
\node[sq] {}; &\node[sq] {}; &\node[sq] {}; \\
\node[sq] {}; &\node[sq] {}; &\node[sq] {}; \\

And here is what I got:


I want to get rid of the second outer border and make inner border have equal thickness with outer border.

  • 1
    \tikzstyle{sqvec} = [matrix,thick], but for more nice result you need to tweek your nodes' settings.
    – Zarko
    Aug 5 '17 at 14:12

enter image description here

for above image the solution given in my comment should be replaced with more sophisticated way:

\documentclass[tikz, margin=3mm]{standalone}

\matrix (m) [matrix of nodes,
             nodes={minimum size=7mm, draw, outer sep=0pt},
             nodes in empty cells,
             column sep=-\pgflinewidth, row sep=-\pgflinewidth
    &   &   \\
    &   &   \\

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.