# How to display a chapter / section reference in the pattern (chapter n section m), where n is the chapter number and m the section path

I have the following content structure:

\chapter{Kapitel 1}
\label{ch:c_1}
\section{Abschnitt 1}
\subsection{Unterabschnitt 1}
\subsection{Unterabschnitt 2}
\label{ch:u_a_2}


The goal is a chapter reference. When I want to refer to a chapter (ch:c_1) the output should look like this:

In Chapter 1 you can see...

When I want to refer to a section or subsection (ch:u_a_2) the output should look like this:

In Chapter 1 Section 1.2 you can see...

Is there any package I can use?

The Answer

With the package cleveref you can write cref{ch:c_1} cref{ch:u_a_2} If you want to change the naming of the default ones you can use \crefname in the following way (german example):

\crefname{chapter}{Kapitel}{Kapitel}
\crefname{section}{Abschnitt}{Abschnitte}

• \Cref{ch:c_1} \Cref{ch:u_a_2}, using the cleveref package in conjunction with the ngerman option of the babel package. The naming scheme of your labels is error-prone, however. Make sure to load the cleveref package as the last one of all – user31729 Mar 4 at 9:50
• And this is surely a duplicate – user31729 Mar 4 at 9:53
• I thought it would be possible in just one command. Thank you everything worked fine. Is there a possibility to change the naming of chapter and section? – dodo978 Mar 4 at 10:00
• As I wrote: Use the ngerman option to the document class and babel and you will get Kapitel etc. Please see the manual as well -- reading it does not hurt ;-) – user31729 Mar 4 at 10:11
• The plural form of Kapitel is Kapitel, not Kapitel, as well Abschnitte and not Abschnitts ;-) – user31729 Mar 4 at 10:12