LaTeX is a free doc typesetting software program, used for writing scientific and technical paperwork. LaTeX offers knowledgeable look to paperwork and gives many packages that may assist programmers format textual content in a means that will in any other case not be potential with the standard textual content formatting software program.
In contrast to most technical writing software program or documentation instruments like Microsoft Phrase that depend on a What You See Is What You Get (WYSIWYG) editor, LaTeX, as an alternative, makes use of LaTeX instructions to enter and output content material. The TeX engine then takes care of changing these instructions right into a PDF doc.
On this technical writing tutorial, you’ll study some widespread LaTeX instructions that may enable you to create your personal LaTeX paperwork.
Learn: High Gantt Chart Instruments for Builders
How one can Set up LaTeX
Putting in LaTeX is pretty easy. From the terminal, merely sort the command under to start set up:
sudo apt-get set up texlive
Subsequent, you’ll be able to affirm that you’ve got put in LaTeX by checking for the model, coming into the next command:
LaTeX -v #
Or:
LaTeX --version
How one can Write Your First LaTeX Doc
To start writing your first LaTeX doc, create a file that ends with the .tex extension. You need to use any textual content editor of your selection, similar to Notepad or Notepad++.
On the primary line of your file, declare the documentclass. This can be a command that defines the kind of doc you’re going to write. Discover that the command begins with a ahead slash (). That is the overall syntax for writing a LaTeX command:
command.
After the command,you could optionally have curly brackets {}, the place you’ll be able to declare information. There are a selection of doc sorts you’ll be able to select from, together with an article or ebook. The doc sort determines how content material will likely be typeset on the doc.
Right here is a few fundamental pattern instructions for creating an article sort doc in LaTeX:
documentclass{article} start{doc} My First LaTeX Doc! finish{doc}
Subsequent, embrace some phrases between the start{doc} and finish{doc} tags. This constitutes the physique of your doc. The part earlier than the physique is named the preamble and it’s used to set specifics such because the doc class and packages.
The following step is compilation. To compile your code, run the command under:
$ pdfLaTeX firstDoc.tex # exchange firstDoc with the identify of your tex file
This may output a .PDF doc referred to as firstDoc.pdf within the present listing. You possibly can open this file out of your terminal utilizing the evince command:
$ evince firstDoc.pdf
You can too open the file utilizing any .PDF reader of your selection.
The next is an inventory of a number of the doc sorts – also called doc lessons – obtainable in LaTeX:
- article: Used for articles featured in scientific journals, quick stories, displays, and likewise for software program documentation
- IEEEtran: Used for articles utilizing the IEEE Transaction for.
- report: Used for lengthy stories, small books, thesis papers, and paperwork containing a number of chapters.
- ebook: Used for precise books.
- slides: Used to create slides.
- letter: Used when creating letters or notes.
Sizing Fonts and Styling Textual content in LaTeX
Programmers can set the font dimension of their textual content in LaTeX by together with the scale worth in [ ] brackets after the documentclass command. For instance:
documentclass[14pt]{article}
The above LaTeX command would create textual content that’s 14pt in dimension.
To make your textual content daring or italicized, builders can use emp (or textbf) for daring and textit for italics. To underline textual content, use the underline command.
Learn: Greatest Productiveness Instruments for Builders
Setting Title, Writer, and Date in LaTeX
To set the title, writer, or date of your doc, use the next instructions, respectively: title, writer, or date. To ensure that these attributes to indicate up, you could use the maketitle command in your doc’s physique.
Right here is an instance of learn how to set the title, writer, and date in a LaTeX doc utilizing maketitle:
documentclass{article} title{My LaTeX Doc} writer{Michael Jenkins} date{June 2025} start{doc} maketitle This can be a PDF doc created utilizing LaTeX code. finish{doc}
How one can Construction a LaTeX Doc
To incorporate an summary in your LaTeX doc, place it between the next tags:
start{summary} finish{summary}
To create a brand new line, you’ll be able to both use or newline.
To create a brand new part and chapters, you should utilize the tags under:
part{Part Title} subsection{Subsection Title} part*{Unnumbered Part}
Right here is an instance displaying learn how to absolutely construction a LaTeX doc, together with learn how to outline its documentclass:
documentclass{ebook} usepackage{graphicx} graphicspath{{my-images/}} start{doc} tableofcontents chapter{} part{Introduction} subsection{Objective} This defines the supposed use of the doc. It summarizes the objective of the doc. Ensure that it's transient and straight to the purpose. subsection{Scope} subsection{Definitions, Acronyms, and Abbreviations} subsection{References} subsection{Overview} chapter{} includegraphics{my-cartoon} part{Necessities} part{Constraints} part*{Unnumbered Part} finish{doc}
To output a desk of contents, you could add the tableofcontents tag in your doc’s physique.
Documenting Algorithms in LaTeX
First, let’s have a look at learn how to add packages to LaTeX. To import a bundle, achieve this by utilizing the usepackage{package-name} command within the doc preamble.
Generally a bundle could not already be downloaded together with your default LaTeX set up. Let’s take use an instance of the algorithm2e bundle which you, as a developer, can use to put in writing algorithms.
This bundle may be downloaded from the CTAN (Complete TEX Archive Community) repository. Merely seek for the bundle within the search bar after which obtain the supplied .ZIP archive. Extract the bundle and find the .sty file (on this case algorithm2e.sty).
Copy this file to the listing of your .tex file (the listing the place you’ll be importing this bundle). Now, you’ll be able to freely import this bundle with none compilation errors.
Right here is a few pattern code displaying learn how to use the algorithm2e bundle in LaTeX:
documentclass{article} usepackage{algorithm2e} start{doc} start{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]} finish{algorithm} finish{doc}
Last Ideas on Technical Writing with LaTeX
LaTeX is a strong typesetting software program that permits you to create varied sorts of technical paperwork, starting from mathematical docs to algorithms. From the examples on this tutorial, it’s best to be capable of confidently create, write, and format LaTeX paperwork.
Learn: How one can Create a Glossy Trying Resume Utilizing LaTeX.