2

I am having diffuculties in adjusting the spaces in different part of my thesis.

I have 3 issues to solve which I try to show in a single image below:

enter image description here

In the first problem, I need to put 18pt space between a text and the figure following the text (same is true for tables as well)

In the second problem, the caption of the figure should be 18pt below the figure

In the third case, there should be 18pt distance after the figure caption and the text/section/subsection etc following the figure.

I attach the sample code that I use to insert figure to the tex file as below:

\begin{figure}[h]
\centering
\includegraphics[width=0.6\linewidth]{figures/dist_list_bim.pdf}
\caption[Change of prediction softmax score of MLP model]{Change of prediction softmax score of MLP model.}
\label{fig:dist_list_bim} \end{figure}

And I also I use below command below as well to arrange the captions:

\captionsetup{labelsep=space, labelfont = normalfont, skip = 18pt, font = normalsize}

Would you please guide me on how to handle these 3 issues?

Best wishes,

2
  • 2
    Never provide code fragments. It's likely that the source of the problem lies with the code before or after the picture, or with the document's global configuration. Please read about Minimal Working Example and edit your question accordingly.
    – Miyase
    Dec 27, 2022 at 15:35
  • 1
    Problem 1 and problem 3 are not in the spirit of LaTeX. If you're using floating environments like figure (which you should use), then LaTeX will calculate the optimal spacing so that it looks nice. You shouldn't have any control over it.
    – Gargantuar
    Dec 27, 2022 at 15:50

1 Answer 1

3

Look at this answer: https://tex.stackexchange.com/a/23316/101651.

With \captionsetup{skip = 18pt} you set the space between the figure and its caption.

With

\setlength{\intextsep}{18pt plus 2pt minus 2pt}
\setlength{\textfloatsep}{18pt plus 2pt minus 2pt}

you set the length between the caption and the text.

Before the section, there is some other space but we need more infos about your document (a brief but complete example).

\documentclass{book}
\usepackage{graphicx}
\usepackage{caption}
\captionsetup{labelsep=space, labelfont = normalfont, skip = 18pt, font = normalsize}

\setlength{\intextsep}{18pt plus 2pt minus 2pt}
\setlength{\textfloatsep}{18pt plus 2pt minus 2pt}

\begin{document}
\listoffigures
\chapter{My chapter}
\section{My first section}
Some text for testing purpose only. 
Some text for testing purpose only.
Some text for testing purpose only. 
Some text for testing purpose only. 
\begin{figure}[h]\centering
\includegraphics[width=0.6\linewidth]{example-image-duck}
\caption[Change of prediction softmax score of MLP model]{Change of prediction softmax score of MLP model.}
\label{fig:dist_list_bim} 
\end{figure}
\section{My second section}
Some text for testing purpose only.
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .