[Tugindia] Colored square

Sridhar M.A. sridharma at gmail.com
Wed Sep 19 13:56:13 CEST 2012


On Wed, Sep 19, 2012 at 4:35 PM, Asha G <dendron.15 at gmail.com> wrote:
> I would like to create colored squares :
>
> \blacksquare creates a filled black square
>
> but using the same logic
>
> \redsquare does not give  a filled red square but an error message.
>
You can use tikz to do that. Here is a MWE :


\documentclass[11pt]{article}
%
\usepackage{tikz}

\newcommand{\redsquare}{\tikz \path [fill=red,draw=black]  (0,0)
rectangle (10pt,10pt) ;}

\begin{document}

This is a red square~\redsquare

\end{document}

HTH,

Regards,

-- 
Sridhar M.A.


More information about the tugindia mailing list