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 am using Ubuntu 11.04 with TeXmaker and TeX Live. There is a \newenvironment definition in my LaTeX file:

\newenvironment{algo}[1]{%
  \begin{algorithm}[#1]
    \SetTitleSty{textsc}{normalsize}
    \SetInd{0.25em}{0.25em}
    \SetAlgoVlined
    \SetNlSty{normal}{}{}
    \DontPrintSemicolon
    \SetKwComment{tcp}{}{}
    \small
  }{%
    \vspace{-0.5ex}
  \end{algorithm}
}

And the use is something like

\begin{algo}{t}
...
\end{algo}

which gives an error:

! Undefined control sequence.
\algo ... \SetInd {0.25em}{0.25em} \SetAlgoVlined 
                                                  \SetNlSty {normal}{}{} \Do...

The file compiles well on Windows 7 + MikTeX.

Anybody else facing similar problems on Ubuntu?

share|improve this question

migrated from stackoverflow.com May 26 '11 at 3:16

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers

You might have an old version of the algorithm2e package -- I know mine's from the ubuntu repos texlive distro, and I have to use \dontprintsemicolon instead of the capitalized version.

You can either find out whether there are old analogues for the commands you're trying to use, update the algorithm2e package on your local tex distribution, or provide a copy of the latest algorithm2e.sty in the directory where it's being compiled.

Edit: in case you do have an old version (which you probably do, with the texlive from ubuntu repos), here's the corresponding commands:

  • \SetAlgoVlined is \SetVline
  • As mentioned, \DontPrintSemicolon is \dontprintsemicolon
share|improve this answer
    
Ubuntu 11.04 still contains TeX Live 2009. If you want to use versions of packages that are newer than what came with TL2009, you should install directly from TUG instead of using the Debian/Ubuntu packages. –  Caramdir May 26 '11 at 3:47
    
and @Caramdir Thanks for your help! I tried to do what TJ said, namely using the older commands but that did not work as it gave me some other errors. So I installed Texlive 2010 and now it works smoothly! Sorry I did not reply earlier, took some time for me to install the new version of Texlive. –  Nilesh Jun 3 '11 at 3:23
    
@Nilesh glad you got it working! –  TJ Ellis Jun 5 '11 at 1:21
add comment

For some reason, you might want your code to be compatible with both versions of the package. In that case, one possibility is to use the \providecommand as follows:

\usepackage[...]{algorithm2e}
\providecommand{\SetAlgoLined}{\SetLine}
\providecommand{\DontPrintSemicolon}{\dontprintsemicolon}
[...]

After that, the use of \SetAlgoLined and \DontPrintSemicolon should consistently do the job.

share|improve this answer
add comment

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.