使用wrapfigure后,为什么lipsum文本可以自动换行,而普通文本却不能?

使用wrapfigure后,为什么lipsum文本可以自动换行,而普通文本却不能?
%
% ------ Would like to use the Exercise environment ------ %
%
%---------------------------------------------------------------------------- %
\documentclass[demo]{book}
%---------------------------------------------------------------------------- %
%
\usepackage[english]{babel} %
\usepackage{xcolor}
\usepackage{relsize} %
\usepackage[utf8]{inputenx}
\usepackage{newunicodechar} % unit of degree
\usepackage{caption} %


\usepackage[paperwidth=170mm,paperheight=240mm,textwidth=132mm,lmargin=12.5mm,rmargin=12.5mm,bindingoffset=12.5mm,noheadfoot,nomarginpar,showframe,showcrop]{geometry}
    \usepackage[a4,frame,cam,center]{crop}
    \usepackage{layout}
    \usepackage{graphicx} %
    \usepackage[lastexercise, answerdelayed]{exercise}
    \usepackage{wrapfig}
    \usepackage{lipsum}  % generates filler text
    \usepackage{setspace} %
    %
    \setlength{\unitlength}{1mm} % 1mm=2.834646pt; 1pt=0.3515mm
    %
    \graphicspath{ {book_questions/images/} }
    %
    \begin{document}
    %
    % --------------------------------------------------------------------------- %
    \setstretch{1.25}

\Question{
\begin{tabular}{cc}
\parbox{0.6\textwidth}{Show that the distance \hspace{0.4pt}$x$ \hspace{0.6pt}from the centre of the crank to the piston pin\hspace{0.6pt}, expressed in terms of the connecting rod length \hspace{0.8pt}$p$\hspace{0.4pt}, \hspace{0.8pt}the crank radius \hspace{0.4pt}$r$\hspace{0.3pt}, \hspace{0.8pt}and the crank angle \hspace{2.4pt}$\theta$\hspace{0.4pt}, \hspace{1.2pt}satisfies\hspace{0.6pt}, \hspace{0.6pt}implicitly, \hspace{0.6pt}the following equation\hspace{0.6pt}:}
&
\begin{minipage}{0.3\textwidth}
    \begin{figure}[H]
%        \caption{Lithium-ion battery operation}
        \includegraphics[width=1\textwidth]{../my_book/book_questions/fig_01_piston_accel}
        \label{fig:LIB_image}
    \end{figure}
\end{minipage}
\end{tabular}
 }

    \begingroup % using required text 
    \setlength{\intextsep}{0pt} %
    \setlength{\columnsep}{10pt} %
    \begin{wrapfigure}[12]{r}{46mm}
      \centering
        \includegraphics[width=42mm]{fig_01_piston_accel}
    \end{wrapfigure}

    \setlength{\parindent}{30pt}
    \noindent Show that the distance \hspace{0.4pt}$x$ \hspace{0.6pt}from the centre of the crank to the piston pin\hspace{0.6pt}, expressed in terms of the connecting rod length \hspace{0.8pt}$p$\hspace{0.4pt}, \hspace{0.8pt}the crank radius \hspace{0.4pt}$r$\hspace{0.3pt}, \hspace{0.8pt}and the crank angle \hspace{2.4pt}$\theta$\hspace{0.4pt}, \hspace{1.2pt}satisfies\hspace{0.6pt}, \hspace{0.6pt}implicitly, \hspace{0.6pt}the following equation\hspace{0.6pt}:
    \endgroup

    \vspace{120pt}

    \begingroup % using lipsum text
    \setlength{\intextsep}{0pt} %
    \setlength{\columnsep}{10pt} %
    \begin{wrapfigure}[10]{r}{45mm}
      \centering
        \includegraphics[width=40mm]{fig_01_piston_accel}
    \end{wrapfigure}
    \lipsum[1]

    \endgroup

    \clearpage

    % --------------------- Inside of Execise enviroment ------------------------ %

    \begin{Exercise}[label={chap_02_exer_01}]

    \Question{
    \begingroup % using required text ******
    \setlength{\intextsep}{0pt} %
    \setlength{\columnsep}{10pt} %
    \begin{wrapfigure}[10]{r}{45mm}
      \centering
        \includegraphics[width=40mm]{fig_01_piston_accel}
    \end{wrapfigure}

    \setlength{\parindent}{30pt}
    \noindent Show that the distance \hspace{0.4pt}$x$ \hspace{0.6pt}from the centre of the crank to the piston pin\hspace{0.6pt}, expressed in terms of the connecting rod length \hspace{0.8pt}$p$\hspace{0.4pt}, \hspace{0.8pt}the crank radius \hspace{0.4pt}$r$\hspace{0.3pt}, \hspace{0.8pt}and the crank angle \hspace{2.4pt}$\theta$\hspace{0.4pt}, \hspace{1.2pt}satisfies\hspace{0.6pt}, \hspace{0.6pt}implicitly, \hspace{0.6pt}the following equation\hspace{0.6pt}:
    \endgroup }

    \vspace{120pt}
    \Question{
    \begingroup % using lipsum text ******
    \setlength{\intextsep}{0pt} %
    \setlength{\columnsep}{11pt} %
    \begin{wrapfigure}[10]{r}{45mm}
      \centering
        \includegraphics[width=40mm]{fig_01_piston_accel}
    \end{wrapfigure}
    \lipsum[1]

    \endgroup }

    \end{Exercise}

    \end{document}

答案1

在此处输入图片描述

您需要在之前留一个空行,\endgroup以便段落结束而不会丢失 wrapfig 设置。(但\begingroup \endgroup实际上并不是用于文档的乳胶语法)

相关内容