I use the report class and I have learned from other questions on this site (like Remove spacing between per-chapter figures in LoF) how I can adjust the spacing between per-chapter figures in the LoF. I would like to change the traditional
\addtocontents{lof}{\protect\addvspace{10\p@}}
in the report.cls file to
\addtocontents{lof}{\protect\addvspace{15\p@}} by using this patch :
\makeatletter
\patchcmd{\@chapter}%
{\addtocontents{lof}{\protect\addvspace{10\p@}}}% <search>
{\addtocontents{lof}{\protect\addvspace{15\p@}}}% <replace>
{}{}% <success><failure>
\makeatother
However, by issuing \tracingpatches I can see the following :
[debug] analyzing '\@chapter'
[debug] ++ control sequence is defined
[debug] ++ control sequence is a macro
[debug] ++ macro can be retokenized cleanly
[debug] -- search pattern not found in replacement text
Am I doing something wrong ? I don't understand why \patchcmd can't find the specified code. For the record, there are 3 other patches in my document (not modifying \@chapter) and they all work well.
Edit: While preparing a MWE, I realized that the package hyperref is the culprit, since removing it solves the problem.
\documentclass[12pt,twoside,openright]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{etoolbox}
\usepackage[pdftex,colorlinks,linkcolor=blue,citecolor=red]{hyperref}
%----------------------- Patch -----------------------
\tracingpatches
\makeatletter
\patchcmd{@chapter}%
{\addtocontents{lof}{\protect\addvspace{10\p@}}}% <search>
{\addtocontents{lof}{\protect\addvspace{15\p@}}}% <replace>
{}{}% <success><failure>
\makeatother
%-----------------------------------------------------
\begin{document}
\listoffigures
\chapter{A chapter}
\begin{figure}\caption{A figure}\end{figure}
\begin{figure}\caption{A figure}\end{figure}
\chapter{A chapter}
\begin{figure}\caption{A figure}\end{figure}
\begin{figure}\caption{A figure}\end{figure}
\appendix
\chapter{A chapter}
\addtocontents{lof}{\protect\addvspace{10pt}}%
\begin{figure}\caption{A figure}\end{figure}
\begin{figure}\caption{A figure}\end{figure}
\end{document}
Is there a way to fix this ? I need to keep loading the hyperref package.

hyperrefpackage. – Croisillon Aug 22 '20 at 01:59