diff options
author | Norbert Preining <norbert@preining.info> | 2021-07-02 03:02:09 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-07-02 03:02:09 +0000 |
commit | c4d400d058136a9045857b99d816595e7a655125 (patch) | |
tree | c94ed379e2025f98ef92962c8aedaaa4f207a96c /support/optexcount/doc | |
parent | c840f97520ba98156a0ed525d6b5d05ab6a324f6 (diff) |
CTAN sync 202107020302
Diffstat (limited to 'support/optexcount/doc')
-rw-r--r-- | support/optexcount/doc/optexcount-doc.pdf | bin | 27286 -> 28863 bytes | |||
-rw-r--r-- | support/optexcount/doc/optexcount-doc.tex | 46 |
2 files changed, 36 insertions, 10 deletions
diff --git a/support/optexcount/doc/optexcount-doc.pdf b/support/optexcount/doc/optexcount-doc.pdf Binary files differindex bc85ab1d62..8a838fa803 100644 --- a/support/optexcount/doc/optexcount-doc.pdf +++ b/support/optexcount/doc/optexcount-doc.pdf diff --git a/support/optexcount/doc/optexcount-doc.tex b/support/optexcount/doc/optexcount-doc.tex index 0e10fa2b90..764c1c527b 100644 --- a/support/optexcount/doc/optexcount-doc.tex +++ b/support/optexcount/doc/optexcount-doc.tex @@ -6,7 +6,7 @@ \def\title{\OpTeX count} \def\desc{Python script for counting words in \OpTeX/ documents} -\def\version{Version 1.0} +\def\version{Version 1.1} \def\author{Richard Hartmann} \def\maketitle {\vbox to 9\baselineskip{ @@ -39,33 +39,59 @@ It counts words and other elements of \OpTeX/ document and sorts them out into i * Displayed math formulae \enditems -Regular text words are words that occur in the main text. Header words are introduced using these particular keywords: {\Blue `\tit`}, {\Blue `\chap`}, {\Blue `\sec`} and {\Blue `\secc`}. Caption words take into account captions of tables and figures, i.e., {\Blue `\caption/t`} and {\Blue `\caption/f`}, footnotes({\Blue `\fnote`} or {\Blue `\fnotetext`}) and marginal notes({\Blue `\mnote`}). Header count is the number of all headers in our document. Figures/Tables count counts all tables and figures which occur in the document. Inline formulae are introduced using {\Blue `$`\dots`$`} and displayed formulae are introduced using {\Blue `$$`\dots`$$`}. +Regular text words are words that occur in the main text. +Header words are introduced using these particular keywords: {\Blue `\tit`}, {\Blue `\chap`}, {\Blue `\sec`} and {\Blue `\secc`}. +Caption words take into account captions of tables and figures, i.e., {\Blue `\caption/t`} and {\Blue `\caption/f`}, footnotes({\Blue `\fnote`} or {\Blue `\fnotetext`}) and marginal notes({\Blue `\mnote`}). +Header count is the number of all headers in our document. +Figures/Tables count counts all tables and figures which occur in the document. +Inline formulae are introduced using {\Blue `$`\dots`$`} and displayed formulae are introduced using {\Blue `$$`\dots`$$`}. If there is a verbatim text in some category, its words are counted too. Alongside above mentioned statistics, all individual sections are printed separately with particular word counts. -To get this utility running, Python3 has to be installed. Then user can run this utility by command: +To get this utility running, you need to install it using basic bash script. +Use command {\Blue `sudo ./install.sh`}. +Installation requires `python3` and `zip` utility running. +Then user can run this utility by command: \begtt -python3 optexcount.py optex-filename +optexcount [-h] [-v] [-s SET_VERBCHAR] [--version] filename \endtt -User can also use two optional specifiers: {\Blue `-verbose`} and {\Blue `-set-verbchar=verb-char`}. When the utility is ran in {\Blue `-verbose`} mode, the source code is printed on the screen with colored words, so he can easily see, what is considered as text word, header word, caption word or keyword. User can specify(using {\Blue `-set-verbchar=verb-char`} specifier) implicit verbatim inline character. This can be useful when the specific verbatim character is used in the file but not explicitely set in the file. The situation may occur for example when user wants to count words in file, that is read by different main file. The verbatim character is set in the main file, but not in the file we want to analyze. +Use {\Blue `-h`} or {\Blue `--help`} specifier for the help message. +User can also use two optional specifiers: {\Blue `-v`}~/~{\Blue `--verbose`} and {\Blue -s SET_VERBCHAR}~/~{\Blue --set-verbchar SET_VERBCHAR}. +When the utility is ran in verbose mode, it prints the source code on the screen with colored words, so user can easily see, what is considered as text word, header word, caption word or keyword. +Character {\Blue `SET_VERBCHAR`} sets implicit verbatim inline character. +This can be useful when the specific verbatim character is used in the file but not explicitely set in the file. +The situation may occur for example when user wants to count words in file, that is read by different main file. +The verbatim character is set in the main file, but not in the file we want to analyze. + +In case you don't want to install this software you can run python script {\Blue `src/optexcount.py`} with {\Blue `python3`} command explicitly. \sec A Brief Implementation Description -\OpTeX count uses regular expressions to separate individual words, to identify keywords, brackets, math formulae etc. These preprocessed words are sequentially loaded into counter that decides how to treat with the word. +\OpTeX count uses regular expressions to separate individual words, to identify keywords, brackets, math formulae etc. +These preprocessed words are sequentially loaded into counter that decides how to treat with the word. -If some specific keyword occurs, that is not known by this utility, it is skipped. Problem may occur, if an unknown keyword has got some arguments, the utility could count these arguments as individual words. Therefore, most common keywords with arguments are listed in `src/keywords.py`, so the utility can load successfully these arguments. If there is some important keyword missing, feel free to modify this file, to add this keyword\dots +If some specific keyword occurs, that is not known by this utility, it is skipped. +Problem may occur, if an unknown keyword has got some arguments, the utility could count these arguments as individual words. +Therefore, most common keywords with arguments are listed in `src/keywords.py`, so the utility can load successfully these arguments. +If there is some important keyword missing, feel free to modify this file, to add this keyword\dots -In case of some keyword, that is important for the utility to identify, for example {\Blue `\sec`} or {\Blue `\fnote`}, special handler routine is ran, to manage this particular keyword. The place, from which we process the word also determines the category of the word, in what color should be this word highlighted in {\Blue `-verbose`} mode etc. +In case of some keyword, that is important for the utility to identify, for example {\Blue `\sec`} or {\Blue `\fnote`}, special handler routine is ran, to manage this particular keyword. +The place, from which we process the word also determines the category of the word, in what color should be this word highlighted in verbose mode etc. \sec Utility Limitations -The results are pretty precise when the most basic \OpTeX/ constructions are used. As It has been already mentioned above, it is really basic and lightweight utility. When user uses some more advanced \TeX constructions, problems may occur, and the counts may be imprecise. It doesn't take into account macro expansion, self defined rules etc\dots When using this utility, a valid \OpTeX/ source code should be passed. If the file contains some errors(for example unterminated inline verbatim), utility terminates the process and won't provide much information about the problem. This utility only works with one particular file so it doesn't count included files as well. +The results are pretty precise when the most basic \OpTeX/ constructions are used. +As It has been already mentioned above, it is really basic and lightweight utility. +When user uses some more advanced \TeX/ constructions, problems may occur, and the counts may be imprecise. +It doesn't take into account macro expansion, self defined rules etc\dots When using this utility, a valid \OpTeX/ source code should be passed. +If the file contains some errors(for example unterminated inline verbatim), utility terminates the process and won't provide much information about the problem. +This utility only works with one particular file so it doesn't count included files as well. -Beside above mentioned limitations of this utility, it could be very useful for the analysis of basic \OpTeX/ documents(such as the exemplary document {\Blue `tests/main_test.tex`}). +Beside above mentioned limitations of this utility, it could be very useful for the analysis of basic \OpTeX/ documents(such as the exemplary document {\Blue `examples/example_01.tex`}). \bye |