wrapfig 下方有空格

wrapfig 下方有空格

我习惯wrapfig让文本整齐地围绕在图像周围。我有一块文本,右边有一张图片,然后是填充线,后面跟着更多文本。我无法让第二块文本填满页面宽度。

我尝试了这个问题,这在一定程度上有效,但对填充线下方的第二段文本无效。将图像样式更改为浮动没有任何区别,但添加\vspace{-70pt}到块中wrapfig确实允许第一段文本恢复占据整个页面宽度,但填充线后的文本具有与 相关的空白wrapfig

这张图片显示,vspace 可以让文本在 wrapfig 之后填满页面宽度,但我不知道为什么这不能持续到第二个文本块。

这是 MWE:我还尝试使用 adjustwidth 包围行为不当的文本,以强制其填满页面,但它没有响应。可以注释掉 adjustwidth 命令,而不会更改显示的页面。img_fibre.jpeg 是一个 300x145 像素的图像。

\documentclass[11pt]{exam}
\RequirePackage{adjustbox}
\usepackage{changepage}
\usepackage{wrapfig}
\usepackage[margin=0.4in]{geometry}

\parindent 0ex

\begin{document} 

    \begin{wrapfigure}{R}{0.45\textwidth}
        \adjustimage{scale=0.8}{img_fibre.jpeg}
        \vspace{-70pt} % use -60pt to clear image
    \end{wrapfigure}
    
    \section*{Applications of Total Internal Reflection}
    
    Fibre optic cables use a core glass with high refractive index, surrounded by cladding with low refractive index. Data can be sent though the fibre as pulses of light, the same way that data is encoded in electricity as varying voltage levels. Fibre optic cables are often more fragile than electrical cables. List the advantages that fibre optics offers. 
    
    \vspace{1cm}
    
    \fillwithlines{3cm}

    \begin{adjustwidth}{0pt}{-\dimexpr\wrapoverhang+\columnsep\relax}
        In addition to common uses in data transfer and computing, applications of fibre optics include endoscopic surgery, lighting, and situations where electronic data transfer is impossible, such as underwater, or where the is strong electromagnetic interference.         
    \end{adjustwidth}   
\end{document}

答案1

您需要将环境放在命令wrapfigure后面section

对于垂直调整,您可以使用 wrapfig 环境的可选参数来更改 wrapbox 的高度作为解决方法。

\documentclass[11pt]{exam}
\RequirePackage{adjustbox}
\usepackage{changepage}
\usepackage{wrapfig2}
\usepackage[margin=0.4in]{geometry}

\parindent 0ex

\begin{document} 
    
    \section*{Applications of Total Internal Reflection}

    \begin{wrapfigure}[6]{R}{0.45\textwidth}
        \vspace*{-\baselineskip}
        \adjustimage{width=0.43\textwidth,height=3cm}{example-image}
    \end{wrapfigure}
    
    Fibre optic cables use a core glass with high refractive index, surrounded by cladding with low refractive index. Data can be sent though the fibre as pulses of light, the same way that data is encoded in electricity as varying voltage levels. Fibre optic cables are often more fragile than electrical cables. List the advantages that fibre optics offers. 
    
    \vspace{1cm}
    
    \fillwithlines{3cm}

    
    In addition to common uses in data transfer and computing, applications of fibre optics include endoscopic surgery, lighting, and situations where electronic data transfer is impossible, such as underwater, or where the is strong electromagnetic interference.
    
\end{document}

在此处输入图片描述

答案2

这显示了一个 paracol 解决方案。Paracol 比 wrapfig 更强大,尽管它可能需要手动分段。

请注意,考试类别与几何包不兼容,尽管问题可能很微妙。

\documentclass[11pt]{exam}
%\usepackage[margin=0.4in]{geometry}% not compativble with exam class
\RequirePackage{adjustbox}
\usepackage{changepage}
\usepackage{paracol}
\globalcounter*

\parindent 0ex
\extrawidth{1.2in}% how exam class sets margins

\begin{document} 

\begin{paracol}{2}
    \section*{Applications of Total Internal Reflection}
    
    Fibre optic cables use a core glass with high refractive index, surrounded by cladding with low refractive index. Data can be sent though the fibre as pulses of light, the same way that data is encoded in electricity as varying voltage levels. Fibre optic cables are often more fragile than electrical cables. List the advantages that fibre optics offers. 

\switchcolumn
    \begin{figure}% only needed with captions
        \adjustimage{width=\linewidth}{example-image}
    \end{figure}
\end{paracol}

    \fillwithlines{3cm}
    
    In addition to common uses in data transfer and computing, applications of fibre optics include endoscopic surgery, lighting, and situations where electronic data transfer is impossible, such as underwater, or where the is strong electromagnetic interference.         
 
\end{document}

在此处输入图片描述

相关内容