[Tex/LaTex] Compare strings


I have some troubles by comparing strings in my beamer theme.

I would like to compare the "techno" argument with a string (iOS, Android, Java,…):

if techno =="iOS" logo_path = "some_image" else if techno == "android" logo_path = "some_other_image"

and so on,

I take an argument from the main .tex files and I would like to compare it do define an image to include :




Then I include a graphics :


When I compile it tolds me : image `ios' (back quote + value + quote) is not found.

I have to declare a macro to solve the problem :


Do someone have some explanations?

Best Answer

It is hard to guess from the code fragment which strings you want to compare but I think you want to compare \beamer@ALE@Techno (The option value) with \beamer@ALE@iOSLogo which you can do with

   ... ios case
  ... other case

Your question has


It is hard to guess what the intention of that is as \IfStrEq is intended to compare strings (lists of characters) but you have passed it a definition.

However I don't think you nwant to do a compare at all, just define


\DeclareOptionBeamer{techno}{\csname tech-image-#1\endcsname}}


then it will include an image mydefaultimage unlesss techno=ios or techno=android in which case you get teh specified files, more \@namedef could be added as required.

Related Question