LaTeXTools icon indicating copy to clipboard operation
LaTeXTools copied to clipboard

label is missing from the ref list

Open co0p opened this issue 11 years ago • 7 comments

I am using the listing package. The declared label is missing from the drop down ref list...

\lstset{basicstyle=\footnotesize, language=c, label={code:bubble}, caption={...}}
\lstinputlisting{../resources/code/bubble.c}
\ref{ ... missing here .... }

here is a small working example:

\documentclass{article}
\usepackage{listings}
\begin{document}

\lstset{language=Pascal, label=code:label, caption={caption text}}
\begin{lstlisting}[frame=single]
Write(’Pascal keywords.’);
\end{lstlisting}

Look at code listing \ref{code:label} (this is not picked up by the plugin). 

\end{document}

co0p avatar Jun 29 '13 21:06 co0p

Hmmm... it is probably not picked up. Will need to look into this.

On Sat, Jun 29, 2013 at 4:23 PM, Julian Godesa [email protected]:

I am using the listing package. The declared label is missing from the drop down ref list...

\lstset{basicstyle=\footnotesize, language=c, label={code:bubble}, caption={...}} \lstinputlisting{../resources/code/bubble.c} \ref{ ... missing here .... }

— Reply to this email directly or view it on GitHubhttps://github.com/SublimeText/LaTeXTools/issues/214 .

Marciano Siniscalchi Economics Department, Northwestern University http://faculty.wcas.northwestern.edu/~msi661

msiniscalchi avatar Jun 29 '13 21:06 msiniscalchi

This is going to require special handling... I suppose just adding a label statement won't work, right? As a workaround you could put the listing in a table and add a label to that...

msiniscalchi avatar Jun 30 '13 10:06 msiniscalchi

Today, I stumbled upon an identical issue, using the (more powerful) listings package (note the trailing s). I believe this might be bugging quite a lot of people, because those writing LaTeX in Sublime Text are often the tech-savvy ones dealing with code everyday.

Putting listings in a table is not a suitable workaround because this screws up the 'List of Listings' and 'List of Tables' sections.

shaaati avatar Apr 26 '16 21:04 shaaati

Is there an update on this issue? If someone can guide me, I am willing to work on a patch for this.

Mq89 avatar Jul 04 '19 09:07 Mq89

I think the functionality can be added in latex_ref_completions.py.

The \lstlisting commands need to be found and the labels extracted from their arguments to be put in the completions list.

Mq89 avatar Jul 04 '19 10:07 Mq89

@Mq- Technically there are also other consumers of the known labels, which would not work in that case, e.g. jumpto_anywhere.py and the toc_quickpanel.

However the auto completion is the most important, so yes that should be enough for the autocompletion current view and document analysis.

Note if you want to implement something:

  • You should work on the version4 branch
  • You can find the analysis code here, which may help to use the corresponding methods and understand the existing code

r-stein avatar Jul 04 '19 16:07 r-stein

I am also expecting this feature. Thank you for your great work!

CareF avatar Feb 14 '20 16:02 CareF