5

I'd like to have a general overview of documents I'm writing with LaTeX (e.g. a couple of books), I need tools to generate statistics on a LaTeX document (made of many files included into a main one), per chapter/section basis.

I.E., something that could generate an "overview" document with such things as (per section/chapter):

  • number of words/chars (not lines since it depends on the page size)

  • number of references

  • number of figures

  • number of subsections

  • etc.

I currently use just refcheck to check if I missed citing something and I wrote a shell script (http://atrent.it/doku.php/divertissements:latexstats) that gives some stats but on file basis and it's not enough for my purposes.

My "super" purpose is also to have a rough idea of the completion percentage of the whole work on a per chapter/section basis.

Thank you

  • Counting formal constructs like \refs, \cites and floats would be fairly straight forward, if you disclose all the packages you're using. Words is typically counted using an external program. I don't understand how you'd get a "completion percentage", since you'd need a completed document to estimate that. – Werner Jul 23 '18 at 15:23
  • "completion percentage" in terms of words per chapter (e.g., an essay could have an upper/lower bound) so that I may estimate if I'm going too deep/shallow on different aspects (chapters/sections) – atrent Jul 23 '18 at 15:56
  • there exist 'texcount' (app.uio.no/ifi/texcount), a perl script, that is better than my script and it's the closest thing I've found – atrent Jul 23 '18 at 15:59
1

This is a partial (but fairly complete) answer, the texcount tool (included in texlive-extra-utils on Debian Linux) is, as I mentioned in my comment, the closest thing I found, it only lacks the reference counting.

Here is an example of texcount (with the options "-col -merge -incbib") output, run on a "large" (~300 A5 pages) doc I'm writing:

File: main.tex
Encoding: utf8
Words in text: 54907
Words in headers: 614
Words outside text (captions, etc.): 4365
Number of headers: 224
Number of floats/tables/figures: 58
Number of math inlines: 92
Number of math displayed: 6
Subcounts:
  text+headers+captions (#headers/#floats/#inlines/#displayed)
  567+5+0 (1/0/0/0) _top_
  694+1+44 (1/0/0/0) Chapter: Introduzione}\label{chap:intro
  184+3+38 (1/0/0/0) Section: I Sistemi Embedded}\label{sistemaembedded
  220+1+0 (1/0/0/0) Subsection: PLC
  535+1+86 (1/0/0/0) Subsection: Microcontrollori}\label{Microcontrollori
  404+1+38 (1/0/0/0) Subsection: SoC
  144+3+0 (1/0/0/0) Section: Struttura del testo
  0+2+0 (1/0/0/0) Chapter: Concetti generali}\label{chap:concetti
  484+2+55 (1/0/0/0) Section: Real Time
  429+4+67 (1/1/0/0) Section: Sistemi ``monoprogrammati'' e ``multiprogrammati''
  1063+3+268 (1/0/0/0) Section: Modo di pensare}\todo{esploderlo in più subsect
  0+6+0 (1/0/0/0) Section: Stili di programmazione: race conditions, watchdogs (?)
  0+4+0 (1/0/0/0) Section: cpu power e corrente
  0+9+0 (1/0/0/0) Section
  11+8+0 (1/0/0/0) Section: dimensioni fisiche, forse già trattato sparso nel testo
  0+5+0 (1/0/0/0) Section: Open hardware (controllo, riproducibilità, costi)
  0+6+0 (1/0/0/0) Section: tecniche costruttive (per produzione di massa)
  0+2+0 (1/0/0/0) Section: ***harsh environments
  0+10+0 (1/0/0/0) Section
  0+7+0 (1/0/0/0) Section: (atrent) spiegare il concetto di callback function
  0+17+0 (1/0/0/0) Section
  0+12+0 (1/0/0/0) Section
  19+2+0 (1/0/0/0) Section: PID controller
  0+15+0 (1/0/0/0) Section
  15+9+0 (1/0/0/0) Section: (atrent) add sezione "isteresi" in intro o concetti generali
  126+3+19 (1/0/0/0) Chapter: Richiami di elettronica} \label{chap:elettronica
  0+3+0 (1/0/0/0) Section: Richiami sui principi
  321+1+0 (1/0/1/0) Subsection: Elettricità
  193+3+0 (1/0/4/3) Subsection: Legge di Ohm}\label{sec:ohm
  546+3+70 (1/1/2/0) Subsection: Continua e alternata
  876+1+32 (1/1/1/0) Subsection: Segnali}\label{sec:segnali
  399+2+12 (1/4/1/1) Section: Forme d'onda}\label{sec:formeonda
  95+3+70 (1/0/0/0) Section: Componenti di base
  92+1+0 (1/0/0/0) Subsection: Interruttori
  95+1+21 (1/0/0/0) Subsection: Lampadine
  86+1+32 (1/0/0/0) Subsection: Relè}\label{sec:relè
  317+1+15 (1/2/5/0) Subsection: Resistenze}\label{sec:resistenze
  288+1+4 (1/1/0/0) Subsection: Condensatori}\label{sec:condensatori
  221+4+0 (1/0/10/0) Subsection: Pile, batterie, accumulatori, generatori, ...}\label{sec:pilebatterie
  544+15+4 (5/0/14/2) Subsection: Serie e parallelo
  447+2+15 (1/3/7/0) Subsection: Circuiti RC
  467+4+120 (1/1/2/0) Section: PWM (Pulse Width Modulation)}\label{sec:pwm
  205+1+4 (1/1/0/0) Section: Semiconduttori}\label{sec:semiconduttori
  368+3+56 (1/2/0/0) Subsection: Diodi e LED
  423+1+76 (1/0/2/0) Subsection: Transistor}\label{sec:transistor
  678+7+177 (2/1/2/0) Subsection: Circuiti integrati
  339+3+0 (1/0/1/0) Section: Strumenti di misura
  315+3+33 (1/0/0/0) Subsection: ``Tester di circuito''
  91+1+11 (1/2/0/0) Subsection: Voltmetro
  212+3+90 (1/0/1/0) Subsection: Amperometro, pinza amperometrica
  146+2+58 (1/0/1/0) Subsection: Ohmmetro, prova-diodi
  48+2+3 (1/1/0/0) Subsection: Multi-tester/multimetro
  132+1+3 (1/1/0/0) Subsection: Oscilloscopio
  360+2+70 (1/2/0/0) Section: Montaggio fisico
  483+4+82 (1/0/0/0) Section: Conversione AD e DA}\inFuturo{(atrent) approfondire un po', vedi altro todo sotto
  304+3+92 (1/0/2/0) Section: Sensori e attuatori
  160+4+0 (1/0/0/0) Section: Sensori (e attuatori!) MEMS
  406+1+46 (1/2/8/0) Section: Multiplexing
  111+2+0 (1/0/0/0) Chapter: Architetture Embedded}\label{chap:architetture
  234+3+0 (1/0/0/0) Section: Instruction Set Architecture
  196+1+0 (1/0/0/0) Subsection: CISC
  230+1+0 (1/0/0/0) Subsection: RISC
  223+1+0 (1/0/0/0) Subsection: Endianness
  165+1+49 (1/0/0/0) Section: ARM}\label{ARM
  163+3+0 (1/0/0/0) Subsection: Architettura e \textit{core}
  313+1+0 (1/0/0/0) Section: MIPS}\label{MIPS
  275+1+0 (1/0/1/0) Section: ARC
  272+1+78 (1/0/1/0) Section: AVR
  160+1+0 (1/0/0/0) Section: Xtensa
  0+2+0 (1/0/0/0) Section: Esempi pratici
  441+6+0 (2/0/0/0) Subsection: MCU, SoC e Board
  379+3+8 (2/0/0/0) Subsection: Arduino}\label{Arduino
  605+7+50 (4/3/0/0) Subsection: Discovery STM32
  71+1+18 (1/0/0/0) Subsection: ESP8266}\label{sec:esp8266
  110+4+1 (2/1/0/0) Subsection: Ci40} \label{sec:CI40
  461+7+36 (3/1/0/0) Subsection: BeagleBone Black} \label{sec:BeagleBoneBlack
  109+1+0 (1/0/0/0) Subsection: PIC32
  90+1+44 (1/0/0/0) Subsection: NodeMCU
  743+6+86 (2/0/0/0) Section: Implementazione Hardware}\label{impl
  112+2+0 (1/0/0/0) Subsection: Form Factor} \label{subsec:formfactor
  233+1+0 (1/0/0/0) Subsection: PCB} \label{subsec:PCB
  168+1+0 (1/0/0/0) Subsection: Costo} \label{subsec:cost
  0+5+0 (1/0/0/0) Chapter: Memorie, I/O e comunicazione}\label{chap:io
  389+1+0 (1/0/0/0) Section: Memorie}\label{sec:Memory
  294+4+45 (1/0/0/0) Subsection: La memoria di sistema
  1149+7+69 (3/0/0/0) Subsection: La memoria di massa
  99+3+0 (1/0/0/0) Section: Bus e periferiche}\label{bus-periferiche
  646+3+21 (1/2/0/0) Subsection: RS-232 Serial port
  5+1+0 (1/0/0/0) Subsection: NMEA}\todo{(atrent) faccio io se vuoi
  304+1+7 (1/2/1/0) Subsection: I2C
  286+1+0 (1/0/3/0) Subsection: I2S
  201+1+4 (1/1/1/0) Subsection: SPI
  436+1+6 (1/1/0/0) Subsection: CAN-BUS
  414+1+0 (1/0/0/0) Subsection: Ethernet
  495+1+62 (1/1/3/0) Subsection: GPIO}\label{sec:gpio
  212+2+10 (1/0/0/0) Subsection: Bit banging
  434+1+127 (1/0/0/0) Subsection: JTAG}\label{sec:JTAG
  23+1+0 (1/0/0/0) Section: Rete}\label{protocolli_rete
  635+1+25 (1/1/0/0) Subsection: MQTT}\label{MQTT
  159+1+0 (1/0/0/0) Subsection: OSC}\label{sec:osc
  5+1+0 (1/0/0/0) Subsection: LoRa}\todo{(atrent) faccio io se vuoi
  27+1+0 (1/0/0/0) Subsection: Firmata}\todo{(atrent) faccio io se vuoi
  35+3+0 (1/0/0/0) Chapter: Il sistema operativo}\label{chap:os
  153+1+0 (1/0/0/0) Section: Introduzione
  902+7+1 (3/0/0/0) Subsection: Classificazione degli OS
  262+1+49 (1/0/0/0) Section: FreeRTOS}\label{sec:freertosbreve
  0+4+0 (1/0/0/0) Section: I sistemi GNU/Linux
  454+5+18 (1/0/0/0) Subsection: Storia dei sistemi GNU/Linux
  957+7+35 (3/0/0/0) Subsection: Il kernel Linux
  168+2+0 (1/0/0/0) Section: Root Filesystem
  274+3+2 (1/0/2/0) Subsection: La libreria C} \label{clib
  594+1+30 (1/0/0/0) Subsection: Init} \label{init
  437+2+0 (1/0/0/0) Subsection: La shell
  583+1+54 (1/0/0/0) Section: Bootloader} \label{sec:bootloader
  370+4+0 (2/0/0/0) Subsection: U-boot
  239+4+24 (1/1/0/0) Section: La fasi di boot
  153+3+0 (1/0/0/0) Chapter: Configurazione GNU/Linux}\label{chap:gnulinux
  89+3+29 (1/0/0/0) Section: Ambiente di sviluppo
  1210+6+86 (2/0/1/0) Subsection: Toolchain
  1799+22+388 (6/2/0/0) Subsection: La compilazione del Kernel Linux} \label{sec:kernelcompile
  1303+5+151 (2/0/0/0) Subsection: Build system
  0+1+0 (1/0/0/0) Section: Buildroot
  363+5+0 (2/0/0/0) Subsection: Inizializzazione dell'ambiente
  622+9+77 (3/2/0/0) Subsection: Configurazione di buildroot
  194+3+6 (1/0/0/0) Subsection: Compilazione del rootfs} \label{subsec:comprootfs
  425+4+15 (1/0/0/0) Subsection: Variabili di ambiente U-boot} \label{subsec:uEnv
  276+3+0 (1/0/0/0) Section: Dispositivo di memoria} \label{sec:memorydevice
  946+8+81 (3/0/0/0) Subsection: Il partizionamento classico
  238+5+0 (1/0/0/0) Section: Esempio di configurazione della SD
  18+1+0 (1/0/0/0) Chapter: FreeRTOS}\label{sec:freertos
  113+1+0 (1/0/0/0) Section: Note
  231+3+6 (1/0/0/0) Section: Introduzione a FreeRTOS
  60+3+0 (1/0/0/0) Section: Caratteristiche di FreeRTOS
  658+3+49 (1/0/0/0) Section: FreeRTOS concetti basilari
  144+2+0 (1/0/0/0) Section: Usare FreeRTOS
  352+2+0 (1/0/0/0) Subsection: Naming Conventions
  495+4+99 (1/0/0/0) Section: Gestione della memoria HEAP
  134+1+0 (1/0/0/0) Section: Task
  308+3+7 (1/0/0/0) Subsection: Creazione del task
  555+1+45 (1/0/0/0) Section: Queue
  456+1+0 (1/0/0/0) Section: Timer
  160+1+3 (1/0/0/0) Section: Interrupt
  302+1+0 (1/0/0/0) Section: Semafori
  205+3+11 (1/0/0/0) Section: Esempio:Led Blink
  411+3+21 (1/0/0/0) Chapter: Arduino e Wiring}\label{chap:wiring
  419+4+7 (1/0/0/0) Section: I punti di forza
  258+4+41 (1/0/0/0) Section: I punti di debolezza
  216+4+0 (1/0/0/0) Section: Struttura di uno \textit{sketch}
  233+2+20 (1/0/0/0) Section: Il linguaggio
  446+5+8 (1/0/7/0) Subsection: Tipi di dato e variabili}\label{tipidatoarduino
  200+3+0 (1/0/1/0) Subsection: Espressioni e operatori}\label{sec:espressioni
  248+1+20 (1/0/0/0) Subsection: Array
  136+4+0 (1/0/0/0) Subsection: Direttive \#define e \#include
  76+1+0 (1/0/0/0) Subsection: Commenti
  179+3+0 (1/0/0/0) Subsection: Costrutti di ``selezione''
  182+3+0 (1/0/0/0) Subsection: Costrutti di ``ripetizione''
  158+3+0 (1/0/0/0) Subsection: Definizione di funzioni
  82+2+0 (1/0/0/0) Subsection: Funzioni predefinite
  26+1+0 (1/0/0/0) Subsection: Matematiche
  18+1+0 (1/0/0/0) Subsection: Tempo
  225+2+3 (1/1/1/0) Subsection: I/O
  140+3+0 (1/0/0/0) Subsection: Uso della seriale
  416+2+45 (1/0/6/0) Subsection: Gestione interrupt}\label{sec:interrupt
  204+3+6 (1/1/0/0) Subsection: \textit{Shield} (con esempio)
  116+3+0 (1/0/0/0) Chapter: Ambiente di Test}\label{chap:testenv
  253+7+0 (1/0/0/0) Section: Uso della rete in ambiente di test
  114+1+8 (1/1/0/0) Section: Rete}\label{sec:rete
  211+3+31 (1/0/0/0) Subsection: Topologie di rete
  331+4+0 (1/0/0/0) Section: Ambiente di test Linux}\label{sec:testlinux
  194+1+0 (1/0/0/0) Subsection: NFS
  156+1+0 (1/0/0/0) Subsection: TFTP
  107+6+0 (1/0/0/0) Subsection: Utilizzo di NFS/TFT in U-Boot
  63+2+0 (1/0/0/0) Chapter: Esempi pratici}\label{chap:esempi}\todo{(atrent) la maggior parte sono a base arduino/esp8266, eventualmente aggiungere esempi linux?
  611+7+30 (1/0/0/0) Section: Abilitare un led tramite GPIO su Linux
  260+5+13 (1/1/0/0) Section: Creare una ``termo-ventola'' con Arduino
  1028+1+5 (1/1/0/0) Section: **TaskScheduler}\label{sec:taskscheduler
  1414+1+0 (1/0/0/0) Section: **Firmata
  33+1+0 (1/0/0/0) Section: ***TVout
  176+4+0 (1/0/0/0) Section: ***LED matrix e strip
  27+2+0 (1/0/0/0) Section: ***JSON parsing
  71+6+65 (1/0/0/0) Section: ***Rilevatore presenza PIR+DHT11 via MQTT
  6+1+0 (1/0/0/0) Subsection: Librerie
  37+2+4 (1/1/0/0) Subsection: Schema elettrico
  70+1+0 (1/0/0/0) Subsection: Inizializzazioni
  169+4+4 (1/1/0/0) Subsection: Corpo principale del programma
  252+9+15 (1/0/0/0) Section: **Comandare un ``robot'' usando un cellulare tramite protocollo OSC
  244+1+6 (1/1/0/0) Subsection: L'hardware
  482+2+190 (1/6/0/0) Subsection: Il software
  27+1+0 (1/0/0/0) Section: ***OTA
  69+5+0 (1/0/0/0) Chapter: ******************Note interne + materiale da integrare
  247+3+0 (1/0/0/0) Chapter: Quarta di copertina

BTW if I "git" the stats output I can see the (re/pro)gress between versions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.