This question is somewhat related to How to check if figures are on the same page of call out/text? but for another purpose and its answer is irrelevant here (though probably the solution to my answer is deeply buried in the code of varioref), hence the current new question.
Is there a way to change the style of a float (e.g. with a caption text in bold face) depending on whether it is on the same page of call out or not?
Here is a skeleton of what I'm after:
\documentclass{article}
\usepackage{graphicx}
\usepackage{mwe}
\NewDocumentCommand{\IfOnTheSamePage}{ m m }{%
(Maybe in bold face...)
}
\begin{document}
\begin{figure}
\centering
\includegraphics{example-image}
\caption{%
\IfOnTheSamePage{}{\bfseries}%
Caption%
}
\end{figure}
\end{document}
\pagerefwith the current page and fix up the typesetting on the next run if they are the same – David Carlisle Jan 05 '22 at 00:23