[Tugindia] colored square

Asha G dendron.15 at gmail.com
Tue Oct 2 12:08:50 CEST 2012


>
> 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.
>
> Please help.
>
> Thanks
>
> Asha Gopinathan
>
>
> ------------------------------
>
> May be it is possible if you use xcolor package. See the documentation of
> xcolor.
>
>
>
> >
> 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.
>

 I am sending snippets of code which work for me in captions.

>
> \usepackage{amssymb}
>
   \usepackage{color}



{
\color{red}$\blacksquare$}:compact;{\color{green}$\blacksquare$}:analytical;{\color{blue}$\blacksquare$}:central}

Asha


More information about the tugindia mailing list