# cleveref and appendix packages: appendix referenced as section

Using this example:

\documentclass{scrartcl}
\usepackage{lipsum}
\usepackage{appendix}
\usepackage{cleveref}

\begin{document}
\section{The first section}\label{sec:1}
\lipsum[2]

\section{The second section}
\cref{sec:1} tells us something, while \cref{app:1} tells us something else!

\begin{appendices}
\section{The first appendix}\label{app:1}
\lipsum[2]
\end{appendices}

\end{document}


The reference \cref to the appendix section unfortunately references it as “section A”, rather than “appendix A”.

Is there any way to fix that?

section 1 tells us something, while section A tells us something else!

One solution I found is this: Create an additional \crefname and use it as an optional argument to \label.

The package cleveref provides a mechanism for this. Introduce a new type appsec and set up the label name via \crefname; then in the appendices part use \crefalias to get the section type to point to the type appsec:

\documentclass{scrartcl}
\usepackage{lipsum}
\usepackage{appendix}
\usepackage{cleveref}

\crefname{appsec}{Appendix}{Appendices}

\begin{document}
\section{The first section}\label{sec:1}
\lipsum[2]

\section{The second section}
\Cref{sec:1} tells us something, while \cref{app:1} tells us something else!

\begin{appendices}
\crefalias{section}{appsec}
\section{The first appendix}\label{app:1}
\lipsum[2]
\end{appendices}

\end{document}

• Perhaps it should be obvious, but just to note: if you want a lowercase (or otherwise different) prefix mid-sentence, you need to define \Crefname and \crefname – OJFord Jun 19 '17 at 13:58
• It can also be helpful in some circumstances to add additional lines at the beginning of the appendices like \crefalias{subsection}{appsec}, in which case references to subsections in the appendix will have the correct label as well. – Jim Garrison May 30 '18 at 21:35