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.
stri_stats_latex(str)
character vector to be aggregated
Returns an integer vector with the following named elements:
CharsWord
- number of word characters;
CharsCmdEnvir
- command and words characters;
CharsWhite
- LaTeX white spaces, including { and } in some contexts;
Words
- number of words;
Cmds
- number of commands;
Envirs
- number of environments;
... (Other stuff that may appear in future releases of stringi).
We use a slightly modified LaTeX Word Count algorithm taken from Kile 2.1.3, see http://kile.sourceforge.net/team.php for original contributors.
Other stats: stri_stats_general
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab