0

I use Sublime 3 with the LaTeXTools plugin. Everything is updated.

Here is a minimal example showing what happens when I use autocompletion for commands I defined locally: enter image description here

As you can see, it handles commands with zero arguments as if they have one argument. This costs me an insane amount of time.

Is this always a problem with LaTeXTools, or did something break with my installation? (I already reinstalled all my plugins, and Sublime itself, but it is still there.) Is there any way for me to change this behavior?

  • 1
    Welcome to TeX.SX! – Bobyandbob May 9 '18 at 15:46
  • Hi! Wasn't sure if this is the right platform for that question, but there are fitting tags, so I tried it. – x432ph May 9 '18 at 16:01
  • 1
    Actually \oo{} is not always bad. If we have \newcommand*{\oo}{Otto} then \oo{} is gives what I would argue is the expected result while \oo is does not. If no one has a solution here in due time, you may want to start a feature request at github.com/SublimeText/LaTeXTools/issues – moewe May 9 '18 at 21:16
  • @moewe Why would this be the expected results? In my understanding, the compiler just replaces the new command with the text in the second argument of \newcommand. This would lead to "Otto{} is" instead of "Otto is". Why would that be expected? Or am I misunderstanding something about macros? – x432ph May 9 '18 at 23:24
  • 1
    Space after macros without arguments is swallowed, so \oo is results in "Ottois", while \oo{} is gives "Otto is". I would argue that the latter is the expected output, but of course you may feel otherwise. That said, there are many situations where I would want to use a parameterless command without a brace group after it, so I can definitely see why it would be annoying that your editor always places {} after it. As a rule of thumb the {} is often desired when writing text (i.e. your document content) while the form without is often more appropriate for 'programming'. – moewe May 10 '18 at 4:52
1

I asked about that on the Github project of LaTeXTools, see here.

So it is deliberate, and at the moment, there is no intended way to change that behavior (but maybe in the future).

As a provisional solution, I now opened the file latex_own_command_completions.py in my LaTeXTools package folder, and changed the line

s = c.args + "{}"

to

s = c.args

I hope this helps, in case you have the same problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.