段落和图像之间的空间太大

时间:2019-06-13 17:24:54

标签: latex

我正在尝试在图形中使用tabularx将几张图像以表格形式放置。我的问题是,由于某种原因,图像上方的最后一段与图像本身之间的空间太大。


    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}

为什么会生成此空间?如何避免?

1 个答案:

答案 0 :(得分:1)

带有[h]浮动说明符的文本和对象之间的间隔由\intextsep定义。其默认值为12.0pt plus 2.0pt minus 2.0pt,但可以这样修改:

\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