图像上方和下方的 \baselineskip 间距不一致

图像上方和下方的 \baselineskip 间距不一致

我希望文本和图像之间的间距(顶部和底部)保持一致且等于 1。\baselineskip虽然与文本中的其他间距相比,底部间距看起来是正确的,但顶部间距明显较小。我该如何纠正这种差异?

\documentclass{article}
\usepackage{graphicx}
\RequirePackage[
    font=normalsize,
    justification=raggedright,
    singlelinecheck=false,
    format=hang,
    labelsep=endash,
    figurewithin=none,
    tablewithin=none,
]{caption}
\RequirePackage[style=abnt]{biblatex}
\AtBeginDocument{%
    \setlength{\intextsep}{\baselineskip}
    \setlength{\floatsep}{\baselineskip}
    \setlength{\textfloatsep}{\baselineskip}
    \setlength{\abovecaptionskip}{0pt}
    \setlength{\belowcaptionskip}{0pt}
    \setlength{\abovedisplayskip}{\baselineskip}
    \setlength{\belowdisplayskip}{\baselineskip}
    \setlength{\abovedisplayshortskip}{\baselineskip}
    \setlength{\belowdisplayshortskip}{\baselineskip}
    \setlength{\jot}{\baselineskip}
}
\addbibresource{Referencias.bib}
\usepackage{lipsum}

\title{Experimento 4}
\author{Lucas Martins Soares}
\date{\today}

\begin{document}
\maketitle
\section{Introdução}

\lipsum[1]

\begin{figure}[!htb]
    \centering
    \begin{minipage}{0.8\textwidth}
        \caption{\label{fig:Stack} Pilha de Tecnologias utilizadas em Big Data}
        \includegraphics[width=\textwidth]{Imagens/Stack.png}
        \caption*{\footnotesize Fonte: \textcite{sun2023survey}.}
    \end{minipage}
\end{figure}

\lipsum[1]
\end{document}

在此处输入图片描述

答案1

发布的文档有错误,因此没有可靠的输出,但是

在此处输入图片描述

\documentclass{article}
\usepackage{graphicx}
\RequirePackage[
    font=normalsize,
    justification=raggedright,
    singlelinecheck=false,
    format=hang,
    labelsep=endash,
    figurewithin=none,
    tablewithin=none,
]{caption}
\RequirePackage[style=abnt]{biblatex}
\AtBeginDocument{%
    \setlength{\intextsep}{\baselineskip}
    \setlength{\floatsep}{\baselineskip}
    \setlength{\textfloatsep}{\baselineskip}
    \setlength{\abovecaptionskip}{0pt}
    \setlength{\belowcaptionskip}{0pt}
    \setlength{\abovedisplayskip}{\baselineskip}
    \setlength{\belowdisplayskip}{\baselineskip}
    \setlength{\abovedisplayshortskip}{\baselineskip}
    \setlength{\belowdisplayshortskip}{\baselineskip}
    \setlength{\jot}{\baselineskip}
}
\addbibresource{Referencias.bib}
\usepackage{lipsum}

\title{Experimento 4}
\author{Lucas Martins Soares}
\date{\today}

\begin{document}
\maketitle
\section{Introdução}

\lipsum[1]

\begin{figure}[!htb]
    \centering
   % \begin{minipage}{0.8\textwidth}
        \caption{ Pilha de Tecnologias utilizadas em Big Data}\label{fig:Stack}
        \includegraphics[width=.6\textwidth]{example-image}
        \caption*{\footnotesize Fonte: \textcite{sun2023survey}.}
    %\end{minipage}
\end{figure}

\lipsum[1]
\end{document}

添加


\showoutput
\showboxdepth=4

生产

....\OT1/cmr/m/n/10 m
....\OT1/cmr/m/n/10 .
....\penalty 10000
....\glue(\parfillskip) 0.0 plus 1.0fil
....\glue(\rightskip) 0.0
...\penalty 0
...\glue 12.0
...\vbox(182.10617+0.0)x345.0
....\vbox(182.10617+0.0)x345.0 []
...\penalty 0
...\glue 12.0
...\glue 0.0 plus -1.0
...\penalty 10000
...\glue(\parskip) 0.0 plus 1.0
...\glue(\parskip) 0.0
...\glue(\baselineskip) 5.05556
...\hbox(6.94444+1.94444)x345.0, glue set 0.85849
....\hbox(0.0+0.0)x15.0
....\OT1/cmr/m/n/10 L
....\OT1/cmr/m/n/10 o
....\OT1/cmr/m/n/10 r
....\OT1/cmr/m/n/10 e
....\OT1/cmr/m/n/10 m

显示间距的效果是在浮动元素上方添加 12pt,在浮动元素下方添加 12pt,并在浮动元素下方添加 5pt,与浮动元素的 7pt 高度相结合L为以下文本的基线提供了 12pt 的空间。

任何其他空白都在浮动范围内,因此不受文档级浮动间距参数的影响。

相关内容