When I autocomplete an environment, I get a red box (which I now know, from this question is called a placeholder.)

content placeholder content placeholder with content

What are these placeholders for, what functionality is associated with them, and what is the intended workflow for using them?

(I think this information is probably all on here somewhere, spread over a series of different questions/answers. But it would be great to have everything in one place and to know I'm not missing anything)

  • Have you read texstudio.sourceforge.net/manual/current/…? Commented Feb 12, 2018 at 14:00
  • @TorbjørnT. That's a useful link, thanks. I'm not certain it covers every piece of functionality associated with placeholders. (For example, it says nothing about pressing Enter to clear them.)
    – LondonRob
    Commented Feb 12, 2018 at 15:15

1 Answer 1


Placeholders are mostly used to indicate arguments when commands are autocompleted: under what conditions these appear can be controlled via cwl files.

By designating where these placeholders go, you will be able to quickly jump from one argument to the next using the keyboard shortcut Ctrl+Left / Right, which is meant to make typesetting your documents more efficient. (Compare this to when there are no placeholders available.)

For example:


When you're done typing the arguments in the placeholders, you can use Ctrl+Shift+K to remove the placeholders (i.e., the boxes in question).

Another useful property of the placeholders (which can be customized, particularly in user macros) is the mirror property. With this, you can set two (or more) placeholders to have the same content. You can see this in action with one of the default keyboard shortcuts in TeXstudio, Ctrl+E, which is a shortcut to create \begin{}/\end{} environments.


Here I use the following keyboard shortcut sequence:

  • Ctrl+E to create the \begin{document} and \end{document}
  • Ctrl + Right to jump to the next placeholder; and enter the document body (highlighting the content placeholder name for easy replacement with my own text)
  • Ctrl+E to create the align/equation environment
  • Ctrl + Right to jump to the next placeholder; and enter the equation environment body
  • Ctrl+Shift+K to remove placeholders.

Such functionalities and properties of the placeholders are made available to the TXS user to use in their own user macros as well. See this answer for an example. (Sorry for the unintentional self-plug--it's easier to find examples from my own previous answers.)

In the same vein: TXS is intelligent enough to highlight the placeholders when your cursor is left on relevant content for a short while. By 'highlight the placeholders', I mean the re-boxing of the commands as seen in the gif. (The actual highlighting of equation, I used the Ctrl+ D shortcut.)

This allows you to (using the properties of placeholders) replace contents in mirrored placeholders quickly and simultaneously (once again, for efficiency purposes).


All other related properties to the 'placeholder' function are stated in the TXS manual, Sect 4.5.1 on Text macros (which I won't elaborate on here).

  • Nice! One learns something everyday (+1). Though I always mess up the use of "Ctrl + Left/Right" for this is somehow built-in in my brain to jump between words and I end up jumping more than desired every time I fill in a bibentry. Still, the feature is very nice indeed overall.
    – gusbrs
    Commented Feb 12, 2018 at 19:15
  • Thank you! :) I don't use the "Ctrl+L/R" too much during typesetting sessions myself as well.
    – Troy
    Commented Feb 12, 2018 at 19:22
  • Wow. I think this is the best answer I've ever seen on this StackExchange...
    – LondonRob
    Commented Feb 14, 2018 at 17:19
  • And today I learned some more: tex.stackexchange.com/q/410484/105447. And got rid of that annoying shortcut in the process! :)
    – gusbrs
    Commented Feb 20, 2018 at 16:31

You must log in to answer this question.

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