You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

LaTeX双面文档左侧页面章节标题环绕wrapfigure的问题

解决scrbook双面排版中左侧页面章节标题环绕wrapfigure的异常问题

我明白你遇到的困扰——在基于scrbook的双面文档里,用wrapfigure实现章节标题环绕效果时,第二章节在左侧页面(偶数页)显示异常,但第一、三章却正常。这主要是openright选项强制章节从奇数页启动,再加上章节标题自带的垂直间距,干扰了wrapfigure的行数计算和起始定位。

下面给你几个实用的解决方案:

方案1:手动调整wrapfigure的行数与起始位置

章节标题会占据额外的垂直空间,而wrapfigure的行数参数[n]默认从当前行开始计数,没把标题的空间算进去。你可以在章节标题后加\par强制换行,同时增加行数参数的值:

\documentclass[12pt,a4paper,twoside,openright]{scrbook} 
\usepackage{wrapfig} 
\usepackage{graphicx} 
\usepackage{caption} 
\usepackage[english]{babel} 
\usepackage{blindtext} 

\begin{document} 
\chapter{First Chapter} 
\section{First Section} 
\begin{wrapfigure}[14]{o}{0.4\textwidth}
  \includegraphics[width=\linewidth]{example-image}
  \caption{Test caption}
\end{wrapfigure}
\blindtext

\chapter{Second Chapter} 
\section{Second Section}
\par % 强制换行,让wrapfigure从标题下方的新行开始
\begin{wrapfigure}[16]{o}{0.4\textwidth} % 把行数从14调整为16,适配标题的额外空间
  \includegraphics[width=\linewidth]{example-image}
  \caption{Test caption}
\end{wrapfigure}
\blindtext

\chapter{Third Chapter} 
\section{Third Section} 
\begin{wrapfigure}[14]{o}{0.4\textwidth}
  \includegraphics[width=\linewidth]{example-image}
  \caption{Test caption}
\end{wrapfigure}
\blindtext
\end{document}

方案2:用垂直间距抵消标题的额外空间

如果不想修改行数参数,可以在wrapfigure内部用\vspace*{-\baselineskip}抵消章节标题的垂直间距,让图片和标题对齐:

\chapter{Second Chapter} 
\section{Second Section}
\begin{wrapfigure}[14]{o}{0.4\textwidth}
  \vspace*{-\baselineskip} % 抵消标题带来的额外行间距
  \includegraphics[width=\linewidth]{example-image}
  \caption{Test caption}
\end{wrapfigure}
\blindtext

方案3:全局调整章节标题与wrapfigure的兼容性

如果你希望所有章节都能自动适配,避免反复调整,可以用needspace包给标题下方预留足够空间:

先导入needspace包:

\usepackage{needspace}

然后在章节标题后添加预留空间的命令:

\chapter{Second Chapter} 
\section{Second Section}
\needspace{5\baselineskip} % 预留足够空间容纳wrapfigure
\begin{wrapfigure}[14]{o}{0.4\textwidth}
  \includegraphics[width=\linewidth]{example-image}
  \caption{Test caption}
\end{wrapfigure}
\blindtext

这样能从根源上避免wrapfigure和标题的空间冲突,让排版更稳定。

内容的提问来源于stack exchange,提问作者Daniel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 12:24:47