我有以下代码:
\documentclass{article}
\usepackage{fontspec}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{parskip}
\begin{document}
\begin{minipage}{\linewidth}
\begin{minipage}{\linewidth}
{\huge Seth Creewnusher}
\par\vspace{-2mm}
{\rule{\textwidth}{0.2mm}
\end{minipage}
\par\vspace{2mm}
\begin{minipage}{\linewidth}
\begin{wrapfigure}{L}{36mm}
\vspace{-5mm}
\includegraphics[width=36mm]{1.png}
\vspace{-10mm}
\end{wrapfigure}
Golden Road Solutions\par\vspace{2mm}Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ac lacus at libero pellentesque feugiat sit amet hendrerit dolor. Pellentesque lobortis sollicitudin risus nec volutpat. Vivamus nibh neque, pellentesque ac tortor a, malesuada euismod mi. Sed sit amet ante mattis metus finibus tempus a ornare odio.\par\vspace{2mm}Integer posuere sem ut nisi fermentum feugiat. Praesent dictum libero lacus, vitae tincidunt nisi mollis in. Sed imperdiet ante at ligula fringilla, non aliquam dui egestas. Maecenas blandit ligula augue, vitae ultricies nunc sagittis nec. Sed dui purus, varius eu posuere vitae, consectetur et leo.
\end{minipage}
\end{minipage}
\vspace{6mm}
\begin{minipage}{\linewidth}
\begin{minipage}{\linewidth}
{\huge Trevin Smeeltood}
\par\vspace{-2mm}
{\rule{\textwidth}{0.2mm}
\end{minipage}
\par\vspace{2mm}
\begin{minipage}{\linewidth}
\begin{wrapfigure}{L}[0mm]{36mm}
\vspace{-5mm}
\includegraphics[width=36mm]{3.jpg}
\vspace{-10mm}
\end{wrapfigure}
Labyrinth Microsystems\par\vspace{2mm}Aliquam scelerisque, mauris quis maximus venenatis, arcu neque vestibulum ante, et iaculis lorem diam vel ex.\par\vspace{2mm}Etiam consequat sollicitudin tortor a varius. Phasellus vel rutrum turpis. Donec orci lacus, ultrices eget interdum eget, suscipit et quam. Donec consequat et nisl a porta.
\end{minipage}
\end{minipage}
\vspace{6mm}
\begin{minipage}{\linewidth}
\begin{minipage}{\linewidth}
{\huge Rowena Zodsinch}
\par\vspace{-2mm}
\rule{\textwidth}{0.2mm}
\end{minipage}
\par\vspace{2mm}
\begin{minipage}{\linewidth}
\begin{wrapfigure}{L}{36mm}
\vspace{-5mm}
\includegraphics[width=36mm]{4.jpg}
\vspace{-10mm}
\end{wrapfigure}
Vortex Microsystems\par\vspace{2mm}Morbi euismod felis quam, nec ultrices elit tincidunt eu. Nam tempus et est a hendrerit. Nunc blandit orci nec nisi tempus, id aliquam sapien porta. Morbi quis condimentum mauris. Cras a consectetur erat, quis laoreet neque. Cras mattis quis nisl at varius. Vestibulum ligula sem, imperdiet congue erat nec, congue euismod orci. Mauris vulputate neque eros, nec semper velit feugiat eu. Suspendisse interdum lacus a suscipit rhoncus.
\end{minipage}
\end{minipage}
\end{document}
fbox
我在最后 2 左右添加了一个minipage
来说明问题:minipage
大小(高度)仅扩展到 周围文本的大小wrapfigure
,而不是 本身的大小wrapfigure
。因此,当文本比 短时wrapfigure
(如第二个 中的情况minipage
),下一个minipage
将从文本之后开始(相对于vspace
)并位于 之上wrapfigure
。
有没有办法让minipage
自动扩展并调整其大小以适应 或文本的大小wrapfigure
(以较长者为准)?理想情况下,我会得到这样的结果:
答案1
以下\wrapfill
由 CTAN 贡献者 Donald Arseneau 编写的宏在添加到环绕图形的文本之后时达到了预期的效果:
\makeatletter
\def\wrapfill{\par
\ifx\parshape\WF@fudgeparshape
\nobreak
\ifnum\c@WF@wrappedlines>\@ne
\advance\c@WF@wrappedlines\m@ne
\vskip\c@WF@wrappedlines\baselineskip
\global\c@WF@wrappedlines\z@
\fi
\allowbreak
\WF@finale
\fi
}
\makeatother
完整代码:
\documentclass{article}
\usepackage{fontspec}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{parskip}
\begin{document}
\makeatletter
\def\wrapfill{\par
\ifx\parshape\WF@fudgeparshape
\nobreak
\ifnum\c@WF@wrappedlines>\@ne
\advance\c@WF@wrappedlines\m@ne
\vskip\c@WF@wrappedlines\baselineskip
\global\c@WF@wrappedlines\z@
\fi
\allowbreak
\WF@finale
\fi
}
\makeatother
\begin{minipage}{\linewidth}
\begin{minipage}{\linewidth}
{\huge Seth Creewnusher}
\par\vspace{-2mm}
{\rule{\textwidth}{0.2mm}
\end{minipage}
\par\vspace{2mm}
\begin{minipage}{\linewidth}
\begin{wrapfigure}{L}{36mm}
\vspace{-5mm}
\includegraphics[width=36mm]{1.png}
\vspace{-10mm}
\end{wrapfigure}
Golden Road Solutions\par\vspace{2mm}Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ac lacus at libero pellentesque feugiat sit amet hendrerit dolor. Pellentesque lobortis sollicitudin risus nec volutpat. Vivamus nibh neque, pellentesque ac tortor a, malesuada euismod mi. Sed sit amet ante mattis metus finibus tempus a ornare odio.\par\vspace{2mm}Integer posuere sem ut nisi fermentum feugiat. Praesent dictum libero lacus, vitae tincidunt nisi mollis in. Sed imperdiet ante at ligula fringilla, non aliquam dui egestas. Maecenas blandit ligula augue, vitae ultricies nunc sagittis nec. Sed dui purus, varius eu posuere vitae, consectetur et leo.
\wrapfill
\end{minipage}
\end{minipage}
\vspace{6mm}
\begin{minipage}{\linewidth}
\begin{minipage}{\linewidth}
{\huge Trevin Smeeltood}
\par\vspace{-2mm}
{\rule{\textwidth}{0.2mm}
\end{minipage}
\par\vspace{2mm}
\begin{minipage}{\linewidth}
\begin{wrapfigure}{L}[0mm]{36mm}
\vspace{-5mm}
\includegraphics[width=36mm]{3.jpg}
\vspace{-10mm}
\end{wrapfigure}
Labyrinth Microsystems\par\vspace{2mm}Aliquam scelerisque, mauris quis maximus venenatis, arcu neque vestibulum ante, et iaculis lorem diam vel ex.\par\vspace{2mm}Etiam consequat sollicitudin tortor a varius. Phasellus vel rutrum turpis. Donec orci lacus, ultrices eget interdum eget, suscipit et quam. Donec consequat et nisl a porta.
\wrapfill
\end{minipage}
\end{minipage}
\vspace{6mm}
\begin{minipage}{\linewidth}
\begin{minipage}{\linewidth}
{\huge Rowena Zodsinch}
\par\vspace{-2mm}
\rule{\textwidth}{0.2mm}
\end{minipage}
\par\vspace{2mm}
\begin{minipage}{\linewidth}
\begin{wrapfigure}{L}{36mm}
\vspace{-5mm}
\includegraphics[width=36mm]{4.jpg}
\vspace{-10mm}
\end{wrapfigure}
Vortex Microsystems\par\vspace{2mm}Morbi euismod felis quam, nec ultrices elit tincidunt eu. Nam tempus et est a hendrerit. Nunc blandit orci nec nisi tempus, id aliquam sapien porta. Morbi quis condimentum mauris. Cras a consectetur erat, quis laoreet neque. Cras mattis quis nisl at varius. Vestibulum ligula sem, imperdiet congue erat nec, congue euismod orci. Mauris vulputate neque eros, nec semper velit feugiat eu. Suspendisse interdum lacus a suscipit rhoncus.
\wrapfill
\end{minipage}
\end{minipage}
\end{document}
应该产生如下结果: