I have been trying to create the following macro in TeXStudio(seen in the picture below):


but when I activate it in my tex file I get this:

(cursor here) 

with no tab before the cursor. How can I create the macro to include the tab before the cursor. Also, are there any in depth articles/tutorials regarding macros in TeXstudio?

picture of macro example

1 Answer 1


You can achieve this by using a little bit of Javascript (more detail can be found here):

cursor.movePosition(1, cursorEnums.PreviousLine, cursorEnums.MoveAnchor);


enter image description here

  • Ok, thanks! So I guess there is no way to do it with a simple text replace (not that it matters much, but do you know why the text macro editor does not include spacing)? Also, where would be a good place to start learning Java Script for the sole purpose of making advanced macros (assuming a fairly strong programming/scripting background?
    – walwb
    Commented Dec 23, 2015 at 23:59
  • @walwb: I don't think I can answer that, the only reason I "learn" Javascript was in fact that to write some fairly simple scripts in TeXstudio. All I did is Googling around.
    – Francis
    Commented Dec 24, 2015 at 0:04

You must log in to answer this question.

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