2

Possible Duplicate:
What is the meaning of double pound symbol (##1) in an argument?

In the following code, I would like to build one macro \caseWord with two arguments corresponding to Case and end case so as to change the macro \algocf@Case which have two arguments. How can I achieve this ?

\documentclass{article}
    \usepackage[longend]{algorithm2e}

    \makeatletter
        \renewcommand\algocf@Case[2]{%
            \KwSty{Case} #1 \algocf@block{#2}{%
                \@algocf@endoption{end case}%
            }%
        }
    \makeatother

\begin{document}

\begin{algorithm}
    \Begin{
        \Switch{X}{
            \Case{1}{
                \While{Continue}{Action}
            }
        }
    }
\end{algorithm}

\end{document}
5
  • This must be a duplicate of something:-) You need to use ##1 and ##2 Oct 28, 2012 at 11:57
  • There are further examples of doubling up # here tex.stackexchange.com/a/79151/1090 Oct 28, 2012 at 11:59
  • If someone want to destroy my question. Just do it... Sorry for this duplicate. :-(
    – projetmbc
    Oct 28, 2012 at 12:00
  • There should be a (more sensible than my tree example) canonical question/answer for the need to double # it is probably more useful to close this as duplicate rather than just delete it. I'm just looking for a good question to reference... Oct 28, 2012 at 12:07
  • Good choice for the duplicated questions !
    – projetmbc
    Oct 28, 2012 at 16:36

0

Browse other questions tagged .