0
votes

I am trying to place several images in a tabular arrangement using tabularx within a figure. The problem I have is that for some reason there is too much space between the last paragraph above the image and the image itself.


    bla bla bla bla 

    \begin{figure}[h]
    %\setlength\tabcolsep{2pt}%
    \begin{tabularx}{\textwidth}{@{}c*{3}{C}@{}}

       \includegraphics[ width=0.3\linewidth, height=0.3\linewidth, keepaspectratio]{Imagen_a.png} &
       \includegraphics[ width=0.3\linewidth, height=0.29\linewidth, keepaspectratio]{Imagen_b.png} &
       \includegraphics[ width=0.3\linewidth, height=0.41\linewidth, keepaspectratio]{Imagen_c.png} &
       \\
       (a) & (b) & (c) & \\
       \includegraphics[ width=0.3\linewidth, height=0.3\linewidth, keepaspectratio]{Imagen_d.png}  &
       \includegraphics[ width=0.3\linewidth, height=0.3\linewidth, keepaspectratio]{Imagen_e.png}  &
       \includegraphics[ width=0.3\linewidth, height=0.3\linewidth, keepaspectratio]{Imagen_e.png} &
     \\
     (d) & (e) & (f) & \\
    \end{tabularx}
    \caption{Spatial distribution of customers - centered depot. (a) 30C, (b) 22C, (c) 15C, (d) 20C, (e) 15C.1} \label{fig:spatial-distribution}
    \end{figure}

Why is this space generated and how can I avoid it?

1

1 Answers

1
votes

The space between the text and an object with the [h] floating specifier is defined by \intextsep. Its default value is 12.0pt plus 2.0pt minus 2.0pt, but in can be modified like this:

\documentclass{article}

\usepackage{graphicx}
\usepackage{tabularx}

\setlength{\intextsep}{5.0pt plus 2.0pt minus 2.0pt}

\begin{document}


    bla bla bla bla 
    \begin{figure}[h]
    %\setlength\tabcolsep{2pt}%
    \begin{tabularx}{\textwidth}{@{}*{3}{c}@{}}%
       \includegraphics[ width=0.3\linewidth, height=0.3\linewidth, keepaspectratio,page=1]{example-image-duck} &
       \includegraphics[ width=0.3\linewidth, height=0.29\linewidth, keepaspectratio,page=2]{example-image-duck} &
       \includegraphics[ width=0.3\linewidth, height=0.41\linewidth, keepaspectratio,page=3]{example-image-duck}\\
       (a) & (b) & (c)\\
       \includegraphics[ width=0.3\linewidth, height=0.3\linewidth, keepaspectratio,page=4]{example-image-duck}  &
       \includegraphics[ width=0.3\linewidth, height=0.3\linewidth, keepaspectratio,page=5]{example-image-duck}  &
       \includegraphics[ width=0.3\linewidth, height=0.3\linewidth, keepaspectratio,page=6]{example-image-duck}\\
     (d) & (e) & (f)\\
    \end{tabularx}%
    \caption{Spatial distribution of customers - centered depot. (a) 30C, (b) 22C, (c) 15C, (d) 20C, (e) 15C.1}% \label{fig:spatial-distribution}%
    \end{figure}



\end{document}

enter image description here