When I use Hyperref package together with memoir class, and when I put a label to a PGFPlot inside a subbottom environment, and try to reference to it, an error reported:
! File ended while scanning use of \Hy@setref@link.
A MWE:
\documentclass[11pt, letterpaper, oneside, article]{memoir}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.7}
\usepackage[hyperfootnotes=true]{hyperref}
\newsubfloat{figure}
\begin{document}
A test for hyperref, subbottom of memoir class, and legend reference.
This is the legend reference:\ref{plot:firstplot}.
\begin{figure}[hbt]
\centering
\subbottom[]{
\begin{tikzpicture}
\begin{axis}
\addplot coordinates {(0,0)(0.5,1)(1,2)};
\label{plot:firstplot}
\end{axis}
\end{tikzpicture}
}
\end{figure}
\end{document}
If we do not use Hyperref, or if we do not put the plot inside subbottom, things would work out well.