![如何保持它们之前的默认浮动环境间距,同时减少它们之后的数字间距?](https://linux22.com/image/398612/%E5%A6%82%E4%BD%95%E4%BF%9D%E6%8C%81%E5%AE%83%E4%BB%AC%E4%B9%8B%E5%89%8D%E7%9A%84%E9%BB%98%E8%AE%A4%E6%B5%AE%E5%8A%A8%E7%8E%AF%E5%A2%83%E9%97%B4%E8%B7%9D%EF%BC%8C%E5%90%8C%E6%97%B6%E5%87%8F%E5%B0%91%E5%AE%83%E4%BB%AC%E4%B9%8B%E5%90%8E%E7%9A%84%E6%95%B0%E5%AD%97%E9%97%B4%E8%B7%9D%EF%BC%9F.png)
我在用\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
看完之后:
我设法通过直接修补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}