如何使用 picinpar 调整标题和图片之间的间距

如何使用 picinpar 调整标题和图片之间的间距

有时候,需要figwindow通过 LaTeX 中的包来调整环境中标题与图形之间的间距picinpar。那么,如何完成这个动作呢?

例如:

\documentclass{article}
\usepackage{picinpar,graphicx}
\begin{document}
\begin{figwindow}[3,r,{\includegraphics[width=0.4\textwidth]{example-image-a}},{hello}\label{fig:title}]
    The figure environment takes care of the numbering and positioning of the image within the document. In order to include a figure, you must use the includegraphics command. It takes the image width as an option in brackets and the path to your image file. As you can see, I put linewidth into the brackets, which means the picture will be scaled to fit the width of the document. As a result smaller pictures are upscaled and larger pictures downscaled respectively. As I mentioned before the brackets contain the path to the image. In this case the image is stored in the same directory as my .tex file, so I simply put boat.jpg here to include it. For large documents, you probably want to store image files in a different folder, say we created a folder images, then we would simply write images/boat.jpg into the braces. In the next command we set a caption, which is the text shown below the image and a label which is invisible, but useful if we want to refer to our figure in our document. You can use the ef command to refer to the figure (marked by label) in your text and it will then be replaced by the correct number. LaTeX is smart enough to retrieve the correct numbers for all your images automatically. Note that you will need to include the graphicx package in order to use this code.
\end{figwindow}
\end{document}

这将产生: 形象

当更改\begin{figwindow}[3,r,{\includegraphics[width=0.4\textwidth]{example-image-a}},{hello}\label{fig:title}]为 时\begin{figwindow}[3,r,{\includegraphics[width=0.4\textwidth]{example-image-a}},{\vspace{1cm}hello}\label{fig:title}],输出是一样的。

谢谢。

答案1

MWE 展示如何在标题之前和/或之后添加一些垂直空间:

在此处输入图片描述

\documentclass{article}
\usepackage{picinpar,graphicx,lipsum}
\begin{document}
\begin{figwindow}[4,r,{%
\includegraphics[width=0.4\textwidth]{example-image-a}
\vspace{2cm}},  % <=== space before the caption 
{hello everybody}\label{fig:title}%
\par\vspace{2cm}] % <=== space after the caption 
\lipsum[1-3]
\end{figwindow}
\end{document}

相关内容