4

Note: I have seen the previous answer to this problem here and it doesn't work for my purposes. I suspect that others are in the same boat.

I'm writing a paper for which the publisher requires the use of RevTex 4.1. I have several pages worth of algorithms already written using the algorithm2e package. But when I went to put them in the paper, all of the indentation failed. Here's a minimal working example:

\documentclass[aip,jcp]{revtex4-1}

\usepackage[ruled,vlined,linesnumbered,commentsnumbered]{algorithm2e}

\begin{document}

\begin{algorithm}
  \ForEach{i}{
    \ForEach{j}{
      hello world\;
    }
  }
  \caption{This is wrong: no indentation}
\end{algorithm}

\end{document}

which gives: Output

Am I stuck rewriting pages and pages of algorithms in algorithmic syntax (or something else), or is there a workaround for this problem?

  • There are two answers in the link you provided? None of them works? – user31729 Jul 14 '14 at 18:41
  • 2
    @ChristianHupfer: Both answers use the algcompatible package, which uses algorithmic syntax (as opposed to algorithm2e syntax). I would have to rewrite all of my algorithms in a different syntax. Not impossible, but a lot of work that I'd rather not do if a workaround exists. – David Hollman Jul 14 '14 at 18:44
  • Yes, I see... no, this is should be only the last method to be applied. – user31729 Jul 14 '14 at 18:46
  • @DavidHollman Any solutions yet? I have the same problem – smörkex Nov 3 '17 at 5:09
  • 1
    @smörkex, this is still a known bug of algorithm2e – BambOo Nov 15 '18 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.