Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

stri_stats_latex

Statistics for a Character Vector Containing LaTeX Commands


Description

This function gives LaTeX-oriented statistics for a character vector, e.g., obtained by loading a text file with the readLines function, where each text line is represented by a separate string.

Usage

stri_stats_latex(str)

Arguments

str

character vector to be aggregated

Details

We use a slightly modified LaTeX Word Count algorithm implemented in Kile 2.1.3, see https://kile.sourceforge.io/team.php for the original contributors.

Value

Returns an integer vector with the following named elements:

  1. CharsWord - number of word characters;

  2. CharsCmdEnvir - command and words characters;

  3. CharsWhite - LaTeX white spaces, including { and } in some contexts;

  4. Words - number of words;

  5. Cmds - number of commands;

  6. Envirs - number of environments;

  7. ... (Other stuff that may appear in future releases of stringi).

See Also

Other stats: stri_stats_general()

Examples

s <- c('Lorem \\textbf{ipsum} dolor sit \\textit{amet}, consectetur adipisicing elit.',
       '\\begin{small}Proin nibh augue,\\end{small} suscipit a, scelerisque sed, lacinia in, mi.',
       '')
stri_stats_latex(s)

stringi

Character String Processing Facilities

v1.6.1
file LICENSE
Authors
Marek Gagolewski [aut, cre, cph] (<https://orcid.org/0000-0003-0637-6028>), Bartek Tartanus [ctb], and others (stringi source code); IBM, Unicode, Inc. and others (ICU4C source code, Unicode Character Database)
Initial release
2021-05-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.