This blog post serves as a gentle introduction to LaTeX, the documentation preparation system and docmentation markup language.
This semester I decided to write my reports from my Analysis of Algorithms class in LaTeX. This was not a difficult task to accomplish, it actually made writing these reports easier (and prettier). Before diving into installing LaTeX packages and setting up your first LaTeX document, let us begin by looking into the history of LaTeX.
History behind LaTeX
TeX is a typesetting system written by Donald Knuth in 1978 and is still used for typesetting complex math formulas today. LaTeX is written in TeX and, like Tex, was designed “to allow anybody to produce high-quality books using a reasonably minimal amount of effort, and to provide a system that would give exactly the same results on all computers, at any point in time”.
LaTeX/TeX is still quite popular in academia in areas such as mathematics, sciences, and economics. You may have actually read a few books that were written in LaTeX (and you didn’t even know). But, did you also know you can create beautiful resumes and CVs with LaTeX as well? Excited yet? Let’s begin installing LaTeX on your machine!
On Windows 7/8, download MiKTeX from here.
On Mac OS X, download MacTeX from here.
On *Nix System, just check your distribution’s package manager for “xelatex”.
If you have any issues installing LaTeX, just follow this link for more download instructions.
Setting up your LaTeX file
This is an example from a report I wrote in my Analysis of Algorithms class. Remember that LaTeX can still be used for all kinds of documents (not just computer science reports).
Above is a portion of code that serves as the “header” of your LaTeX document. The header of the page includes the documentclass, packages, specific fonts, etc. The “header” can be extended to include much more than this including custom layouts for various kinds of documents.
You can look here for more information on creating your own .sty files.
Above is the portion of code that makes up the “body” of the LaTeX document. The body is where all the contents of your document are contained. In example below, I have included a Title, Author, and Date Tag (which is created by the \maketitle tag), an Algorithm function and an example table of CPU clock cycle times in Milliseconds.
Compiling your LaTeX file
To compile your LaTeX file to pdf format, run the following command.
If you run into any issues on compilation, first read the compilation error and enter ‘r’ to finish compilations.
You can also use an online LaTeX editor such as WriteLaTeX.com.
Many LaTeX concepts can be learned from the example file, however you can learn way more by just diving into LaTeX (which ultimately helped me the most). Also, I feel as though LaTeX has helped me better structure and think through my reports for class. I hope this post was of some use to you!
Please comment below with any questions or concerns. Thanks again!
Extra: Here is an example of a LaTeX resume.
Lately, I haven’t had very much time to write blog posts and work on the projects that I want to work on. Instead Analysis of Algorithms and undergraduate research has taken a significant portion of my time. However, I did start writing my papers in LaTeX which has actually been a fun experience and pretty easy to learn (and you get pretty reports)! Also, I’ve started to gain in interest in Video Streaming development from the undergradute research project that I am working on. My time management has been out of wack lately too, need to fix this problem. My algorithms class has been kicking my butt, however I’m enjoying the material I am learning - especially dynamic programming (very interesting concept). You can find the algorithm projects that I have been working on here.
This post is for readers/friends who want to get started on their own blog, but don’t know where to start.
Over the years, I’ve had a countless number of conversations with programmer friends about how awesome Jekyll is and how awesome Github is for letting you host your own website/blog for free. However, the usual responses from friends include:
- "Jekyll sounds too difficult to setup and maintain."
- "what is git?"
- "why not wordpress?"
Jekyll is a static page generator written in Ruby. In this post, we’ll be using Jekyll to generate our blog. Also, with a few commands in terminal, you’ll have a working blog up in less than a few minutes (depending on your connection speeds). Here is a link to the Jekyll website.
git is a open source version control system designed for small and large projects. Many developers/companies are using and supporting git everyday. I myself use git everyday for various small and large projects that I am working on. In this post, I will not get into the specifics of how to use git, however you can learn more about that by youtubing “git tutorials” or checking out this link.
Github is a website that allows you to contribute, share, and show off your git repositories to the world. Also, Github offers a free web hosting service called Github Pages, which is what you are going to use to get your Jekyll-based blog running on Github. Bonus: here is a link by Tom Preston-Werner called the Git Parable.
I’ll get to why I don’t recommend going the wordpress way at the conclusion of my post.
Don’t be afraid of what comes next. I’m going to try and explain everything as clearly as I can in this post!
Getting started with Jekyll
- Your machine is using a unix/linux operating system.
- You are used to using a command line interface.
- You have ruby installed on your machine.
Check to see that you have ruby gems installed on your machine. You can check by finding the verion number typing using the following command and pressing enter in Terminal.
If you have ruby gems installed on your computer, please skip to Part three. If you don’t have ruby gems (no version number appeared) then, please read Part two.
Install ruby gems by going to their website and downloading the TGZ file. After downloading, change directory in terminal to designated download folder. Next, copy and paste these command into terminal and press enter:
Ruby gems should now be installed on your machine, check by entering the following command:
You should now see a version number, which will prepare you for Part three.
Part Three (Installing Jekyll)
Install Jekyll on your machine by entering this command in terminal (within a desired directory):
Next, change your directory to your documents (or where you please). Then type the following and press enter:
This will create a jekyll folder called my-site. Next, change directory to my-site, then enter the following command:
This will generate the static files from that directory into a working website folder called _site and will start a ruby webserver pointing to that folder.
Next, go to your web-browser and type “localhost:4000” and press enter.
You should be staring at what the above example displays. Congratulations! This might just be your first jekyll-based website!
If you have any problems setting up Jekyll, read the documentation page here!
Getting started with git
You’re going to need git on your machine. If you already have git on your machine then you should skip to the Important Git Commands section.
For OSX users, go to this link to download git directly from the git website.
For Linux users, in terminal enter:
First, make sure you update and upgrade your packages to get the latest version of git!
The three git commands you will primarily use for “publishing” your website/blog:
Again, I will not be going over how git works because that is a blog post in itself. Take some time learning git before getting started with Github (it won’t take long to understand how git works)!
Check out this link for more information on using git.
My biggest reason against using a wordpress as a blog platform for a software developer is that its just not modern platform anymore. Whereas with Jekyll, you learn alot about modern (important) technologies like git and github along the way (as well as a little Ruby). I highly recommend that you pursue learning more about web design and development regardless of your current title.
Feel free to send me an email if I have made any mistakes in this post! Thanks for reading!
Also, check out this link for more information on using the free website hosting service, Github Pages!
Follow this link to try out Jekyll without touching the commandline!