Los artículos o los libros, por ejemplo, tiene por defecto el texto alineado de forma justificada, pero se puede alinear el texto a la derecha, la izquierda o de forma centrada. Se puede configurar para todo el texto o una parte. Hay que aplicar alguno de los tres comandos antes o justo después del comienzo del ambiente document, es decir, justo antes o después de \begin{document}. Pero, en LaTex, puede resultar un poco confuso, a tenor del nombre del comando porque, puede parecer que funciona al revés de como se configuraría en un procesador de texto:
Ejemplos:
\begin{document}
\raggedleft
...
ó
\raggedleft
\begin{document}
...

Overleaf: alineación a la derecha.
\begin{document}
\raggedright
...
ó
\raggedright
\begin{document}
...

Overleaf: alineación a la izquierda.
\begin{document}
\centering
...
ó
\centering
\begin{document}
...

Overleaf: alineación de forma centrada.
Para aplicar las alineaciones a un párrafo o parte del texto, hay que meter dicho párrafo o parte entre 3 ambientes: flushleft and flushright y center. Funcionan como los tres comandos mencionados anteriormente:
Ejemplos:
\begin{document}
...
\begin{flushleft}
La\TeX{} is a document preparation system and document markup
language. \LaTeX{} uses the \TeX{} typesetting program for formatting
its output, and is itself written in the \TeX{} macro language.
\LaTeX{} is not the name of a particular (executable) typesetting program, but
refers to the suite of commands (\TeX{} macros) which form the markup
conventions used to typeset \LaTeX{} documents.
\end{flushleft}
\section*{A paragraph typeset flush right}
\begin{flushright}
La\TeX{} is a document preparation system and document markup
language. \LaTeX{} uses the \TeX{} typesetting program for formatting
its output, and is itself written in the \TeX{} macro language.
\LaTeX{} is not the name of a particular (executable) typesetting program, but
refers to the suite of commands (\TeX{} macros) which form the markup
conventions used to typeset \LaTeX{} documents.
\end{flushright}
\begin{center}
\section*{A paragraph: center}
La\TeX{} is a document preparation system and document markup
language. \LaTeX{} uses the \TeX{} typesetting program for formatting
its output, and is itself written in the \TeX{} macro language.
\LaTeX{} is not the name of a particular (executable) typesetting program, but
refers to the suite of commands (\TeX{} macros) which form the markup
conventions used to typeset \LaTeX{} documents.
\end{center}
....
\end{document}

Overleaf: tres párrafos alineados a la derecha, izquierda y de forma centrada.
Documentos:
Para saber más sobre la alineación del texto, léase:
