latexfiguretabularoverleaf

latex figure as table


enter image description here

I am design a figure on latex overleaf. the figure shall contain multi images as above. i used this code as it is required for a conference paper. i faced a problem with the first image , the mirgin of this image looks different and wider than the others. can some one help me to solve this issue

here the code:

    \begin{figure}[!ht]
\begin{tabular}{ccccc}
%\hline
\centering
\bmvaHangBox{\fbox{\parbox{2.0cm}{~\\[0.8mm]
\rule{0pt}{1ex}\hspace{0.5mm}\includegraphics[width=1.8cm]{images/knet_deeplab_R/Original/000874.jpg}\\[-0.1pt]}}} &
\bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/Original/001075.jpg}}} &
\bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/Original/002478.jpg}}} &
\bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/Original/002756.jpg}}} &
\bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/Original/002849.jpg}}} \\
\multicolumn{5}{c}{Original Images} \\
%2nd row 
\bmvaHangBox{\fbox{\parbox{2.0cm}{~\\[0.8mm]
\rule{0pt}{1ex}\hspace{0.5mm}\includegraphics[width=1.8cm]{images/knet_deeplab_R/DenseCL_200/000874.jpg}\\[-0.1pt]}}} &
\bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/DenseCL_200/001075.jpg}}} &
\bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/DenseCL_200/002478.jpg}}} &
\bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/DenseCL_200/002756.jpg}}} &
\bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/DenseCL_200/002849.jpg}}} \\
\multicolumn{5}{c}{DenseCL with 200 epochs}\\

Solution

  • The \rule command is applied to adjust vertical spacing inside the \parbox, and the \parbox is used to make the box’s width more specific. Therefore, it may seem like a larger margin. Still, in one with an image, the additional space can be eaten up if it is desired to add text there. I suggest using this same method of boxing so that all images are presented the same way. This way, all will look the same and will be properly adjusted to the image. The following is the code that I have edited to apply the same to all the images and not to use \parbox when not needed.

    \begin{figure}[!ht]
    \centering
    \begin{tabular}{ccccc}
    %\hline
    \bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/Original/000874.jpg}}} &
    \bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/Original/001075.jpg}}} &
    \bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/Original/002478.jpg}}} &
    \bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/Original/002756.jpg}}} &
    \bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/Original/002849.jpg}}} \\
    \multicolumn{5}{c}{Original Images} \\
    %2nd row
    \bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/DenseCL_200/000874.jpg}}} &
    \bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/DenseCL_200/001075.jpg}}} &
    \bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/DenseCL_200/002478.jpg}}} &
    \bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/DenseCL_200/002756.jpg}}} &
    \bmvaHangBox{\fbox{\includegraphics[width=1.8cm]{images/knet_deeplab_R/DenseCL_200/002849.jpg}}} \\
    \multicolumn{5}{c}{DenseCL with 200 epochs}\\
    \end{tabular}
    \end{figure}