[Tex/LaTex] The indentfirst package does not work with ragged2e package

horizontal alignmentindentationragged2e

I am using the ragged2e package in the article class and want the first paragraph within the justify environment to be indented. As such, I used the indentfirst package. However, this does not change the indentation of the first paragraph. Here is a MWE:

\documentclass{article}
\usepackage{ragged2e} % Used to get good looking fully-justified (even on both sides) text
\usepackage{indentfirst} %Used to indent the first paragraph in a section

\usepackage{lipsum} %used to generate filler text

\begin{document}

\begin{justify}
\lipsum[1-2]
\end{justify}

\end{document}

Best Answer

It is not that indentfirst doesn't work (my packages always work:-) it's just not relevant here as it only interacts with section headings. justify is a list internally so you need the itemindent to be the same as the parindent:

\documentclass{article}
\usepackage{ragged2e} % Used to get good looking fully-justified (even on both sides) text
%\usepackage{indentfirst} %Used to indent the first paragraph in a section

\usepackage{lipsum} %used to generate filler text

\renewenvironment{justify}{%
   \trivlist
   \justifying
   \itemindent\JustifyingParindent
   \item\relax
   }{%
   \endtrivlist
   }

\begin{document}

\begin{justify}
\lipsum[1-2]
\end{justify}

\end{document}