Skip to content

Errors E716 E116 when running :VimtexTocOpen in a file containing a \label #2883

@brechetp

Description

@brechetp

Hi :)

First of all, thank you so much for this wonderful vim plugin! I couldn't think of writing .tex files without it.

It's my first time opening a ticket on github, I hope the description will be to your liking! Please, tell me otherwise.

Description

Two errors (E716, E116) come up when running :VimtexTocOpen (or :VimtexTocToggle) in a file containing some \label commands. The commands run smoothly in the same file without the \label.

Here is the error log:

Error detected while processing function 356[12]..361[5]..vimtex#parser#toc[13]..vimtex#parser#toc#parse[65]..509:
line    4:
E716: Key not present in Dictionary: "format, l:key, l:label), 'number' : '', 'file'   : a:context.file, 'line'   : a:context.lnum, 'level'  : a:context.max_level - a:context.level.current, 'rank'   : a:context.lnum_total, 'type'   : 'label', }"
E116: Invalid arguments for function printf(self.format, l:key, l:label), 'number' : '', 'file'   : a:context.file, 'line'   : a:context.lnum, 'level'  : a:context.max_level - a:context.level.current, 'rank'   : a:context.lnum_total, 'type'   : 'label', }

I can't seem to find the same set of errors online.

It is relatively recent, and persists even when checking-out older commits. I therefore think it's because of my system, but I can't find the reason why, nor can debug vim scripts :'(

I tried with a minimal vimrc file, no other plugins, and with a minimal.tex file as well.

Would you have an idea where this could be coming from?

Steps to reproduce

  1. vim -Nu "vimrc" mimimal.tex
  2. Run :VimtexTocOpen ---> fails

minimal.tex:

\documentclass{article}
\begin{document}

\section{Introduction}
\label{sec:intro}

\end{document}

vimrc (using vim-plug):

call plug#begin()
Plug 'lervag/vimtex'
call plug#end()

Expected behavior

When following the above-mentioned steps, I expect the TOC to open.

Actual behavior

When following the above steps, I get the following error message

Error detected while processing function 356[12]..361[5]..vimtex#parser#toc[13]..vimtex#parser#toc#parse[65]..509:
line    4:
E716: Key not present in Dictionary: "format, l:key, l:label), 'number' : '', 'file'   : a:context.file, 'line'   : a:context.lnum, 'level'  : a:context.max_level - a:context.level.current, 'rank'   : a:context.lnum_total, 'type'   : 'label', }"
E116: Invalid arguments for function printf(self.format, l:key, l:label), 'number' : '', 'file'   : a:context.file, 'line'   : a:context.lnum, 'level'  : a:context.max_level - a:context.level.current, 'rank'   : a:context.lnum_total, 'type'   : 'label', }

Do you use a latexmkrc file?

no

VimtexInfo

System info:
  OS: Debian GNU/Linux 11 (bullseye)
  Vim version: VIM 8.2 (1-2434)
  Has clientserver: true
  Servername: undefined (vim started without --servername)

VimTeX project: minimal
  base: minimal.tex
  root: /home/user/thesis
  tex: /home/user/thesis/minimal.tex
  main parser: current file verified
  document class: article
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: General
  qf method: LaTeX logfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions