LaTeX forum ⇒ Others ⇒ In TexStudio, how to define macro for a command with text

Information and discussion about other LaTeX editors not listed above
ali8
Posts: 2
Joined: Tue May 13, 2014 6:10 pm

In TexStudio, how to define macro for a command with text

Hi,

I am writing my text in Arabic, but sometimes I have English sentences. Those need to be done like this:

\textenglish{sample text here}

I was able to define new macro for that command, but I want to go a step further, I want that when I select a text, and press the macro shortcut, I want the text to be entered into that command, and NOT overwritten. This actually works with the \$..\$ environment/command shortcut provided by default in TexStudio.

Any idea?

mnsao
Posts: 1
Joined: Thu Jul 31, 2014 1:16 pm
You can use

%< ... %>

in macros, whereas the ... stand for the default input at that place. If you then mark some text and use the macro, the marked text is inserted there instead of the default.