5

How can I get references to subcaption numbers when using memoir? In this example:

\documentclass{memoir}

\newsubfloat{figure}
\begin{document}

\chapter{Lorem}
\section{ipsum}

\begin{figure}[b]
\begin{minipage}{0.49\textwidth}
    \centering
    \Large \textbf{Lorem}
    \subcaption{Lorem}
    \label{lorem}
\end{minipage}
\begin{minipage}{0.49\textwidth}
    \centering
    \Large \textbf{ipsum}
    \subcaption{Ipsum}
    \label{ipsum}
\end{minipage}
\caption{Lorem Ipsum}
\end{figure}

Lorem (figure:~\ref{lorem}) ipsum (figure:~\ref{ipsum}) dolor sit amet, consectetur adipiscing elit. Nullam ut nunc lacus, ac vestibulum orci. Nullam viverra dictum dolor, in molestie neque ullamcorper sed. Nullam felis velit, vestibulum ut convallis quis, luctus sit amet est. Etiam vel viverra magna. Phasellus euismod venenatis augue, quis rutrum sem pulvinar at. Donec pellentesque enim vitae ante tristique lacinia. Nulla auctor fermentum lorem, ut scelerisque nunc vehicula id. Phasellus sed facilisis erat. Nulla porttitor, metus eu bibendum molestie, elit dui lacinia dolor, nec iaculis sem tortor sit amet tortor. Vivamus a euismod arcu.

\end{document}

I would like to get references like "Lorem (figure: 1.1a) ipsum (figure: 1.1b)" instead it looks like this:

enter image description here

With the subcaption package which was used before I switched to memoir it seems this worked out of the box. How can I get this behavior with memoir?

8

Put the label within the subcaption command, as mentioned in §10.9 of the memoir manual. This will print parenthesis around the subreference, e.g. 1.1(a), but those cannot, at the moment, be removed (see comment by daleif).

\documentclass{memoir}
\newsubfloat{figure}
\begin{document}

\chapter{Lorem}
\section{ipsum}

\begin{figure}[h]
\begin{minipage}{0.49\textwidth}
    \centering
    \Large \textbf{Lorem}
    \subcaption{Lorem\label{lorem}}
\end{minipage}
\begin{minipage}{0.49\textwidth}
    \centering
    \Large \textbf{ipsum}
    \subcaption{Ipsum\label{ipsum}}
\end{minipage}
\caption{Lorem Ipsum}
\end{figure}

Lorem (figure:~\ref{lorem}) ipsum (figure:~\ref{ipsum}) dolor sit amet[...]
\end{document}

enter image description here

  • Actually, that works for me. Thanks! But now that you mention it I am very curious whether those parantheses can be removed... :) – jonalv Oct 5 '11 at 19:49
  • 3
    The ()'s are hardwired into the macro/label and currently cannot be removed. – daleif Oct 10 '11 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.