7

Inside my quote, I have a bold, italic and centered header. How can I define a command so that I can typeset this text all in one go? I tried:

\newcommand{\QuoteTitle}[1]{\centerline{\textit{\textbf{#1}}}}

but it just jammed the whole thing on one line!

Here is what I need it to look like, given this input:

\begin{quote}
``\QuoteTitle{Quot paria coniculorum in uno anno ex uno pario germinentur.}

Qvidam posuit unum par cuniculorum in quodam loco, qui erat undique
pariete circundatus, ut sciret, quot ex eo paria germinarentur in uno
....''
\end{quote}

should produce the following output:

enter image description here

2
  • 2
    \begin{center}``\textit{\textbf{#1}}\end{center}? – user10274 Mar 10 '13 at 4:58
  • 1
    @drozzy \centerline is a TeX command and it does what it states. It centers the text on one line. Go with Marc's suggestion. – Yiannis Lazarides Mar 10 '13 at 5:52
10

I think it might be easier to instead redefine the quote environment to take an optional argument, so that it could be used as

\begin{quote}
...
\end{quote}

or

\begin{quote}[Title goes here]
...
\end{quote}

So, in the code below, that's exactly what I've done, using

\let\oldquote\quote
\let\oldendquote\endquote

and then, borrowing the 'empty' test from What is the difference between \empty and \@empty? to redefine the quote environment as

\renewenvironment{quote}[1][]{\oldquote%
        \if\relax\detokenize{#1}\relax
        ``
        \else
            \begin{center}%
            ``{\bfseries\itshape #1}%
            \end{center}\nobreak
        \fi}{''\oldendquote}

screenshot

Here's the complete MWE

\documentclass{article}

\let\oldquote\quote
\let\oldendquote\endquote

\renewenvironment{quote}[1][]{\oldquote%
        \if\relax\detokenize{#1}\relax
        ``
        \else
            \begin{center}%
            ``{\bfseries\itshape #1}%
            \end{center}\nobreak
        \fi}{''\oldendquote}

\begin{document}

\begin{quote}
  Qvidam posuit unum par cuniculorum in quodam loco, qui erat undique
  pariete circundatus, ut sciret, quot ex eo paria germinarentur in un
  Qvidam posuit unum par cuniculorum in quodam loco, qui erat undique
  pariete circundatus, ut sciret, quot ex eo paria germinarentur in un
\end{quote}

\begin{quote}[Here's one with a title]
  Qvidam posuit unum par cuniculorum in quodam loco, qui erat undique
  pariete circundatus, ut sciret, quot ex eo paria germinarentur in un
  Qvidam posuit unum par cuniculorum in quodam loco, qui erat undique
  pariete circundatus, ut sciret, quot ex eo paria germinarentur in un
\end{quote}
\end{document}
3
  • Wow, thanks. Great suggestion. Do you think it would make sense to create a new environment, instead of redefining the old one? I mean I only need this twice in a book... Something like \begin{TitleQuote}[Title]...? – Andriy Drozdyuk Mar 10 '13 at 14:40
  • Hm... this wouldn't work if I use something like csquotes package, would it? Well, that's a different question that I will ask! Cheers. – Andriy Drozdyuk Mar 10 '13 at 15:26
  • @drozzy it's up to you if you want to create a new environment :) if so, you don't need to mess around with the \let business, and just use \newenvironment{titlequote}[1][]{.... etc. glad it helped! – cmhughes Mar 10 '13 at 18:12

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.