Apps/Gaming

How to Use LaTeX for Technical Writing

LaTeX is a free document typesetting software, used for writing scientific and technical documents. LaTeX gives a professional look to documents and provides many packages that can help programmers format text in a way that would otherwise not be possible with the usual text formatting software.

Unlike most technical writing software or documentation tools like Microsoft Word that rely on a What You See Is What You Get (WYSIWYG) editor, LaTeX, instead, uses LaTeX commands to input and output content. The TeX engine then takes care of converting these commands into a PDF document.

In this technical writing tutorial, you will learn some common LaTeX commands that will help you create your own LaTeX documents.

Reading: Top Gantt Chart Tools for Developers

How to Install LaTeX

installing Latex is fairly simple. From the terminal, simply type the command below to begin installation:

sudo apt-get install texlive

Next, you can confirm that you have installed LaTeX by checking for the version, entering the following command:

LaTeX -v #

Or:

LaTeX –version

How to Write Your First LaTeX Document

To begin writing your first LaTeX document, create a file that ends with the .tex extension. You can use any text editor of your choice, such as Notepad or Notepad++.

On the first line of your file, declare the documentclass. This is a command that defines the type of document you are going to write. Notice that the command begins with a forward slash (). This is the general syntax for writing a LaTeX command:

command.

After the command, you may optionally have curly brackets {}, where you can declare data. There are a number of document types you can choose from, including an article or book. The document type determines how content will be typeset on the doc.

Here is some basic sample commands for creating an article type document in LaTeX:

documentclass{article} begin{document} My First LaTeX Doc! end{document}

Next, include some words between the begin{document} and end{document} tags. This constitutes the body of your document. The section before the body is called the preamble and it is used to set specifics such as the document class and packages.

The next step is compilation. To compile your code, run the command below:

$ pdfLaTeX firstDoc.tex # replace firstDoc with the name of your tex file

This will output a .PDF document called firstDoc.pdf in the current directory. You can open this file from your terminal using the evince command:

$evincefirstDoc.pdf

You can also open the file using any .PDF reader of your choice.

The following is a list of some of the document types – also known as document classes – available in LaTeX:

  • article: Used for articles featured in scientific journals, short reports, presentations, and also for software documentation
  • IEEEtran: Used for articles using the IEEE Transaction for.
  • report: Used for long reports, small books, thesis papers, and documents containing multiple chapters.
  • book: Used for actual books.
  • slides: Used to create slides.
  • letter: Used when creating letters or notes.

Sizing Fonts and Styling Text in LaTeX

Programmers can set the font size of their text in LaTeX by including the size value in [ ] brackets after the document class command. For example:

documentclass[14pt]{article}

The above LaTeX command would create text that is 14pt in size.

To make your text bold or italicized, developers can use emp (or textbf) for bold and textit for italics. To underline text, use the underline command.

Reading: Best Productivity Tools for Developers

Setting Title, Author, and Date in LaTeX

To set the title, author, or date of your document, use the following commands, respectively: title, author, or date. In order for these attributes to show up, you need to use the maketitle command in your document’s body.

Here is an example of how to set the title, author, and date in a LaTeX document using maketitle:

documentclass{article} title{My LaTeX Document} author{Michael Jenkins} date{June 2025} begin{document} maketitle This is a PDF document created using LaTeX code. end{document}

How to Structure a LaTeX Document

To include an abstract in your LaTeX document, place it between the following tags:

begin{abstract} end{abstract}

To create a new line, you can either use or newline.

To create a new section and chapters, you can use the tags below:

section{Section Title} subsection{Subsection Title} section*{Unnumbered Section}

Here is an example showing how to fully structure a LaTeX document, including how to define its document class:

documentclass{book} usepackage{graphicx} graphicspath{{my-images/}} begin{document} tableofcontents chapter{} section{Introduction} subsection{Purpose} This defines the intended use of the document. It summarizes the goal of the document. Make sure that it is brief and straight to the point. subsection{Scope} subsection{Definitions, Acronyms, and Abbreviations} subsection{References} subsection{Overview} chapter{} includegraphics{my-cartoon} section{Requirements} section{Constraints} section*{ Unnumbered Section} end{document}

To output a table of contents, you need to add the tableofcontents tag in your document’s body.

Documenting Algorithms in LaTeX

First, let’s look at how to add packages to LaTeX. To import a package, do so by using the usepackage{package-name} command in the document preamble.

Sometimes a package may not already be downloaded with your default LaTeX installation. Let’s take use of an example of the algorithm2e package which you, as a developer, can use to write algorithms.

This package can be downloaded from the CTAN (Comprehensive TEX Archive Network) repository. Simply search for the package in the search bar and then download the provided .ZIP archive. Extract the package and locate the .sty file (in this case algorithm2e.sty).

Copy this file to the directory of your .tex file (the directory where you will be importing this package). Now, you are able to freely import this package without any compilation errors.

Here is some sample code showing how to use the algorithm2e package in LaTeX:

documentclass{article} usepackage{algorithm2e} begin{document} begin{algorithm} eIf{$val[0] > $val[1]} { tmp[0] = val[1]
tmp[1] = val[0]
}{ tmp[0] = val[0]
tmp[1] = val[1]} eIf{$val[2] > $val[3]}{ tmp[2] = val[3]
tmp[3] = val[2]
}{ tmp[2] = val[2]
tmp[3] = val[3]} end{algorithm} end{document}

Final Thoughts on Technical Writing with LaTeX

LaTeX is a powerful typesetting software that allows you to create various types of technical documents, ranging from mathematical docs to algorithms. From the examples in this tutorial, you should be able to confidently create, write, and format LaTeX documents.

Reading: How to Create a Sleek Looking Resume Using LaTeX.

Related posts

Smartsheet vs Monday.com

TechLifely

What is a ScrumMaster?

TechLifely

How to implement linked lists in Go

TechLifely

Leave a Comment