# Change style of specific algorithm with algorithm2e

I have the following LaTeX code

 \documentclass{article}
\usepackage[ruled]{algorithm2e}
\begin{document}

\begin{algorithm}
do something\;
\caption{Algorithm #1}
\end{algorithm}

\begin{algorithm}
do something\;
\caption{Algorithm #2}
\end{algorithm}

\begin{algorithm}
do something\;
\caption{Algorithm #3}
\end{algorithm}

\end{document}


Given that I have initialised algorithm2e with the "ruled" option, the three algorithms appear with a nice ruled frame.

I want the second algorithm to appear with no frame at all, that is, just plain code. Is there a way to achieve this?

Thanks.

These options are set when loading the package and is meant to promote consistency. However, it's fairly trivial to adjust the algorithm style.

Below I've introduced \algorithmstyle{<style>} where you can specify/update the algorithm style to match any of the existing ones provided by the package:

\documentclass{article}
\usepackage[ruled]{algorithm2e}
\makeatletter
\makeatother
\begin{document}

\begin{algorithm}
do something\;
\caption{Algorithm A}
\end{algorithm}

\algorithmstyle{plain}
\begin{algorithm}
do something\;
\caption{Algorithm B}
\end{algorithm}

\algorithmstyle{ruled}
\begin{algorithm}
do something\;
\caption{Algorithm C}
\end{algorithm}

\end{document}


Default style choices include plain, plainruled, boxed, ruled, algoruled, boxruled and tworuled.