Skip to content

Commit

Permalink
修复浮动体间距的 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sikouhjw committed Mar 19, 2022
1 parent 54b0d45 commit 5f25004
Showing 1 changed file with 23 additions and 25 deletions.
48 changes: 23 additions & 25 deletions gdutthesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1062,31 +1062,29 @@
\setlength{\floatsep}{2\baselineskip-2\ccwd-1pt}
\setlength{\textfloatsep}{2\baselineskip-2\ccwd-1pt}
\setlength{\intextsep}{2\baselineskip-2\ccwd-1pt}
\patchcmd{\@addtocurcol}%
{\ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi}%
{}%
{\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}

\patchcmd{\@addtocurcol}%
{\vskip \intextsep}%
{\addvspace\intextsep
\ifnum\outputpenalty <-\@Mii \vskip\parskip\fi}%
{\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}

\patchcmd{\@addtocurcol}%
{\vskip\intextsep}{\fix@second@intextsep}%
{\typeout{*** SUCCESS ***}}%
{\typeout{*** FAIL ***}}

\def\fix@second@intextsep {%
% was the float seen in vertical mode?
\ifnum\outputpenalty <-\@Mii
\aftergroup\vskip\aftergroup\intextsep
\aftergroup\nointerlineskip
\else
\vskip\intextsep
\fi
}
\ctex_patch_cmd:Nnn \@addtocurcol
{\vskip \intextsep}
{\edef\save@first@penalty{\the\lastpenalty}\unpenalty
\ifnum \lastpenalty = \@M % hopefully the OR penalty
\unpenalty
\else
\penalty \save@first@penalty \relax % put it back
\fi
\ifnum\outputpenalty <-\@Mii
\addvspace\intextsep
\vskip\parskip
\else
\addvspace\intextsep
\fi}
\ctex_patch_cmd:Nnn \@addtocurcol
{\vskip\intextsep \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi}
{\ifnum\outputpenalty <-\@Mii
\aftergroup\vskip\aftergroup\intextsep
\aftergroup\nointerlineskip
\else
\vskip\intextsep
\fi}
\ctex_patch_cmd:Nnn \@getpen { \@M } { \@Mi }
%% 设置浮动体格式
\AtBeginEnvironment{figure}{%
\def\@floatboxreset{\centering}%
Expand Down

0 comments on commit 5f25004

Please sign in to comment.