Software Technology

LaTeX — Typesetting Program

LaTeX — Typesetting Program
Written by twitiq

LaTeX refers to a typesetting program. It is used in mathematical & scientific writings or publications. In this article, you will get to know what is LaTeX, what is LaTeX used for, its structures, etc.

What Is LaTeX Typing?

It indicates a document preparation system for the TEX typesetting program. With this system’s help, you can create publication-quality output with accuracy and consistency.

It is capable of working on any type of computer. This one can create PS or PDF documents that are industry-standard. You should know that LaTeX is available in free (open-source) & commercial implementations. Now, let’s learn what is LaTeX used for.

What Is LaTeX Used For?

It was created so that producing general-purpose books & articles within TeX becomes easier. This one is an extension of the TeX typesetting system. That’s why it comes with the ability of TeX to typeset technical documents, which is capable of containing complex mathematical equations.Because of this feature, LaTeX is popular among scientists and engineers. It is intended to offer a top-quality descriptive markup language, which is capable of accessing TeX’s power for writers easily.

TeX is able to handle the layout side, whereas LaTeX can only handle the content side to process documents. LaTeX includes a collection of TeX macros and a program for processing LaTeX documents. As plain TeX formatting commands are elementary, it is capable of offering authors the readymade commands for formatting as well as for the layout requirements, like chapter headings, footnotes, cross-references & bibliographies.

Is LaTeX Difficult To Learn?

Yes. It’s difficult. It has a much steeper learning curve compared to MS Word. But, learning basic LaTeX (text, figures, titles, tables) is not that much difficult.  You may face difficulties while understanding the concepts, which are used by LaTeX, like floating objects.

Benefits of LaTeX:

Easy Formatting:

LaTeX is capable of offering a very powerful and easy-to-learn procedure for formatting documents. It can offer a consistent as well as uniform layout. This layout is possible to be used for creating a variety of documents, like books, reports, slides, and so on.

Advanced Mathematics:

When it comes to writing scientific documents, LaTeX is very useful. Because it can provide a wide range of mathematical symbols as well as equations. It can typeset complex mathematical equations with accuracy.

Cross-Platform Compatible:

You can use this cross-platform software on several operating systems, such as Linux, Windows, and Mac OS. Therefore, the documents, which will be created in LaTeX, are possible to be shared easily across different platforms.

Professional Look and Feel:

LaTeX documents come with a professional look and feel, as it is capable of providing a consistent formatting style that is used for creating complex documents easily.

Open Source:

As it is an open-source software, you should know that it is free to use and modify. A large community of developers is continuously trying to improve and expand the system, so that it can become an excellent choice for any document project.

Flexibility:

LaTeX is capable of providing a great deal of flexibility regarding document structure. You will be able to create documents with several levels of headings, subheadings, and footnotes, for creating tables and figures.

Automated Processes:

LaTeX comes with a number of automated procedures, which are used for speeding up the document production method.

Collaboration:

LaTeX can be an excellent choice for collaborative documents. It permits multiple users to work on the same document at a time as well as allows them to make changes and additions quickly and easily.

Security:

The files of LaTeX are encrypted, which means you can not edit them without the right password. Therefore, the documents will remain secure & confidential.

Compatibility:

It is compatible with several types of documents, and it is possible to be used for creating PDFs, HTML pages, as well as PowerPoint presentations.

Cost: You can download and use it free of cost. Therefore, it becomes an economical choice for document production.

Easy to Learn: It is easy to learn.

Customization: LaTeX is capable of providing a lot of customization options that permit users to create documents according to their specifications.

Consistency: It is capable of ensuring consistency across different documents, and permits users to create a unified look and feel throughout their work.

Publishing: Publishers use it a lot, and the process of submitting documents for publishing becomes easier.

Scalability: It is designed to be scalable, and permits users to create documents of any length and complexity.

Extensibility: It is highly extensible, and allows users to add custom functions as well as features according to their needs.

Accessibility: It is designed in such a way that it can be accessible, and it permits users to view as well as edit documents on any OS.

Versatility: It is versatile, and permits users to easily switch between different types of documents, like books, reports, as well as slides.

How To Write Formulas In LaTeX?

If you are willing to write more complex maths, you need to insert a LaTeX snippet in your document for inserting a LaTeX block. You need to click on Insert. Then, you have to tap on LaTeX. In the LaTeX block, you are capable of inserting an inline formula, and you need to type the equation inside $.. $ . For instance, you need to type: An inline equation, which is $e=mc^2$.

LaTeX Structures:

Commands:

Regarding creating any document in LaTeX, commands play a very crucial role. There are multiple uses of commands, like changing document/text formatting, creating equations, inputting symbols, delineating sections of a document, etc. Whether you are willing to use a command, you have to place a backslash before the command.  For instance, the command is \pi to insert the π symbol. Whereas for inputting a matrix, one of the commands which is required is \begin{matrix}. Usually, you can see the commands in the format like- \command[optional argument]{required argument}.

You can use several arguments with a few commands. And to do so, you need to separate each argument with a comma. For instance, \hypersetup{colorlinks=true, linkcolor=blue, urlcolor=blue} sets the font color of hyperlinks in a document. There are a few commands, like \pi, which don’t have an optional or required argument. You can see other commands, like \begin{} that are capable of working with a recognized required argument. A few commands are capable of accepting an optional argument that you can use in order to specify the action the command needs to take. Like \documentclass[11pt, twocolumn]{article} informs LaTeX that this current project indicates an article with 11pt font. It should have a format containing two columns, leaving out the optional argument.

\documentclass{article} lets LaTeX use the defaults which are connected to the command.

At last, there are a few commands that can come with over one required argument. Suppose \frac{numerator}{denominator} helps to generate a faction in which the numerator is the first document, whereas the denominator is the second argument.

Packages:

In order to supplement LaTeX’s standard features, you can use packages. Whether you are willing to use a command and then find that it is creating an error, then it might happen that you haven’t added the important package in your document. The \usepackage{} command, which has the package name as the argument, tells LaTeX that it should add a specific package to your document. You need to place packages in the document preamble. When you want to add many packages to your document, you need to include the \usepackage{} command several times. Or you can use this once, and then you need to separate every package name with a comma, i.e.:

\usepackage{geometry}

\usepackage{amsmath}

\usepackage{graphicx}

\usepackage{geometry, amsmath, graphicx}

You should try to list packages separately if you are willing to use an optional argument with any package. Or you will see it coming down to personal preference. Several standard packages have a MikTex or MacTex. However, you are capable of installing new ones when it is necessary. You can find a few instructions online for installing new packages.

Text:

You can easily write text in a LaTeX document. As soon as you enter the inside part of the body of your document, your task is to begin typing. Once you compile the code, LaTeX will help you to handle the job of text formatting, depending on the used commands & packages.

Math:

A very important feature of LaTeX is to incorporate mathematical symbols and equations. You can find several ways through which you are able to add maths in a LaTeX document.

Comments:

If something follows a % in a code line, it will be called a comment, which should be ignored by the compiler. Whether you are willing to add a percentage symbol in your text, you need to use this command \%. Suppose you are willing to write 100% in LaTeX. If this is the case, you need to write 100\%.

Document Structure:

If you are willing to generate PDFs with LaTeX, you should make a .tex file. Hence, you need to know that the file will include the code compiled by the back-end LaTeX software with the aim of producing the end result PDF document. Once you install LaTeX, you are able to generate .tex files in Notepad on Windows or TextEdit on OS X computers. However, we strongly recommend to directly create these files in a LaTeX text editor.

A LaTeX document has two major pieces, including a preamble and the body. You can consider the bibliography a third piece that depends on how you need to structure this. We recommend you to create a new folder on the computer for every LaTeX document on which you work. If LaTeX compiles a .tex file, it will help you to create multiple files to produce the PDF. You should have a folder for every document that you are working on to keep all files organized. In addition, you might be willing to insert images, figures, or other objects into the document. You can insert items into the document easily once these are located in the same folder as the .tex file.

Preamble:

All information occurring before the document starts is the preamble to a LaTeX document. It begins with the \documentclass{} command, whereas the command \begin{document} is marking the end. You can place various objects in the preamble between the commands \documentclass{} & \begin{document}. The command \usepackage{} is one of the common ones of these items. A package lets you know about the compiler of a few commands which you will use. You can add some packages in the preamble. Adding a command in the document without adding the actual package in the preamble is a common mistake that new LaTeX users  usually make. There are some commands like \title, \author, and \date you can add in the preamble. After that, you can incorporate it within the document. At last, you can create new commands in the preamble, which you can use in the current document.

Body:

The body is that part of a LaTeX document where you can place all of the text, equations, figures, tables, and so on. The document’s body starts with \begin{document} command whereas it will end with \end{document} command.

Writing Math:

LaTeX can simply incorporate & format equations and symbols. And it is a very famous feature of LaTeX. You need to remember two things in order to make sure that LaTeX can handle mathematical formulas accurately.

Your first job is ensuring that you have added all important packages. In order to use mathematical formulas in a document, the most common package is “amsmath.” Although the package lets you use a multitude of mathematical symbols & commands, it doesn’t come with everything. Do you try to compile a document & you face an error that is related to a mathematical object added by you?

Then, you need to check if any extra packages are there you require. For instance, if you are willing to attempt to add bold lettering in a mathematical equation without the package “bm,” you will face an error.

Secondly, you need to enter math mode, which is capable of letting LaTeX know that it is important to format something as maths & not regular text. You can also find a few LaTeX symbols & commands which you can not use outside of math mode.

You can enter math code in various ways. Whether you are willing to write mathematical expressions inside a line of text, each mathematical text needs to be bookended by $. Suppose you write $x+3$. It tells LaTeX that it has to write x+3 as math. Whether you are willing to see the math on its line, known as display mode, you have to use the command $$ on each math side or \[ and \].

The above instance looks like $$x+3$$ or \[x+3\].  At last, a few commands place you in math mode. For instance, any text that appears between the commands \begin{equation} & \end{equation} is possible to be written in LaTeX math mode.

Common Commands:

We have given here a list containing a few common commands for LaTeX. Whether you want to know more about LaTeX math symbols, you can perform a simple Google search, which can often provide great results.

Preamble Commands:

\documentclass{}:

It is the first command used in any document. This command helps to specify the document type which will be created.

\usepackage{}:

It is used to import a package into the LaTeX document. If you want to add any command that isn’t standard in LaTeX, you are able to use this command.

\title{}:

You need to use the intended title of the document as the argument.

\author{}:

You need to use the document’s author as the argument. You need to use \and for multiple authors in order to separate authors’ names, or you are capable of using the authblk package. When it comes to the authblk package, you should use this format given underneath where you need to use \affil to entire the author’s affiliation. Whereas, the optional argument indicates whatever symbol needs to be used after the author’s name:

\author[1]{1st Author}

\author[1]{2nd Author}

\author[1]{3rd Author}

\author[2]{Nth Author}

\affil[1]{Institute 1}

\affil[2]{Institute 2}

\date{}

The argument refers to a date which is linked to the document. You need to remember that if you leave an empty argument, it will generate a blank date in the title, and not including the command will make the title default to the date compiled.

Body Commands:

\maketitle:

This command is used to make a title, which will be based on the \title, \author, and \date given.

\tableofcontents, \listoffigures, \listoftables:

It is used to create a list of figures, a table of content, and/or a list of tables.

\newpage{}:

This command generates a new page.

\\:

It can make a line break.

\begin{} and \end{}:

If you see the command \begin{}, remember that you need to pair this with an \end{} command at some point later with the same argument in the document. \begin{} says LaTeX to enter a certain environment. And \end{} is used to conclude that environment.  \begin{document} is used to start the document’s body whereas \end{document} finishes the document. Equation, align, tabular, and figure are other common arguments.

\section{}:

This one denotes a new section, which must be used as the argument. You can see the sections added automatically in the table of contents. In order to create sections within sections, you need to use \subsection{} and \subsubsection{} commands.

Common Packages:

Packages let you use extra features within a LaTeX document. MikTex and MacTex have pre-installed standard packages and instructions used to install new packages. If you are willing to use a package, you need to add the command \usepackage{} where the argument refers to the package name i.e., \usepackage{amsmath}.

We have given here a list of a few useful LaTeX packages:

amsmath:

It lets you use mathematical structures that are more complicated within a document, like matrices.

geometry:

It is used by more advanced users. This package lets you control the document’s formatting in a better way.

graphicx:

It enables graphics to be integrated into a document.

hyperref:

This one allows for hyperlinks inside a document. In order to control various link colors, you have to use the command \hypersetup{}.

booktabs:

It is beneficial when you face issues with spacing inside of tables.

The Bottom Line:

LaTeX, which is an impressive typesetting system, comes with features that are designed for the production of technical and scientific documentation. It is the de facto standard for the scientific document’s publication.

Frequently Asked Questions

Does overleaf use LaTeX?

It has a complete, and ready to go LaTeX environment, which can run on the servers. With the help of Overleaf, you are capable of getting the same LaTeX set-up wherever you go.

What is LaTeX in math?

It refers to a system that is used for top-quality technical typesetting.

Many mathematicians as well as other people prefer using LaTeX in order to typeset papers, exams, books, etc.

What is the difference between HTML and LaTeX?

With the help of LaTex, you are able to paginate content. Besides, it enables you to set up various page styles depending on left or right pages for physical publishing purposes. On the other hand, HTML does not have intrinsic knowledge of “page layout” in terms of a paper’s single physical page. You are capable of specifying print-specific layouts with CSS, but you need to know that pagination isn’t trivial.

About the author

twitiq