Difference between revisions of "Long quotations and extracts"

From ConTeXt wiki
(Define long quotations with \definedelimitedtext)
(example of setting block quotations in smaller type)
Line 60: Line 60:
 
   before={\setupindenting[next]}]
 
   before={\setupindenting[next]}]
 
</texcode>
 
</texcode>
 +
 +
==Example using <cmd>setupdelimitedtext</cmd>==
 +
 +
Here is how to get indented quotations set in small type:
 +
<texcode>
 +
\setupdelimitedtext[blockquote][style={\setupbodyfont[9pt]}]
 +
Hello
 +
\startblockquote
 +
\input knuth
 +
\par
 +
\stopblockquote
 +
Hello
 +
</texcode>
 +
 +
The <cmd>par</cmd> inside the block quotation keeps TeX's paragraph builder happy.  Otherwise the last paragraph in the block quotation gets the wider linespacing of the outside environment rather than the narrower linespacing appropriate to nine-point text.
 +
 +
Using <code>style=small</code> does not work as well as <code>style={\setupbodyfont[9pt]}</code> or <code>style={\setupbodyfont[10pt]}</code>, because <code>small</code> shrinks only the font size but not the linespacing.

Revision as of 21:49, 16 December 2008

The following may serve as a guide to others in formatting long quotations or extracts:

Long quotations defined with \definestartstop

In body text:

 \defineblank[extractdistance][3pt]
 \definestartstop[extract][
     before={\blank[extractdistance]       %[extractdistance,force] causes spurious overfull \hbox warnings
    	\setupnarrower[left=1.5pc,right=1.5pc]
    	\startnarrower[left,right]
	\noindent},
      after={\stopnarrower
   	\blank[extractdistance]
	\indenting[yes]}]

In footnotes:

\defineblank[footenoteextractdistance][2.7pt]
 \definestartstop[fnextract][
      before={\blank[footenoteextractdistance]
    	\setupnarrower[left=1.5pc,right=1.5pc]
    	\startnarrower[left,right]
	\noindent},
      after={\stopnarrower
   	\blank[footenoteextractdistance]
	\indenting[yes]}]

Long quotations defined with \definedelimitedtext

In body text:

\defineblank[extractdistance][3pt]

\definedelimitedtext[extract][blockquote]

\setupdelimitedtext
  [extract]
  [spacebefore= extractdistance,
   leftmargin=1.5pc,
   before={\setupindenting[next]}]

In footnotes:

\defineblank[footenoteextractdistance][2.7pt]

\definedelimitedtext[fnextract][blockquote]

\setupdelimitedtext
  [fnextract]
  [spacebefore= footenoteextractdistance,
   leftmargin=1.5pc,
   before={\setupindenting[next]}]

Example using \setupdelimitedtext

Here is how to get indented quotations set in small type:

\setupdelimitedtext[blockquote][style={\setupbodyfont[9pt]}]
Hello
\startblockquote
\input knuth
\par
\stopblockquote
Hello

The \par inside the block quotation keeps TeX's paragraph builder happy. Otherwise the last paragraph in the block quotation gets the wider linespacing of the outside environment rather than the narrower linespacing appropriate to nine-point text.

Using style=small does not work as well as style={\setupbodyfont[9pt]} or style={\setupbodyfont[10pt]}, because small shrinks only the font size but not the linespacing.