TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Why if I write :

\State \textbf{upon event $< Init >$  do}
        \For{\textbf{all $n$} $\in N$}
            \State $value[r]=0$;

I have this output:

enter image description here but I want:

enter image description here How can I do it?Thankyou very much

share|improve this question

You can define a new block structure \Event...\EndEvent to suit your needs:

enter image description here

\usepackage{amsmath,algpseudocode}% http://ctan.org/pkg/{amsmath,algorithmicx}
\algdef{SE}[EVENT]{Event}{EndEvent}[1]{\textbf{upon event}\ #1\ \algorithmicdo}{\algorithmicend\ \textbf{event}}%
  \Event{$< Init >$}
    \For{\textbf{all} $n \in N$}
      \State $\text{value}[r] = 0$;
  \State Do something else;
share|improve this answer
OP, see also texdoc algorithmicx, the utility package algpseudocode is built with. – Sean Allred Feb 26 '14 at 17:20
$\langle\mathit{Init}\rangle}$ – egreg Feb 26 '14 at 17:27
thank you very much. I added \algdef{SE}[EVENT]{Event}{EndEvent}[1]{\textbf{upon event}\ #1\ \algorithmicdo}{\algorithmicend\ \textbf{event}}% \algtext*{EndEvent} and everything works! – user1938352 Feb 26 '14 at 17:40

Your Answer


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.