# Include section number in reference to subsection [duplicate]

In an article I omit the section number for subsection titles, using:

\renewcommand\thesubsection{\arabic{subsection}}


However, when I now create a \label in a subsection and reference it using \ref in another part of the document, the printed reference only shows the subsection number, even in a totally different section! How can I show the section AND subsection number in references (as usual) while keeping only the subsection number in subsection titles?

MCVE:

\documentclass{article}

\renewcommand\thesubsection{\arabic{subsection}}

\begin{document}

\section{My first section}

\subsection{Foo}

\subsection{Bar}
\label{ssec:bar}

\section{My second section}

\subsection{Misc}

\subsection{Notes}

\end{document}


The printed reference shows 2, however, I want it to be 1.2.

## marked as duplicate by Community♦Feb 13 at 17:55

• remove \renewcommand\thesubsection{\arabic{subsection}}. than will work as desired. – Zarko Feb 13 at 16:47
• Try \makeatletter\renewcommand\p@subsection{\thesection.}\makeatother. See also tex.stackexchange.com/q/186974/35864, tex.stackexchange.com/q/67742/35864 and tex.stackexchange.com/q/437402/35864 – moewe Feb 13 at 17:21