%% LaTeX package xassoccnt - version 2.0 (2021/11/21 -- 12:14:58)
%% Example file for coupled counters file for xassoccnt.sty
%%
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2016 -- 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{article}

\usepackage{caption}
\usepackage{xassoccnt}
\usepackage{blindtext}


\usepackage{hyperref}

\DeclareCoupledCountersGroup{figuretablebundle}

\DeclareCoupledCounters[name=figuretablebundle,multiple=false]{figure,table}

\DeclareCoupledCounters[name=figuretablebundle,multiple=false]{figure,table,figure}

\DeclareCoupledCounters[name=sectionequationbundle]{section,equation}

\begin{document}

\AddCoupledCounters[name=figuretablefoo]{figure,table,figure}

\listoffigures
\listoftables

\section{First}


\blindtext[10]

\begin{figure}[!ht]

\caption{A figure}
\end{figure}

A footnote here\footnote{Myfootnote}

\blindtext[10]


\begin{table}[!ht]
\caption{A table}
\end{table}

\begin{equation}
  E=mc^2
\end{equation}

\section{Second}

\blindtext[10]

\begin{figure}[!ht]

\caption{A foo figure}
\end{figure}

\blindtext[10]


\begin{table}[!ht]
\caption{A foo table}
\end{table}



\begin{table}[!ht]
\caption{A foobar table}
\end{table}



\begin{figure}[!ht]

\caption{A foobar figure}
\end{figure}

\blindtext[10]

\begin{table}[!ht]
\caption{Yet another foo table}
\end{table}



\begin{figure}[!ht]

\caption{Yet another foo figure}
\end{figure}

\RemoveCoupledCounters[name=figuretablebundle]{figure}
\addcontentsline{lof}{section}{After using RemoveCoupledCounters for figure}

\blindtext[10]

\begin{figure}[!ht]

\caption{An intermediate figure that is not coupled}
\end{figure}


\begin{table}[!ht]
\caption{Yet another foobar table}
\end{table}

\begin{table}[!ht]
\caption{Even more foobar table}
\end{table}

\begin{table}[!ht]
\caption{Even most foobar table}
\end{table}



\begin{figure}[!ht]

\caption{Even more foobar figure}
\end{figure}

\clearpage

\begin{figure}[!ht]

\caption{Another intermediate figure that is not coupled}
\end{figure}


\AddCoupledCounters[name=figuretablebundle]{figure}

\addcontentsline{lof}{section}{After using AddCoupledCounters for figure again}

\begin{figure}[!ht]
\caption{Even most foobar figure}
\end{figure}

\begin{table}[!ht]
\caption{Another coupled table}
\end{table}

\begin{figure}[!ht]
\caption{Another coupled figure}
\end{figure}


\ClearAllCoupledCounters
\clearpage

\addcontentsline{lof}{section}{After using ClearAllCoupledCounters}
\addcontentsline{lot}{section}{After using ClearAllCoupledCounters}

\begin{figure}[!ht]
\caption{Almost next to last figure}
\end{figure}


\begin{table}[!ht]
\caption{Almost next to last table}
\end{table}

\begin{figure}[!ht]
  \caption{Next to last figure}
\end{figure}

\begin{table}[!ht]
  \caption{Next to last table}
\end{table}



\AddCoupledCounters[name=figuretablebundle]{figure,table}
\addcontentsline{lof}{section}{After using AddCoupledCounters}
\addcontentsline{lot}{section}{After using AddCoupledCounters}


\begin{figure}[!ht]
\caption{The last figure}
\end{figure}

\begin{table}[!ht]
\caption{The last table}
\end{table}



\end{document}