![TOCから[newfloat]のリストを削除します](https://rvso.com/image/290208/TOC%E3%81%8B%E3%82%89%5Bnewfloat%5D%E3%81%AE%E3%83%AA%E3%82%B9%E3%83%88%E3%82%92%E5%89%8A%E9%99%A4%E3%81%97%E3%81%BE%E3%81%99.png)
私はパッケージ newfloat を使用しており、新しい図を追加しました:
\DeclareFloatingEnvironment{dirfigure}
これで、使用すると\listofdirfigures
、リストが目次に追加されます。
\listoffigures*
通常の図では、 ( *
) を使用して TOC にリストしないようにできますが、\listofdirfigures*
機能しません。
TOC に数字のリストをリストしないようにするにはどうすればよいですか?
最小限の例:
\documentclass[a4paper,twoside]{memoir}
\usepackage{newfloat}
\DeclareFloatingEnvironment{dirfigure}
\begin{document}
\tableofcontents*
\listoffigures*
\listofdirfigures
\chapter{bah}
\begin{dirfigure}
bah
\caption{bah}
\end{dirfigure}
\begin{figure}
bah
\caption{bah}
\end{figure}
\end{document}
ありがとう
答え1
参考までに、memoir
唯一の方法は次のとおりです。
\documentclass[a4paper,twoside]{memoir}
\newfloat[chapter]{dirfigure}{dirf}{Dirfigure}
\newlistof{listofdirfigures}{dirf}{List of Dirfigures}
\newlistentry[chapter]{dirfigure}{dirf}{0}
\cftsetindents{dirfigure}{0em}{2.3em}
\begin{document}
\tableofcontents*
\listoffigures*
\listofdirfigures*
\chapter{bah}
\begin{dirfigure}
bah
\caption{bah}
\end{dirfigure}
\begin{figure}
bah
\caption{bah}
\end{figure}
\end{document}
答え2
でこれを実行したい場合は\newfloat
、 のリスト印刷マクロと同じ機能を実現する方法は次のとおりですmemoir
。
\documentclass[a4paper,twoside]{memoir}
\usepackage{etoolbox}
\usepackage{newfloat}
\makeatletter
%% we define a helper macro for adjusting lists of new floats to
%% accept a * behind them for not being shown in the TOC, like
%% the other list printing commands in memoir
\newcommand{\AdjustForMemoir}[1]{%
\csletcs{kept@listof#1}{listof#1}%
\csdef{listof#1}{%
\@ifstar
{\csappto{newfloat@listof#1@hook}{\append@star}%
\csuse{kept@listof#1}}%
{\csuse{kept@listof#1}}%
}
}
\def\append@star#1{#1*}
\makeatother
\DeclareFloatingEnvironment{dirfigure}
\AdjustForMemoir{dirfigure} % prepare `\listofdirfigures` so it accepts a *
\begin{document}
\tableofcontents*
\listoffigures*
\listofdirfigures*
\chapter{bah}
\begin{dirfigure}
bah
\caption{bah}
\end{dirfigure}
\begin{figure}
bah
\caption{bah}
\end{figure}
\end{document}
\listofdirfigures
なしで使用すると*
、リストは目次に入ります。
\listofdirfigures
これは、が呼び出されたときに最後に実行されるコマンドが(グループ内)であるという事実を利用して機能します。
\newfloat@listofdirfigure@hook\listoffigures
しかし、newfloat
パッケージは、 が正しい動作をするように再定義します\listoffigures
。フックは通常空ですが、無関係です。私は、\listofdirfigures
(または、 と呼ばれる代替バージョン\listofdirfigure
)を再定義して、次の を探します*
。この場合、\append@star
フックに追加して、TeXが最終的に を認識するようにします。
\append@star\listoffigures
が呼び出された場合\listofdirfigures*
、希望どおりになります\listoffigures*
。 が表示されない場合は*
、何も変更されません。
\AdjustForMemoir
すべての新しいフロート リスト作成コマンドをそのように変更できるように、マクロを提供しました。
答え3
コミットで修正https://gitlab.com/axelsommerfeldt/caption/commit/5584091f13a4d63c5245b4d8b0e9ac0171c85436
本日、CTANに「キャプションパッケージバンドル」の新バージョンをプッシュします。それまでの間、https://gitlab.com/axelsommerfeldt/caption/raw/master/tex/newfloat.sty古い newfloat.sty の代わりとして。
ところで、このような問題やコードを私に報告してください。そうすれば、時間内に修正する機会が得られます。(偶然この問題を見つけるのに 5 年かかりました。)