texlab icon indicating copy to clipboard operation
texlab copied to clipboard

Could texlab recongnize label create by \newtchtheorem

Open yqwu905 opened this issue 3 years ago • 6 comments

\newtcbtheorem from tcolorbox can auto create label, Is there a way to configure texlab so these labels could be recognize and provide to auto-completion in \ref? For example, I create a definition environment:

\newtcbtheorem[number within=section]{definition}{Definition --\ }{
   coltitle=purple,
   colframe=red!80!blue,
   detach title,
   boxrule=0pt,
   leftrule=2pt,
   attach title to upper,
   sharp corners,
   left=1mm,
}{def}

And create a definition with:

  \begin{definition}{definition title}{definition_label}
     definition content
  \end{definition}

Then label def:definition_label will be created automatically, and could be link by \ref{def:definition_label}. However, texlab could not recognize this label. Is it possible to achieve that?

yqwu905 avatar Jan 15 '22 14:01 yqwu905

Thanks for the report!

Is there a way to configure texlab so these labels could be recognize and provide to auto-completion in \ref?

Currently, there is no way to configure texlab to recognize this construct. This needs to be done in the source code. There was a proposal once to make the parser/analysis configurable but the suggested approach would be very tedious to ensure backwards compatibility between releases. In the mean time, there would have been a lot of breakages.

However, implementing this particular feature is not too difficult but it shows that the future analysis will need to have more than one pass probably (one definition changes the way labels can be introduced) so there is still some work to do.

pfoerster avatar Jan 17 '22 16:01 pfoerster

Any improvements?

jczhang02 avatar Feb 05 '24 23:02 jczhang02