[texhax] recursive macro in latex
Martin Heller
mr_heller at yahoo.dk
Thu Jun 14 10:54:54 CEST 2007
Mario Cupelli skrev:
> Hi,
>
> for my documentation a need a recursive macro for adding menu item in
> the text.
>
> I want to write
>
> \menu{item1}{item2}...{itemn}
>
> and this should be replaced by
>
> \textbf{item1} $\rightarrow$ \textbf{item2} ... $\rightarrow$ \textbf{itemn}
How about something along the lines of
\documentclass{article}
\usepackage{textcomp}
\makeatletter
\newcommand\menu[1]{\@menu#1\zzz}
\def\@menu#1,#2\zzz{\textbf{#1}%
\@for\@tmpmenu:={#2}\do{~%
\textrightarrow\ \textbf{\@tmpmenu}%
}%
}
\makeatother
\begin{document}
\menu{item1,item2,itemn}
\end{document}
More information about the texhax
mailing list