5

I'm trying to make a custom quote environment. I'm beginning from the following:

\documentclass{article}
\usepackage{xcolor}
\usepackage{times}
\definecolor{quotationcolour}{HTML}{F0F0F0}
\definecolor{quotationmarkcolour}{HTML}{1F3F81}

\newcommand{\epiline}{\hrule}

\newcommand{\hugequote}{%
\fontsize{42}{48}\selectfont \color{quotationmarkcolour}\textbf{"}
  \vskip -.6em
}
\newcommand{\epigraph}[2]{%
  \bigskip
  \begin{flushright}
  \colorbox{quotationcolour}{%
    \parbox{.60\textwidth}{%
    \epiline \vskip 1em {\hugequote} \vskip -.5em
    \parindent 2.2em
    #1\begin{flushright}\textsc{#2}\end{flushright}
    \epiline
    }
  }
  \end{flushright}
  \bigskip
}

\begin{document}
  \epigraph{lalal}{lilili}
\end{document}

I would like to put a small picture at the top of the quote, and which overlaps the first horizontal line, something which looks like this:

enter image description here

5

Update

After some comments, this is the required aspect:

enter image description here

The code:

\documentclass{article}
\usepackage[many]{tcolorbox}

\definecolor{quotationcolour}{HTML}{F0F0F0}
\definecolor{quotationmarkcolour}{HTML}{1F3F81}

\newcommand\hugequote{%
{\fontsize{42}{48}\selectfont\color{quotationmarkcolour}\textbf{"}}
  \vskip -.6em
}

\newtcolorbox{QuoteBox}[1]{
  breakable,
  enhanced,
  boxrule=0pt,
  colback=quotationcolour,
  arc=0pt,
  top=1cm,
  bottom=0.7cm,
  outer arc=0pt,
  overlay={
    \draw 
      ([yshift=-0.3cm,xshift=6pt]frame.north west) -- ([yshift=-0.3cm,xshift=-6pt]frame.north east);
    \draw 
      ([yshift=0.3cm,xshift=6pt]frame.south west) -- ([yshift=0.3cm,xshift=-6pt]frame.south east);
    \node[inner sep=0pt,outer sep=0pt,anchor=north west] 
      at ([yshift=0.4cm]frame.north west)
      {\includegraphics[height=1.2cm,width=3cm]{example-image-a}};
    \node[anchor=south east,font=\scshape] 
      at ([yshift=0.3cm,xshift=-6pt]frame.south east) 
      {#1}; 
  },
  before upper={\begingroup\fontsize{42}{48}\selectfont\color{quotationmarkcolour}\textbf{"}\endgroup}
}
\newcommand\epigraph[2]{\begin{QuoteBox}{#2}#1\end{QuoteBox}}

\begin{document}

\epigraph{lalal}{lilili}

\end{document}

Here's an option using tcolorbox:

enter image description here

The code:

\documentclass{article}
\usepackage[many]{tcolorbox}

\definecolor{quotationcolour}{HTML}{F0F0F0}
\definecolor{quotationmarkcolour}{HTML}{1F3F81}

\newcommand\hugequote{%
{\fontsize{42}{48}\selectfont\color{quotationmarkcolour}\textbf{"}}
  \vskip -.6em
}

\newtcolorbox{QuoteBox}[1]{
  breakable,
  enhanced,
  boxrule=0pt,
  colback=quotationcolour,
  arc=0pt,
  top=1.4cm,
  bottom=0.7cm,
  outer arc=0pt,
  overlay={
    \draw 
      ([yshift=-0.7cm,xshift=6pt]frame.north west) -- ([yshift=-0.7cm,xshift=-6pt]frame.north east);
    \draw 
      ([yshift=0.3cm,xshift=6pt]frame.south west) -- ([yshift=0.3cm,xshift=-6pt]frame.south east);
    \node[inner sep=0pt,outer sep=0pt,anchor=north west] 
      at (frame.north west)
      {\includegraphics[height=1.2cm,width=3cm]{example-image-a}};
    \node[anchor=south east,font=\scshape] 
      at ([yshift=0.3cm,xshift=-6pt]frame.south east) 
      {#1}; 
  },
  before upper={\begingroup\fontsize{42}{48}\selectfont\color{quotationmarkcolour}\textbf{"}\endgroup}
}
\newcommand\epigraph[2]{\begin{QuoteBox}{#2}#1\end{QuoteBox}}

\begin{document}

\epigraph{lalal}{lilili}

\end{document}
  • It would be perfect if the colored box would not be up to the top of the image, but rather right over the horizontal line. The image is perfectly placed still! If there is not solution to this its already helpful, thanks. – Louis La Brocante Jul 22 '15 at 19:37
  • @LouisLaBrocante The modification is easy. I'll make it as soon as I am in front of a computer. – Gonzalo Medina Jul 22 '15 at 19:56
  • i was able to modify a bit the code to get what i wanted! thanks a lot for the very reliable/general setup which allowed me to do this! – Louis La Brocante Jul 22 '15 at 19:56
  • @LouisLaBrocante You're welcome! I'm glad to hear that you could modify my code to get the desired redult. In any case, I updated my answer also. – Gonzalo Medina Jul 22 '15 at 21:12
2

Maybe this is what you're looking for: I typeset the image after the quotation box.

\documentclass{article}
\usepackage{xcolor,graphicx}
\usepackage{times}
\definecolor{quotationcolour}{HTML}{F0F0F0}
\definecolor{quotationmarkcolour}{HTML}{1F3F81}

\newcommand{\epiline}{\hrule}

\newcommand{\hugequote}{%
\fontsize{42}{48}\selectfont \color{quotationmarkcolour}\textbf{"}
  \vskip -.6em
}
\newcommand{\epigraph}[2]{%
  \bigskip
  \begin{flushright}
  \colorbox{quotationcolour}{%
    \parbox[t]{.60\textwidth}{%
    \epiline \vskip 1em {\hugequote} \vskip -.5em
    \parindent 2.2em
%    \vspace{1cm}
    #1\begin{flushright}\textsc{#2}\end{flushright}
    \epiline
    }\makebox[0pt][r]{%
       \raisebox{1mm}{%
         \makebox[.6\textwidth][l]{\includegraphics[height=.8cm,width=2cm]{duck}}%
       }%
     }%
  }
  \end{flushright}
  \bigskip
}

\begin{document}
  \epigraph{lalal}{lilili}
\end{document}

enter image description here

  • Should it be ``lalal? – Sigur Jul 20 '15 at 11:07
  • im not able to place it properly on the top left of the quote over the line. – Louis La Brocante Jul 20 '15 at 11:21

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.