我正在写一本有插图的书,这些插图都是带横线的,并配有精美的标题。现在我决定还要在段落中插入一些卡通。我需要文字环绕它们,这就是我需要 wrapfig 的原因。(我不需要 wrapfig 的浮动功能,因为我更喜欢放置插图。)
不幸的是,我遇到了不愉快的互动。作为浮动图形,即使我不想在卡通中显示水平规则,也会显示来自横线图形的水平规则(而且很奇怪;顶部规则在文本后面,底部规则在文本前面):
是否有一个版本只将文本环绕,而不依赖于图形(浮动)?
创作来源是
\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{color}
\usepackage{lipsum}
\usepackage{calc}
\usepackage{float}
\floatstyle{ruled}
\restylefloat*{figure}
\usepackage{caption}
\usepackage{wrapfig}
\definecolor{lightyellow}{rgb}{1.0,1.0,0.5}
\begin{document}
\begin{wrapfigure}{l}{0.35\textwidth}%
\vspace{-\baselineskip}%
{\color{lightyellow}\fbox{\rule{0.28\textwidth}{13em}}}
\vspace{-25pt}%
\end{wrapfigure}%
Consider our planet's historical human population. Even as recently as 5,000~BC---almost 200,000~years after the rise of homo sapiens---the human population was still tiny, approximately 5 million people. Around the time of the Han, Mayan, Parthian, and Roman empires, the planet hosted about 150--200~million people. By the end of the middle ages, it stood around 400~million. Humanity's impact on the global environment was still largely negligible---though we probably did manage to wipe out some species, not only the Woolly Mammoth but also other human species.
\begin{figure}
shows the rules, because box has content
\end{figure}
\begin{figure}
%% shows nothing. nice
\end{figure}
\end{document}
答案1
环境wrapfigure
仅通过以下方式定义
\def\wrapfigure{\wrapfloat{figure}}
因此您可以定义一个类似的环境,wrapfigure
或者直接使用wrapfloat
。该caption
包不会修改未经过特殊样式设置的浮点类型。
\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{color}
\usepackage{lipsum}
\usepackage{calc}
\usepackage{float}
\floatstyle{ruled}
\restylefloat*{figure}
\usepackage{caption}
\usepackage{wrapfig}
\definecolor{lightyellow}{rgb}{1.0,1.0,0.5}
\begin{document}
\begin{wrapfloat}{notfigure}{l}{0.35\textwidth}%
\vspace{-\baselineskip}%
{\color{lightyellow}\fbox{\rule{0.28\textwidth}{13em}}}
\vspace{-25pt}%
\end{wrapfloat}%
Consider our planet's historical human population. Even as recently as 5,000~BC---almost 200,000~years after the rise of homo sapiens---the human population was still tiny, approximately 5 million people. Around the time of the Han, Mayan, Parthian, and Roman empires, the planet hosted about 150--200~million people. By the end of the middle ages, it stood around 400~million. Humanity's impact on the global environment was still largely negligible---though we probably did manage to wipe out some species, not only the Woolly Mammoth but also other human species.
\begin{figure}
shows the rules, because box has content
\end{figure}
\begin{figure}
%% shows nothing. nice
\end{figure}
\end{document}