ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* alternating items in an itemization
@ 2011-05-23 20:08 Jesse Alama
  2011-05-24 12:16 ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Jesse Alama @ 2011-05-23 20:08 UTC (permalink / raw)
  To: ntg-context

I'd like to define an itemization that has two kinds of items, 
representing a dialogue between two people.  (One could imagine 
extending this to more than two.)  I'd like to have something like this:

\startdialogue
\john What did you have for breakfast?
\mary I skipped breakfast today.
\john Oh, why?
\mary Because I wasn't hungry.  I was too distraught at what had 
happened the previous night.
\stopdialogue

The \john and \mary parts would each be their own paragaphs.  The 
paragraphs would be colored with different text backgrounds, and joined 
up with one another  (that is, the blocks of text representing the 
paragraphs for the different speakers would be adjacent to one another).

I've tried doing this using \defineparagraphs, \defineframedtext, and 
\defineenumerations, but I can't quite get the right effect;

\setupcolors[state=start]
\definetextbackground[john-background][backgroundcolor=green]
\definetextbackground[mary-background][backgroundcolor=red]
\definestartstop[dialogue]
\defineparagraphs[john][before={\starttextbackground[john-background]},after={\stoptextbackground}]
\defineparagraphs[mary][before={\starttextbackground[mary-background]},after={\stoptextbackground}]

Putting 

this before the above \start/stopdialogue snippet (suitably enclosed in 
\start/stoptext) gives me an error about a missing "}"; I suppose I'm 
overlooking something.

An enumeration-based solution would be along these lines:

\defineenumeration
  [chat]
\setupenumerations
  [chat]
  [joinedup,packed]
\define[0]\john{\item John: }
\define[0]\may{\item Mary: }

I can't figure out how to get the textbackgrounds to work here, and 
there's a bullet symbol at the beginning of every "dialogue paragraph", 
which I'd rather get rid of (and I don't want the indent between the 
bullet and the beginning of the text).

A framed-text solution starts to come close:

\defineframedtext[john][frame=off,background=color,backgroundcolor=magenta]
\defineframedtext[mary][frame=off,background=color,backgroundcolor=lightred]

But then the boxed paragraphs are separated from each other by some 
vertical whitespace.

Another idea would be to use tables, but I haven't explored that yet.  
Any suggestions for how to render "dialogues" as above in ConTeXt?

Thanks,

Jesse


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-24 14:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-23 20:08 alternating items in an itemization Jesse Alama
2011-05-24 12:16 ` Wolfgang Schuster
2011-05-24 14:24   ` Jesse Alama
2011-05-24 14:35     ` Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).