Loading ...
Sorry, an error occurred while loading the content.

15985Re: tags for LaTeX?

Expand Messages
  • Benji Fisher
    Feb 1, 2001
    • 0 Attachment
      "Andrzej M. Ostruszka" wrote:
      >
      > On Wed, Jan 31 (2001), Benji Fisher wrote:
      > > Happy, productive vimmers:
      > >
      > > Does anyone use tags with LaTeX? I think it would be pretty easy to
      > > write a vim script to generate a tags file from the .aux file. Then, it
      > > would take some work to think of a convenient way to use it (i.e., write
      > > some macros to use the tags) but I think it can be done. Has anyone
      > > already done this? If not, I will, but do not hold your breath waiting!
      >
      > Well there are two options either you insert in your file comments with
      > some e.g. C definitions (or whatever ctags supports) - I used typedef's
      > %typedef label eq_one;
      > or
      > %typedef eq_one;
      > and 'ctags --language=c file.tex'
      > This method has two drawbacks: you have to insert additional text like
      > this comments and the other is that you cannot use ':' in your label
      > (which is valid LaTeX label character).
      >
      > Since I've found myself only using "LaTeX tags" for places where I use
      > \label{...} and \bibitem{...} I've commited small perl script (attached
      > -- I hope nobody will get upset, it's quite small). It's quick and dirty
      > hack but does the job for me and it is easy to improve it if someone
      > wants to.
      > Best regards

      Thanks. That's the sort of thing I had in mind, except that I was
      planning to write it as a vim script, instead of in Perl. I was also
      thinking of extracting the tags from the .aux file; you get them from the
      .tex file, right? I was also thinking of using it only for label/ref and
      bibitem/cite: it would be really cool to do (if I have the syntax right;
      I cannot try this yet!)

      :ptselect /^label

      and get a list of labels or

      :ptselect /^label:eqn

      and choose from a list of labels. Look at the one in the preview window,
      with a bit of context, and do :ptnext or :ptprev until I find the right
      one. Then automatically insert \ref{eqn:foo} and close the preview
      window. Designing the maps to make this convenient will be harder than
      generating the tags file!

      If we have only one tags file in a directory with many latex files,
      should it only have tags for one .tex file at a time, or should it contain
      tags for all the files in the directory? I am thinking of automagically
      running the tag-generating script every time I run latex (so whenever the
      .aux file gets updated).

      --Benji Fisher
    • Show all 9 messages in this topic