summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xassoccnt/xassoccnt_label_example.tex
blob: dc07d862c82d50948678d58d02270ce62ab9e564 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
%% LaTeX package xassoccnt - version 1.8 (2020/07/19 -- 12:38:30)
%% Example file the the usage of labels with associated counters file for xassoccnt.sty
%%
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2017 -- 2020 by Dr. Christian Hupfer <dr dot christian dot hupfer at gmail dot com>
%% -------------------------------------------------------------------------------------------
%%
%% 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 `author-maintained`
%%
%%

\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}