From: Robert via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: r.ermers@hccnet.nl
Subject: [NTG-context] Re: serial letters
Date: Mon, 11 Nov 2024 16:12:00 +0100 [thread overview]
Message-ID: <B9753422-FA2C-41B2-8B86-0B249174228F@hccnet.nl> (raw)
In-Reply-To: <5c77145c-2e8c-4d9d-87aa-775e1155e9fc@mailbox.org>
Interesting question. You can use an xml database in which you collect your contacts and how to address them. I have been doing this for over 20 years now. Try this for a single letter:
\startxmlsetups xml:setups
\xmlfilter{#1}{contact[@label=‘labelMaryDoe']/command(xml:contact)}
\xmlsetsetup{#1}{prefix|email|initials|address|city|telephone|information|internet|prov|informalname|formalname|telephone||formalname|mobiletelephone}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:setups}
\setuplettersection[content][alternative=setups]
\startsetups[letter:section:content]
\readtexfile{./letter-to-mycontacts.tex}{}
\stopsetups
\startxmlsetups xml:contact
\setupletter
[toaddress={\switchtobodyfont[reset,10pt]\xmltext{#1}{/address/(bn|nm|st|pz|p)/command(xml:p)}
{\switchtobodyfont[reset,kixbarc,9pt]\xmltext{#1}{/kix}}},
opening={Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},},
closing={Kind regards,},
subject={Subject: How to write interesting letters},
signature={Joseph Doe,
\setupitemize[before=\tfx]
{\startitemize[blacktriangle,joinedup,packed,nowhite,text]
\item Brother of John Doe
\stopitemize
}}]
\relax
\placeletter
\stopxmlsetups
\setuppagenumbering [state=stop]
\starttext
\xmlprocessfile{contacts}{myaddresses.xml}{}
\stoptext
00000
my addresses.xml:
<contacts>
<contact label='labelMaryDoe'>
<initials>M.</initials>
<formalname>Doe</formalname>
<informalname>Mary</informalname>
<prefix>Mrs</prefix>
<telephone>010-12343243</telephone>
<address>
<p>Organisation</p>
<p>T.a.v. Mrs. M. Doe</p>
<p>Long Alley</p>
<p>Shortby</p>
</address>
<email>m.doe@organisation.com</email>
<information>sent letter in 2024.</information>
</contact>
</contacts>
> Op 11 nov 2024, om 14:46 heeft juh+ntg-context--- via ntg-context <ntg-context@ntg.nl> het volgende geschreven:
>
> Dear all,
>
> using this example below from 2019 to make a serial letter I get three pages.
> The second letter is split on page 2 and 3.
>
> Are there any new approaches to make serial letters?
>
> TIA
> juh
>
> Am 09.04.19 um 21:38 schrieb Wolfgang Schuster:
>> \usemodule[letter]
>> \setuplettersection
>> [opening]
>> [alternative=setups]
>> \startsetups [letter:section:opening]
>> \doifelse{\getvariable{address}{sex}}{male}
>> {Dear Sir,}
>> {Dear Madam,}
>> \stopsetups
>> \setvariable{address}{set}{\placeletter}
>> \starttext
>> \startlettercontent
>> \unknown
>> \stoplettercontent
>> \setvariables
>> [address]
>> [name=John,
>> sex=male]
>> \setvariables
>> [address]
>> [name=Anna,
>> sex=female]
>> \stoptext
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2024-11-11 15:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-08 13:26 Henning Hraban Ramm
2019-04-09 19:38 ` Wolfgang Schuster
2019-04-10 7:08 ` Henning Hraban Ramm
2019-05-06 11:15 ` Jan U. Hasecke
2019-05-07 10:08 ` Henning Hraban Ramm
2024-11-11 13:46 ` [NTG-context] " juh+ntg-context--- via ntg-context
2024-11-11 15:12 ` Robert via ntg-context [this message]
2019-05-24 11:49 ` Jean-Philippe Rey
2019-05-24 16:05 ` Wolfgang Schuster
2019-05-24 18:19 ` jean-philippe.rey
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=B9753422-FA2C-41B2-8B86-0B249174228F@hccnet.nl \
--to=ntg-context@ntg.nl \
--cc=r.ermers@hccnet.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).