If you are a developer, researcher or student, then you can’t avoid using Latex. It allows to develop beautifully written articles in no time. But most of the editors are chunky and slow. So i tried “LaTeXTools” plugin with Sublime Text. As adoption of ST is rocket high, i was intrigued to use ST for my work in Latex. Here is how i set up and started using LaTeXTools plugin with ST.
- Use Package Control feature in ST to install LaTeXTools plugin. If package control is not installed in ST, then refer to this page.
- To access package control in ST “command palette” is used. Open the command palette by pressing ctrl+shift+p (Win, Linux) or cmd+shift+p (OS X). If you type “Package Control: Install Package” in command palette, it displays a list of packages to install. Type LaTeXTools to filter the LaTeXTools plugin and select it to install the plugin in ST. The progress of installation will be displayed in the status bar ( at the bottom of the window) of ST.
- Once the plugin is installed, it needs to be configured. It can be done by two ways such as:
- From menu: “
Preferences > Package Settings > LaTeXTools > Reconfigure and migrate settings
- From command palette: “LaTeXTools: Reconfigure and migrate settings”
- From menu: “
This will create a configuration file, LaTeXTools.sublime-settings, in the User directory of ST. At this point the LaTeXTools plugin is installed and ready to use. The next step is to configure a pdf tool to work with ST. Skim PDF previewer (OSX), Sumatra PDF previewer (Windows) and Evince PDF viewer (Linux) are tested and verified PDF tools which can be used with ST. Here i will explain the configuration details for OSX using Skim.
- Download and install Skim here.
- Open Skim. Go to “Preferences > Sync tab” :
- uncheck the “Check for file changes” option.
- choose the Sublime Text 2 or Sublme Text 3 preset depending upon your ST version.
This will enable inverse search option for LaTeXTools & Skim. Make sure that you are using the latest version of Skim.
- Now verify if the LaTeXTools path setting is proper. Open user settings file “LaTeX.sublime-settings”. Search for the section named “Platform Settings”. Now under “Platform Settings” look for OSX. Here you need to verify if the
"texpath"setting is correct and include “
- To open the “LaTeX.sublime-settings” file go to “Preference > Package Settings > LaTeXTools > Settings – User”.
- Finally, edit the file
Userdirectory to make sure that the configuration reflects your preferred TeX distribution. Open the file and scroll down to the section titled “Platform settings.” Look at the block for your OS, namely
"osx". Within that block, verify that the
"texpath"setting is correct. Note that
Now we have installed both LaTeXTools and Skim and configured them so that ST can utilize Skim. If you have Latex tools installed on you Mac, then you can directly go ahead and work on any Tex files using ST. If you don’t have Latex tools installed then follow the below instructions. I know only about the MacTeX distribution available for Mac.
- Download and install MacTeX from here. It is a huge distribution of around 2.4 G. If you don’t want to install the complete package follow the next step.
- You can install only the required packages to be able to work with ST & LaTeXTools such as BasicTeX package & latexmk utility. BasicTeX can be downloaded and installed from here. “latexmk” utility needs to be installed separately as it is not included under BasicTeX. Install “latexmk” from terminal as:
- sudo tlmgr install latexmk
Now let’s see how to use LaTeXTools to work with tex file in ST.
- Create a new tex file using a template. You can refer to various templates here.
- Save the file before compiling. Now compile the file using ‘cmd + b’ key combination. You can see the results at the bottom of the ST window. This will also open the pdf in another window if the compilation is successful.
- LaTeXTools features are triggered using
Ctrl+l(Windows, Linux) or
Cmd+l(OS X), followed by corresponding key or key combination. The key combination to compile is only ‘cmd + l’ which is the standard key binding for ST.
- You can do forward search which means jump to a position in the PDF file corresponding to the current curser position. Use ‘(cmd + l) + j’ i.e. press ‘cmd+l’ and then release both keys and press ‘j’ quickly.
- You can do inverse search also which means jump to a position in source tex file in ST window corresponding to the curser position in PDF window. cmd+shift+click inverse search. It can be done by ‘
CMD+Shift+Click'in Skim (OSX), double-clicking in Sumatra (Windows), or using ‘
Ctrl+click'in Evince (Linux).
These are the basic key bindings to start with LaTeXTools in ST. You can refer to the LaTeXTools github page for more keybindings here. Happy hunting!!! Hope this information will help you all. Provide your valuable feedback.
2 thoughts on “Work with Latex in Sublime Text”
[…] The setup of LaTexTools is the most complex part of this enterprise but fortunately, the developers walk you through the whole process: https://latextools.readthedocs.io/en/latest/install/ . You can see the overview of the package on github: https://github.com/SublimeText/LaTeXTools. It can be a little long process, but worth the effort. (a more step-by-step tutorial is here: https://withgyanesh.wordpress.com/2015/05/22/latex-st/) […]