DEV Community

Cover image for Let's use LaTeX!

Let's use LaTeX!

nickymarino profile image Nicky Marino Updated on ・2 min read

This post was originally posted on my blog here.

LaTeX is a beautiful documentation system. It's similar to Markdown, but has many more features and is commonly used for academic papers and other publications that require a lot of equations. In this quick how to, we cover how to install LaTeX and use Visual Studio Code as an editor/previewer.

Installing LaTeX

I recommend downloading TeX Live for Windows/Linux, and MacTex for macOS.

Setting up our editor

If you haven't already, install Visual Studio Code and go through a tutorial. Then, we need to install our extension for LaTeX itself. Head over to LaTeX Workshop and click install.

Using LaTeX

Now that we have our editor setup, we can write our first project. All LaTeX documents have a (non-blank) file that ends with .tex, which is the "main" file that has all of the text of the document. Since LaTeX usually generates more files (such as .log, etc.) while building the document, it's recommended that every document you want to write has its own folder.

For starters, create a file named example.tex:

    % General document formatting

% Put your text here
This is starter text.
Enter fullscreen mode Exit fullscreen mode

Press Ctrl-Alt-B to build your project (or use the Command Palette), then Ctrl-Alt-T to view the pdf in a new tab. The end result should look like this:



LaTeX and VSCode are a great combination that you can use to write beautiful reports and papers. Check out a tutorial or two to realize the full experience LaTeX has to offer.

Edit: Fanny recommends another great tutorial as well.
Edit 2: Fixed a tutorial link.

Discussion (21)

Editor guide
fannyvieira profile image

This tutorial can also help:

nickymarino profile image
Nicky Marino Author

Wow that's great! I'll add it.

lucasreeh profile image
Lucas Reeh

If you do not use Latex often and need just to write one paper there are online tools available. I set it up on my machine because I write a lot, but I was trying out and it was a great experience because they have a lot of templates and git support. And no I do not get money to recommend them :D Just think it is a good place for beginners who have problems with the installation ;)

nickymarino profile image
Nicky Marino Author

+1 Overleaf is great! I've recommended it to a few people as well.

oxfist profile image

I strongly suggest using a specialized IDE such as TeXstudio, for me it was the best option (there are a lot!) and simply a delight to use during my college years.

yssybyl profile image
Dr Janet Bastiman

I've loved LaTeX since I first saw it. I've been advocating Pweave for literal programming in my team and trying to get them to use it for automated diagrams too. I'm now delving into the depths of style files to create a PDF that appeases the marketing department for platform to customer automation. I've got a couple of posts already written on diagrams in LaTeX and using other True Type fonts which I'll cross post to here.

Spread the \LaTeX \heartshape :)

citizen428 profile image
Michael Kohl

I treat LaTeX more as a compilation target. For example Emacs' org-mode can export wonderful LaTeX documents, including Beamer presentations etc. Best of both worlds IMHO, you get to write an extremely simple markup language (inline LaTeX is supported though) and Emacs takes care of converting that to LaTeX first and your desired output format later from that.

heikodudzus profile image
Heiko Dudzus

I second that. Org-mode is great. I rarely use LaTeX, these days, but I use org-mode for many things, often exporting via LaTeX to PDF

stealthmusic profile image
Jan Wedel • Edited

It’s probably very powerful, but it won’t replace markdown. I use markdown very often in Sublime with highlighting to just structure some thoughts without ever generating a document from it. Markdown is just some formalized way to structure a text file like humans would do. Latex clearly is not something a human would write.

Now look at you basic example, it’s completely unreadable as source.

For more complex technical documentation I would still probably use Asciidoc.

Then, there are scientific papers. Actually when I did my masters thesis, I wanted to use Latex but I knew I had to use a lot of formulas, pictures and tables. The way to add those to a latex document was overly complex at that time and unreadable in source. So I read a couple of articles about how to handle large documents in Word (yes, I said it) without crashing it. Then I spent some time to create a Layout, styles and add fonts etc to resemble a document that looks like something that Latex would produce. At the end, I was much faster with the formula editor, inline Tables and graphics.

So I don’t think I would ever write Latex as primary source. Some WYSIWYG editor that generates Latex that I could change If I want to.

espoir profile image
Espoir Murhabazi

Thanks a lot , i've used latex for 2 years now for my research paper and all my universities homework, it is a good and awesome tool, my favorite editor is texstudio the other thing i like about latex it is his community, the tex.stackexchange has already answers to any problems you can have with that editor

shreyasminocha profile image
Shreyas Minocha

I'm a fan of lyx, a WYSIWYM(What you see is what you mean) editor for latex.

michie1 profile image

In my experience this is an application you want to use with Docker.

marlysson profile image
Marlysson Silva • Edited

Why do use docker to this..?

michie1 profile image

This is based on my experience a few years ago. I installed Latex from the default Ubuntu repo and it missed a package. Installing the missing package didn't work because it depended on a more recent version of Latex. I installed Latex with the official ISO, but there were some conflicts with the previous installation. I removed the previous installation but I forgot to remove some configuration settings. Possible it's just me, but it was not plugin and play.

Few months ago I needed Latex again and I tried one of the popular public available docker latex container. Besides waiting to download the container it only took me one minute to figure out what I wanted to do, did it and removed the container again.

alex_escalante profile image
Alex Escalante

That's just how I use it nowadays. Look for the image in the Docker Hub!

hoffmann profile image
Peter Hoffmann

I finally managed to write my reply to your article, thank you for the motivation

alex_escalante profile image
Alex Escalante

You can use LaTeX from a Docker container, so you don't have to install anything! It works like a charm…

alex_escalante profile image
Alex Escalante

I've produced novels, poetry books and whatnot using LaTeX. It's quirky and strange, but it gets beautiful results. More people should try it!

pdomingo profile image
Pedro Domingo

I also suggest online platforms like Sharelatex or Overleaf. They work really well and are also really easy to use.

dginev_92 profile image
Deyan Ginev • Edited

You can also try Authorea if you're interested in web-friendly LaTeX with code snippets, data, etc.