I am beginning with TikZ. How to do the simplest square of defined position, width&height, eventually color with text inside please ?

I used before the command framebox, but I don't have the same result with TikZ.

Thanks a lot,


  • Welcome to TeX.SE. It is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it.While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. Nov 4, 2014 at 20:34

1 Answer 1


Does this help:

enter image description here



    \node[#1] (A) at #2 {#3};
    \node [anchor=west, align=left, text width=8cm] at (A.east) {\tiny#1};



\MyNode[draw=red, inner sep=0, outer sep=0]{(0,0)}{2}

\MyNode[draw=red, inner sep=0, outer sep=0, minimum width=1cm]{(0,0)}{3}

\MyNode[draw=red, inner sep=0, outer sep=0, minimum height=1cm]{(0,0)}{4}

\MyNode[draw=red, inner sep=0, outer sep=0, minimum width=1cm, minimum height=1cm, fill=yellow]{(0,0)}{5}


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .