[Tex/LaTex] Pseudocode: Algorithm Package boxes all figures

algorithmicalgorithmicxalgorithms

for writing pseudocode I decided to use the solution from here. Unfortunately, this package changes the style of all my figures defined like this:

\begin{figure}[H]
    \centering
    \includegraphics[height=4cm]{AKP13_command_dependency_graph}
    \caption{Command Dependency Graph}
    \label{fig:AKP13_command_dependency_graph}
\end{figure}

I would like to have my standard figures without these horizontal lines and with a caption under the figure but my Algorithms like in 1.

Is this possible?

Thanks in advance 🙂

UPDATE:
Here is a MWE:

\documentclass[twoside, openright, 12pt]{book}
%pseudocode
\usepackage{mathtools} 
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}

\makeatletter
\def\BState{\State\hskip-\ALG@thistlm}
\makeatother
% include graphics
\usepackage{graphicx}
\graphicspath{{./arbeit/figures/}}
% fix graphics on defined position
\usepackage{float}
\restylefloat{figure}

\begin{document}

\begin{figure}[H]
    \centering
    \includegraphics[height=4cm]{AKP13_command_dependency_graph}
    \caption{Command Dependency Graph}
    \label{fig:AKP13_command_dependency_graph}
\end{figure}

\begin{algorithm}
    \caption{Dependency Graph Assembly}\label{algo:AKP13_command_dependency_graph_assembly}
    \begin{algorithmic}[1]
        \Procedure{MyProcedure}{}
        \State $\textit{stringlen} \gets \text{length of }\textit{string}$
        \State $i \gets \textit{patlen}$
        \BState \emph{top}:
        \If {$i > \textit{stringlen}$} \Return false
        \EndIf
        \State $j \gets \textit{patlen}$
        \BState \emph{loop}:
        \If {$\textit{string}(i) = \textit{path}(j)$}
        \State $j \gets j-1$.
        \State $i \gets i-1$.
        \State \textbf{goto} \emph{loop}.
        \State \textbf{close};
        \EndIf
        \State $i \gets i+\max(\textit{delta}_1(\textit{string}(i)),\textit{delta}_2(j))$.
        \State \textbf{goto} \emph{top}.
        \EndProcedure
    \end{algorithmic}
\end{algorithm}

\end{document}

I figured out that my problem comes with these lines:
\usepackage{float}
\restylefloat{figure}

I use the because I want my figures to be fixed at the place where I defined them.

Best Answer

I've found an incredibly easy workaround.

% fix graphics on defined position
\usepackage{float}
\restylefloat{figure}

%pseudocode
\usepackage{mathtools} 
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}

\makeatletter
\def\BState{\State\hskip-\ALG@thistlm}
\makeatother

It works if I change the order of the \usepackage calls

Related Question