4

I am using the following aquote environment, to create quotes that also place an author name at the bottom right of the quote (in beamer). This macro is used because the Author name can be 'squished up' into the space on the previous line if there is some.

My latex skills are limited. Is it possible to redefine this environment to also \enquote{} the text within the quote? I am having trouble working out how to do it.

\documentclass{beamer}

\usepackage[style=british]{csquotes}

\def\signed #1{{\leavevmode\unskip\nobreak\hfil\penalty50\hskip1em
  \hbox{}\nobreak\hfill #1%
  \parfillskip=0pt \finalhyphendemerits=0 \endgraf}}

\newsavebox\mybox
\newenvironment{aquote}[1]
  {\savebox\mybox{#1}\begin{quote}}
  {\vspace*{1mm}\signed{\usebox\mybox}\end{quote}}

\begin{document}

\begin{frame}
      Example:
      \begin{aquote}{Author Name}
      This is an example with some text that goes across more than one line.    
      \end{aquote}

\end{frame}

\end{document}

This macro I am using is based on an original one posted on this site for articles, but was customised slightly to work with beamer. If I can find the original example on this site I will link it below.

enter image description here

  • Try replacing #1 in \signed with \enquote{#1}. – TeXnician Apr 18 '17 at 6:30
  • 1
    Replacing the first #1 with enquote essentially does nothing (I don't know why). Replacing the second or third #1 with enquote puts quotes around the Author name rather than the quote. – Jacob Apr 18 '17 at 7:31
  • 1
    If meant the one after \hfill. So you would have a line \hbox{}\nobreak\hfill\enquote{#1}% – TeXnician Apr 18 '17 at 7:48
  • 1
    As far as I can tell, that \hfill #1 is what is used to push the Author Name to the right. Putting it in \enquote{} puts quotes around the Author Name rather than the actual quote. – Jacob Apr 18 '17 at 7:55
  • Then put \openautoquote after \begin{quote} and \closeautoquote before \vspace*{1mm}. – TeXnician Apr 18 '17 at 7:57
5

Here's a solution you maybe have to adjust according to your fonts (the \hspace).

example quote

\documentclass{beamer}

\usepackage[style=british]{csquotes}

\def\signed #1{{\leavevmode\unskip\nobreak\hfil\penalty50\hskip1em
  \hbox{}\nobreak\hfill #1%
  \parfillskip=0pt \finalhyphendemerits=0 \endgraf}}

\newsavebox\mybox
\newenvironment{aquote}[1]
  {\savebox\mybox{#1}\begin{quote}\openautoquote\hspace*{-.7ex}}
  {\unskip\closeautoquote\vspace*{1mm}\signed{\usebox\mybox}\end{quote}}

\begin{document}

\begin{frame}
      Example:
      \begin{aquote}{Author Name}
      This is an example with some text that goes across more than one line.    
      \end{aquote}

\end{frame}

\end{document}

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.