
readLines
function, where each text line
is represented by a separate string.stri_stats_latex(str)
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;stri_stats_general
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.",
"")
if (stri_install_check(silent=TRUE))
stri_stats_latex(s)
# Stats for the preprint version of M. Gagolewski's book
# "Programowanie w jezyku R", Wydawnictwo Naukowe PWN, 2014.
# see http://rksiazka.rexamine.com
apply(
sapply(
list.files(path="~/Publikacje/ProgramowanieR/rozdzialy/",
pattern=glob2rx("*.tex"), recursive=TRUE, full.names=TRUE),
function(x)
stri_stats_latex(readLines(x))
), 1, sum)
CharsWord CharsCmdEnvir CharsWhite Words Cmds Envirs
718755 458403 281989 120202 37055 6119
Run the code above in your browser using DataLab