2

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}

\newcommand*{\Iconmenu}[1]{\includegraphics[scale=0.4]{#1}}%
\newcommand*{\UnrollMenu}[2]{%
    \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 appearance.jpg -> 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
  • 1
    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
  • 1
    You can have a look at my package menukeys which provides want you want I guess. – Tobi Jul 31 '14 at 10:58
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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