Sublime Forum

Issue with latextools_jumpto_anywhere

#1

Hi, in the LaTexTools package, the latextools_jumpto_anywhere command is extremely useful for productivity. It is triggered by Ctrl + L, Ctrl + J, and it allows for different actions depending on where the caret is. For example:

  • If the caret is on a citation, it jumps to the bibliography file.
  • If the caret is on a package, it opens the package PDF documentation.
  • If the caret is on a file name, it jumps the file.
  • If the caret is on a reference, it jumps to the reference’s label.
  • If the caret is on a label, it shows a list of all references of that label.

Since V4 of LaTexTools, I have been unsuccessful in making the last two applications work (the first three applications work just fine). I would appreciate any help. Below I provide a minimal non-working example. By that I mean that when I put the cursor on \ref{eq_abc} and press the key binding, I get an error in the status bar: “No matching label found for ‘eq_abc’.”.

\documentclass{article}
\usepackage{amsmath} % Allows mathematical commands like \begin{align}.
\usepackage{amssymb} % Allows mathematical symbols like \mathbb{N}.
\PassOptionsToPackage{hyphens}{url}\usepackage[pdftex, bookmarksnumbered=true, bookmarksopen=true, bookmarksopenlevel=1, colorlinks=true, allcolors=blue, pdfstartview={FitH}]{hyperref} % Turns references into hyperlinks and allows configuration of the PDF file.

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
\begin{align} \label{eq_abc}
	a &= b + c
\end{align}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod

As we can see from equation \ref{eq_abc}, ...

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod

\end{document}

For reference, this is from the original Default (Windows).sublime-keymap file:

// Jump to anywhere
// This will select the executed jump according to the context,
// e.g. if the cursor is inside a ref command it will jump to the corresponding label
{
	"keys": ["ctrl+l", "ctrl+j"],
	"command": "latextools_jumpto_anywhere",
	"context": [
		{ "key": "selector", "operand": "text.tex.latex" }
	]
},
0 Likes

#2
1 Like

#3

Wow, that was fast! @deathaxe, thank you so much for fixing it!!

I am looking forward to Package Control to updating LaTexTools.

0 Likes

#4

@deathaxe, sorry to bother you. Package Control has updated LaTeXTools to V4.3.2. The updated code you developed fixed the issue of references and labels! Now, I am able to jump to the label when the caret is on a reference, as well as seeing a list of all references to a label when positioning the caret on the label.

However, the fix also affected the behavior of latextools_jumpto_anywhere for bullet points 1 and 3 as well. I describe the new behavior below:

  • If the caret is on a citation, it jumps to the bibliography file.

Now, ST opens the bibliography file (.bib), but does not jump to the specific citation inside the .bib file as it used to do.

  • If the caret is on a file name, it jumps to the file.

I have files that I insert into the main document using \input{}. It can be something like \input{../../directory_a/file_x.tex}. When I trigger the command, the file is not opened and I get the following error in the console:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text\Lib\python38\sublime_plugin.py", line 1642, in run_
    return self.run(edit)
  File "C:\Users\USER\AppData\Roaming\Sublime Text\Packages\LaTeXTools\latextools\jumpto_anywhere.py", line 314, in run
    self.window.run_command("latextools_jumpto_file", kwargs)
AttributeError: 'LatextoolsJumptoAnywhereCommand' object has no attribute 'window'

Could you please take a look?

0 Likes

#5

Thanks for heads up. Fix released, should arive soon.

1 Like

#6

@deathaxe, everything seems to be working now. Thank you so much for all you do for the community!!

0 Likes