### Manage TeXcount Configuration Files Source: https://context7.com/einarandreas/texcount/llms.txt Demonstrates how to use an external configuration file to store counting options, macro rules, and output templates. ```bash texcount.pl -opt=myoptions.txt document.tex ``` ```text -sum=1,1,1 -sub=section %macro \url 1 %subst \chapterpath chap/ ``` -------------------------------- ### Access TeXcount Help and Information Source: https://context7.com/einarandreas/texcount/llms.txt Provides common command-line flags to retrieve help, version information, and rule definitions. ```bash texcount.pl -h texcount.pl -ver texcount.pl -help-all-rules ``` -------------------------------- ### Define Custom Counters and Macros Source: https://context7.com/einarandreas/texcount/llms.txt Demonstrates how to create custom counters for specific elements like footnotes and assign them to macros using %TC:newcounter and %TC:macro instructions. ```latex %TC:newcounter fwords Words in footnotes %TC:newcounter footnote Number of footnotes %TC:macro \footnote [fwords] %TC:macroword \footnote [footnote] ``` -------------------------------- ### Define Custom Output Templates Source: https://context7.com/einarandreas/texcount/llms.txt Create formatted output strings using placeholders for various counter types. Templates support conditional logic and summation of counts. ```bash texcount.pl -template="{word}" document.tex texcount.pl -template="Words: {word}, Headers: {hword}, Math: {inmath}+{dsmath}" document.tex texcount.pl -template="{word} words{ERROR? ({ERROR} errors)?ERROR}" document.tex texcount.pl -sum -template="Total: {SUM} words" document.tex texcount.pl -sub -template="=== {TITLE} ===\nWords: {word}\n{SUB?Sections:\n|{TITLE}: {word}\n|?SUB}" document.tex ``` -------------------------------- ### Configure CJK Language Support Source: https://context7.com/einarandreas/texcount/llms.txt Use specific CLI flags to enable word and character counting for Chinese, Japanese, and Korean documents. These flags adjust the tokenizer to handle logograms and script-specific word boundaries. ```bash texcount.pl -chinese document.tex texcount.pl -japanese document.tex texcount.pl -korean document.tex texcount.pl -korean-words document.tex texcount.pl -chinese-only document.tex texcount.pl -alphabets=Digit,Latin,Greek document.tex texcount.pl -logograms=Ideographic,Katakana,Hiragana document.tex ``` -------------------------------- ### Configure Subcount Breakpoints Source: https://context7.com/einarandreas/texcount/llms.txt Shows how to define breakpoints for subcounts using %TC:break and %TC:breakmacro to organize word count reports by document sections. ```latex %TC:break Introduction %TC:break Methods %TC:breakmacro \customsection Section ``` -------------------------------- ### Execute Research Paper Counting Workflow Source: https://context7.com/einarandreas/texcount/llms.txt A sequence of commands for processing a multi-file academic paper, including subcounts, HTML report generation, and frequency analysis. ```bash texcount.pl -inc -sum paper.tex texcount.pl -inc -html -v -sum paper.tex > word_count_report.html texcount.pl -inc -freq=3 paper.tex ``` -------------------------------- ### Define Environment Rules with TC Instructions Source: https://context7.com/einarandreas/texcount/llms.txt Control how the contents of specific LaTeX environments are counted using %TC:envir instructions. ```latex %TC:envir theorem [] text %TC:envir lstlisting [] xall %TC:envir sidewaysfigure [] float %TC:envir namedtheorem [header] text \newenvironment{namedtheorem}[1]{\textbf{#1.}}{} ``` -------------------------------- ### Define File Inclusion Rules Source: https://context7.com/einarandreas/texcount/llms.txt Configures how TeXcount handles custom file inclusion macros using %TC:fileinclude. ```latex %TC:fileinclude \input input %TC:fileinclude \myinclude file ``` -------------------------------- ### Analyze Word Frequency and Statistics Source: https://context7.com/einarandreas/texcount/llms.txt Generate reports on word usage frequency and document statistics. These commands help identify common terms or analyze the distribution of macros and environments. ```bash texcount.pl -freq document.tex texcount.pl -freq=5 document.tex texcount.pl -stat document.tex texcount.pl -macrostat document.tex ``` -------------------------------- ### Implement Text Substitution Source: https://context7.com/einarandreas/texcount/llms.txt Allows TeXcount to resolve macro-based file paths by providing the expanded text via %TC:subst. ```latex \newcommand\chappath{chapters} %TC:subst \chappath chapters \input{\chappath/chapter1} ``` -------------------------------- ### Process LaTeX via Standard Input Source: https://context7.com/einarandreas/texcount/llms.txt Pipe LaTeX source code directly into TeXcount. This is useful for processing generated content or integrating TeXcount into automated build pipelines. ```bash cat document.tex | texcount.pl - echo '\documentclass{article}\begin{document}Hello world\end{document}' | texcount.pl - latexpand main.tex | texcount.pl - ``` -------------------------------- ### Define Macro Rules with TC Instructions Source: https://context7.com/einarandreas/texcount/llms.txt Embed %TC instructions within LaTeX files to specify how custom macros should be counted. This allows mapping macro parameters to specific counting categories. ```latex %TC:macro \refnote [text,otherword] \newcommand\refnote[2]{\textit{#1}\footnote{#2}} %TC:macro \newsection [header,ignore] \newcommand\newsection[2]{\section{#1}\label{sec:#2}} %TC:macro \NB 1 \newcommand\NB[1]{\marginpar{#1}} %TC:macro \note [option:ignore,text] \newcommand\note[2][Note]{\textbf{#1:} #2} ``` -------------------------------- ### Count Macros as Words Source: https://context7.com/einarandreas/texcount/llms.txt Instruct TeXcount to treat specific macros as a defined number of words using %TC:macroword. ```latex %TC:macroword \TeXcount 1 \newcommand\TeXcount{{\TeX}count} %TC:macroword \LaTeX 1 %TC:macroword \acknowledge [header,hword] \newcommand\acknowledge{\section*{Acknowledgements}} %TC:macroword \boilerplate 3 ``` -------------------------------- ### Perform Character and Letter Counting Source: https://context7.com/einarandreas/texcount/llms.txt Count individual letters or characters instead of words. These options allow for excluding spaces or specific logographic characters from the final count. ```bash texcount.pl -char document.tex texcount.pl -char-only document.tex texcount.pl -all-nonspace-characters document.tex ``` -------------------------------- ### Exclude Sections from Counting Source: https://context7.com/einarandreas/texcount/llms.txt Use %TC:ignore and %TC:endignore to wrap document sections that should be excluded from the word count. ```latex \begin{document} This text is counted. %TC:ignore This entire section will be ignored by TeXcount. %TC:endignore This text is counted again. \end{document} ``` -------------------------------- ### Adjust Parsing Behavior Source: https://context7.com/einarandreas/texcount/llms.txt Modify how TeXcount interprets the document structure. Options include relaxed or strict matching and quiet mode to suppress warnings. ```bash texcount.pl -relaxed document.tex texcount.pl -restricted document.tex texcount.pl -strict document.tex texcount.pl -quiet document.tex ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.