TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some problems with cleveref and titlesec, providing a minimal working example below:

\usepackage{titlesec} %% <-- the issue as far as i know, but i need the package
\chapter{ninjas are okay}
some text \cref{app:ninja_bkg} bla bla and \cref{app:ninja_fail}
\chapter{ninja background}
ninjas originated from ???
\section{ninja fail}
usually ninjas dont fail, but sometimes they do

where the line in the middle produces:

some text appendix A bla bla and section A.1

But I want:

some text appendix A bla bla and appendix A.1

If I remove the titlesec package everything works fine, but sadly I need it. Guessing titlesec redefines \section, but I'm not enough of a latex-hacker to fix it =/

share|improve this question
I was just going to suggest to use hyperrefs \autoref instead, but then figured out that it produces the same text output. – Martin Scharrer May 10 '11 at 13:31
I'll comment this to show a minimal working solution: Change \label{app:ninja_fail} into \label[appendix]{app:ninja_fail} – flindeberg May 11 '11 at 6:48
up vote 12 down vote accepted

You can use (as described in cleveref's documentation) \crefname, \Crefname, and the optional argument for the \label command to supply a new "type" for the sections in the appendices, ; a little example:




\chapter{Test chapter}\label{testchap}

\section{test section}\label{testsec}

A reference to a regular section: \cref{testsec}, and a reference to a section in appendix: \cref{testsecapp}

\chapter{Test appendix}\label{testapp}

\section{Test section in app}\label[secinapp]{testsecapp}


The cleveref documentation gives a hint about using the aliascnt package to avoid having to use the optional argument for the new type (I haven't tested this approach, though).

share|improve this answer
That works, even though a bit cumbersome. Thanks! – flindeberg May 10 '11 at 14:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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