DEV Community

Mustafif
Mustafif

Posted on • Updated on

Latex For Beginners Part 1

What is latex you may ask? LaTeX is like the HTML for academic documents, it's a scripted language used to define components for a document. If this makes absolutely no sense, trust me, keep reading and you'll understand.


Technical Requirements

You need some sort of tex compiler, and a text editor, personally I use texlive and VSCode respectively.

Debian:

$ sudo apt install texlive-full
Enter fullscreen mode Exit fullscreen mode

Windows:
Install here

MacOS:
Install here


First Document

Let's create a new file FirstDoc.tex, and let's add the following code:

% This is a comment 
% This defines the font size, paper size, and document class
% Document classes may be articles, book, beamer(slides)
\documentclass[11pt, letterpaper]{article}

% Your metadata, define title, author, and date
% in the preamble
\title{First Document}
\author{Your Name}
\date{\today}

% start the document
\begin{document}
\maketitle % create title page 
\pagenumbering{arabic} % either arabic or roman page numbering
\newpage % Create a new  blank page 
\end{document}
Enter fullscreen mode Exit fullscreen mode

Wow wow wow, that's a lot of mumbo jumbo, I think a lot of the comments explain the metadata quite well, so let's talk about the
\begin{}...\end{}, what is this?

Environments

Environments are essentially blocks of code that have a defined behaviour where everything between it's begin and end are part of the environment. Let's look at a few more environments that you'll regularly use.

Itemize:

Created a dotted list using itemize, so let's define it:

\begin{itemize}
   \item An item 
   \item Another item
\end{itemize}
Enter fullscreen mode Exit fullscreen mode

Add this to your document, run pdflatex FirstDoc in your terminal and you'll see a FirstDoc.pdf you can open.

If you do enumerate instead of itemize, the list will be numbered instead of dotted.

Center:

Have everything centered using the center environment, so if we
have the following:

\begin{center}
   This will all be centered
\end{center}
Enter fullscreen mode Exit fullscreen mode

But this isn't very useful if we don't understand sections, paragraphs, etc. So let's talk about that in the next part.

Top comments (0)