Skip to content

Incorrect folding of table environment if a threeparttable with a tablenotes env is present #2771

@cristobaltapia

Description

@cristobaltapia

Description

When a threeparttable environment is created with the corresponding tablenotes environment, then the folding of the table environment does not work correctly, as the text below (outside) the table environment gets folded too (see images below). This problem does not occur if only the threeparttable environment is present without the tablenotes (which of course makes no sense in practice).

Before folding:
Screenshot-2023-08-17-201917
After folding:
Screenshot-2023-08-17-202020

Steps to reproduce

  1. Create a *.tex file with the following content:
    \documentclass[a4paper]{article}
    \usepackage{threeparttable}
    
    \begin{document}
    
    \begin{table}[tbp]
      \caption{Test caption}
      \label{tab:test}
      \begin{threeparttable}
        \begin{tabular}{cc}
          a & b\tnote{*} \\
          1 & 2          \\
        \end{tabular}
        \begin{tablenotes}
          \item[*] note 1
        \end{tablenotes}
      \end{threeparttable}
    \end{table}
    
    Some text, which is hidden when the table is folded.
    
    \end{document}
  2. Place the cursor on the table environment and close the fold e.g. with zc.
  3. Observe that not only the table environment got hidden, but also the text that comes after the table.

Expected behavior

Only the table environment should fold.

Actual behavior

The text below the table environment gets hidden too.

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: Ubuntu 22.04.2 LTS
  Vim version: NVIM v0.9.1
  Has clientserver: true
  Servername: /run/user/1001/nvim.2335660.0

VimTeX project: test
  base: test.tex
  root: /home/tapiac
  tex: /home/tapiac/test.tex
  main parser: fallback current file
  document class: 
  compiler: latexmk
    engine: -lualatex
    options:
      -verbose
      -shell-escape
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    out_dir: out
    aux_dir: .aux
    callback: 1
    continuous: 0
    executable: latexmk
  viewer: Zathura
    xwin id: 0
  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