# sidecaptions in memoir sometimes incorrect when hyperref used?

When using memoir, I find that sometimes sidecaptions end up in the wrong margin despite my using \strictpagecheck and even \overridescapmargin. It seems that there is an interaction between memoir and hyperref, as demonstrated by the following MWE:

\documentclass[a4paper]{memoir}
\setstocksize{29.7cm}{21.0cm} % A4 stock
\settrimmedsize{27.94cm}{21.0cm}{*} % 27.94cm = 11in
\setlength{\trimtop}{0.0cm}
\setlength{\trimedge}{\stockwidth}
\settypeblocksize{23.94cm}{12.3cm}{*}
\setlrmargins{1.13cm}{*}{*}
\setulmargins{2.0cm}{*}{*}
\setmarginnotes{\onelineskip}{6.15cm}{\onelineskip}
\sidecapmargin{outer}
\setsidecaps{\onelineskip}{6.15cm}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage[pdftex]{hyperref}
\checkandfixthelayout
\begin{document}
\lipsum[1-6]
\strictpagecheck
\begin{figure}
\begin{sidecaption}{Dummy caption dummy caption dummy caption.}[fig:dummyfig]
\centering
\begin{tikzpicture}
\draw (0,0) rectangle (12,12);
\end{tikzpicture}
\end{sidecaption}
\end{figure}
\end{document}


If hyperref is used, the caption ends up on the wrong side. If I comment hyperref out, the caption ends up on the right side. However, this only happens in the MWE if the figure is on the second page. If I delete the lipsum paragraphs so that the figure is on the first page, the caption is positioned correctly.

The setpagesize=false option suggested in this post does not make any difference.

Your mwe work at me just fine (I use recent version of memoir package). Maybe the following will help you (if your problem still persist):

1. in preamble add:

\newcommand\side{\strictpagechecktrue
\checkoddpage\ifoddpage\else\raggedleft\fi}

2. to figure environment add:

   \begin{figure}\side
\begin{sidecaption}{Dummy caption dummy caption dummy caption.}[fig:dummyfig]
\centering
\begin{tikzpicture}
\draw (0,0) rectangle (12,12);
\end{tikzpicture}
\end{sidecaption}
\end{figure}

3. don't use \strictpagechecktrue in the text.

• Dear Harish, thank you for editing my answer. I unsuccessful try to include code correctly. I'm still not familiar with this issue ... – Zarko Feb 24 '14 at 6:07
• Indeed, I just updated my TeXLive to the absolute latest version, and the problem has disappeared... I had been running memoir v3.7, now v3.7b appears to have solved the problem. – user1362373 Feb 24 '14 at 8:29
• I need to add that while this now works in my MWE, not all such problems are fixed in my proper document... but now \overridescapmargin works reliably. – user1362373 Feb 24 '14 at 11:32