If I have the following LaTeX code, is it possible to combine both graphic and algorithm so that they are fixed to a common page?
\begin{figure} [H]
\centering{\includegraphics[scale=1]{Figure.png}}
\caption{Figure.}
\label{fig:Figure}
\end{figure}
\begin{algorithm}[H]
\algsetup{indent=2em}
\begin{adjustwidth}{1em}{}
\begin{algorithmic}[1]
\STATE $Line$ $of$ $code$
\end{algorithmic}
\caption{Algorithm.}
\label{alg:Algorithm}
\end{adjustwidth}
\end{algorithm}
To give something like this:
Best Answer
I would place the
algorithm
as a non-float - using the[H]
float specifier - inside thefigure
float:The
[H]
float specifier process the float as a immovable block, making it possible to embed it inside another float (figure
in the above case). Since both objects are contained within the same float, they will always stay together.