Text alignment (center / ragged / justified)

By default LaTeX sets body text justified — flush to both the left and right margins. To switch to centered, left-, or right-aligned text you have two routes: declarations such as \centering, and environments such as center. They look alike, but they differ in the vertical space they add and in how they handle hyphenation — and not knowing the difference is how stray whitespace creeps in around your figures. This page sorts out which to reach for.

The default is justified

For the record: unless you say otherwise, LaTeX sets every paragraph justified. To make the right edge line up, it stretches and shrinks the spaces between words a little, and where needed it hyphenates a word to break the line. This is the same unobtrusive setting used for the body of newspapers and books.

For titles, headings, figure captions, and short quotations you will often want to drop justification for some other alignment. The means of changing alignment really come in just two families: declarations (\centering / \raggedright / \raggedleft) and environments (center / flushleft / flushright). Below we take each in turn, then lay out the one difference that decides between them.

Changing it with a declaration

A declaration is a command that takes effect from where you write it and stays in force to the end of its group — inside { ... }, or between an environment’s \begin and \end. There are three alignment declarations: **\centering for centered text, \raggedright for flush-left (ragged on the right), and \raggedleft** for flush-right (ragged on the left).

One important caveat: these declarations do not start a new paragraph; they only change how the paragraph is set. And the alignment is fixed at the point where the paragraph ends — that is, only if a blank line or \end falls inside the declaration’s group. If the group closes mid-paragraph, as below, only the first line ww xx comes out centered, while the second line containing yy zz is not.

latex
ww {\centering xx \\ yy} zz

So the rule of thumb is to enclose the whole paragraph you want to align and let it end inside the group — leave a blank line, or include it up to the \end of an environment such as figure. The classic case of centering an image and its caption looks like this. \\ forces a line break at any chosen point.

document.tex
\begin{figure}
  \centering
  \includegraphics[width=0.6\textwidth]{plot}
  \caption{実測値と理論値の比較\\(2026 年データ)}
\end{figure}

There is a reason this uses \centering rather than the center environment: inside a figure, \begin{center} would add unwanted vertical space above and below the image, as explained below. Avoiding that is the single biggest reason to reach for the declaration.

Changing it with an environment

The other route is the environments: **center for centered, flushleft for flush-left, and flushright** for flush-right. You wrap material as in \begin{center} ... \end{center}, and the enclosed range is set as its own paragraph with that alignment. Use \\ to break a line wherever you like (a trailing \\ after the last line is optional and adds no extra space).

document.tex
\begin{center}
  最初の行は中央に\\
  次の行も中央にそろう
\end{center}

\begin{flushright}
  右に寄せた署名\\
  2026 年 5 月
\end{flushright}

The environment form is easier to write than the declaration, and \begin/\end make the extent obvious at a glance. Under the hood these environments simply call the matching declaration (center uses \centering, flushleft uses \raggedright, flushright uses \raggedleft), so the alignment itself is identical to the declarations. What differs is the vertical space.

The decisive difference — vertical space

This is the heart of the page. The center, flushleft, and flushright environments are implemented internally as a list (a trivlist), so they automatically insert vertical space above and below, separating the block from the surrounding text. The \centering, \raggedright, and \raggedleft declarations, by contrast, add no such space.

When you want to center a passage in the middle of running text and have a little space around it (a standalone tagline, say), the center environment is handy. But when you want to align the contents of a figure or table, or of a \parbox or tabular cell, that space is either already provided or would actively break the layout — so the right choice is **a declaration (\centering, etc.).** Using \begin{center} inside a figure adds a doubled gap above and below the image and caption, leaving it looking padded out.

AlignmentDeclarationEnvironmentVertical space
中央寄せ\centeringcenterdeclaration none; environment adds it
左寄せ\raggedrightflushleftsame; ragged right edge
右寄せ\raggedleftflushrightsame; ragged left edge

On the side that is not aligned (both sides for centered, the right for flush-left), the edge is left ragged — lines of differing length. That is by design, but as the next section explains, the standard flush-left and flush-right commands carry one more pitfall.

The hyphenation pitfall and ragged2e

The standard \raggedright (and the flushleft environment) has an easily missed flaw: it disables hyphenation almost entirely. It sets the line-end stretch (\rightskip) to an infinite value, so TeX treats even very short lines as not bad — and the right edge comes out extremely ragged. With long Western words in the mix, the line-to-line differences grow large and the text gets hard to read.

The fix is the **ragged2e package, which provides new commands and environments that do the same job but allow hyphenation. The commands are \RaggedRight (flush-left), \RaggedLeft (flush-right), and \Centering (centered); the environments are FlushLeft, FlushRight, and Center** (all capitalized). The mechanism: it sets \rightskip to a finite stretch (0pt plus 2em by default) instead of an infinite one, so that TeX can hyphenate and break lines sensibly.

After switching on \RaggedRight (or its siblings), use **\justifying to switch back to justified text for a passage. To set the whole document flush-left (with hyphenation kept), load it with the [document] option**: this runs \RaggedRight at \begin{document} and also turns on the raggedrightboxes option so that \parboxes and p-columns are set flush-left too.

document.tex
\usepackage[document]{ragged2e}  % 文書全体を左寄せ(ハイフネーションあり)
% あるいは局所的に:
\begin{FlushLeft}
  ハイフネーションを保ったまま左寄せに組まれる段落。
  右端は穏やかにぎざぎざになる。
\end{FlushLeft}

For mostly-Western documents that use flush-left or flush-right, prefer ragged2e over the standard commands. Note that Japanese body text has no interword spaces to begin with, so the gap between ragged and justified is smaller and the problem is less acute than in Western text — but it still matters in paragraphs that mix in Western words.