Align Right LaTeX Text: Left, Center and Right

November 11, 2026 · 10 min read

Align Right LaTeX Text: Left, Center and Right Alignment

To align right LaTeX text, wrap it in a flushright environment, or put the \raggedleft declaration inside a group that ends the paragraph. Left alignment works the same way with flushleft or \raggedright, and centering uses center or \centering. For a date on the right of an existing line, use \hfill.

How Do You Align Text to the Right in LaTeX?

The quickest route is the flushright environment. Every line inside it sits against the right margin, and you end each line with \\. It's the standard way to set a signature block, a date or an address on the right side of the page.

\begin{flushright}
Dr. Jane Smith\\
Department of Physics\\
12 March 2026
\end{flushright}

This prints three short lines pushed against the right margin, with a ragged left edge. Without the \\ line ends, LaTeX fills each line itself and breaks where it fits. The reference manual's flushright page notes that when it breaks long lines, it avoids hyphenation and doesn't stretch the word spaces.

Here's the naming that confuses nearly everyone. Right-aligned text is called ragged left, because the left edge is the uneven one. So the declaration for right alignment is \raggedleft, not \raggedright.

{\raggedleft Signed on behalf of the committee\par}

The minutes continue here as normal text.

The first line lands on the right, and the paragraph after the closing brace goes back to normal. The braces limit the effect, and the \par before the closing brace is what makes it work at all. Leave the \par out and nothing moves, as the scope section below explains. To right align LaTeX text for a whole document, you'd drop the braces, but that's rarely what you want.

LaTeX Left Align: flushleft and \raggedright

LaTeX justifies body text by default. Both edges are straight, and the word spaces stretch to fill each line. So if you're asking how to left align in LaTeX, you're really asking how to switch justification off and let the right edge go ragged.

\begin{flushleft}
This paragraph keeps even spaces between its words.
Its right edge stays uneven instead of stretching to the margin.
\end{flushleft}

The text starts at the left margin with natural word spacing, and the lines end wherever the words run out. To left align LaTeX text across a whole document, put \raggedright on the line after \begin{document}.

One side effect catches people out. In the LaTeX kernel, \raggedright also sets the paragraph indent to zero, so your first-line indents disappear. If you want them back, set \parindent again after the declaration. The ragged2e versions covered below also default to no indent, but you can set their \RaggedRightParindent length.

Center Text in LaTeX: center Environment vs \centering

For a centered block in running text, such as a title page line, use the center environment. Each line is centered between the margins, and \\ starts a new one. Our LaTeX new line guide covers \\ and the other line break commands.

\begin{center}
\Large A Study of Ragged Margins\\[1ex]
\normalsize Jane Smith
\end{center}

You get two centered lines: a large title, a small gap set by [1ex], then the author line. The environment also adds vertical space above and below the block, which is usually what you want in body text.

The \centering declaration centers the same way but adds no extra space and doesn't start a new paragraph. That makes it the better choice inside a minipage, a \parbox or a figure, where extra space looks like a mistake. Inside a figure or table float, \centering centers the whole object, while aligning the columns inside a table is its own topic. Our guide to making a table in LaTeX covers it.

Equations are out of scope as well. Left-aligning or lining up equations happens in math mode with its own environments, so none of the text commands in this guide apply to them. For those, see our guide to new lines in LaTeX equations, which covers the align environment.

LaTeX Text Alignment Cheat Sheet

Every alignment comes in two forms, plus an improved version from the ragged2e package. This table maps each one, so you can align text in LaTeX without memorizing which edge is ragged. The LaTeX right align row is the one people get backwards most often, since its declaration names the left edge.

AlignmentEnvironmentDeclarationragged2e versionRagged edge
Left (flush left)flushleft\raggedrightFlushLeft, \RaggedRightRight
Right (flush right)flushright\raggedleftFlushRight, \RaggedLeftLeft
Centeredcenter\centeringCenter, \CenteringBoth
JustifiedNone (it's the default)None (close the group)justify, \justifyingNeither

The environments start their own paragraph and add space above and below, because LaTeX builds all three on its internal list environment. The declarations change how the current group's paragraphs are set and add no space, so they fit inside boxes and floats.

Why Your LaTeX Alignment Leaks or Only Hits One Line

Most broken alignment comes down to scope. There are two versions of the same mistake.

The first is a declaration with no group around it. A bare \raggedleft changes every paragraph that follows, up to the end of the current group or environment. If it sits in the document body, that can mean the rest of the paper.

\raggedleft
Approved: 4 April 2026

The results section starts here.

Both paragraphs come out right-aligned, and so does everything after them. Wrap the line in braces with a \par, as in the first section, or use flushright instead.

The second mistake is a group that closes before the paragraph ends. LaTeX decides how a paragraph's lines are shaped only when the paragraph finishes. If your braces close first, the setting is already gone by then.

ww {\centering xx \\ yy} zz

This gives a centered first line reading ww xx, then a normal second line reading yy zz. The \\ broke the line while \centering was still active, but the paragraph ended after the group closed. The reference manual's \centering page uses this exact case.

{\centering xx \\ yy\par} zz

Now xx and yy are both centered, and zz starts a new, ordinary paragraph. The rule: a declaration's scope has to include the blank line, the \par or the \end that finishes the paragraph.

Align Right LaTeX Text on the Same Line with \hfill

Sometimes you only need to align right in LaTeX for part of a line, such as a name on the left and a date on the right. flushright can't do it, because it starts a new paragraph and drops the date onto its own line. Use \hfill instead.

\noindent Jane Smith \hfill 12 March 2026

The name sits at the left margin and the date at the right, with stretchy space between them. The \noindent stops the paragraph indent from nudging the name inward. To right-align a single line, put nothing before the fill: \noindent\hfill Draft 3.

Two fills split the leftover space evenly, which gives you a left, middle and right layout.

\noindent Course: PHYS 201 \hfill Quiz 2 \hfill Spring 2026

The middle item is only truly centered when the outer two are the same width, since each fill takes half the leftover space.

One catch: \hfill is the same as \hspace{\fill}, so LaTeX throws it away at a line break. Write Line one\\ \hfill Line two and the second line stays on the left. The reference manual's \hfill page gives the fix: use \hspace*{\fill}, whose space survives the break.

Less Ragged Edges with the ragged2e Package

The standard commands have a flaw. They make hyphenation almost impossible, so ragged text can look very uneven, especially in narrow columns. The ragged2e package on CTAN (version 3.6, dated 2023-06-22) adds versions that allow hyphenation.

\usepackage{ragged2e} % in the preamble

\begin{FlushLeft}
Ragged right text that can still hyphenate long words.
\end{FlushLeft}

\RaggedLeft
Right-aligned text with the same improvement.

\justifying
Back to full justification.

The capitalized commands \RaggedRight, \RaggedLeft and \Centering work like their lowercase cousins, and FlushLeft, FlushRight and Center mirror the environments. The package manual also documents \justifying and a justify environment for switching back to justified text. Load it with the newcommands option and the lowercase commands use the new behavior automatically.

Is It Better to Align Left or Justify?

We prefer ragged right for narrow columns, slides, posters and PDFs read on screen. Justification in a narrow column stretches word spaces into visible gaps, and the eye trips over them. For print body text at normal widths, LaTeX's default justification looks good, because its line breaking is very good at spreading space evenly.

If you do go ragged, load ragged2e so hyphenation evens out the right edge. One limitation: journal and university templates often fix the alignment in the class file. Follow the template over personal taste, since a submission is judged against the house style.

Text Alignment When You Draft in Markdown First

Markdown has no syntax for aligning paragraphs of text. The usual workaround is raw HTML, which our guide to centering text in Markdown covers for GitHub and other renderers. Math in Markdown often goes through KaTeX, and KaTeX's support table lists \hfill as not supported. None of the text alignment commands above are math commands either.

So in our editor, the preview renders inline and display math with KaTeX, but not \raggedleft or flushright. The practical route is to draft in Markdown, convert, then add alignment in the .tex file. The Markdown to LaTeX converter runs in your browser and passes math through unchanged. It outputs a .tex file and doesn't compile a PDF, so you compile it yourself. For the Pandoc route, see converting Markdown to LaTeX, and if you're still choosing a format, read Markdown vs LaTeX.

Right, left or centered, every option comes down to an environment for whole blocks, a declaration for groups, and \hfill for one line. Keep the paragraph end inside the group and you can align right LaTeX text without scope surprises. If you draft in Markdown first, write in our editor with a live KaTeX math preview. Then convert with the Markdown to LaTeX converter and add your alignment in the .tex file.