3

I am using cleveref to cross-reference my thesis. When I use \Cref to reference chapter 1, in the text it appears as "Chapter 1". I was wondering if there I still use the chapter structure for the main text, but the cross-reference in the text will show as "Section 1" instead.

  • 1
    Is the name substitution ("chapter" -> "section") supposed to be global or just on a case by case base? Please advise. – Mico Jul 20 '18 at 5:27
  • It is supposed to be global – Han Li Jul 20 '18 at 15:03
5

If the name substitution is supposed to be global, you could employ the \crefalias device to achieve your objective. E.g.,

enter image description here

Asisde: I assume you are well aware of the fact that your readers may get confused if "chapters" are referred to as "sections."

\documentclass{report}
\usepackage{cleveref}
\crefalias{chapter}{section}

\begin{document}
\refstepcounter{chapter}\label{ch:1}
\refstepcounter{chapter}\label{ch:2}
Cross-references to \cref{ch:1,ch:2}.
\end{document}

If, on the other hand, the name substitution is supposed to apply to just a subset of chapters, e.g., the second chapter, you could set an optional argument for \label instruction associated with the chapter in question.

enter image description here

\documentclass{report}
\usepackage{cleveref}

\begin{document}
\refstepcounter{chapter}\label{ch:1}
\refstepcounter{chapter}\label[section]{ch:2}

Cross-references to \cref{ch:1,ch:2}.
\end{document}
3

You can use \crefname to globally redefine the "name" used by cleveref:

enter image description here

Here's the code:

\documentclass{book}
\usepackage{cleveref}

\crefname{chapter}{section}{sections}

\begin{document}

\chapter{A chapter}\label{C:chapter}

  \Cref{C:chapter}  \cref{C:chapter}

\end{document}

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.