TeX - LaTeX Asked by Talha on November 27, 2020
I want to place 2 figures side-by-side in a single column document written using elsarticle
where each figure has some sub-figures associated with it.
Here is my mwe
documentclass[review]{elsarticle}
usepackage{subfig}
begin{document}
begin{figure}[] % Figure 1
centering
subfloat[A]{includegraphics[width=0.4linewidth,height=0.15 textheight]{example-image-a}}
subfloat[B]{includegraphics[width=0.4linewidth,height=0.15 textheight]{example-image-b}}
caption[]{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque }
end{figure}
begin{figure}[] % Figure 2
centering
subfloat[C]{includegraphics[width=0.4linewidth,height=0.15 textheight]{example-image-c}}
subfloat[X]{includegraphics[width=0.4linewidth,height=0.15 textheight]{example-image}}
caption[]{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque }
end{figure}
end{document}
can someone help me place them the way they look in the attached image?
You need to put both images in one figure
float, each in minipage
or intabularx
:
With minipage
:
documentclass[review]{elsarticle}
usepackage{subfig}
begin{document}
begin{figure}[ht]
setkeys{Gin}{width=0.4linewidth,height=0.15textheight}
% Figure 1
begin{minipage}[t]{0.45linewidth}
centering
subfloat[A]{includegraphics{example-image-a}}
subfloat[B]{includegraphics{example-image-b}}
caption[]{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque }
end{minipage}
quad
begin{minipage}[t]{0.45linewidth}
centering
subfloat[C]{includegraphics{example-image-c}}
subfloat[X]{includegraphics{example-image}}
caption[]{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque }
end{minipage}
end{figure}
end{document}
With tabularx
:
documentclass[review]{elsarticle}
usepackage{subfig}
usepackage{tabularx}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
begin{figure}[ht]
setkeys{Gin}{width=0.4linewidth,height=0.15textheight}
% Figure 1
begin{tabularx}{linewidth}{CC}
subfloat[A]{includegraphics{example-image-a}}
subfloat[B]{includegraphics{example-image-b}}
caption[]{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque }
&
subfloat[C]{includegraphics{example-image-c}}
subfloat[X]{includegraphics{example-image}}
caption[]{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque }
end{tabularx}
end{figure}
end{document}
Result is similar as before.
Correct answer by Zarko on November 27, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP