\raggedright removes paragraph indentation
The definition of \raggedright
in the LaTeX kernel is
% latex.ltx, line 3974:
\def\raggedright{%
\let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip
\leftskip\z@skip
\parindent\z@}
Thus you can say in your document preamble
\makeatletter
\newcommand\iraggedright{%
\let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip
\leftskip\z@skip}
\makeatother
removing the last instruction. Now \iraggedright
will do what you want.
A different approach is to use ragged2e
\documentclass{article}
\usepackage{lipsum}
\usepackage{ragged2e}
\setlength{\RaggedRightParindent}{\parindent}
\begin{document}
\RaggedRight
\lipsum[1-2]
\end{document}
Note that \RaggedRight
is less strict than \raggedright
in that it allows hyphenation, so making “less ragged” output.
It is common practice to typeset flush-left (aka ragged-right) paragraphs without indentation of the first lines of paragraphs. To compensate for this, one usually also inserts a bit of extra whitespace between paragraphs. You could get this effect (i.e., the extra spacing between paragraphs) by loading the parskip
package.
To restore indentation of the first line of a paragraph, you could issue the command
\setlength\parindent{2em} % or whatever length you desire
after issuing the command \raggedright
.
If you really need to typeset entire paragraphs in ragged-right mode, you should consider loading the ragged2e package and issuing the command \RaggedRight
(notice the capitalization of the two R
s), either in the preamble or at the start of the material you want to get typeset ragged-right (flush-left). Doing so will (re)enable hyphenation, making the right-hand edges of paragraphs look much less ragged looking (pun intended) than if you used \raggedright
. As @MartinSchröder -- the author of the ragged2e
package -- has pointed out in a comment, the package provides the parameter \RaggedRightParindent
. You could set this parameter equal to the basic \parindent
parameter to re-enable indentation of the first line of every paragraph. Importantly, you should set the value of this length parameter before issuing the command \RaggedRight
.
\documentclass{article}
\usepackage{lipsum}
\usepackage{ragged2e}
\setlength\RaggedRightParindent{\parindent} % default value of this parameter is `0pt`
\RaggedRight % if invoked in preamble, entire document is set Ragged-Right
\begin{document}
\lipsum[1-3]
\end{document}