%% LaTeX package xassoccnt - version 2.0 (2021/11/21 -- 12:14:58)
%% Example file the the usage of labels with associated counters file for xassoccnt.sty
%%
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2017 -- 2021 by Dr. Christian Hupfer <>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%%
%% This work has the LPPL maintenance status `unmaintained`
%%
%%

\documentclass[10pt,a4paper,twoside]{article}
\usepackage{chngcntr}
\usepackage{xassoccnt}
\usepackage{hyperref}
\NewDocumentCounter{ap, apother}
\DeclareAssociatedCounters{subsection}{ap, apother}

\counterwithout{ap}{section}

\usepackage{cleveref}

\crefname{ap}{package}{packages}
\Crefname{ap}{Package}{Packages}
\creflabelformat{ap}{AP~#2#1#3}
\crefformat{ap}{AP~#2#1#3}

\begin{document}

See \cref{foosection}

  \section{ some section  } \label{foosection}
  \section{ special section on packages  }
  \setcounter{ap}{0}

      Here we describe \cref{ap::ap-one,ap::ap-two,ap::ap-three}  ....
      this will be presented in \cref{ap::ap-one,ap::ap-two} and 
      finally in \cref{ap::ap-three} we describe ....

    Preferably this should look like this:

      Here we describe package AP 1 to AP 3  .... 
      this will be presented in packages AP 1 and AP 2 and 
      finally in package AP 3 we describe ....

    but currently it looks like this:

      Here we describe package AP 2.1 to AP 2.3  .... 
      this will be presented in packages AP 2.1 and AP 2.2 and 
      finally in package AP 2.3 we describe ....

   \subsection{AP~\arabic{ap}: first } \label{ap-one}
     bla bla bla
     Here we describe  ... 
     which will be used in \cref{ap::ap-two,ap::ap-three}  ....


   \subsection{AP~\arabic{ap}: second }
   \label{ap-two}
     bla bla bla
     we described in \cref{ap::ap-one}  .... 
     follow in \cref{ap::ap-three}

     ap counter is \arabic{ap} or \theap.

     subsection counter is \arabic{subsection} 
     and ``thesection'' is \thesubsection.


   \subsection{AP~\arabic{ap}: three }
   \label{ap-three}
     bla bla bla
     we described in \cref{ap::ap-three,ap::ap-two} but look at \ref{ap-three}  


  \section*{Appendix}
     The table of contents is fine as is 
  \tableofcontents

\end{document}
