I have a Tex file that I need to edit while somehow keeping the original words and sentences highlighted. To do this, I am going to cross out the part of the original text that I replace with my own words. The command \st{TEXT} in the package soul seems to do the job. I'm looking for a way to define a macro in TeXstudio such that by selecting the text, the cross out command encapsulate the text, i.e. \st{THE_SELECTED_TEXT}. I am not familiar with macro programming in TeXstudio.

  • 2
    Does it need to be a TeXstudio macro? TeXstudio kind of can this on its own if the macro \st is known for it. If you select text and then type \st and auto-complete it TeXstudio automatically places the selected text as an argument to \st. The only problem is that \st may not properly recognized by TeXstudio. The soul.cwl (the auto-complete configuration file) lists it as a parameter-less macro so you might either change that or use your own soul-custom.cwl file or actually simply ad \st{arg} as a macro. Also, TeXstudio scans \newcommand and `\providecommand´ (dummy) entries. Commented Jul 3, 2013 at 15:40
  • I check-marked soul.cwl in the configuration of TeXstudio, but it didn't help me. Thanks for your comment. It solved my problem
    – Rasoul
    Commented Jul 3, 2013 at 16:08

2 Answers 2


Here is how you'd do it with a script:

enter image description here


I have found another quite simple solution. Say, if you have just typed $AB$, and then you want to surround AB by \overline{}. You can select the text AB and then directly type "ov"(you may, of course, find that the word AB is deleted, but don't worry!) and press "Tab", then you can get what you want.

The macro:

enter image description here

You must log in to answer this question.

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