LaTeX - 定义自定义“wrapfig”环境
我正在用 LaTeX 排版一本书。文本设计包括拉引号,它应该看起来像这样:
Chicken chicken chicken chicken -------------
chicken chicken chicken chicken CHICKEN
chicken chicken chicken chicken CHICKEN
chicken chicken chicken chicken -------------
chicken chicken chicken chicken chicken chicken
所以,wrapfig.sty
看起来它有我需要的基本机制,我只需要定义一个执行水平操作的环境规则、居中和更大的类型。问题是 wrapfigure 似乎不想嵌套在环境定义中。如果我在文本正文中包含此内容,则它可以工作
\begin{wrapfigure}{o}{2in}
\large chicken chicken
\end{wrapfigure}
,但如果我在序言中执行此操作
\newenvironment{pullquote}
{\begin{wrapfigure}{o}{2in}\large}
{\end{wrapfigure}}
,然后我
\begin{pullquote}
chicken chicken
\end{pullquote}
收到此错误消息:
Package wrapfig Warning: Collision between wrapping environments ...
引文在我想要的下面的几个段落中排版(在 的大致位置)接下来 重要引述,看起来像,或者在文档的末尾)并且正文不会围绕重要引述。什么给?我该如何进行这项工作?
I'm typesetting a book with LaTeX. The text design includes pull quotes, which are supposed to look something like this:
Chicken chicken chicken chicken -------------
chicken chicken chicken chicken CHICKEN
chicken chicken chicken chicken CHICKEN
chicken chicken chicken chicken -------------
chicken chicken chicken chicken chicken chicken
So, wrapfig.sty
seems like it has the basic mechanism I need, and I just need to define an environment that does the horizontal rules, centering, and larger type. The problem is that wrapfigure doesn't seem to want to be nested in an environment definition. If I have this in my text body it works
\begin{wrapfigure}{o}{2in}
\large chicken chicken
\end{wrapfigure}
but if I do this in the prologue
\newenvironment{pullquote}
{\begin{wrapfigure}{o}{2in}\large}
{\end{wrapfigure}}
and then I have
\begin{pullquote}
chicken chicken
\end{pullquote}
I get this error message:
Package wrapfig Warning: Collision between wrapping environments ...
the pull quote is typeset several paragraphs below where I want it (at the approximate location of the next pull quote, it looks like, or else at the end of the document) and the body text doesn't get wrapped around the pull quote. What gives? How do I make this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对它没有完全理解,但我怀疑这是因为wrapfigure本身就是图形浮动环境的包装器。
我想我在这里找到了解决方案/解决方法:
http://texblog.net/latex-archive/plaintex/expandafter/
我认为这段代码得到了你想要的:
上面使用的代码重新定义了“wrapfigure”以具有不同的用途,这可能不是你想要的。您可以为 begin{env} 和 end{env} 创建新命令,使 'wrapfigure' 本身保持不变,如下所示:
I don't have full understanding of it, but I suspect it's because wrapfigure is itself a wrapper around figure float environment.
I think I found a solution/workaround here:
http://texblog.net/latex-archive/plaintex/expandafter/
I think this code gets what you want:
The code as used above redefines 'wrapfigure' to have different use, which may not be what you want. You can create new commands for the begin{env} and end{env} which leave 'wrapfigure' itself unaltered, like this: