latex-lsp / texlab

An implementation of the Language Server Protocol for LaTeX
GNU General Public License v3.0
1.55k stars 53 forks source link

correctly parse Theorem nmbs in aux-file when ntheorem is used #1053

Closed martinra closed 7 months ago

martinra commented 7 months ago

When using the package ntheorem, theorem-like environments yields slightly different lines in the aux-file. This results in the corresponding symbols not being fully parsed, which then for instance in nvim/aerial leads to incomplete labels in the symbol navigation (showing as Theorem 1. instead of Theorem 1.1).

Here is a minimal working/non-working example. The crucial difference is, I believe, is the label 1.1 with amsart and 1.{1} with ntheorem.

% This variant works
% \documentclass{amsart}
% The resulting line in the aux-file is
% \newlabel{thm:test}{{1.1}{1}}

% This variant does not work
\documentclass{scrartcl}
\usepackage{ntheorem}
% The resulting line in the aux-file is
% \newlabel{thm:test}{{1.{1}}{1}}

\newtheorem{theoremcounter}{theoremcounter}[section]
\theoremstyle{plain}
\newtheorem{theorem}[theoremcounter]{Theorem}

\begin{document}

\section{test sec}%
\label{sec:test}

some text

\begin{theorem}%
\label{thm:test}
A theorem to test
\end{theorem}

some more

\end{document}