带有图片的精美引文

带有图片的精美引文

我正在尝试创建自定义报价环境。我从以下内容开始:

\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}

我想在引文的顶部放置一张小图片,与第一条水平线重叠,看起来像这样:

在此处输入图片描述

答案1

更新

经过一些评论,这是必需的方面:

在此处输入图片描述

代码:

\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}

这是一个使用选项tcolorbox

在此处输入图片描述

代码:

\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}

答案2

也许这就是你要找的:我排版了图片引文框。

\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}

在此处输入图片描述

相关内容