\section{Introduction}
\label{sec-Intro}

I was directed to try this mailing list to inquire about what appears
to be a bug in the etags shell command for creating a tag table.  I
would appreciate it if anyone with useful information could respond to
me.

(This file is in LaTeX style because this message, about etags applied
to LaTeX files, is self-referential.)

\section{Description of the problem}
\label{sec-Problem}

I am finding that the etags shell command run on latex files is
producing garbage incompatible with the explanation in the GNU Emacs
Manual \cite[pages 147--148]{Stallman87}.  According to
\cite{Stallman87}, this program is supposed to do something
intelligent based on the name and contents of the file to decide what
language it is and make up an appropriate tags file.  Supposedly, tags
for a LaTeX file should be the arguments of any of the commands
\chapter, \section, \subsection, \subsubsection, \eqno, \label, \ref,
\cite, \bibitem, and \typeout.  Unfortunately it doesn't seem to
produce the right thing for a LaTeX file.  It appears to me that it
tends to grab things which appear right before parentheses (like
this), but this is (certainly) not true for all parentheses (as you
shall see) .  I have tried putting -*-TeX-*- or -*-LaTeX-*- in the
first line of the file, but this does not seem to help.

I have tried "man etags", but there is no manual entry for etags here.
I also have been unable to find the source code for etags.  (I am
working on a microvax in the theory group at MIT's Lab for Computer
Science.)

\section{A concrete example}
\label{sec-Example}

The command

  etags tag-bug.tex

produces in the file TAGS the tag table shown below when the contents
of this message (just the stuff following "--text follows this
line--") have been stored in tag-bug.tex.  Yes, the whole message,
including the tag table below can be placed in tag-bug.tex, and then
what is below comes out as the tag table.

It seems that little of what I had naturally typed (so far) would
produce a tag table entry, so (here) is some stuff which will generate
some bogus tags.  Bizarrely, as I have prepared this file, I noticed
behavior whereby rewording one paragraph has affected whether or not
tags are generated from text a couple paragraphs distant.

\begin{thebibliography}

\bibitem{Stallman87}  Richard Stallman.  GNU Emacs Manual, Sixth Edition,
Version 18, March 1987.

\end{thebibliography}

***********************   TAGS file follows  ************************

tag-bug.tex,124
of this message 43,1708
produce a tag table entry, so 49,2016
It seems that little of what I had naturally typed 48,1950
