I have a command that uses package ifthen. I use the command in section titles. I have to protect the command because otherwise I obtained the error Undefined control sequence \equal. So far, so good. Now I started using package hyperref, and the error is here again. How could I solve it? An example follows. Thanks.
\documentclass{article}
\usepackage{ifthen}
\usepackage{hyperref} % remove this line => no error
\newcommand{\something}[1]{Was something}
\newcommand{\somethingelse}[1]{\ifthenelse{\equal{#1}{X}}{Was X}{Was not X}}
\begin{document}
\tableofcontents
\section{\something{}}
\section{\protect\somethingelse{}} % remove this line => no error
\end{document}

ifstrequalof the packageetoolboxeverythink works well. – Marco Daniel Dec 15 '11 at 19:33\texorpdfstringmay come handy). – egreg Dec 15 '11 at 20:44