I want to have a macro that checks if the string has been used in the previous call of the macro as well. I found some examples here how to create switch structure comparing strings in latex but I wasn't able to store and retrieve the value in a variable. What can I do to make this code work?
\documentclass{article}
\usepackage{pdftexcmds}
\def \myoldvalue {emptystart}
\makeatletter
\newcommand\foo[1]{%
\\myoldvalue: \myoldvalue \def \myoldvalue {#1} \newline %
ARG1: #1 \newline %
\def\@tempa{#1}%
\def\@tempb{comparetothis}% % what do I have to put into comparethis to compare against \myoldvalue
compare: \@tempa ~ \@tempb \newline %
\begingroup
\@onelevel@sanitize\@tempa
\@onelevel@sanitize\@tempb
\ifx\@tempa\@tempb
\aftergroup\@firstoftwo
\else
\aftergroup\@secondoftwo
\fi
\endgroup
{TRUE}
{FALSE}%
\newline next old value: \myoldvalue
}
\makeatother
\begin{document}
~\\
\foo{ArgOne} \\ % excepted print out is: FALSE
\foo{ArgOne} \\ % TRUE
\foo{ArgTwo} \\ % FALSE
\foo{ArgTwo} \\ % TRUE
\foo{ArgOne} \\ % FALSE
\foo{ArgTwo} \\ % FALSE
\end{document}
