Lessons in LaTeX — Getting started on Windows

Introduction

If you’ve ever become frustrated with image placement in Microsoft Word, you may have looked for alternative text editors to help you create that beautiful PDF you’ve always dreamed of! If so, there’s a good chance you’ve stumbled upon LaTeX. If you’re not familiar with the installation, coding language, or other LaTeX caveats, it can seem like a very daunting task to get started! I know it was for me.

So in this series, we’ll cover a number of the basics of getting started and other “How To” tutorials with LaTeX, all from scratch! First and foremost, we’ll need to start with getting LaTeX on our system. Like any other software development effort, we’re going to need two things: (1) a scripting interface, and (2) a compiler. In previous software lessons, we’ve used interfaces like Visual Studio Code and a Docker compiler to Dockerize operating systems, databases, and other similar things. In this tutorial, we have one solution to rule them all — MiKTeX actually gives us both our LaTeX compiler as well as our scripting interface (TeXWorks)!

Grabbing the compiler: MiKTeX

The LaTeX compiler is fairly straight forward to install. For simplicity (or a TL;DR) the steps are explicitly listed below for a Windows operating system:

  • Direct your web browser to the MiKTeX website.
  • Download your preferred version of MiKTeX.
  • Once downloaded, double-click the installer and install MiKTeX.

Starting a document

For the sake of argument, let’s say we want to write a book; this can be anything from a science fiction novel to a technical report to an operating manual! Once our MiKTeX installation has finished, we can open TeXWorks by going to the Windows Start menu, which will list TeXWorks at the very top under “Recently Added”. Opening the software, we’re greeted with a blank screen. Let’s try to open a Book template by clicking on File -> New from Template. Browsing the current available options, it seems there is no Book option! Sad panda.

Ingesting new LaTeX templates

So we turn to the next best resource, The Google. By opening a web browser and doing a Google search for “texworks book template”, the first option that pops up is a link to the LaTeX templates website; in our case, it auto-forwards us to the Books page on the website. From here, we can click “View Template Information” under “The Legrand Orange Book”, which takes us to a page where we can view the various page layouts and other information about the template.

At the very bottom, we have options to open or download the template. Since we’re not using Overleaf (which is a great online resource, by the way!), we can Download the Template Code. Clicking on this link begins a download of a ZIP file titled “LaTeXTemplates_legrand-orange-book_v3.1”. Once this file is downloaded, go ahead and copy its contents to an empty folder on your desktop titled “my book”. These steps are roughly outlined in the mash-up screenshot below:

Let’s take a look at the files we’ve just copied into our Desktop folder, “my book” — notice how our main LaTeX file (“main”) is auto-recognized as a LaTeX file type! We know this because the graphical thumbnail just to it’s left has an associated purple graphic next to it, the same graphic we recognize from installing MiKTeX!

Opening our first book file

Since everything seems to be set up for us, let’s double-click on the “main” LaTeX file in our “my book” folder. Doing so brings up a file full of LaTeX code — some of it may seem readable, but other tags are things we’ll have to leaf through at a later date. For now, though, it’s enough for us to know that we’ll need to start writing our book in LaTeX has been included, referenced, or coded within this file. Within the code interface, we see a little green arrow in the upper left corner — this is the arrow we click to tell MiKTeX to begin compiling the code in our main.tex file. Go ahead and click this arrow, and let’s wait for the PDF to be generated. Ideally, it should look like the images shown on the LaTeX template page we arrived at earlier.

Once the code begins compiling, we see status updates scrolling at the bottom of our screen. After a while, the updates are removed from our view, and our generated PDF file is visible! In the graphic below, the left panel shows the LaTeX code in our main.tex file; MiKTeX was able to take that code and generate the PDF shown on the right-side panel. We’ve made our first book!

From here, all that’s really left to do is edit the details: title, images, text, and adding references, chapters, sections, etc. to suit our needs! But this has been a huge first step in getting started with LaTeX using the all-in-one MiKTeX editor. Now get to writing!

Conclusion

In this tutorial, we took a very broad look at LaTeX. We looked at installation steps, downloading a new LaTeX layout template, and we generated our very first PDF file from LaTeX code! Of course, this is not all there is to LaTeX — we still have many things to cover, like assigning images to a folder, obtaining and using different packages, and modifying our book to fit exactly the look we are going for. We can also take a look at the online LaTeX editor, Overleaf, and what advantages it offers over a local installation of the LaTeX compiler.

Join me next time as we begin to make this book really feel like it’s something we are creating! In our next post, we’ll change image throughout the book and make the font formats more consistent throughout.

For now, I hope this has been helpful in getting you started with writing LaTeX documents — something that was always a daunting hurdle for me. If you found this content helpful or you’d like to see more, please feel free to visit my full list of articles, visit my homepage, or sign up for automatic updates! Thank you for dropping by, I cannot wait to see where this takes us!

Get new content delivered directly to your inbox.

%d bloggers like this: