3

I'm using pandoc's default ConTeXt template, and it uses the following setup for blockquotes:

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

Then, any quoted text is entered as

\startblockquote
 Quoted text
\stopblockquote 

Now I want to have this quoted text centered on the page, but setupdelimitedtext does not seem to have that option (adding align=middle has no effect).

This surprises me, as it seems like a reasonable expectation, and makes me suspicious that perhaps I'm going about it all wrong. Is there a more ConTeXt-idiomatic way to do this?

Also, I can't find documentation for the setupdelimitedtext command in the ConTeXt manual. Is it been deprecated or something?

  • 3
    delimitedtext does not provide the align key. (Even if it did, you need a comma after align=middle to get it to work). If you need a specific feature of delimitedtext, please send a feature request to the context mailing list to add align key to delimitedtext? If you just need middle alignment, then the following works: \definestartstop[blockquote][before={\blank[medium]\startmiddlealigned},after={\stopmiddlealigned\blank[medium]}]. – Aditya Jul 18 '14 at 22:46
  • Unfortunately, this does align the text in the middle, but doesn't apply line breaks, so only a small fraction of my text is displayed. Inserting \crlf doesn't help. Any ideas? – mszep Jul 19 '14 at 7:41
2

You can change the alignment in a delimited text environment with the setup before={\setupalign[middle]}. What can be changed as well is to set the spacing around the environment with the spacebefore and spaceafter keys, the setting for spaceafter is only needed when you want a different value from spacebefore.

\setupdelimitedtext
  [blockquote]
  [spacebefore=medium,
   %spaceafter=medium,
   indentnext=no,
   before={\setupalign[middle]}]

\starttext

\input knuth

\startblockquote
\input ward
\stopblockquote 

\input zapf

\stoptext
  • This works as well, and seems the most succinct, but I wonder if this is idiomatic, to use \setupalign in the middle of the document like that? Is the choice between before=\setupalign[middle] and before=\startalignment[middle], after=\stopalignment purely personal preference or are there some guidelines or issues I'm not aware of? The spacing issue is incidental, but thanks anyway for the tip :-) – mszep Jul 19 '14 at 19:38
  • 1
    The \startalignment is a simple wrapper for the \setupalign command which starts a group before the alignment is changed to keep the changes local to the group. Because the blockquote environment already starts a local group before the \setupalign is used there is no need to use the \startalignment environment. – Wolfgang Schuster Jul 20 '14 at 8:29
1

Based on Aditya's comment, I've found something that works:

\definestartstop[blockquote][before={\blank[medium]\startalignment[middle]},
                             after={\stopalignment\blank[medium]}]

It'd be helpful to understand why \startmiddlealigned didn't work though...

  • 2
    \startmiddleanligned...\stopmiddlealigned is equivalent to \midaligned{...}, so it typesets the content inside a \hbox, that does not split lines. – Aditya Jul 19 '14 at 15:12
  • @mszep you wanted it, centered on the page. And you already said that it works. But I'm not quite sure with the above code, blockquote is centered on the page. – doed Jul 19 '14 at 17:53
  • @doed I should have been more precise; I meant horizontally centered. Indeed, the above code centers the text horizontally, but not vertically, so the text does not necessarily appear in the middle of the page. – mszep Jul 19 '14 at 19:33

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.