SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2k stars 364 forks source link

label is missing from the ref list #214

Open co0p opened 11 years ago

co0p commented 11 years ago

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}
msiniscalchi commented 11 years ago

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

On Sat, Jun 29, 2013 at 4:23 PM, Julian Godesa notifications@github.comwrote:

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 commented 11 years ago

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...

shaaati commented 8 years ago

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.

Mq89 commented 5 years ago

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

Mq89 commented 5 years ago

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.

r-stein commented 5 years ago

@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:

CareF commented 4 years ago

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