I want to change the appearance of the caption for algorithms written by algorithm2e
package using the caption
package.
In captionsetup
one can easily customize the caption depending on the float type, whether a table, a figure, or a longtable even, but when I specified a captionsetup for algorrithms it didn't work, is there any way to change the Algorithm 1:
to Algorithm 1.
?
MWE Code:
\documentclass{scrartcl}
\usepackage{caption}
\captionsetup[longtable]{justification=justified} % works fine
\captionsetup[figure]{labelsep=period,format=plain, font={small}} % works fine
\captionsetup[algorithm]{labelsep=period,format=plain} % didn't work!
\usepackage{algorithm2e}
\begin{document}
\begin{algorithm}
\SetAlgoLined
\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\;
}
}
\caption{How to write algorithms}
\end{algorithm}
\end{document}
Output:
Best Answer
You have to use the command
MWE
Output:
P.S. An extract from the
caption
package documentation: