# hyperref / etextools incompatibility?

My document uses both hyperref and etextools. Up until today, they appeared to be playing nicely; however a new command seems to have introduced a conflict somewhere.

The MWE below is a greatly simplified version of a far more complex document; it took quite some time to narrow the problem down as far as I have. Removing either of the % to load hyperref or before the \expandnext results in a compilable document, but removing both causes errors.

It feels as though this answer is related, but I don't understand enough of the details of what is happening at this level to be able to adapt this answer to my needs. Can anybody point me in the right direction please?

## MWE

\documentclass{exam}

\usepackage{etextools}
\usepackage{xstring}
%\usepackage{hyperref}

\renewcommand{\thepartno}{\roman{partno}}
\renewcommand{\thesubpart}{\alph{subpart}}
\renewcommand{\subpartlabel}{(\thesubpart)}

\newcommand{\useinsert}[1]{ % If a (part) question is to be answered on an insert
\IfStrEqCase{#1}{%
{}{%
\textbf{Answer this question on the insert provided.}
}%
}[\textbf{Answer part (#1) of this question on the insert provided.}]%
}

\renewcommand{\thepartno}{\roman{partno}} % Format part numbers as lower-case roman numerals

\begin{document}

\begin{questions}
\question %\expandnext{\useinsert}{\ref{ques:P1Q10i}}
\begin{parts}
\part[3] \label{ques:P1Q10i} Do this.
\droppoints
\end{parts}
\end{questions}
\end{document}

• Don't use etextools. It is incompatible with a lot of things and it is unmaintained. – Ulrike Fischer Jan 29 at 13:23
• Beside this: The idea to expand the \ref and use the result in a string comparision is quite daring. If this ever worked with hyperref (which I doubt) you were extremely lucky. – Ulrike Fischer Jan 29 at 13:29
• I have cleaned up some comments. Reading them, I take it that you care less about th incompatibility than a solution to the task you are trying to achieve. – Joseph Wright Feb 4 at 7:58