Re: [NTG-context] serial letters

2019-05-24 Thread jean-philippe . rey
Thank you very much Wolfgang,

It works very well and perfectly suits my needs.

Thanks again,

> Le 24 mai 2019 à 18:05, Wolfgang Schuster  
> a écrit :
> 
> The problem is that you put the letter-environment in a command but the 
> environment uses the buffer mechanism to store the content which doesn't work 
> when it is used in a command definition.
> 
> What you have to do is to move the content of the letters out of the 
> \GenLetter command, you can use the lettercontent-environment for this. In 
> the \GenLetter command you now use the \placeletter command to flush the 
> content of the letter with the current values for the address etc.
> 
>  begin example
> \usemodule[letter]
> 
> \setupletter
>   [signature={JPR},
>  closing={Sincerely yours,}]
> 
> \setupletter
>   [   toname=\correspondenceparameter{to},
>toaddress=\correspondenceparameter{adr},
>  opening=\correspondenceparameter{civ}]
> 
> \startlettercontent
>   Blah blah \correspondenceparameter{civ}.
> \stoplettercontent
> 
> \def\GenLetter[#1]%
>   {\begingroup
>  \setupletter[#1]%
>  \placeletter
>\endgroup}
> 
> \starttext
> 
> \GenLetter[civ={M.}, to={Pierre Durand}, adr={Trifouillis-les-Oies}]
> 
> \stoptext
>  end example
> 
> Wolfgang


-- 
Jean-Philippe Rey
jean-philippe@centralesupelec.fr
91192 Gif-sur-Yvette Cedex - France
Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] serial letters

2019-05-24 Thread Wolfgang Schuster

Jean-Philippe Rey schrieb am 24.05.2019 um 13:49:

Hello Everybody,


Le 8 avr. 2019 à 15:26, Henning Hraban Ramm  a écrit :

How would you approach serial letters, e.g. to all members of a club?
(Actually I need to send out donation receipts.)

I’d like to use the letter module, since my usual letter design is using it.

I can export the addresses to CSV, JSON, Lua tables or whatever or transfer 
them to a SQLite db.
Would it make more sense to read them in Lua and combine this data with a 
buffer, or to write a single tex file for every letter?
I know how to do the latter, but I’d like to learn a more ConTeXt-ish way.
Would it make sense to use the bibliographies module?

I have the same need. I tried a basic solution:

=== Start failing example
\usemodule[letter]

\setupletter[
   signature={JPR},
   closing={Sincerely yours,}
   ]

\def\GenLetter[#1]{
   \getparameters[GL][#1]
   \startletter[
  toname={\GLto},
  toaddress={\GLadr},
  opening={\GLciv},
  ]

   Blah blah \GLciv.

   \stopletter
}

\starttext

\GenLetter[civ={M.}, to={Pierre Durand}, adr={Trifouillis-les-Oies}]

\stoptext
=== End failing example

My idea being to generate as many letters I like by multiplying the \GenLetter 
line.

However, I get an error message I don’t understand. Can someone point to the 
thing I am doing wrong ?
The problem is that you put the letter-environment in a command but the 
environment uses the buffer mechanism to store the content which doesn't 
work when it is used in a command definition.


What you have to do is to move the content of the letters out of the 
\GenLetter command, you can use the lettercontent-environment for this. 
In the \GenLetter command you now use the \placeletter command to flush 
the content of the letter with the current values for the address etc.


 begin example
\usemodule[letter]

\setupletter
  [signature={JPR},
 closing={Sincerely yours,}]

\setupletter
  [   toname=\correspondenceparameter{to},
   toaddress=\correspondenceparameter{adr},
 opening=\correspondenceparameter{civ}]

\startlettercontent
  Blah blah \correspondenceparameter{civ}.
\stoplettercontent

\def\GenLetter[#1]%
  {\begingroup
 \setupletter[#1]%
 \placeletter
   \endgroup}

\starttext

\GenLetter[civ={M.}, to={Pierre Durand}, adr={Trifouillis-les-Oies}]

\stoptext
 end example

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] serial letters

2019-05-24 Thread Jean-Philippe Rey
Hello Everybody,

> Le 8 avr. 2019 à 15:26, Henning Hraban Ramm  a écrit :
> 
> How would you approach serial letters, e.g. to all members of a club?
> (Actually I need to send out donation receipts.)
> 
> I’d like to use the letter module, since my usual letter design is using it.
> 
> I can export the addresses to CSV, JSON, Lua tables or whatever or transfer 
> them to a SQLite db.
> Would it make more sense to read them in Lua and combine this data with a 
> buffer, or to write a single tex file for every letter?
> I know how to do the latter, but I’d like to learn a more ConTeXt-ish way.
> Would it make sense to use the bibliographies module?


I have the same need. I tried a basic solution:

=== Start failing example
\usemodule[letter]

\setupletter[
  signature={JPR},
  closing={Sincerely yours,}
  ]

\def\GenLetter[#1]{
  \getparameters[GL][#1]
  \startletter[
 toname={\GLto},
 toaddress={\GLadr},
 opening={\GLciv},
 ]

  Blah blah \GLciv.

  \stopletter
}

\starttext

\GenLetter[civ={M.}, to={Pierre Durand}, adr={Trifouillis-les-Oies}]

\stoptext
=== End failing example

My idea being to generate as many letters I like by multiplying the \GenLetter 
line.

However, I get an error message I don’t understand. Can someone point to the 
thing I am doing wrong ?

Thank you.

Here is the corresponding console output:

=== Start console output
This is LuaTeX, Version 1.09.0 (TeX Live 2019/dev) 
system commands enabled.
open source > level 1, order 1, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'
system  > 
system  > ConTeXt  ver: 2018.09.13 17:41 MKIV beta  fmt: 2018.9.16  
int: english/english
system  > 
system  > 'cont-new.mkiv' loaded
open source > level 2, order 2, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 2, order 2, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system  > files > jobname 'letterTest', input './letterTest', result 
'letterTest'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
system  > synctex functionality is enabled, expect 5-10 pct runtime 
overhead!
open source > level 2, order 3, name 
'/Users/jprey/SCA/Concours/2019/JURY/Confirmation fonction/letterTest.tex'
modules > 'letter' is loaded
open source > level 3, order 4, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-modules/tex/context/third/letter/base/s-cor-01.mkvi'
modules > 'cor-00' is loaded
open source > level 4, order 5, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-modules/tex/context/third/letter/base/s-cor-00.mkvi'
resolvers   > lua > loading file 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-modules/tex/context/third/letter/base/s-cor-00.lua'
 succeeded
close source> level 4, order 5, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-modules/tex/context/third/letter/base/s-cor-00.mkvi'
modules > 'cor-06' is loaded
open source > level 4, order 6, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-modules/tex/context/third/letter/base/s-cor-06.mkvi'
close source> level 4, order 6, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-modules/tex/context/third/letter/base/s-cor-06.mkvi'
open source > level 4, order 7, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-modules/tex/context/third/letter/style/letter-imp-default.mkiv'
close source> level 4, order 7, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-modules/tex/context/third/letter/style/letter-imp-default.mkiv'
open source > level 4, order 8, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-modules/tex/context/third/letter/style/letter-imp-dinb.mkiv'
open source > level 5, order 9, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-modules/tex/context/third/letter/style/letter-imp-default.mkiv'
close source> level 5, order 9, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-modules/tex/context/third/letter/style/letter-imp-default.mkiv'
close source> level 4, order 9, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-modules/tex/context/third/letter/style/letter-imp-dinb.mkiv'
system  > module wrapping error in 'letter'
close source> level 3, order 9, name 
'/Users/jprey/Applications/ConTeXt/2018-09-13/tex/texmf-modules/tex/context/third/letter/base/s-cor-01.mkvi'
fonts   > preloading latin modern fonts (second stage)
fonts   > 'fallback modern-designsize rm 12pt' is loaded

tex error   > tex error on line 23 in file 

Re: [NTG-context] serial letters

2019-05-07 Thread Henning Hraban Ramm
Am 2019-05-06 um 13:15 schrieb Jan U. Hasecke :

> Am 10.04.19 um 09:08 schrieb Henning Hraban Ramm:
>> Thank you very much! I’ll try to come up with a solution (and document it).
> 
> Did you find a solution? I am very interested as LibreOffice's serial
> letter function is annoying.

Hi! Not yet, sorry, other stuff was more important...


Grüßlinge, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] serial letters

2019-05-06 Thread Jan U. Hasecke
Am 10.04.19 um 09:08 schrieb Henning Hraban Ramm:
> Thank you very much! I’ll try to come up with a solution (and document it).

Did you find a solution? I am very interested as LibreOffice's serial
letter function is annoying.

Grüße
juh

-- 
Software-Dokumentation mit Sphinx
Zweite überarbeitete Auflage (Sphinx 2.0)
https://www.amazon.de/dp/1793008779
Paperback: 282 Seiten
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] serial letters

2019-04-10 Thread Henning Hraban Ramm
Am 2019-04-09 um 21:38 schrieb Wolfgang Schuster 
:

> Henning Hraban Ramm schrieb am 08.04.2019 um 15:26:
>> How would you approach serial letters, e.g. to all members of a club?
>> (Actually I need to send out donation receipts.)
>> 
>> I’d like to use the letter module, since my usual letter design is using it.
>> 
>> I can export the addresses to CSV, JSON, Lua tables or whatever or transfer 
>> them to a SQLite db.
>> Would it make more sense to read them in Lua and combine this data with a 
>> buffer, or to write a single tex file for every letter?
>> I know how to do the latter, but I’d like to learn a more ConTeXt-ish way.
>> Would it make sense to use the bibliographies module?
> 
> You can use the letter module when you drop the normal letter-environment 
> which is to limited in this case because it uses the buffer mechanism to 
> store the content.
> 
> To have more control over the content for the opening etc. you can switch to 
> the setups alternative (even the content can be set in this way instead of 
> the default buffer) and set all texts with a setups-block.
> 
> The letter itself can be flushed with the \placeletter command, below is a 
> simple example where I flush the letter after each variables setting but you 
> should be able to do the same with a lua table or csv file.

Thank you very much! I’ll try to come up with a solution (and document it).

Grüßlinge, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] serial letters

2019-04-09 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 08.04.2019 um 15:26:

How would you approach serial letters, e.g. to all members of a club?
(Actually I need to send out donation receipts.)

I’d like to use the letter module, since my usual letter design is using it.

I can export the addresses to CSV, JSON, Lua tables or whatever or transfer 
them to a SQLite db.
Would it make more sense to read them in Lua and combine this data with a 
buffer, or to write a single tex file for every letter?
I know how to do the latter, but I’d like to learn a more ConTeXt-ish way.
Would it make sense to use the bibliographies module?


You can use the letter module when you drop the normal 
letter-environment which is to limited in this case because it uses the 
buffer mechanism to store the content.


To have more control over the content for the opening etc. you can 
switch to the setups alternative (even the content can be set in this 
way instead of the default buffer) and set all texts with a setups-block.


The letter itself can be flushed with the \placeletter command, below is 
a simple example where I flush the letter after each variables setting 
but you should be able to do the same with a lua table or csv file.


\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

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] serial letters

2019-04-08 Thread Henning Hraban Ramm
How would you approach serial letters, e.g. to all members of a club?
(Actually I need to send out donation receipts.)

I’d like to use the letter module, since my usual letter design is using it.

I can export the addresses to CSV, JSON, Lua tables or whatever or transfer 
them to a SQLite db.
Would it make more sense to read them in Lua and combine this data with a 
buffer, or to write a single tex file for every letter?
I know how to do the latter, but I’d like to learn a more ConTeXt-ish way.
Would it make sense to use the bibliographies module?

Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] serial letters with letter module

2011-02-10 Thread R. Ermers, Midden Oosten Perspectief
Dear All,

I have been using Hans' old correspondence module with an xml - rng database as 
documented for a number of years.

I now want to switch to Wolfgang's letter module, but do not know how to 
connect it to the xml database. For example, commands like:

\XMLprocesscontacts[./../../adressen-xml/adressen.xml]

\setvariables
[letter:data]
[address=\XMLflush{address},
prefix=\XMLflush{prefix}
]

do not work anymore.

Could anyone (Wolfgang?) help me out in this ? I have installed both mkiv and 
mkii.

Thanks on beforehand,

Robert


___
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
___


Re: [NTG-context] serial letters with letter module

2011-02-10 Thread Wolfgang Schuster

Am 10.02.2011 um 10:14 schrieb R. Ermers, Midden Oosten Perspectief:

 Dear All,
 
 I have been using Hans' old correspondence module with an xml - rng database 
 as documented for a number of years.
 
 I now want to switch to Wolfgang's letter module, but do not know how to 
 connect it to the xml database. For example, commands like:
 
 \XMLprocesscontacts[./../../adressen-xml/adressen.xml]
 
 \setvariables
 [letter:data]
 [address=\XMLflush{address},
 prefix=\XMLflush{prefix}
 ]
 
 do not work anymore.
 
 Could anyone (Wolfgang?) help me out in this ? I have installed both mkiv and 
 mkii.

This works with MkII (pragma.xml contains the data from the manual):

\usemodule[letter][extension=corres]

\setvariables
  [contacts]
  [selection=pragma-pod,
   file=pragma.xml]

\startlettercontent
\input knuth
\stoplettercontent

\starttext
\XMLprocesscontacts[pragma.xml]
\stoptext

As Hans correspondence module is only available for MkII you can’t use MkIV for 
your serial letters.

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
___