Menu

HowTo_ChangeQuote

How to define a quote or quotation environment with indentation on one side only

Just like the standard classes, the KOMA-Script classes also offer the quote and quotation environments, which are indented by a certain amount on the left and right. The quote environment in particular is quite simply defined:

\newenvironment{lquote}{%
  \list{}{\rightmargin\leftmargin}%
  \item\relax
}{%
  \endlist
}

The (additional) right margin \rightmargin is explicitly set to the value of \leftmargin.
To define a right-aligned variant, i.e. one that is only indented to the left, you only need to omit this part of the definition.

It is not much more complicated for the left-aligned, i.e. only right-indented variant: After setting the (additional) right margin, the (additional) left margin must be set to 0 again.

The end result would therefore be, for example:

\documentclass{scrartcl}

\usepackage{blindtext}

\newenvironment{raquote}{%
  \list{}{}%
  \item\relax
}{%
  \endlist
}

\newenvironment{laquote}{%
  \list{}{\rightmargin\leftmargin\leftmargin=0pt}%
  \item\relax
}{%
  \endlist
}

\begin{document}

\blindtext
\begin{quote}
  \texttt{quote}: \blindtext

  \texttt{quote}: \blindtext
  \begin{laquote}
    \texttt{laquote} in \texttt{quote}: \blindtext
  \end{laquote}
  \begin{raquote}
    \texttt{raquote} in \texttt{quote}: \blindtext
  \end{raquote}
  \texttt{quote}: \blindtext
\end{quote}
\blindtext[2]
\begin{laquote}
  \texttt{laquote}: \blindtext

  \texttt{laquote}: \blindtext
\end{laquote}
\begin{raquote}
  \texttt{raquote}: \blindtext

  \texttt{raquote}: \blindtext
\end{raquote}
\blindtext

\end{document}

The definition of quotation is a little more complicated:

\newenvironment{quotation}{%
  \list{}{\listparindent 1em%
    \itemindent    \listparindent
    \rightmargin   \leftmargin
    \parsep        \z@ \@plus\p@
  }%
  \item\relax
}{%
  \endlist
}

As the environment does not work with paragraph spacing but with paragraph indentation, the parameters \listparindent and \parsep must be adjusted accordingly. As you can see here, the paragraph spacing is not completely switched off. In the case of vertical alignment (→ \flusbottom), the paragraph spacing can be stretched up to 1pt.

You can now make the same changes here as with quote:

\documentclass{scrartcl}

\usepackage{blindtext}

\makeatletter
\newenvironment{raquotation}{%
  \list{}{\listparindent 1em%
    \itemindent    \listparindent
    \parsep        \z@ \@plus\p@
  }%
  \item\relax
}{%
  \endlist
}

\newenvironment{laquotation}{%
  \list{}{\listparindent 1em%
    \itemindent    \listparindent
    \rightmargin   \leftmargin
    \leftmargin    \z@
    \parsep        \z@ \@plus\p@
  }%
  \item\relax
}{%
  \endlist
}
\makeatother

\begin{document}

\blindtext
\begin{quotation}
  \texttt{quotation}: \blindtext

  \texttt{quotation}: \blindtext
  \begin{laquotation}
    \texttt{laquotation} in \texttt{quotation}: \blindtext
  \end{laquotation}
  \begin{raquotation}
    \texttt{raquotation} in \texttt{quotation}: \blindtext
  \end{raquotation}
  \texttt{quotation}: \blindtext
\end{quotation}
\blindtext[2]
\begin{laquotation}
  \texttt{laquotation}: \blindtext

  \texttt{laquotation}: \blindtext
\end{laquotation}
\begin{raquotation}
  \texttt{raquotation}: \blindtext

  \texttt{raquotation}: \blindtext
\end{raquotation}
\blindtext

\end{document}

For environments with different indents, however, KOMA-Script offers the addmargin environment documented in the user manuals.


Related

Wiki (English): HowTo_Layout

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.