5

I would like to align 3 subfigures vertically (all on top of each other), and then have these on the right side of the page with text wrapping around them. I know how to use wrapfig for a single figure and subcaption and subfigure to get the 3 vertical figures, but I can't seem to put the them together.

Here is what I currently have for the subfigure alignment:

\documentclass[11pt,letterpaper]{article}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx,color,float,amssymb,amsmath}
\usepackage{pdfpages}
\usepackage{wrapfig}
\usepackage[font=small]{caption, subcaption}

\begin{document}

some text

\begin{figure}
\hfill\begin{minipage}[c][11cm][t]{.5\textwidth}
    \vspace*{\fill}
    \centering\captionsetup[subfigure]{justification=centering}
    \includegraphics[width=.5\textwidth]{example-image-a}
    \subcaption{}
    \label{fig:5a}\par\vfill
    \includegraphics[width=.5\textwidth]{example-image-b}
    \subcaption{}
    \label{fig:5b}
    \includegraphics[width=.5\textwidth]{example-image-c}
    \subcaption{}
    \label{fig:5c}
\end{minipage}
\caption{subfigure}\label{fig:5}
\end{figure}

some text 
\end{document}

Can anyone help figure out a way to wrap the text around this figure environment? Any help is appreciated, thank you!

2
  • 1
    Welcome! Please edit your question to provide a complete example. How is \some defined? You at least need to end the document and provide sufficient text for wrapping. (Maybe that's what the \some is intended to do? Use e.g. example-image-a in place of image1 etc. (there's -b and -c for 2 and 3). Consider using kantlipsum or lipsum for the text.
    – cfr
    Commented Jul 28, 2017 at 22:54
  • I assume letterhead should be letterpaper.
    – cfr
    Commented Jul 28, 2017 at 22:58

2 Answers 2

4

I suppose that you like to have something like this:

enter image description here

For this you need to use wrapfigure environment:

\documentclass[11pt,letterhead]{article}
\usepackage[margin=1in]{geometry}
\usepackage[demo]{graphicx}
\usepackage{color,float,amssymb,amsmath}
\usepackage{pdfpages}
\usepackage{wrapfig}
\usepackage[font=small]{caption, subcaption}

\usepackage{lipsum}

\begin{document}
    \lipsum[1]
\begin{wrapfigure}{r}{.5\textwidth}
    \begin{minipage}{\linewidth}
    \centering\captionsetup[subfigure]{justification=centering}
    \includegraphics[width=\linewidth]{image1}
    \subcaption{}
    \label{fig:5a}\par\vfill
    \includegraphics[width=\linewidth]{image2}
    \subcaption{}
    \label{fig:5b}
    \includegraphics[width=\linewidth]{image3}
    \subcaption{}
    \label{fig:5c}
\end{minipage}
\caption{Figure}\label{fig:5}
\end{wrapfigure}
\lipsum[2-4]
\end{document}

Note: we haven't your original picture, so in the future similar cases please use \usepackage[demo]{graphicx} in your preamble :)

Edit:
code is now slightly changed (added is minipage) according to your wish expressed in comment below

6
  • This worked perfectly! Thank you so much for this simple fix, and in the future I will add filler text to my question so it is easier to understand. Commented Jul 29, 2017 at 17:30
  • Actually, is there anyway I can change the bottom capture to label the whole entire figure instead of another subfigure? So the three images would be (a), (b), and (c), but instead of (d) at the bottom it would be Figure 5 to represent all of the figures? Commented Jul 29, 2017 at 17:36
  • @K.Schneider, see edited answer.
    – Zarko
    Commented Jul 29, 2017 at 18:03
  • 1
    How about side-by-side?
    – khatchad
    Commented Apr 4, 2018 at 16:29
  • @RaffiKhatchadourian, please elaborate your comment. or better, if you have new question, ask it as question, not as comment.
    – Zarko
    Commented Apr 4, 2018 at 16:45
0

You can use the following commands without using the figure enviroment:

\wrapr{<text vertical adjustment>}{<number of lines>}{<image width>}{<text vertical adjustment>}{image}{text}

for placing the image on the right side or

\wrapl{<text vertical adjustment>}{<number of lines>}{<image width>}{<text vertical adjustment>}{image}{text}

for the left side of the document.

\documentclass[11pt,letterhead]{article}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx,color,float,amssymb,amsmath}
\usepackage{pdfpages,lipsum}
\usepackage{wrapfig,tikz}
\usepackage[font=small]{caption, subcaption}


\newenvironment{WrapText1}[3][r]
{\wrapfigure[#2]{#1}{#3}}
{\endwrapfigure}
\newenvironment{WrapText2}[3][l]
{\wrapfigure[#2]{#1}{#3}}
{\endwrapfigure}
\newcommand{\wrapr}[6]{
\begin{minipage}{\linewidth}\mbox{}\\
\vspace{#1}
\begin{WrapText1}{#2}{#3}
\vspace{#4}#5\end{WrapText1}#6
\end{minipage}}

\newcommand{\wrapl}[6]{
\begin{minipage}{\linewidth}\mbox{}\\
\vspace{#1}
\begin{WrapText2}{#2}{#3}
\vspace{#4}#5\end{WrapText2}#6
\end{minipage}}


\begin{document}
\wrapr{-5mm}{24}{4cm}{-5mm}{
\begin{tikzpicture}
\draw  (-2,2.5) rectangle (2,-0.5);
\end{tikzpicture}
\subcaption{}
\label{fig:5a}\par\vfill
\begin{tikzpicture}
\draw  (-2,2.5) rectangle (2,-0.5);
\end{tikzpicture}
\subcaption{}
\label{fig:5b}
\begin{tikzpicture}
\draw  (-2,2.5) rectangle (2,-0.5);
\end{tikzpicture}
\subcaption{}
\label{fig:5c}}
{\lipsum[1-3]}
\newpage
\wrapl{-5mm}{24}{4cm}{-5mm}{
\begin{tikzpicture}
\draw  (-2,2.5) rectangle (2,-0.5);
\end{tikzpicture}
\subcaption{}
\label{fig:4a}\par\vfill
\begin{tikzpicture}
\draw  (-2,2.5) rectangle (2,-0.5);
\end{tikzpicture}
\subcaption{}
\label{fig:4b}
\begin{tikzpicture}
\draw  (-2,2.5) rectangle (2,-0.5);
\end{tikzpicture}
\subcaption{}
\label{fig:4c}}
{\lipsum[1-3]}
\end{document}

enter image description here

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .