修复 wrapfigure 上方的字间距

修复 wrapfigure 上方的字间距

我在使用 wrapfig 时遇到了困难;字间距经常变化,有时我不得不在下面添加一个不需要的新段落。这是我在 tex.stackexchange 上的第一篇文章,如果我没有包含足够的代码或问题背景,请原谅。我祈祷这是一个常见问题,只需简单修复即可,但我找不到任何其他有类似问题的问题。(还有许多其他软件包,但我创建了一个新的 tex 文件并隔离了发现错误的段落,它在没有其他 20 页文本和图像以及许多其他软件包的情况下仍然存在)。

\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{wrapfig}
\usepackage{graphicx}
\setlength\intextsep{0pt}
\setlength{\parindent}{0cm}
\setlength{\parskip}{\baselineskip}
\usepackage[justification=centering]{caption}
\usepackage{ragged2e}
\usepackage[a4paper,top=2cm,bottom=2cm,left=2cm,right=2cm,marginparwidth=2cm]{geometry}
\begin{document}
Niels Henrik Abel (1802-1829) began working on the problem of quintic equations in 1820, at the age of 18 whilst still at school. In his short life, and even shorter working life of six or seven years, Abel ``left mathematicians enough to keep them busy for five hundred years'' \cite[p.~12]{ETBell}.
\begin{wrapfigure}[13]{l}{0.25\linewidth}
        \vspace*{-16pt}
        \setlength{\abovecaptionskip}{4pt plus 1pt minus 1pt}
        \includegraphics[width=\linewidth]{Abel.jpg}
        \caption{\textit{Painting of Abel in 1826, by Johan Gørbitz \cite{AbelPrize}}}
\end{wrapfigure}
    Abel had begun reading the work of Lagrange at a young age. Initially, as many others attempting to find a general solution to the quintic, Abel believed that he had succeeded.
    By 1824, however, he shifted to the venture of proving the impossibility of such general solutions and published a proof in a privately printed booklet \cite[pp.~28-33]{Abel1881}. Having read Cauchy's paper of 1815, Abel was most likely familiar with Ruffini's name but had no recollection of the details of his proof; Abel begins:
        \begin{quote}
        \vspace*{-8pt}
        \textit{Geometers are much concerned with the genereal solution of algebraic equations and several of them have sought to prove the impossibility of it; but if I am not mistaken no-one has succeeded up to the present. I therefore hope that the geometers will receive, with kindess, this [memoir] which aims to fill this gap in the theory of algebraic equations. \cite[p.~28]{Abel1881}}
    \end{quote}

\end{document}

问题照片

答案1

wrapfig 文档提及

在段落之间开始环境很方便,但如果要放置在段落中间,则必须将环境放在两个单词之间有自然换行符的地方。

因此,您唯一能做的就是小心放置环境的位置wrapfigure。但这也意味着,如果您在该特定段落中添加或删除单词,间距会再次出错。因此,这需要您手动调整,而不是 LaTeX 为您完成工作。

\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{wrapfig}
\usepackage{graphicx}
\setlength\intextsep{0pt}
\setlength{\parindent}{0cm}
\setlength{\parskip}{\baselineskip}
\usepackage[justification=centering]{caption}
\usepackage{ragged2e}
\usepackage[a4paper,top=2cm,bottom=2cm,left=2cm,right=2cm,marginparwidth=2cm]{geometry}
\begin{document}
Niels Henrik Abel (1802-1829) began working on the problem of quintic equations in 1820, at the age of 18 whilst still at school. In his short life, and even shorter working life of six or seven years, Abel ``left mathematicians enough to keep them busy for five hundred years'' \cite[p.~12]{ETBell}.
Abel had begun reading the work of Lagrange at a 
\begin{wrapfigure}[13]{l}{0.25\linewidth}
    %        \vspace*{-16pt} % <-------------
    \setlength{\abovecaptionskip}{4pt plus 1pt minus 1pt}
    \includegraphics[width=\linewidth]{example-image}
    \caption{\textit{Painting of Abel in 1826, by Johan Gørbitz \cite{AbelPrize}}}
\end{wrapfigure}%
young age. Initially, as many others attempting to find a general solution to the quintic, Abel believed that he had succeeded.
    By 1824, however, he shifted to the venture of proving the impossibility of such general solutions and published a proof in a privately printed booklet \cite[pp.~28-33]{Abel1881}. Having read Cauchy's paper of 1815, Abel was most likely familiar with Ruffini's name but had no recollection of the details of his proof; Abel begins:
        \begin{quote}
        \vspace*{-8pt}
        \textit{Geometers are much concerned with the genereal solution of algebraic equations and several of them have sought to prove the impossibility of it; but if I am not mistaken no-one has succeeded up to the present. I therefore hope that the geometers will receive, with kindess, this [memoir] which aims to fill this gap in the theory of algebraic equations. \cite[p.~28]{Abel1881}}
    \end{quote}

\end{document}

在此处输入图片描述


但我个人的建议是保持简单:将环绕图放在实际段落之前/之后,不要太在意文档中图形/表格等的位置。

相关内容