From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: alternating items in an itemization
Date: Tue, 24 May 2011 14:16:16 +0200 [thread overview]
Message-ID: <3F5D4FFA-0854-4A8D-BA57-E15EB588F435@googlemail.com> (raw)
In-Reply-To: <ireern$lt8$1@dough.gmane.org>
Am 23.05.2011 um 22:08 schrieb Jesse Alama:
> 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).
Solution 1:
\definetextbackground[john-background][frame=off,location=paragraph,backgroundcolor=green]
\definetextbackground[mary-background][frame=off,location=paragraph,backgroundcolor=red]
\defineenumeration
[john]
[ text=John: ,
width=3em,
number=no,
location=left,
before={\starttextbackground[john-background]},
after=\stoptextbackground]
\defineenumeration
[mary][john]
[ text=Mary: ,
before={\starttextbackground[mary-background]},
after=\stoptextbackground]
\starttext
\john What did you have for breakfast?\par
\mary I skipped breakfast today.\par
\startjohn Oh, why?\stopjohn
\startmary Because I wasn't hungry. I was too distraught at what had happened the previous night.\stopmary
\stoptext
Solution 2:
\usemodule[annotation]
\definetextbackground[john-background][frame=off,location=paragraph,backgroundcolor=green]
\definetextbackground[mary-background][frame=off,location=paragraph,backgroundcolor=red]
\defineannotation
[john]
[ text=John,
stopper=: ,
inbetween=,
before={\starttextbackground[john-background]},
after={\stoptextbackground},
spacebefore=nowhite]
\defineannotation
[mary][john]
[ text=Mary,
before={\starttextbackground[mary-background]},
after={\stoptextbackground}]
\starttext
\john{What did you have for breakfast?}
\mary{I skipped breakfast today.}
\startjohn Oh, why?\stopjohn
\startmary Because I wasn't hungry. I was too distraught at what had happened the previous night.\stopmary
\stoptext
Wolfgang
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2011-05-24 12:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-23 20:08 Jesse Alama
2011-05-24 12:16 ` Wolfgang Schuster [this message]
2011-05-24 14:24 ` Jesse Alama
2011-05-24 14:35 ` Wolfgang Schuster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3F5D4FFA-0854-4A8D-BA57-E15EB588F435@googlemail.com \
--to=schuster.wolfgang@googlemail.com \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).