如何保持它们之前的默认浮动环境间距,同时减少它们之后的数字间距?

如何保持它们之前的默认浮动环境间距,同时减少它们之后的数字间距?

我在用\setlength{\belowcaptionskip}{-10pt}使用如何减少图形后的填充? 减少间距我的数据。而且它运行良好。

但这也影响了我的新浮动环境,并减少了几乎的0间距环境。

我怎样才能修复浮动环境之前的间距(保持它们的间距)同时保持图形环境在图形之后的减小的间距? 在此处输入图片描述

\documentclass[12pt]{memoir}
\usepackage{caption,newfloat}
\usepackage{graphicx}

\def\listofquadrosname{List of Frames}
\DeclareFloatingEnvironment[fileext=loq,placement={!hbtp},name=Frame,
within=chapter,listname=\listofquadrosname]{quadro}

\setlength{\belowcaptionskip}{-10pt}
\begin{document}
Before. Before. Before. Before. Before. Before. Before. Before. Before.

\begin{figure}[h]
    \includegraphics{latex.png}
    \caption{Opis}
\end{figure}

After. After. After. After. After. After. After. After. After. After.

Before. Before. Before. Before. Before. Before. Before. Before. Before.

\begin{quadro}[h]
\caption{Stuff.}
Contents.
\end{quadro}

After. After. After. After. After. After. After. After. After. After.
\end{document}

答案1

一个简单的方法就是使用\vspace命令例如

\documentclass[12pt]{memoir}
\usepackage{caption,newfloat}
\usepackage{graphicx}

\def\listofquadrosname{List of Frames}
\DeclareFloatingEnvironment[fileext=loq,placement={!hbtp},name=Frame,
within=chapter,listname=\listofquadrosname]{quadro}

\setlength{\belowcaptionskip}{-10pt}
\begin{document}
    Before. Before. Before. Before. Before. Before. Before. Before. Before.

    \begin{figure}[h]
        \includegraphics{example-image-a}
        \caption{Opis}
    \end{figure}

    After. After. After. After. After. After. After. After. After. After.

    Before. Before. Before. Before. Before. Before. Before. Before. Before.

    \vspace{5mm} % Increase the spacing before the enviroment
    \begin{quadro}[h]
        \caption{Stuff.}
        Contents.
    \end{quadro}

    After. After. After. After. After. After. After. After. After. After.
\end{document}

答案2

看完之后:

  1. 如何使用 \let\par\relax 禁用我的环境中的段落?
  2. 请指导一下patchcmd和xpatch的使用

我设法通过直接修补figure环境来解决这个问题,同时保持所有其他环境完好无损:

\xpretocmd{\figure}{\setlength{\belowcaptionskip}{-10pt}}{}{}

完整示例:

\documentclass[12pt]{memoir}
\usepackage{caption,newfloat}
\usepackage{graphicx}
\usepackage{xpatch}

\def\listofquadrosname{List of Frames}
\DeclareFloatingEnvironment[fileext=loq,placement={!hbtp},name=Frame,
within=chapter,listname=\listofquadrosname]{quadro}

\xpretocmd{\figure}{\setlength{\belowcaptionskip}{-10pt}}{}{}

\begin{document}
Before. Before. Before. Before. Before. Before. Before. Before. Before.

\begin{figure}[h]
    \includegraphics{latex.png}
    \caption{Opis}
\end{figure}

After. After. After. After. After. After. After. After. After. After.

Before. Before. Before. Before. Before. Before. Before. Before. Before.

\begin{quadro}[h]
\caption{Stuff.}
Contents.
\end{quadro}

After. After. After. After. After. After. After. After. After. After.
\end{document}

在此处输入图片描述

相关内容