Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In the following MWE, I would like the end of switch to be different from the ends of case and other. Is it possible ?

\documentclass{article}
    \usepackage{algorithm2e}

\begin{document}

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

\end{document} 
share|improve this question

1 Answer 1

up vote 3 down vote accepted

enter image description here

It appears to be easier to change it for Case than Otherwise, but this seems to work:

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

\SetKwFor{Case}{case}{}{end case}%

\renewcommand\algocf@Other[1]{%
\KwSty {otherwise}\algocf@block {#1}{\@algocf@endoption {end other}}}

\makeatother

\begin{document}

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


\end{document}
share|improve this answer
    
Thanks for this trick ! –  projetmbc Oct 28 '12 at 10:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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