How to Justify Paragraphs in LaTeX

In LaTeX, paragraphs are justified by default, meaning that the text is aligned on both the left and right margins.

However, if you have changed the alignment settings and want to revert to justified text, We can use the \justify command from the ragged2e package.

The following examples show how to justify paragraphs in LaTeX.

How to Justify Paragraphs Using Default Settings

By default, LaTeX justifies paragraphs. Here is an example of a justified paragraph using the default settings.

\documentclass{article}
\begin{document}

This is an example of a justified paragraph. LaTeX justifies paragraphs by default, aligning the text on both the left and right margins. This ensures that the text is evenly distributed across the width of the page.

This is another justified paragraph. The text is aligned on both sides, creating a clean and professional appearance.

\end{document}

Output: 👇️

This is an example of a justified paragraph. LaTeX justifies paragraphs by default, aligning the text on both the left and right margins. This ensures that the text is evenly distributed across the width of the page.

This is another justified paragraph. The text is aligned on both sides, creating a clean and professional appearance.

In this example, we use the paragraphs are justified by default.

How to Justify Paragraphs Using \justify

If we have changed the alignment settings and want to revert to justified text, We can use the \justify command from the ragged2e package.

Suppose we want to justify a paragraph after using a different alignment.

We can use the following LaTeX code to do so:

\documentclass{article}
\usepackage{ragged2e}
\begin{document}

\raggedright
This is a left-aligned paragraph. The text is aligned to the left margin.

\justify
This is a justified paragraph. The text is aligned on both the left and right margins.

\end{document}

Output: 👇️

This is a left-aligned paragraph. The text is aligned to the left margin.

This is a justified paragraph. The text is aligned on both the left and right margins.

In this example, we use the \justify command to revert to justified text after a left-aligned paragraph.

Conclusion

By default, LaTeX justifies paragraphs, but We can use the \justify command from the ragged2e package to revert to justified text if you have changed the alignment settings.