3

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

0
6

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

0
4

Use the quoting environment, which is easily customisable:

\documentclass{book}
\usepackage[utf8]{inputenc}%
\usepackage[T1]{fontenc} %
\usepackage{erewhon} %
 \usepackage{quoting} %
\usepackage{lipsum}
\quotingsetup{font={itshape, raggedright, noindent}, leftmargin=0.5in, rightmargin=0in, begintext=‘, endtext=’}

 \begin{document}

 \lipsum[2]
\begin{quoting}
Sed feugiat. Cum sociis natoque penatibus et magnis dis parturient
 montes, nascetur ridiculus mus. Ut pellentesque augue sed urna.
 Vestibulum diam eros, fringilla et, consectetuer eu, nonummy id,
 sapien. Nullam at lectus. In sagittis ultrices mauris. Curabitur
 malesuada erat sit amet massa. Fusce blandit. Aliquam erat volutpat.
 Aliquam euismod. Aenean vel lectus. Nunc imperdiet justo nec dolor.
\end{quoting}
\lipsum[3]

\end{document} 

enter image description here

8
  • Miktex return this error just starting the compilation: Command \quoting already defined. Leaders not followed by proper glue... i don't know, becouse i don´t use nor import this package before nor other file in the document...
    – jalliaum
    Jul 3 '17 at 9:51
  • Do you use a \quoting command somewhere else in your document? Can you compile this very code?
    – Bernard
    Jul 3 '17 at 17:55
  • Yes, i can compile this code...
    – jalliaum
    Jul 5 '17 at 13:11
  • Could you post a minimal compilable code reproducing the problem? I suspect a conflict with another package.
    – Bernard
    Jul 5 '17 at 13:21
  • Yes, i can compile this code... But i can't compile my code. Even i haven't any \quoting command in my document... Not even \quote command. In no one of the tex files... not even in the cls file... (a class provided by my university). Very strange..
    – jalliaum
    Jul 5 '17 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.