TeX - LaTeX Asked by gbruss on February 22, 2021
I’m trying to create a tightly knit group of 4 subfigures, in a simple square configuration. I’m able to do this but I would like to remove the whitespace.
I’m not sure about the linewidth numbers. This is a two-column article and I came to 0.235 through trial and error.
This is what I currently have:
This is my code:
begin{figure}
centering
begin{subfigure}[h]{0.235textwidth}
includegraphics[width=textwidth]{assets/kspace-fac4.jpg}
caption{Caption1}
end{subfigure}
begin{subfigure}[h]{0.235textwidth}
includegraphics[width=textwidth]{assets/image-fac4.jpg}
caption{Caption2}
end{subfigure}
begin{subfigure}[h]{0.235textwidth}
centering
includegraphics[width=textwidth]{assets/kspace-full.jpg}
caption{Caption3}
end{subfigure}
begin{subfigure}[h]{0.235textwidth}
centering
includegraphics[width=textwidth]{assets/image-full.jpg}
caption{Caption4}
label{fig:five over x}
end{subfigure}
caption{Undersampling}
end{figure}
Using image width 0.35textwidth
in two column document and require that figure is paced in one column and not require to be placed in two rows cause overlapping of images and uncontrolled break of them into two rows. So I suspect, that you actually looking for:
(red lines indicate text borders)
documentclass[twocolumn]{article}
%--------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%
usepackage[demo]{graphicx} % in real document remove option "demo"
usepackage{subcaption}
begin{document}
begin{figure*} % figure will span both columns in article
setkeys{Gin}{width=linewidth} % common settings of images widths
begin{subfigure}{0.235linewidth}
includegraphics{assets/kspace-fac4.jpg}
caption{Caption 1}
end{subfigure}%
hfill
begin{subfigure}{0.235linewidth}
includegraphics{assets/image-fac4.jpg}
caption{Caption 2}
end{subfigure}%
hfill
begin{subfigure}{0.235linewidth}
includegraphics{assets/kspace-full.jpg}
caption{Caption 3}
end{subfigure}
hfill
begin{subfigure}{0.235linewidth}
includegraphics{assets/image-full.jpg}
caption{Caption 4}
label{fig:five over x}
end{subfigure}
caption{Undersampling}
end{figure*}
end{document}
Note, if before figure is some text, figure will appear at top of the next page! If you not obtain the same result with your images, i.e. have more white space around them as is shown above, than your images contain this white space. To see, that this is a case, add fbox
around images:
begin{subfigure}{0.235linewidth}
fbox{includegraphics{assets/kspace-fac4.jpg}}
caption{Caption 1}
end{subfigure}%
Edit:
In the case, that you like to have figure in one column with two images in the row, than you need to do the following changes in above document:
begin{figure*}
to begin{figure}[ht]
subfigure
width for example to 0.48columnwidth
(or 0.48linewidth
)hfill
command, insert blanc line and for obtain more vertical distance between rows of images insert for example medskip
before third sub figureThis changes should give result similar to this:
Answered by Zarko on February 22, 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