計算文件中的數字、表格和引文

計算文件中的數字、表格和引文

我的想法是使用TeXcount 掃描我的文件並輸出單字、圖形、表格、方程式和引文的數量。

我一直在查看 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)

在範例中,我不需要 package totcount,因為版權頁是文件中出現的最後一個文字。

相關內容