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,
Thomas
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityDoes this help:
\documentclass{article}
\usepackage{tikz}
\newcommand*{\MyNode}[3][]{%
\begin{tikzpicture}
\node[#1] (A) at #2 {#3};
\node [anchor=west, align=left, text width=8cm] at (A.east) {\tiny#1};
\end{tikzpicture}%
}
\begin{document}
\MyNode{(0,0)}{x}
\MyNode[draw=red]{(0,0)}{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}
\end{document}
\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.