LaTeXTools
LaTeXTools copied to clipboard
label is missing from the ref list
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}
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
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...
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.
Is there an update on this issue? If someone can guide me, I am willing to work on a patch for this.
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.
@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
I am also expecting this feature. Thank you for your great work!