Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide preamble in TOC not working #2787

Closed
petobens opened this issue Sep 7, 2023 · 2 comments · Fixed by #2792
Closed

Hide preamble in TOC not working #2787

petobens opened this issue Sep 7, 2023 · 2 comments · Fixed by #2792
Labels

Comments

@petobens
Copy link

petobens commented Sep 7, 2023

Description

vim.g.vimtex_toc_show_preamble doesn't seem to work

Steps to reproduce

  1. Open nvim with the following minimal init.lua:
    local root = '/tmp/nvim-minimal'
    
    -- Set stdpaths to use root dir
    for _, name in ipairs({ 'config', 'data', 'state', 'cache' }) do
        vim.env[('XDG_%s_HOME'):format(name:upper())] = root .. '/' .. name
    end
    
    -- Bootstrap lazy
    local lazypath = root .. '/plugins/lazy.nvim'
    if not vim.loop.fs_stat(lazypath) then
        vim.fn.system({
            'git',
            'clone',
            '--filter=blob:none',
            '--single-branch',
            'https://github.com/folke/lazy.nvim.git',
            lazypath,
        })
    end
    vim.opt.runtimepath:prepend(lazypath)
    
    -- Install and configure plugins
    local plugins = {
        {
            'lervag/vimtex',
            config = function()
                vim.g.vimtex_toc_show_preamble = 0
            end,
            ft = { 'tex', 'bib' },
        },
    }
    require('lazy').setup(plugins, {
        root = root .. '/plugins',
    })
  2. Edit a tex file containing
    \documentclass{article}
    \begin{document}
    
    \section{Foo}
    
    \end{document}
  3. Run VimtexTocOpen

Expected behavior

After 3. above I would expect the preamble not to be seen in the TOC.

Actual behavior

There is a preamble entry in the TOC.

image

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: Arch Linux
  Vim version: NVIM v0.10.0-dev-1045+g131a1ee82d
  Has clientserver: true
  Servername: /run/user/1000/nvim.2623593.0

VimTeX project: foo
  base: foo.tex
  root: /home/pedro/Desktop
  tex: /home/pedro/Desktop/foo.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
@lervag
Copy link
Owner

lervag commented Sep 19, 2023

First, sorry for taking so very long to answer. I've been quite busy lately with work and I've also enjoyed perhaps too many hours of playing Baldurs Gate. 😊

I've merged the PR from @julio-b which seems to resolve your issue. Thanks @julio-b, that is very much appreciated!

@petobens
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants