# Left-justify text in LaTeX

How do I left-justify my whole report? I have tried

\begin{flushleft}\end{flushleft}


But the problem is that it removes the alignment of my pictures. So is there a way to align only the text globally?

• Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. – Tobi May 16 '12 at 8:06
• Try to put \raggedright just after the command \begin{document} and remove all \begin{flushleft}...\end{flushleft}. Tell me if that works. – yo' May 16 '12 at 8:10

I recommend you load the ragged2e package (part of the ms suite of packages) with the document option:

\usepackage[document]{ragged2e}


With this setup, all parts of the document will be typeset left-justified (or "flush-left") rather than fully-justified. The term "all parts of the document" includes:

• regular material in the body of the document -- mostly, all paragraphs
• all footnotes
• all material in minipage environments
• all p-type columns in tabular-like and array environments
• all material in \parboxes
• all material in \marginpar directives.

In contrast, inserting the "standard LaTeX" \raggedright directive immediately after \begin{document} affects only the "regular" material; it does not affect any of other five types of material, at least not when executed solely after \begin{document}.

Relative to the \raggedright directive, employing the ragged2e package also preserves TeX's ability to hyphenate words. This, in turn, avoids creating the excessive line raggedness that almost invariably results from using \raggedright.

A separate observation: In the standard LaTeX document classes, material contained in a "floating" environment -- such as figure and table -- is aligned flush-left by default. If you want to center the contents of these environments, you may do so by issuing a \centering instruction after the \begin{figure} and \begin{table} directives. (The scope of the \centering instruction ends automatically when LaTeX processes the \end{figure} and \end{table} statements.)

\documentclass{article}
\usepackage[document]{ragged2e}
\usepackage{lipsum,xcolor}
\begin{document}
%%\raggedright % this directive only affects "regular" material

\marginpar{\textcolor{red}{Marginpar}\\\lipsum[2]}
{\color{red}Regular Material}\\
\lipsum[2]

aaa\footnote{\textcolor{red}{Footnote}\lipsum*[2]}

\textcolor{red}{Minipage}\\
\begin{minipage}{\textwidth}
\lipsum[2]
\end{minipage}

\textcolor{red}{Tabular}\\
\begin{tabular}{@{}p{\textwidth}@{}}
\lipsum[2]
\end{tabular}

\textcolor{red}{Parbox}\\
\parbox{\textwidth}{\lipsum[2]}
\end{document}

• Left justification is horrible, but this is what they want from me.. – Post Self Feb 15 '18 at 8:24
• @kim366 - Everything is relative: Left-justification may not be "perfect" (and it may even be "horrible"...), but it will still be a lot better than the full justification, which may entail the creation of huge inter-word gaps. If you can at all arrange it, do load the ragged2e package and execute \RaggedRight: because hyphenation is permitted in this setup, the right-hand edge of the text block will almost certainly be a lot less ragged than if you executed \raggedright. – Mico Feb 15 '18 at 12:11
• I see. My actual problem with this package is that minted inline code goes past the right boundary, and so do inline math expressions, which did not happen with full justification. Without hyphenation, you are correct; full justification creates ugly word gaps – Post Self Feb 15 '18 at 15:41
• @kim366 - Please post a new query, in which you lay out your constraints (e.g., which document class you must employ), your objectives, and what's currently not working correctly. – Mico Feb 15 '18 at 15:52

As far as TeX's alignment goes a graphic is just the same as a big letter, it does not treat it any differently.

If you want your entire document flush left it is better to use the declaration form \raggedright after \begin{document} and then use \begin{center} or \begin{flushright} around your \includegraphics. Of if they are already in an environment such as figure perhaps use the declaration forms \centering or \raggedleft rather than the environments.