Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
2  
\begin{center}``\textit{\textbf{#1}}\end{center}? –  Marc van Dongen 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
add comment

1 Answer

up vote 10 down vote accepted

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}
share|improve this answer
    
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]...? –  drozzy 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. –  drozzy 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.