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

Re: tags for LaTeX?

Expand Messages
  • Alexander Wagner
    On Wed, 31 Jan 2001 21:33:38 -0500, Benji Fisher wrote: Hi! ... I searched for something like that, but didn t find anything. It would be
    Message 1 of 9 , Jan 31, 2001
    View Source
    • 0 Attachment
      On Wed, 31 Jan 2001 21:33:38 -0500, Benji Fisher wrote:

      Hi!

      > Does anyone use tags with LaTeX?

      I searched for something like that, but didn't find
      anything. It would be really nice to be able to :ta
      <mysection> or :ta eq:<myequation>. That is, IMHO it would
      be really nice to have something like "ctags --tex" or a
      script that writes a "tags" for TeX.

      > 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.

      IMHO just generating a tags would be the best interface as
      vim allready has some neat functionality to deal with this,
      so one wouldn't need to write a whole set, could use the
      same commands as for C or Fortran code... As far as I saw
      ctags offers also some interface to do it, but it is beyond
      my knowledge and especially my time to do it. Though I'd
      really love to have it.

      > Has anyone already done this? If not, I will, but do not
      > hold your breath waiting!

      Be assured to be proposed for the "Golden VIM honour plate"
      :-)


      --

      CU/2 (( In the beginning was The Word.
      Alexander Wagner )) And The Word was Content-type: text/plain
      Team OS/2 Franken (( -=[ Team OS/2 Germany #294 ]=-
      -----------------------------------------------------------------
      Please use only A.Wagner@... or A.Wagner@... for
      replies, even if some other addresses may appear. Thanks!
      --> Get my PGP-key with Subject: Request for PGP-Keys <--
    • Andrzej M. Ostruszka
      ... 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
      Message 2 of 9 , Feb 1, 2001
      View Source
      • 0 Attachment
        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
        --
        ____ _ ___
        / | \_/ |/ _ \ Andrzej Marek Ostruszka
        / _ | | (_) | Instytut Fizyki, Uniwersytet Jagiellonski (Cracow)
        /_/ L|_|V|_|\___/ (PGP <-- finger ostruszk@...)
      • Benji Fisher
        ... 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
        Message 3 of 9 , Feb 1, 2001
        View Source
        • 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
        • J. David Boyd
          http://users.erols.com/astronaut/vim/ Dr. Chip has written his own tags that does Tex. Might be a good place to start. Dave ... From: Alexander Wagner
          Message 4 of 9 , Feb 1, 2001
          View Source
          • 0 Attachment
            http://users.erols.com/astronaut/vim/
            Dr. Chip has written his own tags that does Tex. Might be a good place to
            start.

            Dave


            ----- Original Message -----
            From: "Alexander Wagner" <A.Wagner@...>
            To: "vim Mailinglist" <vim@...>; "Benji Fisher" <benji@...>
            Sent: Thursday, February 01, 2001 2:18 AM
            Subject: Re: tags for LaTeX?


            > On Wed, 31 Jan 2001 21:33:38 -0500, Benji Fisher wrote:
            >
            > Hi!
            >
            > > Does anyone use tags with LaTeX?
            >
            > I searched for something like that, but didn't find
            > anything. It would be really nice to be able to :ta
            > <mysection> or :ta eq:<myequation>. That is, IMHO it would
            > be really nice to have something like "ctags --tex" or a
            > script that writes a "tags" for TeX.
            >
            > > 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.
            >
            > IMHO just generating a tags would be the best interface as
            > vim allready has some neat functionality to deal with this,
            > so one wouldn't need to write a whole set, could use the
            > same commands as for C or Fortran code... As far as I saw
            > ctags offers also some interface to do it, but it is beyond
            > my knowledge and especially my time to do it. Though I'd
            > really love to have it.
            >
            > > Has anyone already done this? If not, I will, but do not
            > > hold your breath waiting!
            >
            > Be assured to be proposed for the "Golden VIM honour plate"
            > :-)
            >
            >
            > --
            >
            > CU/2 (( In the beginning was The Word.
            > Alexander Wagner )) And The Word was Content-type: text/plain
            > Team OS/2 Franken (( -=[ Team OS/2 Germany #294 ]=-
            > -----------------------------------------------------------------
            > Please use only A.Wagner@... or A.Wagner@... for
            > replies, even if some other addresses may appear. Thanks!
            > --> Get my PGP-key with Subject: Request for PGP-Keys <--
            >
            >
          • Andrzej M. Ostruszka
            ... Yes. Whenever I find label{} or bibitem{} then appropiate tag is generated for this line. With this approach you get the ex command for the tags file
            Message 5 of 9 , Feb 1, 2001
            View Source
            • 0 Attachment
              On Thu, Feb 01 (2001), Benji Fisher wrote:
              > 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?

              Yes. Whenever I find \label{} or \bibitem{} then appropiate tag is
              generated for this line. With this approach you get the ex command for
              the tags file immediately (as a line in which \label|\bibitem is found).
              With your approach one has to extract labels from aux file in which they
              look like:

              \newlabel{eq:langev}{{2}{2}}
              \bibcite{Gaspbook}{2}

              (from this information valuable for tag-purpose is only first brace)
              then you have to grep file (and if you got \include's then also files
              included) for the \{label|bibitem}{label_found_in_aux_file} - if you
              don't want to use perl then you can probably use grep instead (more
              popular utility I guess) and probably 'redir' (I don't know if it's
              possible to get to the :grep results from within vim script - if it is
              maybe this would be the way).

              > 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!

              Well currently this script does not differenciate between \label and
              \bibitem but you can easily change it to add appropiate 'label' or
              'bibitem' in front of the tagname and of course I can do ptselect and
              ptnext since I've got proper tags file. Since I use convention
              fig:tagname for figures and eq:tagname for equations I can select easily
              only figures or equations or bibitems (since I start them with uppercase
              letter). I don't know how to get current tagname - if it can be done
              somehow (maybe 'redir'? I don't know) then this should be quite easy to
              do all you want. Currently I'm inserting \ref{...} by myself.

              > 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?

              That's the design question :)). I'm satisfied with what I got (maybe not
              perfect but workable) i.e. I'm generating tags manually by
              'textags list_of_files_to_be_checked'.
              Best regards
              --
              ____ _ ___
              / | \_/ |/ _ \ Andrzej Marek Ostruszka
              / _ | | (_) | Instytut Fizyki, Uniwersytet Jagiellonski (Cracow)
              /_/ L|_|V|_|\___/ (PGP <-- finger ostruszk@...)
            • Dr. Charles E. Campbell
              ... Yes -- hdrtag supports cites and labels. See http://www.erols.com/astronaut/vim/index.html#Tags Regards, Chip Campbell -- Charles E Campbell, Jr, PhD
              Message 6 of 9 , Feb 1, 2001
              View Source
              • 0 Attachment
                Thus saith Benji Fisher:
                > Does anyone use tags with LaTeX?

                Yes -- hdrtag supports cites and labels. See

                http://www.erols.com/astronaut/vim/index.html#Tags

                Regards,
                Chip Campbell

                --
                Charles E Campbell, Jr, PhD _ __ __
                Goddard Space Flight Center / /_/\_\_/ /
                cec@... /_/ \/_//_/
                PGP public key: http://www.erols.com/astronaut/pgp.html/
              • Benji Fisher
                ... I already downloaded it. Where is the documentation? Do you have any nifty mappings or scripts to go along with it? --Benji Fisher
                Message 7 of 9 , Feb 1, 2001
                View Source
                • 0 Attachment
                  "Dr. Charles E. Campbell" wrote:
                  >
                  > Thus saith Benji Fisher:
                  > > Does anyone use tags with LaTeX?
                  >
                  > Yes -- hdrtag supports cites and labels. See
                  >
                  > http://www.erols.com/astronaut/vim/index.html#Tags

                  I already downloaded it. Where is the documentation? Do you have
                  any nifty mappings or scripts to go along with it?

                  --Benji Fisher
                • Darren Hiebert
                  ... Someone anonymously uploaded just last week a bibtex parser for ctags-4.0.3 for generating tags for bibtex references from the citation in the LaTeX file.
                  Message 8 of 9 , Feb 4, 2001
                  View Source
                  • 0 Attachment
                    On Wed, 31 Jan 2001, Benji Fisher wrote:

                    > 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!

                    Someone anonymously uploaded just last week a bibtex parser for
                    ctags-4.0.3 for generating tags for bibtex references from the
                    citation in the LaTeX file. I know nothing about TeX or LaTeX, so if
                    someone wants to collaborate with me to integrate this into my
                    upcoming 5.0 release, I would be happy to put it in.

                    The parser can be found at:

                    http://sourceforge.net/patch/download.php?id=103486

                    --
                    Darren Hiebert <darren@...>
                    http://darren.hiebert.com
                  Your message has been successfully submitted and would be delivered to recipients shortly.