以下是我目前得到的。
\documentclass{report}
\usepackage{graphicx}
\usepackage{wrapfig}
\begin{document}
\begin{wrapfigure}[5]{r}{0.4\linewidth}
\centering
\includegraphics[width=\linewidth]{example-image-duck}
\caption{A \textbf{ducking} duck!}
\end{wrapfigure}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita
kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem
ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum
dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero
eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no
sea takimata sanctus est Lorem ipsum dolor sit amet.
\end{document}
输出如下:
这是我想要的:
我知道我可以使用\vspace{}
,但是是否有一个参数可以添加到wrapfigure
自身以在 5 行之后添加一些间距或类似的东西?
答案1
如果您只想要一个 5 行的段落然后清除到下一个段落,您可以简单地使用 vspace:
\documentclass{report}
\usepackage{graphicx}
\usepackage{wrapfig}
\begin{document}
\begin{wrapfigure}[5]{r}{0.4\linewidth}
\centering
\includegraphics[width=\linewidth]{example-image-duck}
\caption{A \textbf{ducking} duck!}
\end{wrapfigure}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
\vspace{4\baselineskip}
Stet clita
kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem
ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum
dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero
eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no
sea takimata sanctus est Lorem ipsum dolor sit amet.
\end{document}
答案2
wrapfig2
包计算适合包装的图形/表格/文本所需的行数:
如果计算不成功并需要更正,则可以使用带星号的版本环境(参见文档)。
换行需要文本足够长。但是,如果文本较短,则换行任务将交给下一段。
平均能量损失
\documentclass{report}
\usepackage{graphicx}
\usepackage{wrapfig2}
\begin{document}
\begin{wrapfigure}{r}{0.4\linewidth}
\centering
\includegraphics[width=\linewidth]{example-image-duck}
\caption{A \textbf{ducking} duck!}
\end{wrapfigure}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita
kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem
ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum
dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero
eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no
sea takimata sanctus est Lorem ipsum dolor sit amet.
\begin{wrapfigure}{r}{0.4\linewidth}
\centering
\includegraphics[width=\linewidth]{example-image-duck}
\caption{A \textbf{ducking} duck!}
\end{wrapfigure}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
Stet clita
kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem
ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum
dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero
eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no
sea takimata sanctus est Lorem ipsum dolor sit amet.
\end{document}
如果不需要包装(因此没有标题?如果我理解正确的话,文本将被视为描述):
以下是使用的方法之一tabularray
:
平均能量损失
\documentclass{article}
\usepackage{tabularray}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{tcolorbox}
\tcbuselibrary{vignette}
\newcommand\texta{The cat sat on the mat and the quick brown fox jumps over the lazy dog.\ }
\newcommand\textb{\texta\texta}
\newcommand\textc{\textb\textb}
\newcommand\textd{\textc\textc\textc\hfill$\diamondsuit$\par\textb}
\begin{document}
%\fbox{
\begin{tblr}{
rows = {bg=yellow!50!red!5},
colspec={Q[l,h,0.5\textwidth]Q[c,blue!32]},}
tcolorbox vignette image, small amount of text \texta
&
\begin{tikzpicture}%
\node[draw,fill=blue!60] (A) {{\sffamily\large\bfseries%
\includegraphics[width=1in]{example-image-duck-portrait}%
}};%
\tcbvignette{outside node=A}%
\end{tikzpicture}%
\\
\end{tblr}
%}
\textc
\fbox{
\begin{tblr}{colspec={Q[l,h,0.5\textwidth]Q[c,blue!32!green!5]},rowspec={QQ}}
tcolorbox vignette image, large amount of text \textd
&
\begin{tikzpicture}%
\node[draw,fill=blue!60] (A) {{\sffamily\large\bfseries%
\includegraphics[width=1in]{example-image-duck-portrait}%
}};%
\tcbvignette{outside node=A}%
\end{tikzpicture}%
\\
\end{tblr}
}
\textc
\end{document}
如果需要,可以根据使用情况以多种方式添加 TOC 条目。