0

I'm using TeXStudio with MikTeX distribution. Is there a way to automatically add the curly brackets at the end of a command? Let me explain using an example.

Suppose I'm typing in math-mode \Gamma TM. After I've typed the first 3 letters, the auto-completion shows me the suggestion \Gamma and I press enter. I'd like to have the curly brackets added at the automatically. Because every time I forget to add a space after the command and it becomes \GammaTM. Instead I'd like to have \Gamma{} once I've pressed enter after the first 3 letters, so that I can just keep typing and get \Gamma{}TM.

Is there any setting that could do this? For example, if I use some command that necessarily takes arguments (say \frac{}{}), the IDE automatically adds the curly brackets with placeholders within them. I'd like this to happen for commands that do not take arguments (with possibly empty placeholders). Any help is appreciated.

5
  • I added an answer without thinking enough (defining a command that contained the {})... and did not solve the problem.... So removed it...
    – koleygr
    Jan 17, 2018 at 7:21
  • No do not do that in math mode, it will mess up the spacing. (I do not know texstudio, but if you want it to add anything, make it add a space) Jan 17, 2018 at 8:07
  • @DavidCarlisle That would work too! So, is there any way to automatically add a space after every auto-completed command upon pressing the enter?
    – ChesterX
    Jan 17, 2018 at 8:11
  • @koleygr Are you suggesting to define new commands? But that would only work for the specific ones that I define. I'd like to have this for every command!
    – ChesterX
    Jan 17, 2018 at 8:13
  • @ChesterX as I say I do not know texstudio, someone may answer, but definitely do not routinely add {} in math mode Jan 17, 2018 at 9:02

1 Answer 1

2

I can not help with texstudio configuration, but in any editor, in math mode you only want to add {} where you really need to enter an empty math atom. Do not just routinely add it after command names, as it will negatively impact on the spacing.

A simple example:

enter image description here

\documentclass{article}

\begin{document}

$1\colon \times \rightarrow \times$

$2\colon{} \times{} \rightarrow{} \times{}  $


\end{document}

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.