Now that I converted all my theorems to mdframed, I'd like a consistent layout for my algorithms as well? What ways are there to typeset pseudocode algorithms in mdframed?
So far I've been using algorithm.sty from the algorithms bundle, together with algpseudocode.sty from the algorithmicx. But since that looks completely different, and has problems with cleveref as well, I'm looking for alternatives.
algorithm2e on its own looks nice enough, but since that comes with its own float environment, I get an error Not in outer par mode when I try to plug that into an mdframed theorem environment.
algorithmicx does not insist on outer par mode, but so far I haven't managed to get that working directly inside a frame either. For some reason, I get a lot of error messages I didn't get before, like label names having an extra }, or like destination with the same identifier (name{ALG@line.2}) has been already used, duplicate ignored.
In an ideal world, a suitable solution would offer
- References for the whole algorithm as well as individual lines
- Flexible line numbering
- Flexible syntax formatting
- Allow page breaks withing algorithms
- Other bells and whistles to make things look nice
algorithmicbundle w/wo thealgorithmicxcan do the job, filling all your requirements. – cacamailg May 11 '13 at 15:29algorithmandcleverefboth loaded as well will break things, withoutmdframedbeing in any way involved. – MvG May 11 '13 at 15:51algorithmsandcleveref, without regard forhyperref, since I already hadcleverefafterhyperref, thanks to an answer by egreg. And just because the currently accepted answer uses the packages I already mentioned, I'd still love to hear about other alternatives, like perhaps some way to put analgorithm2e-style layout with lines and all those bells and whistles into anmdframedenvironment. – MvG May 14 '13 at 13:54