GeneralMake cleveref, memoir and hyperref work together

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
leo
Posts: 2
Joined: Sun Nov 15, 2009 1:37 pm

Make cleveref, memoir and hyperref work together

Post by leo »

I was able to make cleveref and memoir work with each other as in this example:

Code: Select all

\documentclass{memoir}
\usepackage{amsmath}
\newcommand\fixme[1]{\framebox[0.5\textwidth]{\vrule height 5cm depth 0pt width 0pt #1}}
\newsubfloat{figure}

\makeatletter
\usepackage{varioref}
\let\label\@mem@old@label
% \usepackage{hyperref}
\usepackage{cleveref}
\makeatother

\begin{document}
\chapter{Hello World}
\begin{figure}
  \centering
  \subbottom[]{\fixme{subfigure a}\label{fig:subfig1}}%
  \subbottom[]{\fixme{subfigure b}\label{fig:subfig2}}%
  \caption{A figure}
  \label{fig:1}
\end{figure}
\begin{equation}
  \label{eq:1}
  \exp{^-2}
\end{equation}
\chapter{Hello UK}
\Vref{fig:1} has \vref{fig:subfig1,fig:subfig2}. \Vref{eq:1}
\end{document} 
However, I can't get the three cleverref, memoir and hyperref to work together. Any hack to make them work? Thank you.

Leo

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

adrian
Posts: 8
Joined: Thu Nov 12, 2009 5:24 pm

Re: Make cleveref, memoir and hyperref work together

Post by adrian »

According to the memoir documentation, hyperref should be included as the last package. (I've never used cleveref, so I'm not sure if this comment is relevant to your example.)

HTH,
Adrian
leo
Posts: 2
Joined: Sun Nov 15, 2009 1:37 pm

Re: Make cleveref, memoir and hyperref work together

Post by leo »

The question is actually harder than it looks. Currently lots of packages are modifying the label and ref from the latex kernel and these packages are difficult to work together. I have found a hack to make these three packages work side by side in my document. But I think the best thing to do for now is to wait until these packages use zref.

Leo
daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Re: Make cleveref, memoir and hyperref work together

Post by daleif »

cleveref will also break memoirs \titleref feature as it takes over the label.

I have ideas about how to fix it but they all involve doubling the number of label lines in the aux files, so I don't know whether this is a good idea.

I agree (I think the cleveref does too) that the zref idea will be the best way to move forward.
Post Reply