0

\cmark has been defined as follows

\newcommand{\cmark}{\ding{51}}

I am using the \textcolor{red}{\cmark} to show the red tick

How do I make a macro for this?

1 Answer 1

4

Include the packages

\usepackage{xcolor,pifont}

then define the rule as

\newcommand*\colourcheck[1]{%
  \expandafter\newcommand\csname #1check\endcsname{\textcolor{#1}{\ding{51}}}%
}
\colourcheck{blue}
\colourcheck{green}
\colourcheck{red}

Then use as

\redcheck
\bluecheck
\greencheck

The rule means that check will be replaced by something which is red, green and blue in this case.

1
  • 2
    To make your answer more readily usable by future readers of this posting, you should provide information about which packages must be loaded for your code to compile successfully. E.g., which package provides the macro called \ding, and which package provides the macro called \textcolor?
    – Mico
    Jun 1, 2018 at 6:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .