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
Asked
Active
Viewed 395 times
1
1 Answers
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
-
thanks for your response. can I remove the frame that surrounds the reference in the final document, – Nicolas Jan 06 '21 at 14:46
-
namerefpackage. – leandriis Jan 06 '21 at 11:27