I am trying to left-align the caption of algorithms of algorithm2e to match the captions of the figures.
Taking a look at Align Caption to the left , here is my code so far:
\documentclass[12pt,a4paper,oldfontcommands]{memoir}
\usepackage{caption}
\usepackage[boxed,vlined,resetcount,algochapter]{algorithm2e}
\SetAlgoCaptionSeparator{:}
\renewcommand\AlCapFnt{\normalfont}
\SetAlCapSkip{\abovecaptionskip\relax}
\captionsetup[algorithm]{justification=raggedright,singlelinecheck=off}
\begin{document}
\chapter{ }
\begin{figure}[h]
\caption{Here is a long caption for an algorithm.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.}
\end{figure}
\begin{algorithm}
Some algorithm step \;
\caption{Here is a long caption for an algorithm.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.}
\end{algorithm}
\end{document}
One solution candidate was to use the figure parameter as explained in Adjusting the caption of an algorithm2e code by considering
\usepackage[figure,boxed,vlined,resetcount,algochapter]{algorithm2e}
However, I would like the algorithms to be boxed (like in the first figure without boxing the caption), numbered and indexed (create a list of algorithms) independently.
Does anybody have ideas?
Edit:
After trying John Kormylo's solution I got:
The text seems to exceed the margin in this case.
algorithm2e
package does not offer any appropriate (internal) interfaces usable by thecaption
package, so unfortunately thecaption
package could not be adapted to thealgorithm2e
package either. Adaptingcaption
tofloat
was a nightmare but adapting it toalgorithm2e
(which contains modified code from thefloat
package) is impossible.