2

In my LaTeX document I use both cleveref and fncychap packages. But fncychap breaks the correct crefname for appendices.

A minimal example:

\documentclass{book}

\usepackage{cleveref}
\usepackage{fncychap}

\begin{document}

\chapter{First chapter}
\label{chap:first}

Reference to the \cref{app:first}.

\appendix
\chapter{First appendix}
\label{app:first}

\end{document}

It displays "Reference to the chapter A." instead of "Reference to the appendix A."

Without \usepackage{fncychap} it works as expected.

How can I fix that?

4
  • 3
    welcome! have you tried loading cleveref last?
    – cfr
    Commented Aug 14 at 2:26
  • 1
    I feel stupid... that worked! Commented Aug 14 at 3:13
  • 2
    cleveref likes being last. it should even be loaded after hyperref, which also likes being last ;).
    – cfr
    Commented Aug 14 at 3:49
  • @cabohah - Fair enough. I've withdrawn my close vote (and upvoted your answer).
    – Mico
    Commented Aug 14 at 6:42

1 Answer 1

5

As already told in a comment by @cfr you should load cleveref last (even after hyperref if you use hyperref):

\documentclass{book}

\usepackage{fncychap}
\usepackage{cleveref}

\begin{document}

\chapter{First chapter}
\label{chap:first}

Reference to the \cref{app:first}.

\appendix
\chapter{First appendix}
\label{app:first}

\end{document}

An alternative solution would be to use zref-clever instead of cleveref. The command \zcref can be used similar to \cref:

\documentclass{book}

\usepackage{zref-clever}
\usepackage{fncychap}

\begin{document}

\chapter{First chapter}
\label{chap:first}

Reference to the \zcref{app:first}.

\appendix
\chapter{First appendix}
\label{app:first}% or \zlabel{app:first} → section 6 of the zref-clever user manual

\end{document}

Reference to appendix A.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .