You probably know that if you highlight text with cursor, and push Ctrl+B, you can get

\textbf{highlighted text}

instead of what was before:

highlighted text

I would like to create a keyboard shortcut similarly for the following:

\colorbox{pink}{highlighted text}

I am using TeXStudio.

  • Are TeXstudio's macros described in my answer what you were looking for?
    – schoekling
    Apr 11, 2021 at 15:06

1 Answer 1


I think the closest thing you can do is to set up a macro (Macros>Edit Macros...).

You can either select one of several keyboard shortcuts (here Ctrl+M+C),
or an abbreviation that, when you type it like a regular command, shows up in the auto-completion window marked with '(Usertag)'.

Highlighted text will be inserted at the marker for curser position %|.

enter image description here

enter image description here

You must log in to answer this question.

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