TeX - LaTeX Asked by Arseniy Sleptsov on August 25, 2021
I have two PDF figures. I would like to combine them to make one figure with sub-figures (a)
and (b)
so that they appear vertically (figure (a)
is on top of figure (b)
), NOT side-by-side because my document has 1 column. I found only for side-by-side. Using package subcaption
I tried as follows:
begin{figure}[h]
begin{subfigure}{textwidth}
includegraphics[trim=70 30 90 60,clip,width=textwidth]{FigA.pdf}
caption{Figure A}
end{subfigure}
begin{subfigure}{textwidth}
includegraphics[trim=70 30 90 60,clip,width=textwidth]{FigureB.pdf}
caption{Figure B}
end{subfigure}
caption{Main caption}
end{figure}
However, although the figures appear vertically, the figure (b)
intersect the caption of the figure (a)
. If there is no other way to organize them, how can I add space between them?
You will get the two subfigures stacked vertically with the code you present, because the space after the first end{subfigure}
allows for a line break.
However, a blank line and some additional vertical space will provide some separation.
In the code I had to add height=8cm
in order to not exceed the page dimensions. Your images are probably much less tall. In any case, such big float should have a p
option, or it might block the float queue.
documentclass{article}
usepackage{graphicx}
usepackage{subcaption}
begin{document}
begin{figure}[htp]
begin{subfigure}{textwidth}
includegraphics[trim=70 30 90 60,clip,width=textwidth,height=8cm]{example-image-a}
caption{Figure A}
end{subfigure}
bigskip
begin{subfigure}{textwidth}
includegraphics[trim=70 30 90 60,clip,width=textwidth,height=8cm]{example-image-b}
caption{Figure B}
end{subfigure}
caption{Main caption}
end{figure}
end{document}
Correct answer by egreg on August 25, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP