使用texcount统计LaTeX文档字数
Published:
TL;DR: Use texcount to quickly count words in LaTeX documents, breaking down counts by text, headers, and captions, and ignoring specified sections.
texcount -inc -sum main.tex # 显示各个子章节的字数和总字数
texcount -inc -total main.tex # 只显示总字数
显示的格式说明:
texcount 输出解释
texcount 的输出格式 text+headers+captions (#headers/#floats/#inlines/#displayed) 解释如下:
text: 正文部分的单词数。这是计算论文字数的主要部分。headers: 章节标题(如\section,\subsection等)中的单词数。captions: 图表标题(\caption{})中的单词数。#headers: 章节标题的数量。#floats: 浮动体(如图figure、表table)的数量。#inlines: 行内数学公式(如$E=mc^2$)的数量。#displayed: 陈列数学公式(如\[ ... \]或equation环境)的数量。
具体文件分析示例:
5065+148+0 (16/0/9/1) Included file: ./chapters/010_introduction.tex5065: 引言 (Introduction) 章节的正文有 5065 个单词。148: 引言章节的标题部分有 148 个单词。0: 引言章节没有图表标题。16: 引言章节有 16 个章节标题。0: 引言章节没有图表等浮动体。9: 引言章节有 9 个行内数学公式。1: 引言章节有 1 个陈列数学公式。
%TC:ignore
中间夹着的内容会被忽略掉,不计入字数
%TC:endignore
