xequations の \iftotalfigures と同等

xequations の \iftotalfigures と同等

参照がある場合にのみリストを印刷するには、次の構文を使用します。

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

ここで、次のように xequations に同じものを使用したいと思います。

% List of xequations
\iftotalxequations\listofxequations\fi

私の宣言は次のようになります:

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

しかし、\iftotalxequations定義されていません。簡単に定義する方法はありますか?

答え1

最初の回答で説明したようにリストの条件付きリスト - リストが存在する場合のみ lstlistoflistingstotalcountパッケージを使用して を定義できます\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}

関連情報