6

Let assume that I want to redefine the quotation environment putting the text in italic and inserting it between quotation marks. I have some problems in adjusting the space after the opening of quotation marks and before the closure of them.

With this code I obtain:

\documentclass{article}

\newenvironment{itquote}
  {\begin{quotation}\itshape``}
  {''\end{quotation}}

\begin{document}


\begin{itquote}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. 
Curabitur dictum gravida mauris.
Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
\end{itquote}

\end{document}

enter image description here

And to fix the spacing I clearly have to put two % in this way:

\begin{itquote}%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. 
Curabitur dictum gravida mauris.
Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.%
\end{itquote}

enter image description here

But I want to fix it inside the definition of the environment in the preamble without the two % symbols in the document, how can I do this?

I try also with \unskip but it works only for the the end:

\newenvironment{itquote}
  {\begin{quotation}\itshape``}
  {\unskip''\end{quotation}}
  • 2
    When the "begin" part of an environment ends with typeset text that starts a paragraph, add \ignorespaces. For the "end" part your way is correct. – egreg Jul 15 '13 at 15:20
  • @egreg ops.. stupid question.. I din't know this command, thanks! – Red Jul 15 '13 at 15:24
  • There was already a question about this: tex.stackexchange.com/questions/102614/… – egreg Jul 15 '13 at 15:31
10

In the \begin part you can use \ignorespaces (see egreg's comment), in the \end part a previous space can be undone by \unskip:

\documentclass{article}

\newenvironment{itquote}
  {\begin{quotation}\itshape``\ignorespaces}
  {\unskip''\end{quotation}}

\begin{document}

\begin{itquote}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
Curabitur dictum gravida mauris.
Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
\end{itquote}

\end{document}

Result

Remarks:

  • \unskip removes the last skip space, that can also a vertical skip space. This can be prevented by \ifhmode\unskip\fi. It is not needed here, because there are bigger problems, if the environment contents ends with vertical space. The quotation mark would be out of place anyway.

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.