5

Consider the following minimum working example containing a blockquote as defined in a Pandoc-generated document:

\setuppapersize [A4][A4]
\setuplayout    [width=middle,  backspace=1.5in, cutspace=1.5in,
                 height=middle, topspace=0.75in, bottomspace=0.75in]

\setuppagenumbering[location={footer,center}]

\setupdelimitedtext
  [blockquote]
  [before={\blank[medium]},
   after={\blank[medium]},
   indentnext=no,
  ]

\starttext
\input tufte
\startblockquote
\input zapf
\stopblockquote
\input knuth
\stoptext

Question

How could I obtain a light gray background for the blockquote with a dark red 1em-thick left vertical borderline only by changing the preamble? Other borders should be 0pt.

1 Answer 1

4

Since the text is marked up logically within a blockquote environment and pandoc includes custom headers included with the -H option after the default ones, you can simply create an environment which displays the text in the desired way using any mechanism which meets your needs.

I define a framedtext environment with the name blockquote and the desired features, which is used instead of the default definition.

\startsetups framedsetups
  \setupwhitespace[medium]
\stopsetups


\defineframedtext
  [blockquote]
  [
    framecolor=darkred,
    background=color,
    backgroundcolor=lightgray,
    frame=off, 
    leftframe=on,
    rulethickness=1em,
    offset=overlay,
    loffset=2em,
    roffset=1em,
    width=\textwidth,
    setups=framedsetups,
  ]

which gives

enter image description here

Another option is to use background environment with the name blockquote. For example:

\definebackground
  [blockquote]
  [
    framecolor=darkred,
    background=color,
    backgroundcolor=lightgray,
    frame=off, 
    leftframe=on,
    rulethickness=1em,
    offset=overlay,
    leftoffset=2em,
    rightoffset=1em,
    width=\textwidth,
    setups=framedsetups,
    before=\blank,
    after=\blank,
  ]

which gives the same result as before, but has the advantage that the content can break across pages.

5
  • Using pandoc's -H option to overwrite pandoc environments is really clever. Sep 4, 2013 at 13:26
  • 1
    I prefer textbackgrounds (or backgrounds) over framed as the latter does not break across pages.
    – Aditya
    Sep 5, 2013 at 17:50
  • @Aditya Another drawback of using framedtext instead of textbackground is that whitespace between paragraphs is not printed. On the other hand, I could textbackground not get that far as to print only the left frame border. Oct 23, 2013 at 19:40
  • 1
    @SergeStroobandt: See the edited answer to see how to add whitespace inside a framedtext and how to use background
    – Aditya
    Oct 24, 2013 at 0:26
  • Can you give some more detail on how to do this? I tried copying the last code block into a blockquote.tex text file, and then including it with pandoc infile.md -o outfile.pdf -H blockquote.tex, but I get an ! Undefined control sequence. l.44 \definebackground error.
    – naught101
    Oct 20, 2014 at 2:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .