# conditional loop printing text and icon

I'm new in the Latex world. I'm writing a little guide and I've choose Latex, in particular Texmaker for writing it.

I'm trying to do a loop for printing some instruction as File -> Save as -> Ok.

this is my code preamble:

\usepackage{graphicx}
\usepackage{tikz}
\usepackage{ifthen}

\foreach \x in {#2} {%
\ifthenelse{\x\equal{#1}{true}}{%
$\x\Iconmenu{#1}\boldsymbol{\rightarrow}$}%
{%
$\x$}%
}}%


and this is the call in the document:

\UnrollMenu{appearance}{Appearance,Themes}


appearance is an icon in jpg format I'd like to print it in this way:

Appearance -> Themes

but I can't figure out, someone could give a hint?

• Where is \foreach defined? Is it in a package? – Ian Thompson Jul 31 '14 at 9:01
• sorry, i forgot to add the packages. – bomba Jul 31 '14 at 9:11
• Try replacing \x\equal{#1}{true} by \equal{#1}{\x}. Note that \equal is case-sensitive. – TonioElGringo Jul 31 '14 at 9:42
• Thanks it works! I was going crazy! little question: if I want to it bold, how i put the \textbf without generating an error? – bomba Jul 31 '14 at 10:08
• You can have a look at my package menukeys which provides want you want I guess. – Tobi Jul 31 '14 at 10:58

The problem in your code comes from the way you use \equal. Instead of having \x\equal{#1}{true}, you should use \equal{#1}{\x}.
Note that \equal is case-sensitive, and some converting should be used if you need the filename lowercased but the displayed name starting with an uppercase.
The menukeys package provided by Tobi is indeed of interest in your case. Support for menu icons could be interesting.