使用 Texcount 模板

使用 Texcount 模板

有人有texcount可以分享的模板嗎?

我注意到texcount文件引用了一個選項-template="template"。我認為這是為了在 texcount 輸出周圍添加一些自訂文字。我的 Google-fu 還沒有提供任何此類模板的範例。

我希望將其與fp製作一個模板結合,報告我的文件的更具敘事風格的摘要,包括根據出版規則計算字數(例如,文本、標題和參考書目+每個圖 100 個字/表/浮動) 。

答案1

一個簡單的例子可以是

texcount.pl example.tex -template="Words: {hword} in headers,
   {word} in text, {oword} other places."

這應該全部在一行上。

指定此範本的另一種方法是使用 TeX 文件本身中的說明%TC。這是一個更詳細的範例:

%%% Template using new format (version 3 and on)
%TC:newtemplate
%TC:template Word count (text+headers+other):
%TC:template  {text}+{headerword}+{otherword} = {sum}\n
%TC:template Element count (head+float+inline+dsmath):
%TC:template  {header}+{float}+{inline}+{displaymath}\n
%TC:template Subcounts{SUB?: {sum}?SUB}

請注意,\n表示必須明確指定的行移位。

您還可以在單獨的選項文件中指定模板以及其他選項,這有時對於大模板可能很方便。例如,如果您建立一個包含以下內容的文件

 # Use as sum count: text words + header words + other words
 -sum=1,1,1

 # Output template
 -template=
   \<ul class=count>\n
   \<li class=header>{title}</li>\n
   \<li>Word count: {sum}</li>\n
   \<li>Equations: {inline} inline, {ds} displayed</li>\n
   \{float?<li>Floats: {float}</li>\n?float}
   \{SUB?<li>Subcounts:</li><span class=subcount>\n
   \| <li>{sum} words in {title}</li>\n
   \|</span>\n?SUB}
   \{file?<li>Number of files in all: {file}</li>?file}\n
   \</ul>\n

您可以使用該選項包含它-opt=。這將使用 HTML 標籤輸出計數。本SUB節給出了子計數。

我希望這些例子可以作為實驗的起點。

相關內容