1

This is what I'm doing:

\documentclass[sigplan,nonacm=true,anonymous=true]{acmart}
\newcommand\anon[1]{%
  \makeatletter\if@ACM@anonymous%
    XXX%
  \else%
    #1%
  \fi\makeatother%
}
\begin{document}
Hello, \anon{Jeff}!
\end{document}

I'm expecting it to print Hello, XXX!, but it prints Hello, Jeff!. What am I doing wrong?

yegor256
  • 12,021

1 Answers1

2

You need @ to be a letter when the definition is made, so

\documentclass[sigplan,nonacm=true,anonymous=true]{acmart}
\makeatletter
\newcommand\anon[1]{%
\if@ACM@anonymous
    XXX%
  \else
    #1%
  \fi
}
\makeatother
\begin{document}
Hello, \anon{Jeff}!
\end{document}

As it was the \makeatletter was doing nothing (as the following characters were already tokenized so \if@ACM@anonymous was interpreted as

\if @A%
  CM@anonymous

compared @ with A so not an error, but always false.

David Carlisle
  • 757,742