12

Background

Created a custom command for rendering quotations (epigraphs).

Problem

The text in the following image has no space at the border:

enter image description here

The word "and" is flush with the right margin.

Code

% Double-line for start and end of epigraph.
\newcommand{\epiline}{\hrule \vskip -.2em \hrule}
% Massively humongous opening quotation mark.
\newcommand{\hugequote}{%
  \fontsize{42}{48}\selectfont\color{quotationmarkcolour}\textbf{``}%
  \vskip -.5em%
}

% Make the box around quotations fit snugly to the epilines.
\setlength\fboxrule{0pt}
\setlength\fboxsep{0pt}

% Beautify quotations.
\newcommand{\epigraph}[2]{%
  \vskip -1.5em%
  \colorbox{quotationcolour}{%
    \begin{minipage}{\linewidth}%
    \hangindent 1.1em%
    \epiline \vskip 1em {\hugequote} \vskip -.5em%
    \parindent 2.2em%
    \setlength\marginparsep{-1.1em}%
    #1\begin{flushright}\color{quotationmarkcolour}\textsc{#2}\hspace*{1em} ~\end{flushright}%
    \epiline%
    \end{minipage}%
  }%
  \bigskip
}

Question

How would you fix the above code to adjust the inner margins of the minipage so that the word "and" (and the quotation marks) is no longer flush with the edge of its containing box, but inset by, say, 1.1em?

Ideas

  • Used \begin{quotation}#1\end{quotation}; it added too much left and right padding.
  • \addtolength\rightmargin{-1.1em}%.
  • Various \begin{minipage}{\linewidth}% settings.

1 Answer 1

6

I got something by enclosing the quoted text inside another box, this time a \parbox. The width of the parbox is 2.2em less than the width of the entire box. Then just make the left offset.

\newcommand{\epigraph}[2]{%
  \vskip -1.5em%
  \colorbox{quotationcolour}{%
    \begin{minipage}{\linewidth}%
    \dimen0\linewidth
    \advance\dimen0 by -3.3em
    \hangindent 1.1em%
    \epiline \vskip 1em \hspace{1.1em}{\hugequote} \vskip -.5em%
    \hspace{1.1em}
    \parbox{\the\dimen0}{
        \parindent 2.2em%
        \setlength\marginparsep{-1.1em}%
        #1}%
    \begin{flushright}\color{quotationmarkcolour}\textsc{#2}\hspace*{1em} ~\end{flushright}%
    \epiline%
    \end{minipage}%
  }%
  \bigskip
}
1
  • (Sorry about making an entire answer out of this, but as a new user I can't comment on the previous answer). Matthews answer is beautiful, but creates a box that is, for some reason a little wider than the text. I assume it's the inner margin of the colorbox. Changing the line to \begin{minipage}{\linewidth-6pt}% I get a box that fits the page. Jan 18, 2017 at 10:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .