2

Given

A \definetextbackground named blockquote is defined as follows:

\setupwhitespace[big]

\definetextbackground[blockquote][
  location=paragraph,
  style=italicbold,
  backgroundcolor=lightgray,
  backgroundoffset=1em,
  %width=\textwidth-2em,
  before={\setupscale[maxwidth=\textwidth]},
  frame=off,
  ]

\starttext
\startcolumns[n=2, rule=on]

\input douglas

\startblockquote
\input lorem
\stopblockquote

\input knuth

\stopcolumns
\stoptext

width

Question

The naively commented width=\textwidth-2em more or less expresses what is desired namely:

The goal is to achieve a reduction of the blockquote environment with 2em. That would result in the backgroundcolor area and its preceding normal paragraph being equal in width; much like this very StackExchange blockquote.

Defining everything in a single blockquote environment (though not necessarily a \definetextbackground) is essential for its projected use as a template for Pandoc Markdown.

finally, I have been experimenting with the \scale command but alas to no effect.

Caveat: offset

There are two ways of defining offset: a single backgroundoffset as above, or topoffset, bottomoffset, leftoffset & rightoffset as shown below. The results are different. The problem with the latter method is that columns break rather ugly without any offset. This should be avoided. Otherwise, I am agnostic towards any particular offset method.

\setupwhitespace[big]

\definetextbackground[blockquote][
  location=paragraph,
  style=italicbold,
  backgroundcolor=lightgray,
  topoffset=1.25ex, bottomoffset=2ex,
  leftoffset=1.5em, rightoffset=1.5em,
  before={\setupscale[maxwidth=\textwidth]},
  frame=off,
  ]

\starttext
\startcolumns[n=2, rule=on]

\input douglas

\startblockquote
\input lorem
\stopblockquote

\input knuth

\stopcolumns
\stoptext

column break without offset[2]

1

I'm not sure whether I understand the question correctly. You can modify the background to your liking using MetaFun. Here I add a topoffset only for the first block and a bottomoffset only for the last block in the frame.

\setupwhitespace[big]

\startuseMPgraphic{custombg}
begingroup;
    save p; path p;
    for i=1 upto nofmultipars :
        p := ( llcorner multipars[i]
            -- lrcorner multipars[i]
            -- urcorner multipars[i]
            -- ulcorner multipars[i]
            -- cycle )
        enlarged (boxfilloffset,0)
        if multilocs[i] = 1: % first block
            topenlarged boxfilloffset
        elseif multilocs[i] = 3: % last block
            bottomenlarged boxfilloffset
        fi;

        if boxlinetype>0 :
            draw p boxlineoptions;
        fi;
        if boxfilltype>0 :
            fill p boxfilloptions;
        fi;
    endfor ;
endgroup;
\stopuseMPgraphic

\definetextbackground
  [blockquote]
  [location=paragraph,
   style=italicbold,
   width=\textwidth,
   mp=custombg,
   backgroundcolor=lightgray,
   backgroundoffset=1em,
   frame=off]

\starttext
\startcolumns[n=2, rule=on]

  \samplefile{knuth}
  \samplefile{knuth}
  \samplefile{knuth}

  \startblockquote
    \samplefile{knuth}
    \samplefile{knuth}
    \samplefile{knuth}
    \samplefile{knuth}
    \samplefile{knuth}
    \samplefile{knuth}
    \samplefile{knuth}
  \stopblockquote

  \samplefile{knuth}
  \samplefile{knuth}

\stopcolumns
\stoptext

enter image description here

0

I believe the behavior you are trying to avoid is caused by the backgroundoffset=1em option. You might be looking for leftoffset option and its relatives like in the example below:

\setupwhitespace[big]

\definetextbackground[blockquote][
  location=paragraph,
  style=italicbold,
  backgroundcolor=lightgray,
  leftoffset=1em,
  rightoffset=1em,
  topoffset=1em,
  bottomoffset=1em,
  width=\textwidth,
  frame=off,
  ]

\starttext
\startcolumns[n=2, rule=on]

\input douglas

\startblockquote
\input lorem
\stopblockquote

\input knuth

\stopcolumns
\stoptext

I'm not sure if you would like the blockquote text offset or not, but if you just want to make the blockquote width match the paragraph, remove the backgroundoffset.

  • 1
    I should have mentioned that I am avoiding the use of bottomoffset and consorts because of the lack of any offset margin at the bottom of column breaks. If you could resolve that issue, this would be a valid answer. Currently, it is not. – Serge Stroobandt Oct 5 '18 at 7:05
  • I added a picture of the column break without any offset. This is the problem with this answer. – Serge Stroobandt Oct 6 '18 at 12:39
  • 1
    @SergeStroobandt Oh I understand what you mean, I just don't know how to help with that unfortunately. I had naively assumed that the problem was relatively simple. I did try to play around with a couple of options, but I'm at a loss. The only thing I can add is that you might be dealing with XY problem here... The fundamental issue seems to be that bottomoffset doesn't respect page/column breaks. That might be worth a separate question on the mailing list. – ssokolen Oct 6 '18 at 18:53

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.