\ifdefstring{command}{str1 OR str2}{yes}{no}

something like above needs to be achieved. is it possible to use logical operator for the string part of \ifdefstring ?

package : etoolbox

command = string type

I added etoolbox to this project and used \ifdefstring source : https://github.com/posquit0/Awesome-CV

  • Where does \ifdefstring come from? Please post a full document code, not just fragments only
    – user31729
    Commented Jan 29, 2017 at 16:41
  • You have a macro, say \foo that may expand to a string and you wish that \ifdefstring{\foo}{str1||str2}{yes}{no} returns yes if \foo is defined and expands to str1 or str2 and no otherwise?
    – egreg
    Commented Jan 29, 2017 at 16:45
  • @egreg yes. exactly. Commented Jan 29, 2017 at 17:01
  • @ChristianHupfer , i dont think it has anything to do with the code. its a simple feature of etoolbox package. Still i have added the repository link. I have made modifications to that. Commented Jan 29, 2017 at 17:08
  • 1
    @ronpatel: I don't see a link. Your question is still unclear to me
    – user31729
    Commented Jan 29, 2017 at 17:10

1 Answer 1


You can build a boolean expression:


      test {\noexpand\ifdefstring{\noexpand#1}{\@firstoftwo#2}}
      test {\noexpand\ifdefstring{\noexpand#1}{\@secondoftwo#2}}








enter image description here

  • 1
    so i can safely assume etool \ifdefstring does not allow logical operation on string, right ? Commented Jan 29, 2017 at 18:19
  • @ronpatel I see no direct support for it.
    – egreg
    Commented Jan 29, 2017 at 18:52
  • 1
    is there any other you can suggest. I dont want to create helper functions for menial tasks ? Commented Jan 29, 2017 at 19:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .