The documentation of the endfloat package explains how to customize the text in the markers from the default of "[Table 3 about here.]" But I would like to customize the markers to include a hyperlink to the figure at the end of the document. How can this be accomplished?
Here's a subquestion: In customizing the marker, \thepostfigure refers to the figure number. Is there a similar command like \thefigurereference that refers to the reference to the figure, so that the marker text can be something like Figure \ref{\thefigurereference}} about here.?
Update 2: In the comments, I asked about a backlink as well, so that the caption of the figure at the end of the document would hyperlink back to the "[Figure 1 about here]" float embedded in the text. @John Kormylo's accepted solution delivers this.
Update 1 [edited to be clearer it's referring to @John Kormylo's original answer, not his revised one]:
@John Kormylo's (original) solution works, but as I have learned it is incompatible with the subcaption package. So, my revised question is: Is there a way to hyperlink to figures that still works with caption?
Here is a MWE using his solution where the hyperlinks don't go to the figures at the end. Figure 2 is just there to demonstrate why I need subcaption - the linking still fails even without it, so long as the subpcaption package is used.
\documentclass{article}
\usepackage{endfloat}
\usepackage{mwe}
\usepackage{hyperref}
\usepackage{subcaption}
% John Kormylo's original solution, which works when the subcaption package isn't used:
\renewcommand{\floatplace}[1]{% #1 = float type (e.g. figure)
\begin{center}
\hyperlink{#1.\csname thepost#1\endcsname}%
{[\csname #1name\endcsname~\csname thepost#1\endcsname\ about here.]}
\end{center}}
\begin{document}
\begin{figure}
\includegraphics{example-image}
\caption{A figure without subfigures}
\end{figure}
\begin{figure}[htb]
\centering
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=.9\textwidth]{example-image}
\caption{first part}
\end{subfigure}%
%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=.9\textwidth]{example-image}
\caption{(second part)}
\end{subfigure}%
\caption{A figure with subfigures}
\end{figure}
\lipsum[1-2]
\end{document}
The aux file produced suggests that the reason the solution didn't work is that subcaption changes the name of the counters from figure.1, figure.2 etc. to figure.caption.2, figure.caption.3 etc. It has these lines for the list of tables (which has working hyperlinks to the figures):
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces This is figure 1.\relax }}{3}{figure.caption.2}}
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces This is figure 2.\relax }}{4}{figure.caption.3}}
One option would be to re-write John Kormylo's (original) \floatplace command starting numbering at 2 and re-naming the head to figure.caption or table.caption. But in in a different document, the numbering for figure.caption in the aux file starts at 18. (I haven't figured out how to reproduce this in a MWE, though.) This means that such a workaround won't do.
\documentclasscommand, has a minimal preamble and then\begin{document}...\end{document}. Unless the problem is a compilation error, the code should compile and be as small as possible to demonstrate your problem. This makes it much easier for people to help you --- and much ore likely that they will! – Feb 07 '16 at 04:36in the figure and then\ref{where you want the reference, whereis whatever label you want. For hyperlinks it might be enough to include\usepackage{hyperref}` -- if you'd included a MWE I'd test this:)