Graphics, Figures & Tablesside by side text and graphics

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
IsleofGough
Posts: 5
Joined: Tue Oct 15, 2019 10:33 pm

side by side text and graphics

Post by IsleofGough »

What is the best way to have side by side text and graphics in LaTex? What I want is something like:

Step 1: xxxx Graphics image
xxxxxxxxxxx
xxxxxxxxxxx

Step 2: xxxx Graphics image
xxxx

etc.

I know how to do this in Framemaker, MadCap Flare, InDesign etc., but I haven't had luck with using things like:
\subsection*{Section Title}

\subsubsection*{Subsection Title}

\begin{wrapfigure}{r}{0.5\textwidth}
\begin{center}
\includegraphics[width=0.48\textwidth]{figures/Graphic1.jpg}
\end{center}
\end{wrapfigure}

xxxxxxxxx

Thanks for any help.

Recommended reading 2024:

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

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

User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

side by side text and graphics

Post by Ijon Tichy »

Depends on what you really have and want. So some more information and a Infominimal working example would have been useful.
\documentclass{article}

\usepackage[etex]{adjustbox}
\usepackage{wrapfig}
\usepackage{mwe}

\newcommand*{\shortblindtext}{This is a very short blindtext, much shorter
  than the longer from \texttt{blindtext} or \texttt{lipsum}.}

\begin{document}

\section{Image and text side by
  side}

\begin{adjustbox}{minipage=.5\textwidth,valign=T}
  \shortblindtext
\end{adjustbox}\hfill
\adjustimage{valign=T,width=.45\textwidth}{example-image-a}

\bigskip

\begin{adjustbox}{minipage=.75\textwidth,valign=T}
  \shortblindtext
\end{adjustbox}\hfill
\adjustimage{valign=T,width=.2\textwidth}{example-image-b}

\bigskip

\begin{adjustbox}{minipage=.5\textwidth,valign=T}
  \blindtext
\end{adjustbox}\hfill
\adjustimage{valign=T,width=.45\textwidth}{example-image-a}

\bigskip

\begin{adjustbox}{minipage=.75\textwidth,valign=T}
  \blindtext
\end{adjustbox}\hfill
\adjustimage{valign=T,width=.2\textwidth}{example-image-b}

\section{Image with text floating
  around}

\begin{wrapfigure}{r}{.5\textwidth}
  \vskip -\baselineskip% really top aligned
  \includegraphics[width=\linewidth]{example-image-a}
\end{wrapfigure}
\blindtext

\begin{wrapfigure}{r}{.25\textwidth}
  \vskip -\baselineskip% really top aligned
  \includegraphics[width=\linewidth]{example-image-b}
\end{wrapfigure}
\blindtext

\bigskip

But this is problematic, if the text
is too short to float around:

\begin{wrapfigure}{r}{.5\textwidth}
  \vskip -\baselineskip% really top aligned
  \includegraphics[width=\linewidth]{example-image-a}
\end{wrapfigure}
\shortblindtext

\begin{wrapfigure}{r}{.25\textwidth}
  \vskip -\baselineskip% really top aligned
  \includegraphics[width=\linewidth]{example-image-b}
\end{wrapfigure}
\shortblindtext

\end{document}
There are several alternatives to wrapfig. All of them have different limitations. Text floating around images or figures is not easy with LaTeX. AFAIK the situation of ConTeXt is better here, but still not the best.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
IsleofGough
Posts: 5
Joined: Tue Oct 15, 2019 10:33 pm

side by side text and graphics

Post by IsleofGough »

Thank you so much!! Your examples will work perfectly. I was about to try putting an image in a table cell to solve the alignment issue, but your solution works. I am very new to LaTex and generally have used Framemaker, Flare, or InDesign for books I've published. For bibliographies and math symbols, LaTex is better than the others. Getting used to packages and figuring out the equivalents of spans (character styles) and paragraph styles and master pages has not been easy.

The other issue with LaTeX is how well it will work for dual output (pdf & ePub). That was a major plus to MadCap Flare, but I will see it that can be managed.
Post Reply