Take the 2-minute tour ×  I am a beginner, trying to make lists
(and eventually count and make statistics) the LaTeX keywords
appearing in some documents. Basically a LaTeX "valid" keyword
can be identified by:    1. The fact that it does not begin with
a "%" sign (it would be commented therefore not in use)   2. It
starts with a backslash.   3. Is is followed by either a left
curly bracket (or a left bracket, in case there are options.)  I
understand there are other "special" cases: keywords followed by
nothing (a white space), or another keyword, but these are
relatively rare and I do no mind the inaccuracy. My primary goal
is to get eventually a rought idea of the number of different
keywords in various types of documents.  I have tried various
ways using awk, but could not get anything working... I have
attached a MWE (meaningless and not functional!) of a LaTeX file
for reference.  \documentclass[a4paper]{scrreprt} % Mode
production \begin{tikzpicture}[remember picture,overlay]
\includegraphics[width=#2]