1

I understood how to use \ label {} and \ ref} to get the number of a section or subsection. I would like to know if it was possible to also obtain the title of a section or sub-section. For example (see VI.1 Test) where Test the title of the subsection

Nicolas
  • 1,023

1 Answers1

1

Use hyperref or cleveref packages.

\documentclass{article}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{document}
    \section{Test}\label{sec:test}
    \ref{sec:test}
    \nameref{sec:test}
\autoref{sec:test}

\cref{sec:test}

\end{document}

You can define a \newcommand to fit your need:

\newcommand{\myref}[1]{(see \autoref{#1}~\nameref{#1}, p.~\pageref{#1})}
NBur
  • 4,326
  • 10
  • 27