In TeXShop I create an equation environment by typing the word "equation" and then pressing CMD-B. This results in the following, where "|" is my cursor:


The cursor is initially indented by a single space. I would much rather it be indented by a tab character. (Or even better, four spaces, as long as the tab key could also be reconfigured to insert four spaces.)

Is there a way to change this behaviour in the way I would like? I couldn't find anything about it in the preferences.

  • Avoid TAB in TeX documents.
    – egreg
    Jul 26, 2022 at 16:48
  • @egreg just out of curiosity, why? (The only reason for wanting to use tab characters is that, as far as I can tell, the tab key cannot be configured to insert spaces in TeXShop.)
    – N. Virgo
    Jul 27, 2022 at 1:37
  • 30+ year experience…
    – egreg
    Jul 27, 2022 at 8:44

2 Answers 2


There is a better way to do this using TeXShop's Command Completion and the Command Completion file can easily be edited. Using Command Completion you would enter


at the beginning of a line and then press the trigger key (ESC by default) to get


where |•| is a selected `bullet' (called a Mark here). Then you can simply type the equation and that Mark will be replaced by youe text. There is a command that jumps to the next bullet and selects it (Ctl-Cmd-F) so you can easily get to the end of the environment. Please see the Help->TeXShop Tips and Tricks document for more information.

Oh... the Command Completion file can be edited so you can can change the formatting of the commands to your taste.


A self-answer: this is easy to achieve by editing the AppleScript. Go to Macros -> Open Macro Editor and then look for "Insert Begin/End". Look for the line

set environment to begin_environment & linefeed & " " & linefeed & end_environment

about half way through and change it to

set environment to begin_environment & linefeed & "\t" & linefeed & end_environment

and that's it.

However, the macro still doesn't respect the indentation of any surrounding environment. Fixing that is a separate question that I've asked at Getting TeXShop to indent begin/end properly.

You must log in to answer this question.

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