Too Much White Space Between Caption and Figure Produced by Tikzdevice and Ggplot2 in Latex

Too much white space between caption and figure produced by tikzDevice and ggplot2 in LaTeX

It's been so long since I asked this question, but I wanted to answer what was the problem in the end.

As you can see in this question on the differences between \input{} and \include{}, the problem has to do with the fact that \include{} does a \clearpage before and after \include{}, that generates the white space I was talking about.

On the other hand, using \input{} is the equivalent to copy and pasting the code into the LaTeX document, that will prevent the white spaces.

Too much space between the paragraph and an image

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}

Sample Image

Getting rid of the Figure 1 : bit

Using the caption package:

\usepackage[labelformat=empty]{caption}

Will remove the "Figure n:" from your captions.

LaTeX puts too much space next to integrals

Something like this will do the trick.

\usepackage{amsmath}
\def\mathclap#1{\text{\hbox to 0pt{\hss$\mathsurround=0pt#1$\hss}}}
\begin{document}
\[
\int\limits_{\mathclap{-\infty < x < c}} (c - x) \ dP(x)
\]
\end{document}

More about such tricks is given in this article.



Related Topics



Leave a reply



Submit