Does anybody know how to change the template for "inline math mode"? The default is when you press Ctrl + Shift + M is creates the following $   $ (two dollar signs a three spaces between them an places the cursor in the middle).

I would like to change it to $$ (two dollar signs an no spaces in between and place the cursor in the middle).

Any ideas?

  • 2
    If you don't mind compiling the source code of texstudio yourself, you can change the template. When you've downloaded the source with hg clone http://hg.code.sf.net/p/texstudio/hg texstudio-hg, you edit the file uiconfig.xml, search for a line that contains the word mathmode, change in that line $ %| $ to $%|$, then make; make install. Afterwards it's not possible to change the template anymore, as the XML file is "compiled" into a CPP file with the Qt resource compiler and later on compiled and linked into the final executable. – Elmar Zander Jan 30 '17 at 16:51

I don’t know if it is possible to change the predefined template, but you can add a user macro and assign a shortcut to it. To create the script go to Macros > edit macros (I got only the german version, but it should be named equally):

edit macros

and add a new “normal” script (mine is called “Inlinemathe”):


new script

you can replace math by whatever you want it is the text shown, when triggering the script. After creating the new script you must assign a short cut in Preferences > Short cuts > Macros

assign shortcut

You can read more about user macros and scripts in the manual, which is available via the Help menu …

  • Changing the predefined template is currently not possible. – Tim Hoffmann Jul 30 '13 at 17:02

I used to follow Tobi's method for replacing the inline-math mode, until I found out how I can configure the default mapping. It's very easy actually :)

  1. Go to Options Menu > Tick "Show Advanced Options" at the bottom (inline with OK and Cancel buttons).
  2. In Texstudio Options list on the left, choose Menus.
  3. Go to Math (3rd top-level entry) > Inline math mode.
  4. Replace the command with this (just remove the space on both sides): $%|$

  5. That's it. The %| is used to denote that the cursor will be placed there :)

I am late to the party, but hope it helps someone. Thank you.

  • Hey @Akhilesh, I cannot verify your answer [no longer using that editor], but thanks for contributing :) Welcome to the community! – Arash Oct 3 '18 at 21:20
  • Sure. I should thank you for asking this question rather, since I remember consulting this page when I first had this problem :) – Akhilesh Siddhanti Oct 4 '18 at 14:52
  • @AkhileshSiddhanti: I have been looking for the exactly same thing and Menus would have been most likely the last place I would have looked into for this issue. Thank you for posting this, it works like a charm (of course) :-) +1 from me. – M.G. Oct 22 '18 at 21:00
  • I'm glad it helped you :) – Akhilesh Siddhanti Oct 25 '18 at 9:32

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.