Graphics, Figures & TablesPlacing graphic and algorithm together on page

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Mr Morgan
Posts: 1
Joined: Wed Oct 14, 2015 11:10 pm

Placing graphic and algorithm together on page

Post by Mr Morgan »

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?

Code: Select all

\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:
Capture.PNG
Capture.PNG (7.06 KiB) Viewed 2091 times
Where the figure and algorithm are connected?

The package subfig is not compatible with other packages in the current project.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Placing graphic and algorithm together on page

Post by Johannes_B »

This is a crosspost to TeX.SX where you already got two solutions.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply