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.

I cannot get any macros working from the algorithm2e package.

My particular example is to do with the title. In reference to numbering / not numbering algorithms, page 20 of the algorithm2e package docs reads:

7.4.5 title of algorithms

titlenumbered: \TitleOfAlgo{title} prints Algorithm n: thetitle where n is the counter of the algo.
Beware: \TitleOfAlgo don't insert an entry in the list of algorithms. So do not use \TitleOfAlgo with a caption. Both increment the counter of the algorithms.
titlenotnumbered (default) the macro \TitleOfAlgo{title} doesn't number the algorithm.

I cannot get \TitleOfAlgo to work, it just isn't recognised.

Here's an example from the docs:

\documentclass[11pt]{article}
\usepackage{algorithm2e}
\begin{document}
\begin{algorithm}[htbp]
  \KwData{this text}
  \KwResult{how to write algorithm with \LaTeX2e }
  initialization\;
  \While{not at end of this document}{
    read current\;
    \eIf{understand}{
      go to next section\;
      current section becomes this one\;
      }{
      go back to the beginning of current section\;
      }
    }
\TitleOfAlgo{How to write algorithms}
\end{algorithm}
\end{document}

Which returns:

! Undefined control sequence.
l.19 \TitleOfAlgo
                 {How to write algorithms}
share|improve this question
    
It works for me with algorithm2e.sty 2013/01/06 v5.00 algorithms environments in miktex. Some thing else is going on! –  Harish Kumar Nov 8 '13 at 6:07
    
The code is fine here too with Package `algorithm2e' Release 5.0 -- january 06 2013 -- –  Jesse Nov 8 '13 at 6:25
    
Seems to be TeXworks only. Works using TeXstudio on the same machine. Weird. –  a different ben Nov 8 '13 at 9:35
1  
@adifferentben This kind of problems usually stems from having two TeX distributions on your machine. Are you on Ubuntu? –  egreg Nov 8 '13 at 11:22
    
@egreg Yes Ubuntu 12.04. I have TeX Live 2012 manually installed, but I just checked and found that indeed TeX Live 2009 is also installed via package manager :( I can't recall if there was a good reason for this situation, but it's possible that v2009 was installed as a dependency of something else and I let it slip through. which tex tells me v2012, but not sure why TeXWorks gets confused? –  a different ben Nov 8 '13 at 11:49
show 1 more comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.