14

Well, the question is pretty self-explanatory. (I'm writing a short tutorial on LaTeX, and wanted some trivia;)).

mbork
  • 13,385

3 Answers3

12

TeX Live

TeX Live 2012 (2012-09-19)

$ egrep -c '\.sty$' ls-R
3381
$ egrep -c '\.cls$' ls-R
448
$ egrep -c '\.(sty|cls)$' texmf-dist/ls-R
3829

Windows has findstr, but it has some limitations. For example, it cannot detect Unix line ends or the end of the last line, if the file does not end with a end-of-line marker.

The equivalent for wc -l is find /c /v "", see What is the Windows equivalent of “wc -l”?.

> findstr /c:.sty ls-R | find /c /v ""
> findstr /c:.cls ls-R | find /c /v ""
> findstr /c:.sty /c:.cls ls-R | find /c /v ""

Different method:

$ find texmf-dist/tex/latex \( -name \*.sty -or -name \*.cls \) | wc -l
3148
$ find texmf-dist/tex/generic \( -name \*.sty -or -name \*.cls \) | wc -l
191
$ find texmf-dist/tex \( -name \*.sty -or -name \*.cls \) | wc -l
3500

Windows:

> (cd texmf-dist\tex\latex && dir /s /b *.sty *.cls | find /c /v "")
> (cd texmf-dist\tex\generic && dir /s /b *.sty *.cls | find /c /v "")
> (cd texmf-dist\tex\tex && dir /s /b *.sty *.cls | find /c /v "")

But:

  • False positives: .sty/.cls files that are not LaTeX packages or classes.
  • There are packages that divide their work on smaller units (modules in tikz, …) that are formally LaTeX packages.
  • TeX Live only contains a subset of free packages and classes.

TeX Catalogue

2012-09-19

$ find catalogue/entries/ -exec grep -l '/macros/latex' {} \; | wc -l
2154

Windows:

> dir /s /b catalogue\entries | findstr /m /f:/ /c:/macros/latex | find /c /v ""

But:

  • Not all package in CTAN are in the Catalogue.
  • There are packages outside CTAN:macros/latex/ (e.g. pgf) or packages that can be used in different formats.
  • One Catalogue entry might contain several packages and classes.
  • False positives: Driver files and other stuff (e.g. pdftex-def).
Heiko Oberdiek
  • 271,626
4

On a full MiKTeX installation:

$ find . | grep '\.sty' | wc -l
3498
$ find . | grep '\.cls' | wc -l
349

So about 3500 style files and about 350 class files.

Lev Bishop
  • 45,462
  • That are a lot more style files than i thought, based on the number of packages. – Juri Robl Sep 19 '12 at 20:45
  • Why not just find . -name \*.sty | wc -l? (Or even find . -name \*.sty -print0 | xargs -0 -L1 basename | sort | uniq | wc -l, just in case;)?) Anyway, thanks; I didn't do this myself only because I do not have a full TeXlive installation (and I don't want/have time to). – mbork Sep 19 '12 at 21:10
3

At least the MiKTeX Package Manager has 2371 packages at the moment.

Juri Robl
  • 4,763