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

Multi-line section titles may lead to empty TOC entries #2364

Closed
xileF1337 opened this issue Mar 31, 2022 · 4 comments
Closed

Multi-line section titles may lead to empty TOC entries #2364

xileF1337 opened this issue Mar 31, 2022 · 4 comments
Labels

Comments

@xileF1337
Copy link

xileF1337 commented Mar 31, 2022

Description

Hi,

I noticed that sometimes vimtex's table of content (TOC) contains empty entries. The issue arises with multi-line section titles like these:

\section{%
    This is a really long section title which is hard-wrapped
    after 80 characters or so to keep the source code readable
}

When opening the TOC using \lt, the corresponding section number will be displayed, but the rest of the line stays blank. The comment symbol % following the opening brace does not seem to make any difference.

Thanks for your help!

Steps to reproduce

I can't attach the tex file, here is the content of, minimal.vim:

\documentclass{article}
\begin{document}

\section{%
    This is a really long section title which is hard-wrapped
    after 80 characters or so to keep the source code readable
}

\end{document}

Steps:

  1. Compile
  2. Open the TOC, by default this is done with \lt.

Expected behavior

Expected behaviour would be to display the full title or the first n non-whitespace characters.

Actual behavior

When opening the TOC using \lt, the corresponding section number will be displayed, but the rest of the line stays blank.

Do you use a latexmkrc file?

no

VimtexInfo

23 System info:                                                                   
 22   OS: Fedora release 33 (Thirty Three)                                         
 21   Vim version: NVIM v0.4.4                                                     
 20   Has clientserver: true                                                       
 19   Servername: /tmp/nvimR51SGy/0                                                
 18                                                                                
 17 VimTeX project: minimal_empty_toc_line                                         
 16   base: minimal_empty_toc_line.tex                                             
 15   root: /homes/foo/Desktop/minimal                                 
 14   tex: /homes/foo/Desktop/minimal/minimal_empty_toc_line.tex       
 13   main parser: current file verified                                           
 12   document class: article                                                      
 11   compiler: latexmk                                                            
 10     engine: -pdf                                                               
  9     options:                                                                   
  8       -verbose                                                                 
  7       -file-line-error                                                         
  6       -synctex=1                                                               
  5       -interaction=nonstopmode                                                 
  4     callback: 1                                                                
  3     continuous: 1                                                              
  2     executable: latexmk                                                        
  1   viewer: General                                                              
24    qf method: LaTeX logfile                                                     
~
~
@xileF1337 xileF1337 added the bug label Mar 31, 2022
@lervag
Copy link
Owner

lervag commented Mar 31, 2022

Thanks, it seems there has been a bug here for a long time. I'm surprised no one noticed. But I believe it is fixed now. Please test!

@lervag lervag closed this as completed Mar 31, 2022
lervag added a commit that referenced this issue Mar 31, 2022
@xileF1337
Copy link
Author

Super fast, as usual ;-) Fix works, thank you so much!

@lervag
Copy link
Owner

lervag commented Mar 31, 2022

Glad to hear it! And well, I'm not fast for everything. It helps when I have a good idea from start. :)

@lervag
Copy link
Owner

lervag commented Mar 31, 2022

(Like in this particular case, where I thought it should work already. Turned out I was right and that I somehow messed something up a couple of years ago. So it was a quick fix.)

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

No branches or pull requests

2 participants