Re: [NTG-context] typesetting serial letters in Context

2017-06-18 Thread r . ermers
Dear Context’ers,

I am trying to use the letter module in mkiv for typesetting serial letters 
from an xml database.

Thanks, Thomas for looking into this. I appreciate it very much. Yet I don’t 
know either whether I actually need the letter module, but it seemed reasonable 
to try this first.

Today I tried to insert some simple luatex code which I found on another forum.

The results are promising:

a. The address appears.
b. The salutation + formalname also appear.

Yet there are some problems:

1. the address elements appear in one line, not underneath as desired,
2. When I add text such as Knuth or references to the database, Context stops.

See the code below.

My question at this point is: how can I proceed? Do I actually need the letter 
module?

Kind regards,

Robert



brieven2mkiv.pdf
Description: Adobe PDF document


\usemodule[letter]

\starttext
\startbuffer[participants]




Hendriks
Karel
mr.
K.
levelA
1 june 2017  
Arnhem

  Mr. K. Hendriks
  Grotestraat 5
  1234 Arnhem

  

  
Janssen
Piet
P.
mr.
levelA
1 june 2017  
Nijmegen

 Mr. P. Janssen
 Kortestraat 8
 1234 Nijmegen

  



\stopbuffer

\startxmlsetups xml:setups
\xmlsetsetup{#1}{contacts|contact|address|prefix}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:setups}

\startxmlsetups xml:contacts
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
 
 \xmlflush{#1}
 \par
\stopxmlsetups

\startxmlsetups xml:contact

\defineletterelement[layer][address][example]%
   {\correspondenceparameter{toname}\\
   \correspondenceparameter{toaddress}
   \par}
   
   \setupletterlayer[address][alternative=example]

\startletter
  [opening={{Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},}},
   closing={Kind regards,},
   signature={Sender},
   toaddress={{\xmltext{#1}{/address}}},
   subject={Interesting offer}]

%\input knuth

%{\xmltext{#1}{/informalname}}
%\xmltext{#1}{/address/p}

\stopletter

\stopxmlsetups

\startluacode
userdata = userdata or { }
userdata.letter = { }
\stopluacode


\xmlprocessbuffer{main}{participants}{}
\stoptext


> Op 18 jun. 2017, om 17:33 heeft Thomas A. Schmitz 
>  het volgende geschreven:
> 
> On 06/15/2017 11:58 PM, r.erm...@hccnet.nl wrote:
>> Thusfar I have been trying to use the letter module with the xmltext and 
>> xmlflush commands. What can be done to make this work?
>> Thanks!
> 
> I'm sorry, I don't use the letter module and don't have it installed. As far 
> as I can see, your way of using the xml commands is correct. There appears to 
> be some sort of incompatibility between the letter module and xml, but I 
> guess only Wolfgang (the author of the module) can really say what's going 
> on. If you want to typeset simple letters, maybe you can bypass the module?
> 
> Thomas

___
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] typesetting serial letters in Context

2017-06-15 Thread r . ermers
Hi Thomas,

Thanks for your advice.

I would like to have a system with which I can send letters to people in my 
database.

It would be nice to be able to make selections according to labels (probably 
with xmlatt), but that can be done later.

I am not a programmer - when I read the documentation, I do not understand 
enough of it to the extent to port it to a new program, but I can adapt and try 
existing code.

Thusfar I have been trying to use the letter module with the xmltext and 
xmlflush commands. What can be done to make this work?

Thanks!

Robert


\usemodule[letter]
\startbuffer[participants]


  
Hendriks
Karel
mr.
K.
levelA
1 june 2017  
Arnhem

  Mr. K. Hendriks
  Grotestraat 5
  1234 Arnhem

  

  
Janssen
Piet
P.
mr.
levelA
1 june 2017  
Nijmegen

 Mr. P. Janssen
 Kortestraat 8
 1234 Nijmegen

  


\stopbuffer


\startxmlsetups xml:setups
\xmlsetsetup{#1}{contacts|contact|address|prefix}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:setups}

\startxmlsetups xml:contacts
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:contact

%\setupletter[
%  name={Sender},
%  email={},
%  signature={X}]

\startletter
  [opening={Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},},
   closing={Kind regards,},
   signature={X},
   toaddress={\xmltext{#1}{/address}},
   subject={Interesting offer}]

\input knuth

%\xmltext{#1}{/informalname}
%Without the letter instructions, the code yields the names in informalname.

\stopletter
\stopxmlsetups

\starttext
\xmlprocessbuffer{main}{participants}{}
\stoptext


tex error on line 17 in file 
/Users/mac/Documents/doc/moperspectief/brieven/brieven2mkiv.tex: ! Use of 
\correspondence_start_parameters doesn't match its definition


\doifelsenextoptional ...\def \m_syst_action_yes {
  #1}\def \m_syst_action_nop...
\setupletter ...bleargument \correspondence_setup 
  [\v!letter ]
\14>:xml:contact #1->\setupletter 
  [name={Sender},email={},signature={X}]\def...
l.17 }

\14>:xml:contacts #1->\xmlflush {#1}

l.7 }


'
> Op 15 jun. 2017, om 19:02 heeft Thomas A. Schmitz 
>  het volgende geschreven:
> 
> On 06/15/2017 10:51 AM, r.erm...@hccnet.nl wrote:
>> I still cannot generate letters from my xml database
> 
> So what are you missing? Make a complete minimal example (you can pack the 
> xml part into a buffer and then use \xmlprocessbuffer), then people will try 
> to help you. Right now, we can't even guess where your problems lie. And 
> writing "I'm not a programmer, so I can't read documentation" is not very 
> motivating - you've been told where to begin, and you appear to be making 
> some progress, so show us what you have.
> 
> Thomas

___
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] typesetting serial letters in Context

2017-06-15 Thread r . ermers
I still cannot generate letters from my xml database, although there is 
apparently a solution to use csv files through lua code 
(https://tex.stackexchange.com/questions/72735/how-to-create-form-letters-from-spreadsheet-data-in-context
 
).

Your help is much appreciated!

Yet I found out how to generate certificates with backgrounds changing 
according to the candidate's course level, which I would like to share with you:

%

participants.xml



Janssen
Piet
P.
levelA
1 june 2017
Nijmegen





certificates.tex

\setuppapersize[A4,landscape][A4,landscape]
\setuplayout[width=170mm,topspace=60mm,rightmargindistance=2.5mm]
\definelayer[module][width=\paperwidth,height=\paperheight,preset=middle]
\useexternalfigure[levelA][sjablonen/CourseLevelA.pdf]
\resetlayer[level]{}

\setupbackgrounds[page][background={level}]

\startxmlsetups xml:setups
\xmlsetsetup{#1}{contacts}{xml:contacts}
\xmlsetsetup{#1}{contact}{xml:contacts:contact}
\stopxmlsetups

\xmlregistersetup{xml:setups}

\startxmlsetups xml:contacts
 \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:contacts:contact

\setlayer[module][][]{\externalfigure[\xmltext{#1}{/courselevel}][factor=550]}

\startalignment [middle]
\color[red]{{\tfd \xmltext{#1}{/initials}} {\tfd 
\xmltext{#1}{/formalname}}\par

\blank[10mm]

{\ss \xmltext{#1}{/city}, \xmltext{#1}{/coursedate}}

\stopalignment
\page[yes]
\stopxmlsetups

\starttext
\xmlprocessfile{main}{./participants.xml}{}

\stoptext

Kind regards,

Robert


> Op 13 jun. 2017, om 15:59 heeft r.erm...@hccnet.nl het volgende geschreven:
> 
> I can take the information out of the nodes. The main problem is to use them 
> in a layout and in a sequences other the one they appear in the xml data file.
> 
> In the current (mkii) file I have something like this: 
> \midaligned{\XMLflush{formalname}, \XMLflush{informalname}}.
> 
> 
> Another point on my wishlist is to change the background of the certificate 
> depending on the type of certificate. In mkii I manage to do this as follows:
> 
> File: participants.xml
> 
> 
> Janssen
> Piet
> levelA
> 
> 
> 
> certificates.tex:
> \resetlayer[module]{}
> \setlayer[module][][]{\externalfigure[\XMLflush{courselevel}[width=\paperwidth,height=\paperheight]}
> 
> \useexternalfigure[levelA][sjablonen/backgroundlevelA.pdf]
> 
> Help is very much appreciated!
> 
> Robert
> 
> 
>> Op 13 jun. 2017, om 09:53 heeft luigi scarso  het 
>> volgende geschreven:
>> 
>> On Tue, Jun 13, 2017 at 9:40 AM,   wrote:
>>> Hello all,
>>> 
>>> I have been using Context mkii with the x-corres.mkii module for a number 
>>> of years now, for many different purposes (mailings, certificates, etc). 
>>> The module works with an xml (actually rng) file with the following 
>>> structure:
>>> 
>>> 
>>>   
>>>   Janssen
>>>   Piet
>>>   
>>> 
>>> 
>>> The contents of each item is grabbed and put in the document by means of 
>>> the command \XMLflush{formalname}.
>>> 
>>> I would like to shift to mkiv now with all its possibilities.
>>> 
>>> Yet there is no x-corres.mkiv. Who can help me out?
>>> 
>> I don't remember x-corres.mkiv, but
>> mkiv has a guide
>> tex/texmf-context/doc/context/documents/general/manuals/xml-mkiv.pdf
>> 
>> -- 
>> luigi
>> ___
>> 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
>> ___
> 
> ___
> 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
> ___

___
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] typesetting serial letters in Context

2017-06-13 Thread r . ermers
I can take the information out of the nodes. The main problem is to use them in 
a layout and in a sequences other the one they appear in the xml data file.

In the current (mkii) file I have something like this: 
\midaligned{\XMLflush{formalname}, \XMLflush{informalname}}.


Another point on my wishlist is to change the background of the certificate 
depending on the type of certificate. In mkii I manage to do this as follows:

File: participants.xml


Janssen
Piet
levelA



certificates.tex:
\resetlayer[module]{}
\setlayer[module][][]{\externalfigure[\XMLflush{courselevel}[width=\paperwidth,height=\paperheight]}

\useexternalfigure[levelA][sjablonen/backgroundlevelA.pdf]

Help is very much appreciated!

Robert


> Op 13 jun. 2017, om 09:53 heeft luigi scarso  het 
> volgende geschreven:
> 
> On Tue, Jun 13, 2017 at 9:40 AM,   wrote:
>> Hello all,
>> 
>> I have been using Context mkii with the x-corres.mkii module for a number of 
>> years now, for many different purposes (mailings, certificates, etc). The 
>> module works with an xml (actually rng) file with the following structure:
>> 
>> 
>>
>>Janssen
>>Piet
>>
>> 
>> 
>> The contents of each item is grabbed and put in the document by means of the 
>> command \XMLflush{formalname}.
>> 
>> I would like to shift to mkiv now with all its possibilities.
>> 
>> Yet there is no x-corres.mkiv. Who can help me out?
>> 
> I don't remember x-corres.mkiv, but
> mkiv has a guide
> tex/texmf-context/doc/context/documents/general/manuals/xml-mkiv.pdf
> 
> -- 
> luigi
> ___
> 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
> ___

___
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] typesetting serial letters in Context

2017-06-13 Thread r . ermers
The problem is that I am not a programmer: I do not know where to start …

Robert

> Op 13 jun. 2017, om 10:31 heeft Thomas A. Schmitz 
>  het volgende geschreven:
> 
> 
>> On 13. Jun 2017, at 09:53, luigi scarso  wrote:
>> 
>>> Yet there is no x-corres.mkiv. Who can help me out?
>>> 
>> I don't remember x-corres.mkiv, but
>> mkiv has a guide
>> tex/texmf-context/doc/context/documents/general/manuals/xml-mkiv.pdf
> 
> Yes, typesetting xml in mkiv is a completely different beast from mkii. It is 
> vastly superior and very powerful, but you will have to relearn and recode. 
> There is the manual Luigi mentioned, there are also some pages on the wiki to 
> facilitate the transition.
> 
> Thomas
> ___
> 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
> ___

___
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] typesetting serial letters in Context

2017-06-13 Thread Thomas A. Schmitz

> On 13. Jun 2017, at 09:53, luigi scarso  wrote:
> 
>> Yet there is no x-corres.mkiv. Who can help me out?
>> 
> I don't remember x-corres.mkiv, but
> mkiv has a guide
> tex/texmf-context/doc/context/documents/general/manuals/xml-mkiv.pdf

Yes, typesetting xml in mkiv is a completely different beast from mkii. It is 
vastly superior and very powerful, but you will have to relearn and recode. 
There is the manual Luigi mentioned, there are also some pages on the wiki to 
facilitate the transition.

Thomas
___
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] typesetting serial letters in Context

2017-06-13 Thread luigi scarso
On Tue, Jun 13, 2017 at 9:40 AM,   wrote:
> Hello all,
>
> I have been using Context mkii with the x-corres.mkii module for a number of 
> years now, for many different purposes (mailings, certificates, etc). The 
> module works with an xml (actually rng) file with the following structure:
>
> 
> 
> Janssen
> Piet
> 
> 
>
> The contents of each item is grabbed and put in the document by means of the 
> command \XMLflush{formalname}.
>
> I would like to shift to mkiv now with all its possibilities.
>
> Yet there is no x-corres.mkiv. Who can help me out?
>
I don't remember x-corres.mkiv, but
mkiv has a guide
tex/texmf-context/doc/context/documents/general/manuals/xml-mkiv.pdf

-- 
luigi
___
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] typesetting serial letters in Context

2017-06-13 Thread r . ermers
Hello all,

I have been using Context mkii with the x-corres.mkii module for a number of 
years now, for many different purposes (mailings, certificates, etc). The 
module works with an xml (actually rng) file with the following structure:



Janssen
Piet

 

The contents of each item is grabbed and put in the document by means of the 
command \XMLflush{formalname}.

I would like to shift to mkiv now with all its possibilities.

Yet there is no x-corres.mkiv. Who can help me out?

Regards,

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