LaTeX is a free doc typesetting software program, used for writing scientific and technical paperwork. LaTeX offers knowledgeable look to paperwork and supplies many packages that may assist programmers format textual content in a method that might in any other case not be attainable 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 be taught some widespread LaTeX instructions that may assist you create your individual LaTeX paperwork.
Learn: Prime Gantt Chart Instruments for Builders
Learn how to Set up LaTeX
Putting in LaTeX is pretty easy. From the terminal, merely kind the command beneath to start set up:
sudo apt-get set up texlive
Subsequent, you possibly can affirm that you’ve put in LaTeX by checking for the model, coming into the next command:
LaTeX -v #
Or:
LaTeX --version
Learn how to 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, reminiscent of 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’ll write. Discover that the command begins with a ahead slash (). That is the final syntax for writing a LaTeX command:
command.
After the command,you could optionally have curly brackets {}, the place you possibly can declare knowledge. There are a selection of doc sorts you possibly can select from, together with an article or guide. The doc kind determines how content material shall be typeset on the doc.
Right here is a few fundamental pattern instructions for creating an article kind 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 known as 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 beneath:
$ pdfLaTeX firstDoc.tex # substitute firstDoc with the title of your tex file
It will output a .PDF doc known as firstDoc.pdf within the present listing. You’ll be able to 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 few of the doc sorts – often known as doc lessons – out there in LaTeX:
- article: Used for articles featured in scientific journals, quick studies, shows, and in addition for software program documentation
- IEEEtran: Used for articles utilizing the IEEE Transaction for.
- report: Used for lengthy studies, small books, thesis papers, and paperwork containing a number of chapters.
- guide: 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 measurement 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 measurement.
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: Finest Productiveness Instruments for Builders
Setting Title, Creator, 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 should 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}
Learn how to 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 possibly can both use or newline.
To create a brand new part and chapters, you need to use the tags beneath:
part{Part Title} subsection{Subsection Title} part*{Unnumbered Part}
Right here is an instance displaying learn how to totally construction a LaTeX doc, together with learn how to outline its documentclass:
documentclass{guide} usepackage{graphicx} graphicspath{{my-images/}} start{doc} tableofcontents chapter{} part{Introduction} subsection{Goal} This defines the meant use of the doc. It summarizes the aim 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 should 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, accomplish that by utilizing the usepackage{package-name} command within the doc preamble.
Generally a bundle might 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 could be downloaded from the CTAN (Complete TEX Archive Community) repository. Merely seek for the bundle within the search bar after which obtain the offered .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}
Closing Ideas on Technical Writing with LaTeX
LaTeX is a robust typesetting software program that permits you to create numerous kinds of technical paperwork, starting from mathematical docs to algorithms. From the examples on this tutorial, it is best to be capable to confidently create, write, and format LaTeX paperwork.
Learn: Learn how to Create a Smooth Trying Resume Utilizing LaTeX.