TeX - LaTeX Asked on August 13, 2021
I can have a 2×2 array of figures with the following snippet:
begin{figure*}
centering
subfloat[f1]{%
{includegraphics[width=0.5textwidth]{./figures/f1.pdf}}
}%
subfloat[f2]{%
{includegraphics[width=0.5textwidth]{./figures/f2.pdf}}
}%
qquad
subfloat[f3]{%
{includegraphics[width=0.5textwidth]{./figures/f3.pdf}}
}%
subfloat[f4]{%
{includegraphics[width=0.5textwidth]{./figures/f4.pdf}}
}%
caption[layout]{layout}%
label{fig:layout}%
end{figure*}
However, if I want to add another figure on the right side of these 4 figures like the following image, I am not sure what to do.
So far I tried:
begin{figure*}
centering
subfloat{
subfloat[f1]{%
{includegraphics[width=0.5textwidth]{./figures/f1.pdf}}
}%
subfloat[f2]{%
{includegraphics[width=0.5textwidth]{./figures/f2.pdf}}
}%
qquad
subfloat[f3]{%
{includegraphics[width=0.5textwidth]{./figures/f3.pdf}}
}%
subfloat[f4]{%
{includegraphics[width=0.5textwidth]{./figures/f4.pdf}}
}%
}
subfloat[f5]{%
{includegraphics[width=0.5textwidth]{./figures/f5.pdf}}
caption[layout]{layout}%
label{fig:layout}%
end{figure*}
but the result wasn’t as I expected.
Does anyone know a simple modification to this?
One possibility is to use tabular
to better control the content of rows and columns. (First example). It requires adjusting the position of the first row to align the top of the figures.
The second option is to use the nicematrix
package and use the command Block
to define a cell block (2 rows, 1 column here) and center the content without the need for additional settings.
There is also the option of minipages
as suggested by leandriis.
All of them are easily generalizable.
documentclass{article}
usepackage{caption}
usepackage{nicematrix}
%% The example images are provided by the graphicx package, which is loaded by nicematrix
%usepackage{graphicx}
begin{document}
begin{table}
begin{tabular}{ccc}
includegraphics[width=0.3textwidth, height=0.3linewidth]{example-image-a} &
includegraphics[width=0.3textwidth, height=0.3linewidth ]{example-image-a} &[-0.31linewidth] %adjust to level the tops
includegraphics[width=0.3textwidth, height=0.3linewidth]{example-image-b} &
includegraphics[width=0.3textwidth, height=0.3linewidth]{example-image-b} &
includegraphics[width=0.3textwidth, height=0.61linewidth]{example-image-c}
end{tabular}
caption[layout]{layout with tabular}%
label{fig:layout1}%
end{table}
vspace{50pt}
begin{table}
begin{NiceTabular}{ccc}
includegraphics[width=0.3textwidth, height=0.3linewidth]{example-image-a} &
includegraphics[width=0.3textwidth, height=0.3linewidth ]{example-image-a} &
Block{2-1}{includegraphics[width=0.3textwidth, height=0.61linewidth]{example-image-c}}
includegraphics[width=0.3textwidth, height=0.3linewidth]{example-image-b} &
includegraphics[width=0.3textwidth, height=0.3linewidth]{example-image-b} &
end{NiceTabular}
caption[layout]{layout with nicematrix}%
label{fig:layout2}%
end{table}
end{document}
Correct answer by Simon Dispa on August 13, 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