TeX - LaTeX Asked by Tman on January 21, 2021
I want to move the caption to be underneath the image, I used hspace*{-3cm}
to move the image to the left but the caption did not move with it the full code is
begin{figure}[htb]
centering
%DSOI 5V
begin{subfigure}{0.25textwidth}
hspace*{-3cm}includegraphics[width=1.6linewidth]{Figures/sec_16-46_3.pdf}
caption{image1}
label{fig:1}
end{subfigure}hfil
begin{subfigure}{0.25textwidth}
hspace*{-1.5cm}includegraphics[width=1.6linewidth]{Figures/sec_614-644_3.pdf}
caption{image2}
label{fig:2}
end{subfigure}hfil
begin{subfigure}{0.25textwidth}
hspace{3cm}includegraphics[width=1.6linewidth]{Figures/sec_852-882_3.pdf}
caption{image3}
label{fig:3}
end{subfigure}
end{figure}
Please advice on how to resolve this.
It is much simpler to do that with the floatrow
package, which defines a subfloatrow
environment:
documentclass{article}
usepackage[showframe]{geometry}
usepackage{caption, subcaption}
usepackage{floatrow}
DeclareFloatSeparators{qqquad}{hskip 2.5em}
usepackage[demo]{graphicx}%
begin{document}
begin{figure}[htb]
floatsetup{subfloatrowsep=qqquad}
ffigbox{%
begin{subfloatrow}[3]
ffigbox[.25textwidth]{caption{image1}label{fig:1}}
{includegraphics[width=linewidth]{Figures/sec_16-46_3.pdf}}
ffigbox[.25textwidth]{caption{image2}label{fig:2}}
{includegraphics[width=linewidth]{Figures/sec_614-644_3.pdf}}
ffigbox[.25textwidth]{caption{image3}label{fig:3}}
{includegraphics[width=linewidth]{Figures/sec_852-882_3.pdf}}
end{subfloatrow}}%
{caption{Three images}}
end{figure}
end{document}
Answered by Bernard on January 21, 2021
[singlelinesheck=off]
will stop the caption from being centered. Your best bet is to apply the hspace*
to the entire subfigure (which is basically a minipage). I would replace [width=1.6linewidth]
with [width=linewidth]
and stop trying to overlap subfigures. If you aren't happy with the spacing, use hfill
instead of hfil
and adjust the subfigure widths.
Since floatrow is on my "packages to avoid" list, here is an alternative.
documentclass{article}
usepackage[showframe]{geometry}
usepackage{caption, subcaption}
usepackage[demo]{graphicx}%
captionsetup[subfigure]{singlelinecheck=off}
begin{document}
begin{figure}[htb]
begin{subfigure}{0.3textwidth}
includegraphics[width=linewidth]{Figures/sec_16-46_3.pdf}
caption{image1}
label{fig:1}
end{subfigure}hfill
begin{subfigure}{0.3textwidth}
includegraphics[width=linewidth]{Figures/sec_614-644_3.pdf}
caption{image2}
label{fig:2}
end{subfigure}hfill
begin{subfigure}{0.3textwidth}
includegraphics[width=linewidth]{Figures/sec_852-882_3.pdf}
caption{image3}
label{fig:3}
end{subfigure}
end{figure}
end{document}
Answered by John Kormylo on January 21, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP