0

This question already has an answer here:

I am trying to compare two strings with pdf@strcmp but I get the error:

! Undefined control sequence.
<argument> \pdf 
            @strcmp{abc}{abc}
l.6     \section{\pdf@strcmp{abc}{abc}}

Here is what I am trying to run:

\documentclass{report}
\usepackage{pdftexcmds}

\begin{document}
    \section{\pdf@strcmp{abc}{abc}}
\end{document}

I was expecting to see something like 0 being output. From what I understand the strcmp returns 0 if the strings are equal, -1 if A < B and 1 otherwise. I've installed the oberdiek package so I believe I have the dependencies I need.

This seems simple but I must be missing something obvious so, how do I make this comparison?

marked as duplicate by egreg conditionals Oct 27 '17 at 17:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

for using a macro with @ in its name you've to use \makeatletter before that to change the at sign cat code.

The following code will work:

\documentclass{report}
\usepackage{pdftexcmds}

\begin{document}
\makeatletter
    \section{\pdf@strcmp{abc}{abc}}
\makeatother    
\end{document}

enter image description here

P.S. You also forgot to put \ before the command.

  • Ah, so simple, I believe the `` disappeared when I simplified the code. I've edited to make it reflect what was actually the problem (the missing \makeatletter). – Christian Eriksson Oct 27 '17 at 15:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.