Graphics, Figures & Tablesimages side by side

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
rishavharsh
Posts: 6
Joined: Sat Jun 20, 2015 2:49 pm

images side by side

Post by rishavharsh »

I need to put the text on the left side and the figure on the right side. If this gets resolved then i would use it for placing two figures side by side. however right now it is coming one on top of other. Any help ?

Code: Select all

\begin{center}
\begin{minipage}[h]{0.4\textwidth}
.....
....%some content
\end{minipage}

\hfill

\begin{minipage}{0.5\textwidth}
\vspace{0pt}
\includegraphics[width=\textwidth]{.....%some figure....}
\end{minipage}
\end{center}
rishavFigurePlacement.png
rishavFigurePlacement.png (111.48 KiB) Viewed 8554 times

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

images side by side

Post by Johannes_B »

You are using blank lines, which in LaTeX are used to mark paragraph breaks. A paragraph starts on a new line.


A complete example, click on Open in writelatex (which is now overleaf) to directly see the output.

Code: Select all

\documentclass{article}
\usepackage{mwe}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\blindtext
\begin{center}
\includegraphics[width=.45\linewidth]{example-image-a}\quad%
\includegraphics[width=.45\linewidth]{example-image-b}%
\end{center}
\blindtext

\begin{figure}
\centering
\subcaptionbox{wobblng whale}{
\includegraphics[width=.6\linewidth]{example-image-16x9}
}
\subcaptionbox{samba Snake}{
\includegraphics[width=.3\linewidth]{example-image-1x1}
}
\caption{As you can see, the whale is larger
than a snake}
\end{figure}
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
rishavharsh
Posts: 6
Joined: Sat Jun 20, 2015 2:49 pm

Re: images side by side

Post by rishavharsh »

Awesome .... :) this works
rishavharsh
Posts: 6
Joined: Sat Jun 20, 2015 2:49 pm

Re: images side by side

Post by rishavharsh »

Here is what i got
Attachments
text and picture.PNG
text and picture.PNG (15.05 KiB) Viewed 8549 times
rishavharsh
Posts: 6
Joined: Sat Jun 20, 2015 2:49 pm

Re: images side by side

Post by rishavharsh »

What are "mwe" and "subcaption" used for ?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

images side by side

Post by Johannes_B »

That question can be answered with Read the fine manual ;-) The most reliable information about a package can be found in its documentation.

Package mwe is helpful for generating minimal working examples, a very helpful thing to show some specific behaviour. Also helpful for troubleshooting.

Package subcaption is needed if you want to have different images with captions for each.

Hint: You can click the package names above to directly download the package manual.
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