I am trying to get TexStudio to autocomplete "\phantom" -- right now the only option it displays is "\phantomsection" and even if I don't press enter and type out all of "\phantom" as soon as I type a "{" it autocompletes to "\phantomsection" which causes me to waste a lot of time deleting the unnecessary "section".

I can also type a space (to end auto-complete) then backspace and then add "{" but this is also inefficient, especially considering I have never used \phantomsection and probably will continue not to do so in the near future.

I want to know what package \phantom is in so I can add it to the TexStudio autocompletion (see here) -- I had also considered trying to remove \phantomsection from the autocomplete suggestion in TexStudio, but that seems to require mucking around too much in the source code, and since I am only a novice or at best intermediate in my LaTeX knowledge, I would prefer not doing that (so as to avoid breaking something and losing even more productive time fixing what I broke).

I am aware that this is a dumb "problem", but I would be very grateful for any suggestions nevertheless, since I lose a lot of time to this every time I want to use \phantom.

  • 2
    I think \phantom comes from LaTeX2e (it's like \def, only that one comes from TeX). Maybe try adding %\newcommand{\phantom}{} somewhere in the preamble, just to trick TeXstudio that you defined it (don't know if this will work though and it's no solution, just a workaround). Dec 19, 2016 at 9:08
  • 1
    It's a TeX primitive
    – user30471
    Dec 19, 2016 at 9:13
  • 3
    The \phantom command is defined (and used) in the LaTeX kernel, but it's not documented in the manual. It comes directly from plain TeX. The fact that TeXStudio doesn't know it depends only on TeXStudio; update its list of known commands. On the other hand, you shouldn't be using \phantom very much in a document: if you do, then it's probably high time for defining a personal macro.
    – egreg
    Dec 19, 2016 at 9:25
  • 4
    @Andrew it's not a primitive, it's a macro defined in plain tex and (with a slightly different definition) in latex Dec 19, 2016 at 9:34
  • 1
    @DavidCarlisle Oops. Thanks for the correction.
    – user30471
    Dec 20, 2016 at 3:18

1 Answer 1


TeXstudio has a strange behavior with auto-completion: it does auto-suggestion and completion at the same time. It is frustrating to me as well but you can press ESC button at the end of typing to prevent TeXstudio from auto-completing the phrase.

Another solution would be to use TeXMaker (program that TeXstudio was forked from) and create User Tags (menu User->User Tags->Edit tags). Define \phantom as a tag that you can insert by pressing e.g. Shift+F1 (for first user tag).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .