Graphics, Figures & TablesPicture and program code side by side

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
thepetas
Posts: 3
Joined: Sun May 17, 2015 2:23 pm

Picture and program code side by side

Post by thepetas »

Hello,
I am trying to find how to have the picture on the left side of sheet and the code (from {algorithmic}) on the right sheet. Do you know anybody how to? :-)
Thanks !

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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

Re: Picture and program code side by side

Post by Johannes_B »

You can always use minipages to place stuff side by side. If you need captions, it gets a bit more tricky. Can you show us an example with an example algorithm, including all the packages needed to compile it? There are more than one algo package out there and they are a bit confusing.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
thepetas
Posts: 3
Joined: Sun May 17, 2015 2:23 pm

Picture and program code side by side

Post by thepetas »

Thank you very much. It work !
my code, maybe it will be better...

Code: Select all

\begin{minipage}[]{0.5\textwidth}
    \begin{flushleft}
        \includegraphics[scale=0.6]{obr1.pdf} 
    \end{flushleft}
\end{minipage}%
%
\begin{minipage}[]{0.5\textwidth}
    \begin{flushright}
        \begin{algorithmic}
  \STATE Zacatek
  \STATE \ \ \ Prikaz1
  \STATE \ \ \ Prikaz2
  \STATE Konec
  \end{algorithmic}
    \end{flushright}    
\end{minipage}
Post Reply