# Increase \label{} counter manually [duplicate]

I use my own version of subsections for definitions:

\newcommand{\definition}[2]{\addtocounter{subsection}{1} \subsection*{\thesubsection ~ Definition (#1) \text{\normalfont{#2}}}}


I use them as:

\definition{DefinedThing}{\cite{Book}[Page 64]}
\label{def:DefinedThing}


This works great, the only problem I have is that the references do no longer work now:

\ref{def:DefinedThing}


This reference does only refer to the section in which the definition is used, not to the actual subsection it represents (for example it refers to "2" instead of to "2.5"). Is there a way to fix this? Maybe by increasing the counter for the \label{}.

## marked as duplicate by Werner sectioning StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Dec 22 '15 at 1:07

• use \refstepcounter – daleif Nov 13 '15 at 13:20
• Then you should start by posting a minimal example that compiles. Then it is a lot easier to help. BTW: what is that \text doing there? \text is for textual comments in displayed math, not for constructions like this. – daleif Nov 13 '15 at 14:11
• Just replace \addtocounter{subsection}{1} by \refstepcounter{subsection} but better would be to use \subsection instead of \subsection* – David Carlisle Nov 13 '15 at 14:11