Vimtex: New feature request (vimtex): equation number in the table of contents

Created on 27 May 2019  路  5Comments  路  Source: lervag/vimtex

This plugin provides the command :VimtexTocOpen to open the table of contents. Here is my tex file:

\documentclass{article}
\begin{document}
\section{Section One}
\label{sec:section_1}

This is the first equation:
\begin{equation}
1 + 1 = 2.
\label{eq:1}
\end{equation}

\noindent
This is the second equation:
\begin{equation}
1 \times 1 = 1.
\label{eq:2}
\end{equation}
\end{document}

When use \lt, I can get the following toc:

<Esc>/q  Close
<Space>  Jump
<Enter>  Jump and close
      r  Refresh
      h  Toggle help text
      t  Toggle sorted TODOs
    -/+  Decrease/increase ToC depth (for content layer)
    f/F  Apply/clear filter
      s  Hide numbering

Layers:  L  label+
         I  include+
         T  todo+
         C  content+

           Preamble
1          Section One
           sec:section_1
           eq:1
           eq:2

However, when I am editing a large file, there might be a lot of labels, so that I cannot remember the label of each equation, but can only see the equation number on the pdf file. Can I request a new feature that the equation numbers can also be displayed in the toc part, for example:

<Esc>/q  Close
<Space>  Jump
<Enter>  Jump and close
      r  Refresh
      h  Toggle help text
      t  Toggle sorted TODOs
    -/+  Decrease/increase ToC depth (for content layer)
    f/F  Apply/clear filter
      s  Hide numbering

Layers:  L  label+
         I  include+
         T  todo+
         C  content+

           Preamble
1          Section One
           sec:section_1
           eq:1                           [Eq. (1.1)]
           eq:2                           [Eq. (1.2)]
           thm:1                         [Thm. (1.1)]

Thank you a lot for your attention!

Most helpful comment

Hmm. My initial reaction is "this is too difficult". However, I've looked a little bit at the code and think I might be able to make it work. I'll prioritize some other issues first, but here's a TODO list for how to work on this:

  • [x] Move parse_aux_files from complete.vim to parse/...
  • [x] Use the new parse/... as a backend for mapping labels to "title"/correct numbering

All 5 comments

Right, I forgot to open that issue after #1191 was merged!

Hmm. My initial reaction is "this is too difficult". However, I've looked a little bit at the code and think I might be able to make it work. I'll prioritize some other issues first, but here's a TODO list for how to work on this:

  • [x] Move parse_aux_files from complete.vim to parse/...
  • [x] Use the new parse/... as a backend for mapping labels to "title"/correct numbering

Sorry for taking so very long! I think this should work mostly as expected now, but I'd appreciate if someone could test it and give feedback before I merge. Let's continue the discussion in #1738.

Thank you a lot for your update. The new feature is so amazing!

Great, happy to hear it! If you have suggestions for improving this before I merge, please comment in #1738. :)

Was this page helpful?
0 / 5 - 0 ratings