LaTeX for Beginners in 6 Minutes

LaTeX for Beginners in 6 Minutes


Master the 20% of LaTeX that powers 80% of your documents.

Whether you are a student, researcher, professionals, or someone who recently came across LaTeX and thought of using it but feel confused about how and where to begin, this short guide will help you understand the basics.

At the end of this tutorial, you’ll be building a simple resume.

As a bonus, I will provide you with the template that we create in this tutorial for reference.



Why LaTeX and why not MS Word?

Before understanding LaTeX, let me begin with why LaTeX and why not traditional word processors like MS Word.

When Donald Knuth, a computer scientist and mathematician, was writing his book The Art of Computer Programming, he became unhappy with the poor-quality typesetting. To solve this, he developed the TeX typesetting system, on top of which LaTeX was later developed.

Reading this, you might already have figured out when LaTeX is useful, right? It’s for those who usually need more than just plain text in their documents – like mathematical expressions, symbols, tables, and technical formatting.

Still wondering, “These things can also be done in word processors like MS Word, so why use LaTeX?”

The key difference is how LaTeX and MS Word handle documents:

  • Word processors like MS Word focus on appearance and what you see on the screen, requiring you to manually adjust the formatting for equations and tables. This manual formatting can be time consuming and inconsistent.

  • In contrast, LaTeX focuses on content. Instead of worrying about how your document looks while you’re typing, you define the structure and formatting of your document with simple markup commands, which LaTeX then uses to create a formatted document with consistent styling.

LaTeX is a powerful and efficient tool for creating technical documents, offering cleaner and more consistent results than word processors.

Now excited to get started with LaTeX? Let’s get into it.



LaTeX Hands-On Guide

For now, we will use online LaTeX editor Overleaf, which is so easy to use. No installation is needed, just a simple login and you’re good to go.

  1. Log in to Overleaf.
  2. Click Create a New Project and select Blank Project.

You’ll see a code editor. It might look overwhelming at first, but don’t worry – just delete the existing code and paste the following:

documentclass{article}
usepackage{graphicx} % Required for inserting images

begin{document}

end{document}
Enter fullscreen mode

Exit fullscreen mode

Now, lets start creating a resume by understanding what these commands actually do.

Note: You need to click the Recompile button each time you make changes to the code, unless you enable auto compile from the dropdown next to this button.



Document Structure:

Every LaTeX file must include the following commands, which define where the actual content of your document begins and ends:

begin{document}
% Contents here...
end{document}
Enter fullscreen mode

Exit fullscreen mode

Usually we write the command documentclass{article} at the top of our file.

  • article is used for articles, short reports, and small papers.
  • It can be replaced with some other document class options, like report (for longer documents with chapters), book (for books), or beamer(for presentations) depending upon context. For now, we will leave it as article.

If you want to use any additional packages, they are usually placed right below the documentclass{...} command, in the form of usepackage{package_name}.
We’ll leave the graphicx package (used for inserting images) as is for now, since we’ll be adding a cute photo of yours to the resume later.



Basic Commands:

Lets understand a few more commands, which are widely used every time you’re working with LaTeX. First, copy the following code and paste it just below the begin{document} command and we’ll see it line by line:

% Name and Contact Info
begin{center}
    {LARGE textbf{Your Name}} \
    vspace{0.2cm}
    Email: mail.me@example.com | Phone: +123 456 7890
end{center}
Enter fullscreen mode

Exit fullscreen mode

  • % you see in first line is how we add comment. Every texts starting with % will be ignored during compilation. For example, Name and Contact Info is a comment that helps us identify the purpose of the section in the code.

  • begin{…} and end{…} are used to mark the start and end of environments. Environment is nothing, but a block of code that is responsible for a specific formatting to the content inside it. Here, we have used center environment, so text inside the begin{center} and end{center} will be centered.

  • We used LARGE command to make the name appear larger. LaTeX allows us to control the size of text using commands like tiny, small, huge, Large, LARGE, etc. You can explore these by replacing LARGE with any of the other size commands to adjust the text size.

  • For text formatting, we have used textbf{Your Name}. We can also use others like textit{italic text}, underline{underlined text}, which you can easily guess what these commands are doing.

  • \, vspace{…}, hspace{…} are widely used commands for spacing. \ just creates a line break i.e. text following it will start on a new line. vspace{…} and hspace{…} as name suggests, are used to add extra vertical space and horizontal space, respectively. For example, vspace{0.2cm} adds 0.2 cm of vertical space.

Clearly you can see, we have combined two commands; LARGE and textbf{Your Name} as {LARGE textbf{Your Name}}, to create a larger and bold version of “Your Name”.



Adding Photos:

Like before, copy the following lines of code just below the name and contact info section we discussed earlier.

% Photo Section
begin{center}
    includegraphics[width=0.2textwidth]{profile_photo.png}
    vspace{0.5cm}
end{center}
Enter fullscreen mode

Exit fullscreen mode

Now, you almost know what’s happening in this code, except for the includegraphics{…} part. Earlier, I mentioned that we’d add a cute photo of yours. Well, this is the step where we do that. See at the line no. 2 of your code we have used graphicx package, now we’re implementing it.

You can see upload button at the top left. Just click there, upload a photo and then rename it to profile_photo.png.

Upload Button Location

The command includegraphics{profile_photo.png} tells LaTeX to include an image with file name profile_photo.png but we need to make sure the image file is in same folder as of main.tex file. Since we’re using Overleaf, uploading it as mentioned will automatically put the file in the correct location.

The width=0.2textwidth option adjusts the image size, making the width 20% of the text width on the page. You can explore different sizes by changing 0.2 to any other value of your choice.



Sections and Sub-Sections:

Copy and paste the code below, and let’s see what’s happening.

% Objective Section
section*{Objective}
Write a short statement about your career goals.

% Education Section
section*{Education}
textbf{Degree Name}, Institution Name hfill Year \
Field of Study

% Work Experience Section
section*{Work Experience}
textbf{Job Title}, Company Name hfill Year -- Year \
Brief description of your role and achievements.
Enter fullscreen mode

Exit fullscreen mode

Now you’ve been introduced with new concept: section. In LaTeX, sections help structure our document into logical parts, making it easier to read and navigate. Lets understand more on how we can create sections in our document.

  • The section{...} command is used to create a main section in our document. Here, we’ve used it to create sections like “Objective,” “Education,” and “Work Experience.” By default, sections are numbered automatically (e.g. 1, 2, 3…) but adding an asterik (*) as shown in code above, will remove the numbering.

  • Likewise, subsection{...} command is used to create a subsection under the main section. Basically, these are second-level section under the main section which are numbered hiererchially. And yeah, to stop auto numbering we can use * as stated earlier.

  • Now you can easily guess what subsubsection{} command does. It creates a third-level section under a subsection.

Additionally, notice the hfill command in the code. This command inserts a blank space that stretches to fill the available space, which is useful for aligning text, such as dates and institution names.



List and Tables:

We’re almost at the end of learning LaTeX. Let’s wrap things up with two more essential elements: lists and tables. As earlier, copy the following code and paste it below work experience section.

% Skills Section
section*{Skills}
begin{itemize}
    item Skill 1
    item Skill 2
    item Skill 3
end{itemize}
Enter fullscreen mode

Exit fullscreen mode

  • begin{itemize} command is usually used to make a bullet list environment. Each bullet point is created using the item command.

  • If we want numbered lists instead of bullets, we can simply use begin{enumerate} command i.e replace itemize with enumerate.

We will not be using tables here in this resume, but I want you explore table in LaTeX. You may take the following code as reference:

begin{tabular}{|c|c|}   hline
Column 1 & Column 2 \
hline   Data 1 & Data 2 \
hline   end{tabular}
Enter fullscreen mode

Exit fullscreen mode

  • begin{tabular}{|c|c|}: Creates a table with two centered columns, separated by vertical lines.
  • hline: Adds horizontal lines.
  • \: Moves to the next row.



Final Touch: Removing Page Numbers

Now, you may see the page number at the bottom of our document. To remove this, simply add pagestyle{empty} command before begin{document} command.

Congratulations! You’ve created a simple resume using LaTeX. As promised, here’s the template we created: Click Here

Feel free to explore more and make it your own. Happy LaTeX-ing!



Source link
lol

By stp2y

Leave a Reply

Your email address will not be published. Required fields are marked *

No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.