文書内の図、表、引用の数を数える

文書内の図、表、引用の数を数える

私のアイデアはテキストカウント 文書をスキャンし、単語数、図、表、方程式、引用を出力します。

TeXcount のドキュメントを見てきましたが、単語と数式はデフォルトで処理されているようですが、異なる環境に独自のカウンターを割り当てる方法がわかりません (引用は別の問題です)。どなたか助けてくれませんか?

答え1

他に数えたいオブジェクトがあるかどうかはわかりませんが、あなたが言及したオブジェクトについては、次のように計算しました。

  • 言葉:使用テクスカウント(下記の例を参照)
  • 数字:デフォルトのLaTeXカウンターを使用するfigure
  • 表:デフォルトのLaTeXカウンターを使用するtable
  • 方程式:デフォルトのLaTeXカウンターを使用するequation
  • 引用:使用最後のよだれかけパッケージ

カウンターの現在の値を表示するには、 を使用します\arabic{NameOfTheCounter}。ドキュメント内の任意のカウンターに割り当てられた最大値を表示するには、合計数パッケージが役に立つはずです。

以下は私が最近使い始めた奥付です。コメントは便宜上提供しました

% characters count: the value is printed in the ancillary file char-count.tex
\bash[ignoreStderr=true,stdoutFile=char-count.tex]
echo `texcount -quiet -merge -1 -char cub-ant-sys-lit-sur.tex`|sed -e 's/\([0-9]*\).*/\1/'
\END
% word count: the value is printed in the ancillary file word-count.tex
\bash[ignoreStderr=true,stdoutFile=word-count.tex]
echo `texcount -quiet -merge -1 insert-name-of-file-here.tex`|sed -e 's/\([0-9]*\).*/\1/'
\END
\section{Colophon}
Document data: \thepage{} pages; % display number of pages
\input{word-count} words; % display number of words
\input{char-count}characters; % display number of characters
\arabic{figure} figures; % display number of figures
\LastBib{} references; % display number of references in the bibliography (not the number of citations)
\arabic{footnote} numbered notes; % display number of footnotes
\arabic{glossaryentry} glossary entries. % display number of glossary entries (using package glossaries)

totcountこの例では、奥付が文書内で最後に表示されるテキストであるため、パッケージは必要ありませんでした。

関連情報