-
-
Notifications
You must be signed in to change notification settings - Fork 182
text editor textnate
TextMate uses a "Bundle" system to handle LaTeX. The key advantage here is the LaTeX Bundle, which is pre-installed but highly customizable through environment variables.
- macOS: TextMate is Mac-exclusive.
-
MacTeX: The standard distribution for Mac. Ensure it is installed so
pdflatexandlatexmkare in your path. -
Perl: Pre-installed on macOS, required for
latexmk.
TextMate’s LaTeX bundle is designed to detect and use latexmk automatically if configured correctly. Instead of changing deep internal settings, you use Environment Variables.
- Open TextMate > Settings (or
Cmd + ,). - Go to the Variables tab.
- Ensure the following variables are set (click the + to add):
-
PATH: Make sure this includes your TeX distribution path (usually
/Library/TeX/texbin:/usr/local/bin:$PATH). -
TM_LATEX_VIEWER: Set this to
Skimif you use the Skim PDF reader (highly recommended for its sync features), or leave it blank to use the built-in TextMate viewer. -
TM_LATEX_COMPILER: Set this to
latexmk. This tells the bundle to use the automation engine instead of a single-pass compiler.
Press Cmd + R.
Because you set TM_LATEX_COMPILER to latexmk, TextMate will:
- Run
pdflatex. - Check for missing citations or references.
- Run
bibtexorbiberautomatically. - Re-run until the document is perfect.
If your project has multiple files (e.g., chapters/intro.tex), you don't want to compile the chapter file alone.
- At the top of your chapter file, add this line:
%!TEX root = ../main.tex - TextMate will now always compile
main.texeven when you are editing a sub-file.
-
Cmd + {: Wraps the current word in a\begin{env} ... \end{env}block. -
Ctrl + Shift + W: Wraps selection in a command (e.g.,\textbf{}). -
Esc: Triggers "Completion." If you type\equand hitEsc, it will cycle throughequation,eqnarray, etc.
| Tool | Purpose |
|---|---|
| Skim | A lightweight PDF reader that supports Forward and Backward Search with TextMate. In Skim settings, go to Sync and select "TextMate." |
latexindent |
If you want to auto-format your code, install this via MacTeX. You can trigger it in TextMate by searching for the "Tidy" command in the Bundle menu. |
TextMate uses the native macOS spell checker.
- To enable: Edit > Spelling and Grammar > Check Spelling While Typing.
-
Pro Tip: Because TextMate is "Scope Aware," it is smart enough not to spell-check your LaTeX commands (like
\includegraphics), only the actual text content.
Note on LuaLaTeX/XeLaTeX: If you need to use a specific engine via
latexmk, create a file named.latexmkrcin your project folder with the line$pdf_mode = 4;(for LuaLaTeX) or$pdf_mode = 5;(for XeLaTeX). TextMate will respect this file automatically.
Thanks for using this template and for contributing with your suggestions. We really appreciate it. If you may, please don't send us emails directly. Post your question in the GitHub Discussions page or the Facebook Group and you will get your answer there — perhaps even faster.