# 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 :

\def\beamer@ALE@iOSLogo{ios.png}
\def\beamer@ALE@AndroidLogo{android_logo.jpeg}

\DeclareOptionBeamer{techno}{\def\beamer@ALE@Techno{#1}}
\ProcessOptionsBeamer

\IfStrEq{\def\beamer@ALE@Techno}{iOS}{{\def\beamer@ALE@TechnoLogo{\beamer@ALE@DiOSLogo}}{{\def\beamer@ALE@TechnoLogo{\beamer@ALE@DefaultLogo}}


Then I include a graphics :

\includegraphics[width=1cm]{\beamer@ALE@TechnoLogo}


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 :

\def\beamer@ALE@iOS{iOS}


Do someone have some explanations?

• Welcome to TeX.SX! Please add a minimal working example (MWE) that illustrates your problem (see some instructions here). It will be much easier to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – e-birk Mar 22 '13 at 17:35
• Why is there a \def inside \IfStrEq{\def\beamer@ALE@Techno}{\def\beamer@ALE@iOSLogo}...? If you want to get the value of \beamer@ALE@Techno it should not be there... – e-birk Mar 22 '13 at 17:38
• Furthermore, by default you cannot (and should not) use @ in macros name in the normal text, e.g. see tex.stackexchange.com/questions/6240/…. Due to a missing MWE it is more difficult to say, but it might be the problem... – e-birk Mar 22 '13 at 17:50
• The question has been edited but it still has nowhere near enough information to guess what the question is. Pleas make a mininimal working example as requested in the first comment. (however I'll put another guess in my answer) – David Carlisle Mar 27 '13 at 9:36

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

\ifx\beamer@ALE@iOSLogo\beamer@ALE@Techno
... ios case
\else
... other case
\fi


\IfStrEq{\def\beamer@ALE@Techno}{iOS}


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

\def\logoimage{mydefaultimage}
\@namedef{tech-image-ios}{\def\logoimage{ios.png}}
\@namedef{tech-image-android}{\def\logoimage{android_logo}}

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

\includegraphics{\logoimage}


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.

• Okay, I edited my first message to give more informations. – YaGeek Mar 27 '13 at 9:27