0

Is there any way to align vertically the figure on the right in the middle of the figure on the left AND add a sub-caption to fill the blank space below the figure on the right ?

Thank you in advance for your help,

Sincerely,

Code :

\documentclass{article} 
\usepackage{graphicx}  % Pour inclure les images
\usepackage{caption}   % Pour les légendes
\usepackage{subcaption}  % Pour les sous-figures

\begin{document}

%%%% FIGURE SCHEMA SETUP %%%%
\begin{figure}[h]
    \centering
    % Première figure avec baseline au milieu de l'image
    \raisebox{-.5\height}{\includegraphics[width=.45\textwidth]{images/Chapitre5/setup2.eps}}
    \hfill
    % Deuxième figure avec baseline au milieu de l'image
    \raisebox{-.5\height}{\includegraphics[width=.45\textwidth]{images/Chapitre5/setupp2.eps}}
    \caption{Schématisation du premier dispositif expérimental mis en place. Gauche : Vue de face des deux disques concentriques. Droite : Vue latérale de ces deux mêmes disques.}
    \label{setupRT1}
\end{figure}

\end{document}

Output :

enter image description here

1
  • I'm sorry, maybe I'm not fully grasping your question, but are you looking for subfigure package? Here is a quick tutorial: latex-tutorial.com/subfigure-latex. You can use \begin{subfigure}[pos][height][inner-pos]{width} for vertical alignment.
    – Miloop
    Commented Jun 20 at 14:25

1 Answer 1

2

You can exploit adjustbox.

With valign=c you set the image half below the baseline. Do the same in the subfigure environment, using [t] vertical alignment.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[export]{adjustbox}

\begin{document}

\begin{figure}[htp]

\includegraphics[width=.45\textwidth,valign=c]{example-image}\hfill
\begin{subfigure}[t]{0.45\textwidth}
  \includegraphics[width=\linewidth,height=1.5cm,valign=c]{example-image}
  \caption{This is the subcaption}
\end{subfigure}

\caption{Schématisation du premier dispositif expérimental mis en place. 
Gauche : Vue de face des deux disques concentriques. Droite : Vue latérale 
de ces deux mêmes disques.}\label{setupRT1}

\end{figure}

\end{document}

enter image description here

In the code I used height just to emulate the shape of your image on the right.

Note that \raisebox{-0.5\height}{...} would amount to the same, but valign=c is much easier to maintain.

1
  • thank you for your answer : valign didn't work for me but implementing the subfigure inside the figure environnement was enough. Thank you again !
    – Waxler
    Commented Jun 23 at 18:11

You must log in to answer this question.

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