我在用\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}