%% anonymous-acm.sty  
%% version 1.0 09-May-2020   
%% Maintained by Brett A. Becker: brett.becker@ucd.ie

% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either 
% version 1.3 of this license or any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.

% This program is distributed in the hope that it will be useful 
% but WITHOUT ANY WARRANTY; without even the implied warranty of 
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

% designed to be used with acmart.cls - required for full functionality

%% Identification
%% The package identifies itself and the LaTeX version needed
\ProvidesPackage{anonymous-acm}
\NeedsTeXFormat{LaTeX2e}


% Define anonymous condition
\newif\ifAnonCondition\AnonConditiontrue

% Declare options
\DeclareOption{true}{\AnonConditiontrue}
\DeclareOption{false}{\AnonConditionfalse}
\DeclareOption*{\PackageWarning{anonymous-acm}{Unknown ‘\CurrentOption’}}
\ProcessOptions\relax

% Anonymous Authors
\newcommand{\authoranon}[1]{#1}
\ifAnonCondition
\renewcommand{\authoranon}[1]{
\author{Anonymous Author(s)}
}
\else
\renewcommand{\authoranon}[1]{#1}
\fi

% Anonymous Arbitrary Text
\newcommand{\textanon}[2]{#1}
\ifAnonCondition
\renewcommand{\textanon}[2]{\ifstrequal{}{#2}{<text removed for peer review>}{#2}}
\else
\renewcommand{\textanon}[2]{#1}
\fi

% Anonymous Links
\newcommand{\linkanon}[2]{\href{#1}{#2}}
\ifAnonCondition
\renewcommand{\linkanon}[2]{<anonymous link>}
\else
\renewcommand{\linkanon}[2]{\href{#1}{#2}}
\fi

\newcommand{\textlinkanon}[2]{\href{#1}{#2}}
\ifAnonCondition
\renewcommand{\textlinkanon}[2]{#2}
\else
\renewcommand{\textlinkanon}[2]{\href{#1}{#2}}
\fi

% Anonymous Citations & References
\newcommand{\citeanon}[2][\ ]{\cite[#1]{#2}}
\ifAnonCondition
\renewcommand{\citeanon}[2][\ ]{[anonymous]}
\else
\renewcommand{\citeanon}[2][@]{\ifstrequal{@}{#1}{\cite{#2}}{\cite[#1]{#2}}}
\fi

% Anonymous Acknowledgments
\ifAnonCondition
\excludecomment{acks}
\fi
