I have a Macro in TexStudio that does the following:
%SCRIPT
txt = cursor.selectedText()
editor.write("\\underbrace{"+txt+"}_{}")
cursor.clearSelection()
That is I select a text, it will be filled in between the first two brackets of underbrace. I would like to add that my cursor should be in the between the second pair of brackets, however the solutions I found so far in the internet have not helped. Does anybody have an idea?
Great thanks!
Best Answer
Found a solution:
How it works is the following: I save what I selected with my cursor in txt. Then I go ahead and write "\underbrace{txt}_{}", where txt will be substituted with what I selected before. The cursor will be afterwards at the end, therefore going one step to the left will land my cursor inside the two curly brackets.