| 1 |
%% LaTeX package xassoccnt - version 2.0 (2021/11/21 -- 12:14:58) |
| 2 |
%% Example file the the usage of labels with associated counters file for xassoccnt.sty |
| 3 |
%% |
| 4 |
%% |
| 5 |
%% ------------------------------------------------------------------------------------------- |
| 6 |
%% Copyright (c) 2017 -- 2021 by Dr. Christian Hupfer <> |
| 7 |
%% ------------------------------------------------------------------------------------------- |
| 8 |
%% |
| 9 |
%% This work may be distributed and/or modified under the |
| 10 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 11 |
%% of this license or (at your option) any later version. |
| 12 |
%% The latest version of this license is in |
| 13 |
%% http://www.latex-project.org/lppl.txt |
| 14 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 15 |
%% version 2005/12/01 or later. |
| 16 |
%% |
| 17 |
%% |
| 18 |
%% This work has the LPPL maintenance status `unmaintained` |
| 19 |
%% |
| 20 |
%% |
| 21 |
|
| 22 |
\documentclass[10pt,a4paper,twoside]{article} |
| 23 |
\usepackage{chngcntr} |
| 24 |
\usepackage{xassoccnt} |
| 25 |
\usepackage{hyperref} |
| 26 |
\NewDocumentCounter{ap, apother} |
| 27 |
\DeclareAssociatedCounters{subsection}{ap, apother} |
| 28 |
|
| 29 |
\counterwithout{ap}{section} |
| 30 |
|
| 31 |
\usepackage{cleveref} |
| 32 |
|
| 33 |
\crefname{ap}{package}{packages} |
| 34 |
\Crefname{ap}{Package}{Packages} |
| 35 |
\creflabelformat{ap}{AP~#2#1#3} |
| 36 |
\crefformat{ap}{AP~#2#1#3} |
| 37 |
|
| 38 |
\begin{document} |
| 39 |
|
| 40 |
See \cref{foosection} |
| 41 |
|
| 42 |
\section{ some section } \label{foosection} |
| 43 |
\section{ special section on packages } |
| 44 |
\setcounter{ap}{0} |
| 45 |
|
| 46 |
Here we describe \cref{ap::ap-one,ap::ap-two,ap::ap-three} .... |
| 47 |
this will be presented in \cref{ap::ap-one,ap::ap-two} and |
| 48 |
finally in \cref{ap::ap-three} we describe .... |
| 49 |
|
| 50 |
Preferably this should look like this: |
| 51 |
|
| 52 |
Here we describe package AP 1 to AP 3 .... |
| 53 |
this will be presented in packages AP 1 and AP 2 and |
| 54 |
finally in package AP 3 we describe .... |
| 55 |
|
| 56 |
but currently it looks like this: |
| 57 |
|
| 58 |
Here we describe package AP 2.1 to AP 2.3 .... |
| 59 |
this will be presented in packages AP 2.1 and AP 2.2 and |
| 60 |
finally in package AP 2.3 we describe .... |
| 61 |
|
| 62 |
\subsection{AP~\arabic{ap}: first } \label{ap-one} |
| 63 |
bla bla bla |
| 64 |
Here we describe ... |
| 65 |
which will be used in \cref{ap::ap-two,ap::ap-three} .... |
| 66 |
|
| 67 |
|
| 68 |
\subsection{AP~\arabic{ap}: second } |
| 69 |
\label{ap-two} |
| 70 |
bla bla bla |
| 71 |
we described in \cref{ap::ap-one} .... |
| 72 |
follow in \cref{ap::ap-three} |
| 73 |
|
| 74 |
ap counter is \arabic{ap} or \theap. |
| 75 |
|
| 76 |
subsection counter is \arabic{subsection} |
| 77 |
and ``thesection'' is \thesubsection. |
| 78 |
|
| 79 |
|
| 80 |
\subsection{AP~\arabic{ap}: three } |
| 81 |
\label{ap-three} |
| 82 |
bla bla bla |
| 83 |
we described in \cref{ap::ap-three,ap::ap-two} but look at \ref{ap-three} |
| 84 |
|
| 85 |
|
| 86 |
\section*{Appendix} |
| 87 |
The table of contents is fine as is |
| 88 |
\tableofcontents |
| 89 |
|
| 90 |
\end{document} |