# Checkmark with specific color

I am trying to include a checkmark in my table that has for example blue color. I have managed to do it using a solution i have found here by using: \def\bluecheck{\tikz\fill[scale=0.4, color=blue](0,.35) -- (.25,0) -- (1,.7) -- (.25,.15) -- cycle;}

end then calling \bluecheck

The problem is when i insert \bluecheck in the caption of my table i get a number of errors (even though it compiles and renders the expected pdf)

Is there a library that creates a checkmark that allows to set its color?

## 3 Answers

The original problem is that \bluecheck is not a robust command and breaks inside moving arguments like \caption. The caption title moves via the .aux file to the .lot file for the list of contents. The solution is to define the command with \DeclareRobustCommand or with \protected\def:

\documentclass{article}
\usepackage{tikz}

\newcommand{\bluecheck}{}%
\DeclareRobustCommand{\bluecheck}{%
\tikz\fill[scale=0.4, color=blue]
(0,.35) -- (.25,0) -- (1,.7) -- (.25,.15) -- cycle;%
}

\begin{document}
\listoftables
\begin{table}
\caption{Blue check mark \bluecheck}
\end{table}
\end{document}


Or, since you're probably using amsmath anyway.....

\documentclass{article}

\usepackage{amssymb}
\usepackage{xcolor}
\newcommand{\bluecheck}{{\color{blue}\checkmark}}

\begin{document}
\bluecheck
\end{document}


TikZ is overkill here. Just use a symbol and colour it.

\documentclass{article}
\usepackage{xcolor,pifont}
\newcommand*\colourcheck[1]{%
\expandafter\newcommand\csname #1check\endcsname{\textcolor{#1}{\ding{52}}}%
}
\colourcheck{blue}
\colourcheck{green}
\colourcheck{red}
\begin{document}
\begin{table}
\centering
\caption{OK \greencheck}
\begin{tabular}{ccc}
\bluecheck & \greencheck & \redcheck\\
\end{tabular}
\end{table}
\end{document}


pifont provides an alternative check if you don't like this one, or use one from the font of your choice, otherwise.