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. – Peter Grill Nov 4 '14 at 20:34

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}


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.