0

To print my lists only when there are references I use the following syntax:

% List of figures
\iftotalfigures\listoffigures\fi
% List of tables
\iftotaltables\listoftables\fi

Now I would like to use the same for my xequations like this:

% List of xequations
\iftotalxequations\listofxequations\fi

My declaration is like this:

\DeclareNewTOC[
  counterwithin=chapter,
  name=equation, 
  type=xequation, 
  nonfloat, 
]{loe}

\AtBeginDocument{
\newcaptionname{ngerman}\xequationname{Gleichung}
\newcaptionname{ngerman}\listxequationname{Gleichungsverzeichnis}
}

-

\begin{xequation-}
\begin{gather}
\begin{aligned}
a &= b\\
\label{eq:1}
\end{aligned}\\
\begin{array}{lll}
\text{mit:} &&\\
a & \text{--} & \text{Test [1]}\\
b & \text{--} & \text{Test [1]}
\end{array}
\notag
\end{gather}
\caption[Test]{Test}
\end{xequation-}

But \iftotalxequations is not defined. Is there an easy way to define it?

PascalS
  • 826
  • What is the xequation- environment? – Bernard Aug 11 '19 at 18:17
  • I'm not sure, but I found some working examples... For example – PascalS Aug 11 '19 at 18:29
  • @Passe it's helpful that you provided examples, unfortunately none of them is a full MWE (Minimal Working Example, or Minimalbeispiel in German). A MWE is complete, which means that it contains everything to recreate the issue, including \documentclass, \usepackage statements, the contents, and \end{document}, all put together in a single code example. Luckily, on the page you linked there is an MWE at the bottom that I could use for my answer - maybe for your next question you can try to include a code example with this convention yourself. – Marijn Aug 12 '19 at 16:07

1 Answers1

1

As explained by the first answer to Conditional list of listings - lstlistoflistings only if listings are present you can use the totalcount package to define \iftotalxequations.

MWE:

\documentclass[listof=entryprefix]{scrartcl}
\DeclareNewTOC[%
   name=Formula,
   type=xequation,
   nonfloat,
]{loe}
\usepackage[xequation]{totalcount}
\begin{document}
\iftotalxequations\listofxequations\fi
\begin{xequation-}  
$a=b$
\caption{P-Anteil}
\end{xequation-}

\begin{xequation-}  
$E=mc^2$
\caption{Einstein}
\end{xequation-}
\end{document}
Marijn
  • 37,699