How to work alignment(text alignment) in LaTeX? | Left, Right, Center, and Justify align. (2023)

LaTeX give you the ability to align your paragraph(text). LaTeX contains an algorithm in the TeX program which by default renders paragraphs to be justified.

In other words, LaTeX stretches or shorten spaces between words to produce lines of text of equal lengths.

This article explains in detail how to change(modify) the alignments of portions of a text(paragraphs) or the entire body of text using LaTeX built-in commands and the ragged2e package.

Writing can be single-column and also can be multi-column. Those columns can be aligned in different ways.

Such as left side, right side, along the middle and equally on both sides. The types are given below

Basic alignment: There Are two types of basic Alignment.

  1. Single Column
  2. Multi-Column

There is 4 type of each alignment basically exit.

  1. Left
  2. Right
  3. Center
  4. Fully Justified

Standard LATEX Environments and Commands

There are basically 3 environments that work by changing the declaration that control how TeX typesets your paragraphs.

(Video) Align Documents in Latex [right, left, center, and justify] | Latex Tutorial # 12

These declarations are also available as LaTeX commands.

EnvironmentLaTeX command
center\centering
flushleft\raggedleft
flushright\raggedright
justify\justifying

The same environment and command for left, right, and center alignment is present in the ragged2e package.

However, there is no default command or environment for justify. In this case, you have to use this package.

Single Column Alignment

1. Left Align

If you want to single column left align text or figure or equation then you must have to use flushleft environment. For left alignment text should be inserted into \begin{flushleft} & \end{flushleft}.

When you are going to write then you must have to follow the format order. Given below is the complete formula with an example.

\documentclass{article}\usepackage[document]{ragged2e}\begin{document} \begin{flushleft} \section{What is Lorem Ipsum?} Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. \subsection{Why do we use it?} It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution. \end{flushleft}\end{document}

Output :

How to work alignment(text alignment) in LaTeX? | Left, Right, Center, and Justify align. (1)

2. Right Align

Same as the procedure you can align the right side for a single column. The difference between left and right just changes it flushleft to the flashright.

A complete format is given below for your proper instruction.

(Video) Latex Tutorial Left Right Center Justify; Page Justification in LateX; LaTeX - Text Alignment

\documentclass{article}\usepackage[document]{ragged2e}\begin{document} \begin{flushright} \section{What is Lorem Ipsum?} Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. \subsection{Why do we use it?} It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution. \end{flushright}\end{document}

Output :

How to work alignment(text alignment) in LaTeX? | Left, Right, Center, and Justify align. (2)

3. Center Align

If you want to align a paragraph to the center. Then you can also follow the usual rules of left alignment which are already discussed in the 1st rule.

Just change the center instead of flushleft. Already given the decorated format for example. Look at the below:

\documentclass{article}\usepackage[document]{ragged2e}\begin{document} \begin{center} \section{What is Lorem Ipsum?} Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. \subsection{Why do we use it?} It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution. Proin et massa et nisl porttitor tempor. Vestibulum volutpat enim nec orci egestas, sed iaculis lorem dignissim. Mauris nec lorem varius, malesuada nulla sit amet, posuere leo. Integer id risus et ligula tempus sagittis eu sit amet leo. Vestibulum maximus turpis aliquam neque ultrices imperdiet. \end{center}\end{document}

Output :

How to work alignment(text alignment) in LaTeX? | Left, Right, Center, and Justify align. (3)

4. Justify Align

The ragged2e also provide us with the justified environment and command(\justifying) which produces a justified text with a moderate amount of raggedness.

\documentclass{article}\usepackage[document]{ragged2e}\begin{document} \begin{justify} \section{What is Lorem Ipsum?} Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. \subsection{Why do we use it?} It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution. Proin et massa et nisl porttitor tempor. Vestibulum volutpat enim nec orci egestas, sed iaculis lorem dignissim. Mauris nec lorem varius, malesuada nulla sit amet, posuere leo. Integer id risus et ligula tempus sagittis eu sit amet leo. Vestibulum maximus turpis aliquam neque ultrices imperdiet. \end{justify}\end{document}

Output :

How to work alignment(text alignment) in LaTeX? | Left, Right, Center, and Justify align. (4)

Multi-Column(two) Alignment

1. Left Align

As per our writing requirement, we can write text/equation/set image in double columns. If we want to write something in a double column then we need an extra packet of \usepackage{multicol} than a single column.

In the wiring part, we have to set the paragraph between \begin{multicols}{2} & \end{multicols}{2}. Others part will as usual previous rules. For better understanding please look at the given format.

(Video) Dealing with Text Alignment in InDesign

If you look at the code above, you will see that manual lorem text has been used. However, you can generate new ones instead of manually importing random text. There is a latex lipsum package for this.

\documentclass{article}\usepackage{multicol,lipsum}\begin{document} \begin{flushleft} \begin{multicols}{2} \section{What is Lorem Ipsum?} \lipsum[1][1-7] \subsection{Why do we use it?} \lipsum[2][1-4] \end{multicols}{2} \end{flushleft}\end{document}

Output :

How to work alignment(text alignment) in LaTeX? | Left, Right, Center, and Justify align. (5)

2. Right Align

As like a single column, we can align a double-column right alignment. Just follow the left alignment rules which are already used in the double-column alignment but with major changes in the flushleft to flushright.

Already shown below furnished structure and example, please look at this for your practice.

\documentclass{article}\usepackage{multicol,lipsum}\begin{document} \begin{flushright} \begin{multicols}{2} \section{What is Lorem Ipsum?} \lipsum[1][1-7] \subsection{Why do we use it?} \lipsum[2][1-4] \end{multicols}{2} \end{flushright}\end{document}

Output :

How to work alignment(text alignment) in LaTeX? | Left, Right, Center, and Justify align. (6)

3. Center Align

Maximum times this structure is used for images or equation align.

In the double-column center alignment used package is \usepackage{multicol} and variation from others alignment is \begin{center} & \end{center} instant of \begin{flushright} & \end{flushright}.

Proper format and example already discussed below

(Video) Alignment in latex using environments and commands|ragged right,left,centering,flushright,flushleft

\documentclass{article}\usepackage{multicol,lipsum}\begin{document} \begin{center} \begin{multicols}{2} \section{What is Lorem Ipsum?} \lipsum[1][1-7] \subsection{Why do we use it?} \lipsum[2][1-4] \end{multicols}{2} \end{center} \end{document}

Output :

How to work alignment(text alignment) in LaTeX? | Left, Right, Center, and Justify align. (7)

4. Fully justified Align

Single column fully justified alignment & double column fully justified alignment same procedure just added an extra package \usepackage{multicol} and used \begin{multicols}{2} & \end{multicols}{2} Front and back in the text.

Please follow the format and example which will give you clear understanding of it.

\documentclass{article}\usepackage[document]{ragged2e}\usepackage{multicol,lipsum}\begin{document} \begin{justify} \begin{multicols}{2} \section{What is Lorem Ipsum?} \lipsum[1][1-7] \subsection{Why do we use it?} \lipsum[2][1-4] \end{multicols}{2} \end{justify} \end{document}

Output :

How to work alignment(text alignment) in LaTeX? | Left, Right, Center, and Justify align. (8)

Use commands instead of environment

Environment has been used in the above case. You can do the same thing by putting commands before paragraphs instead of environment. But, you need a ragged2e package to justify it.

\documentclass{article}\usepackage[document]{ragged2e}\usepaxkage{xcolor}\begin{document} \RaggedRight {\color{red} \verb|\RaggedRight| }\\ It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages.\\ \Centering {\color{red}\verb|\Centering| }\\ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.\\ \RaggedLeft {\color{red}\verb|\RaggedLeft|} \\It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages.\\ \justifying {\color{red}\verb|\justifying| }\\ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. } \end{document}

Output :

How to work alignment(text alignment) in LaTeX? | Left, Right, Center, and Justify align. (9)

Don't forget to share if I have added any value to your education life. See you again in another tutorial. thank you!

(Video) MS Word : Format Text Better with Justify Alignment

Videos

1. ALIGN LEFT, CENTER, ALIGN RIGHT, JUSTIFY - PARAGRAPH ALIGNMENT
(PTTV)
2. Introduction to LaTeX Tutorial: Create Sections, paragraphs and text justification
(Abhijeet Chodankar)
3. Aligning Dates and Locations on Your Resume in MS Word (PC)
(Natalie Wolfe)
4. Left, Right, Center and Justify Shortcuts (Text Alignment Shortcuts)
(Nuts & Bolts Speed Training)
5. Left align, center, and right align text on one line
(Laura Townsend - TownsendTek)
6. LaTex Basics - Table(Part 3), Horizontal alignment - Tutorial #6
(Exploring Latex)
Top Articles
Latest Posts
Article information

Author: Lakeisha Bayer VM

Last Updated: 03/22/2023

Views: 6203

Rating: 4.9 / 5 (69 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Lakeisha Bayer VM

Birthday: 1997-10-17

Address: Suite 835 34136 Adrian Mountains, Floydton, UT 81036

Phone: +3571527672278

Job: Manufacturing Agent

Hobby: Skimboarding, Photography, Roller skating, Knife making, Paintball, Embroidery, Gunsmithing

Introduction: My name is Lakeisha Bayer VM, I am a brainy, kind, enchanting, healthy, lovely, clean, witty person who loves writing and wants to share my knowledge and understanding with you.