YouTube YouTube Twitter Github /RSS PayPal PayPal

There are so many ways to do it!

If you're just beginning to use LaTeX, or haven't even started yet, it might seem like there are a lot of options for compiling your documents. That's eventually going to be great for you, because it allows you to hone in on the perfect setup for you, but at the beginning it can be daunting. Here are a couple of options for the kinds of ways you can do it. I recommend you to go with what's easiest for you at the beginning.

Option 1: Writing with an online service

You can compile your TeX code on your own computer, or in a cloud computing service. I strongly recommend eventually doing it on your own machine, but using an easy cloud-like service like ShareLaTeX could be extremely convenient for new users (I began writing LaTeX with ShareLaTeX).

This and sites like it allow you to easily write code in one panel and see a preview in another; you will not need to install anything on your computer.

Option 2: Writing offline on your own computer

This is the better option in my opinion, because you can create a custom setup to fit your own needs and don't need to entrust your files to a foreign server. There are many options here, so installation can be compilated at first!

Installing packages

I strongly recommend not just installing the TeX compiler, but all TeX packages for your own convenience, so you have everything offline already. This will be a big download at first, but nowadays the storage space should be minimal.

On GNU/Linux

On Debian-based distros (Ubuntu/Linux Mint):

$ sudo apt-get install texlive-full

For Arch-based distros (Manjaro, Parabola, Antergos):

$ sudo pacman -S texlive-most texlive-lang

Note that some minor distros will use tlmgr to install TeX packages instead of the main repositories.

On Windows

Download and install the packages here. (Choose the net install to be able to install all packages.)

On MacOS

Download and install the packages here.

How to compile LaTeX offline

Generally, you can use the pdflatex command in your terminal to compile a .tex file into a .pdf. You can do think manually or using another program to make this streamlined for you.

vim

For vim users, there are several ways to automatically compile LaTeX code, but my favorite by far is the vim-live-latex-preview originally put together Kevin Klement.

I'll run you through installing it since people have asked. First make sure you have mupdf, xdotool and git installed. Then, you should install a vim add-on manager; I use Pathogen, so here are the directions for installing by it.

Note: both Pathogen and the vim-live-latex-preview are available in the AUR, I belive, so Arch users can skip these steps if they install it that way.

First, if you don't have vim-pathogen in your distro's repository, you can easily install it with these commands:

mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

Also make sure you have the following lines in your ~/.vimrc:

execute pathogen#infect()
syntax on
filetype plugin indent on

Then download the actual vim-live-latex-preview package here.

git clone https://github.com/ying17zi/vim-live-latex-preview.git
mv vim-live-latex-preview ~/.vim/bundle/

You may also need to add ~/.vim/bundle/vim-live-latex-preview/bin to your PATH in /etc/profile. This package uses biber to compile references, so be sure to have biber installed and use compatible syntax.

After that, the package should be installed and can easily be run whenever vim opens a .tex file; simply press the shortcut \o to begin the auto-compile. Check the documentation for all the bells and whistles!

emacs

Emacs has the AUCTeX package for compiling LaTeX.

TeXmaker

TeXMaker is one of the more common LaTeX creation programs for people who don't use crazy customizable text editors like vim or emacs. This might be best for newbies wanting to compile offline.

Lyx

Lyx is a popular way to write LaTeX in a way which is more WYSIWYG (what you see is what you get). It's not my style, so I don't vouch for it personally, but I know several people who really like it.