2

I can't figure out, why the following macro definition \gcmarknode does not work:

\documentclass{beamer}

\usepackage{tikz}
\usepackage{pifont}
\newcommand{\cmark}{\ding{51}} 
\usetikzlibrary{calc}

\newcommand{\gcmark}{\llap{\vphantom{Ay}\normalsize\textcolor{green}{\cmark}}}
\newcommand[1]{\gcmarknode}{ \node[left] at ($(#1.north east)!0.5!(#1.south east)$) {\gcmark}; } % does not work!

\tikzstyle{baseBlock}=[
        minimum width = 5cm, minimum height = 2cm, text width = 4cm,
        draw = black, thick, align = center, font = \footnotesize\bf]

\begin{document}

\begin{tikzpicture}

\node[baseBlock] (Y2) {Hello}; \node[left] at ($(Y2.north east)!0.5!(Y2.south east)$) {\cmark}; % works!
\node[baseBlock] (X2) {Hello}; \gcmarknode{X2} % does not work!

\end{tikzpicture}

\end{document}

What am I doing wrong? The macro code itself works.

1 Answer 1

2

Macros with arguments are defined as

\newcommand{<macro>}[<number of arguments>][<default value of optional arg>]{<definition>}

You have the [<number of arguments>] in the wrong place,

\newcommand{\gcmarknode}[1]{ \node[left] at ($(#1.north east)!0.5!(#1.south east)$) {\gcmark}; }

works.

Incidentally, why not use #1.east?

1
  • this is embarrassing, bloody deadlines :D east works for this case, sure, but I intended to vary the 0.5 Commented Nov 3, 2017 at 13:08

You must log in to answer this question.

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