[Tex/LaTex] how to left justify text in quote environment with the rest of the text in justified format

horizontal alignmentquoting

I need to left justify text in quote environment. The rest of the text is justified to both margins.

I just need to raggedright the text inside the quote environment.

I'm using this

\usepackage{etoolbox}
\patchcmd{\quote}{\rightmargin}{\leftmargin 0.5in \rightmargin 0}{}{}

to change the margins.

Thanks in advance

Best Answer

The patch you need is the following:

\AtBeginEnvironment{quote}{\raggedright}

so that each time a quote environment starts, the text is typeset ragged right.

MWE:

\documentclass{article}

\usepackage{lipsum} % just for the example

\usepackage{etoolbox}
\AtBeginEnvironment{quote}{\raggedright}

\begin{document}
\lipsum[2]

\begin{quote}
  \lipsum[1]
\end{quote}

\lipsum[2]
\end{document} 

Output:

enter image description here

Related Question