是否可以在本地定义“图形”和“表格”环境(“ \intextsep”)上方和下方的空间?

是否可以在本地定义“图形”和“表格”环境(“ \intextsep”)上方和下方的空间?

确定了如何在captions全局和局部定义上下垂直空间后,我想知道是否有办法在\intextsep局部定义。此外,floating通过使用Hpackage 提供的参数禁用此功能后float,我认为这\textfloatsep不是问题。

\documentclass{article}
\usepackage[demo]{graphicx} 
\setlength{\intextsep}{50.0pt plus 2.0pt minus 2.0pt}
\usepackage[font=small,skip=10pt]{caption}
\usepackage{float}

\begin{document}

Some text...

\begin{figure}[H]
\captionsetup{font=Large,skip=5pt}
\begin{center}
\includegraphics[height=1in,width=1in,angle=-90]{foo}
\caption{This is a figure.}
\end{center}
\end{figure}

... more text...

\begin{figure}[H]
\captionsetup{font=tiny,skip=15pt}
\begin{center}
\includegraphics[height=1in,width=1in,angle=-90]{foo}
\caption{This is another figure.}
\end{center}
\end{figure}

... still more text...
\newpage
Text...

\begin{table}[H]
\captionsetup{font=small,skip=10pt}
\centering
\caption{This is a table.}
\begin{tabular}{|c|c|}
\hline
    % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
    1 & 2 \\
    4 & 7 \\
    \hline
\end{tabular}
\end{table}

... end of text.

\end{document}

答案1

您可以在命令内部定义它\begingroup\endgroup参见下文并检查已设置为 20pt 的第一个距离:

编辑:正如@daleif在问题中评论的那样\begin{centrer}\end{center} 添加额外的空间是不需要的,并且会增加实际空间。因此,我将其替换为,\centering以便为未来的访问者提供更好的代码。

\documentclass{article}
\usepackage[demo]{graphicx} 
\setlength{\intextsep}{50.0pt plus 2.0pt minus 2.0pt}
\usepackage[font=small,skip=10pt]{caption}
\usepackage{float}

\begin{document}

Some text...

\begingroup
\setlength{\intextsep}{20.0pt plus 2.0pt minus 2.0pt}
\begin{figure}[H]
\captionsetup{font={Large},skip=5pt}
\centering
\includegraphics[height=1in,width=1in,angle=-90]{foo}
\caption{This is a figure.}
\end{figure}

... more text...
\endgroup

\begin{figure}[H]
\captionsetup{font={normalsize},skip=15pt}
\centering
\includegraphics[height=1in,width=1in,angle=-90]{foo}
\caption{This is another figure.}
\end{figure}

... still more text...
\newpage
Text...

\begin{table}[H]
\captionsetup{font=small,skip=10pt}
\centering
\caption{This is a table.}
\begin{tabular}{|c|c|}
\hline
    % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
    1 & 2 \\
    4 & 7 \\
    \hline
\end{tabular}
\end{table}

... end of text.

\end{document}

相关内容