There are a lot of front-end editors for writing LaTeX source, for example, Texmaker, TeXstudio, WinEdt. I have used TeXstudio for a while, but its user interface is a little dull. So I decided to give Sublime Text a shot. In this post, I want to share the configurations necessary to write and compile LaTeX source code and to preview the produced PDF files.
Choose a TeX distribution#
$\TeX$ is like a programming language, you need a compiler and other necessary components such as packages and classes to compile your source files. For Windows, TeX Live is an excellent choice. You can download it here. When installing TeX Live, you can choose the full scheme, which will install everything you need on your computer.
The full installation of TeX Live may take more than half of an hour depending
on various factors. Stay patient. After installation, you should add TeX Live
executables to your system PATH
. On my system, the directory where these
executables reside is D:\texlive\2017\bin\win32
.
Restarting your computer may be required for PATH
change to take effect.
Install the LaTeXTools package#
Now, you should install the LaTeXTools package, which provides a lot of functionalities for writing and compiling LaTeX files. If you have installed package control, you can install this package using package control.
Install Sumatra PDF reader#
To preview the produced PDF files, I recommend using the well-known light-weight Sumatra PDF reader. After install, we should also set its path properly.
Check your system#
After all these installations and settings, we can use the built-in function of LaTexTools to check our system. To check if there are any issues, follow the image below on how to do it:
The result of Check System
is shown below:
If there are no issues found, you can now write and compile your LaTeX source files.
Write and compile LaTeX source files#
Use the shortcut key Ctrl+B to compile the file. You may be prompted to choose a builder. Just choose the basic builder.
Other packages to install#
There are a few packages designed for use with LaTeXTools, for example, LaTex-cwl and LaTeXYZ. You should install them to enhance your experience of writing LaTeX in Sublime Text.
Configure inverse search for PDF files#
Inverse search is a handy
feature. First, compile any tex files and open it with Sumatra PDF reader. Then
go to Settings -> Options
. In the inverse search
part, use the following
setting:
"D:\Program Files\Sublime Text 3\sublime_text.exe" "%f:%l"
In the above setting, change the directory of Sublime Text executable to its actual location on your system.
More questions?#
The LaTeXTools package has an online documentation, which is well written. You can read it here.