4

Subfloats

I want these left-right-arrows to be higher, at center, as the red ones go, but I have no idea how it can be done. Here's my code:

\documentclass{article}
\usepackage{geometry}
\usepackage[demo]{graphicx}
\usepackage{subfig}

\begin{document}
\begin{figure}[htb]%
\centering
\subfloat[$f(t)$]{{\includegraphics[width=5cm]{pierw1} }}%
\qquad 
\subfloat{$\Longleftrightarrow$}%
\qquad 
\subfloat[$F(\omega)$]{{\includegraphics[width=5cm]{pierw2} }}%

\subfloat[$F(t)$]{{\includegraphics[width=5cm]{pierw3} }}%
\qquad 
\subfloat{$\Longleftrightarrow$}%
\qquad 
\subfloat[$2 \pi f(-\omega)$]{{\includegraphics[width=5cm]{pierw4} }}%

\caption{2 Figures side by side}%
\label{fig:example}%
\end{figure}
\end{document}

I tried by making it as a subfloat, but I don't know how I can position it.

And second problem - how can I get rid off these (a) (b) etc. while leaving caption only?

2
  • Your code doesn't compile, because you haven't included the \documentclass command nor \begin{document}. Please add those, as well as the packages you're using. Commented Dec 12, 2016 at 23:26
  • (1) welcome, (2) if you don't need the numbering, you also don't need subfloat. Just put the four images into four nodes in a tikz images, then add the four captions to that and the two arrows.
    – daleif
    Commented Dec 12, 2016 at 23:27

2 Answers 2

4

Below I set the images using adjustbox's valign=c. This places the vertical anchor (used for alignment) at the centre. Since each image is set with the same (fixed) width, the "subcaptions" are set inside a similar-width \makebox:

enter image description here

\documentclass{article}

\usepackage[export]{adjustbox}

\begin{document}

\begin{figure}
  \centering\small

  % Top images
  \includegraphics[width=5cm, valign=c]{example-image-a}
  \qquad 
  $\Longleftrightarrow$
  \qquad 
  \includegraphics[width=5cm, valign=c]{example-image-b}

  \medskip

  % Top captions
  \makebox[5cm]{$f(t)$}
  \qquad
  \phantom{$\Longleftrightarrow$}
  \qquad
  \makebox[5cm]{$F(\omega)$}

  \bigskip

  % Bottom images
  \includegraphics[width=5cm, valign=c]{example-image-b}
  \qquad 
  $\Longleftrightarrow$
  \qquad 
  \includegraphics[width=5cm, valign=c]{example-image-a}

  \medskip

  % Bottom captions
  \makebox[5cm]{$F(t)$}
  \qquad
  \phantom{$\Longleftrightarrow$}
  \qquad
  \makebox[5cm]{$2 \pi f(-\omega)$}

  \caption{2 figures side by side}%
\end{figure}

\end{document}

Without the need for subfloat numbering, you can just set the entire structure inside a tabular:

\begin{figure}
  \centering\small

  % Top images
  \begin{tabular}{ @{} c @{\qquad} c @{\qquad} c @{} }
    \includegraphics[width=5cm,valign=c]{example-image-a} &
    $\Longleftrightarrow$ &
    \includegraphics[width=5cm,valign=c]{example-image-b} \\
    % Top captions
    \rule{0pt}{\normalbaselineskip}$f(t)$ &&
    $F(\omega)$ \\[\bigskipamount]
    % Bottom images
    \includegraphics[width=5cm, valign=c]{example-image-b} &
    $\Longleftrightarrow$ &
    \includegraphics[width=5cm, valign=c]{example-image-a} \\
    % Top captions
    \rule{0pt}{\normalbaselineskip}$F(t)$ &&
    $2 \pi f(-\omega)$
  \end{tabular}

  \caption{2 figures side by side}%
\end{figure}
3
  • Great ! It also works inside subfigure environment! Any idea if we can make the two arrows aligned when the figures have different width ? Or should I just use tabular ? Commented Mar 7, 2018 at 1:24
  • @CiprianTomoiagă: Yes, that is possible. As a consequence, that naturally may lead to the images also being aligned. Please provide example code (using the style I provided above) using Pastebin.
    – Werner
    Commented Mar 7, 2018 at 16:27
  • Thank you ! Here is a MWE pastebin.com/vgT3VRxN with links to images Commented Mar 7, 2018 at 20:37
3

enter image description here

It is achieved by use of package \usepackage[export]{adjustbox} (by which the baseline of images is moved to vertical center of images) and set subfig options as \captionsetup[subfloat]{labelformat=empty}, which eliminate subcaption numbering:

\documentclass{article}
\usepackage{geometry}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\usepackage[export]{adjustbox}

\begin{document}
\begin{figure}[htb]%
\captionsetup[subfloat]{labelformat=empty}

\centering
\subfloat[$f(t)$]{{\includegraphics[width=5cm,valign=m]{pierw1} }}%
\qquad
\subfloat{$\Longleftrightarrow$}%
\qquad
\subfloat[$F(\omega)$]{{\includegraphics[width=5cm,valign=m]{pierw2} }}%

\subfloat[$F(t)$]{{\includegraphics[width=5cm,valign=m]{pierw3} }}%
\qquad
\subfloat{$\Longleftrightarrow$}%
\qquad
\subfloat[$2 \pi f(-\omega)$]{{\includegraphics[width=5cm,valign=m]{pierw4} }}%

\caption{2 Figures side by side}%
\label{fig:example}%
\end{figure}
\end{document}
0

You must log in to answer this question.

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