-
Notifications
You must be signed in to change notification settings - Fork 38
Closed
Description
From https://tex.stackexchange.com/q/548778/2388
\Hy@SaveLastskip\Hy@RestoreLastskip as issued for example by \refstepcounter removes possible breakpoints:
\documentclass{article}
\usepackage{hyperref} %
\textheight 3cm
\begin{document}
\begin{minipage}{5cm}
\rule{1cm}{2cm}
\end{minipage}
%\refstepcounter{section}
\makeatletter \Hy@SaveLastskip\Hy@RestoreLastskip\makeatother
\begin{minipage}{5cm}
\rule{1cm}{2cm}
\end{minipage}
\end{document}
A suggested fix is
\documentclass{article}
\usepackage{hyperref} %
\textheight 3cm
\makeatletter
\def\Hy@SaveLastskip{%
\let\Hy@RestoreLastskip\relax
\ifvmode
\ifdim\lastskip=\z@
\ifnum\lastnodetype=11 %not sure this is needed really %<--new
\let\Hy@RestoreLastskip\nobreak
\else %new
\let\Hy@RestoreLastskip\relax %new
\fi %new
\else
\begingroup
\skip@=-\lastskip
\edef\x{%
\endgroup
\def\noexpand\Hy@RestoreLastskip{%
\noexpand\ifvmode
\noexpand\nobreak
\vskip\the\skip@
\vskip\the\lastskip\relax
\noexpand\fi
}%
}%
\x
\fi
\else
\ifhmode
\ifdim\lastskip=\z@
\let\Hy@RestoreLastskip\nobreak
\else
\begingroup
\skip@=-\lastskip
\edef\x{%
\endgroup
\def\noexpand\Hy@RestoreLastskip{%
\noexpand\ifhmode
\noexpand\nobreak
\hskip\the\skip@
\hskip\the\lastskip\relax
\noexpand\fi
}%
}%
\x
\fi
\fi
\fi
}%
\makeatother
\begin{document}
\begin{minipage}{5cm}
\rule{1cm}{2cm}
\end{minipage}
%\refstepcounter{section}
\makeatletter \Hy@SaveLastskip\Hy@RestoreLastskip\makeatother
\begin{minipage}{5cm}
\rule{1cm}{2cm}
\end{minipage}
\end{document}
Metadata
Metadata
Assignees
Labels
No labels