Re: [NTG-context] letters in context mkiv

2017-08-01 Thread r . ermers
Thanks Wolfgang and Thomas,

The solutions of both of you function!

Thank you!

Robert


> Op 1 aug. 2017, om 13:17 heeft Schmitz Thomas A.  
> het volgende geschreven:
> 
> 
>> On 1. Aug 2017, at 12:15, r.erm...@hccnet.nl wrote:
>> 
>> While understanding what it means, I guess this might imply that it is 
>> difficult (?) or impossible (?) to correctly process files such as the knuth 
>> text and for that matter any other letter text that contains regular Context 
>> commands.
>> 
>> Nevertheless, for the moment this problem remains unsolved.
>> 
>> What would you advise as the next step?
>> 
>> Should the letter be somehow set-up outside xml setups rather than inside?
>> Should the letter texts (and a specific knuth sample text) be reformatted as 
>> xml?
> 
> So: you want to import the letter texts from an external file. Easiest 
> solution: instead of simply \input knuth, try this:
> 
> {\pushcatcodetable
> \catcodetable\ctxcatcodes\input knuth
> \popcatcodetable}
> 
> As you can see, changing the catcode regime processes the file correctly. 
> “Expansion” means something different in TeX speak.
> 
> Other possibilities: write your letter body in xml, or write the letters in 
> buffers and use \processTEXbuffer.
> 
> 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] letters in context mkiv

2017-08-01 Thread Schmitz Thomas A.

> On 1. Aug 2017, at 12:15, r.erm...@hccnet.nl wrote:
> 
> While understanding what it means, I guess this might imply that it is 
> difficult (?) or impossible (?) to correctly process files such as the knuth 
> text and for that matter any other letter text that contains regular Context 
> commands.
> 
> Nevertheless, for the moment this problem remains unsolved.
> 
> What would you advise as the next step?
> 
> Should the letter be somehow set-up outside xml setups rather than inside?
> Should the letter texts (and a specific knuth sample text) be reformatted as 
> xml?

So: you want to import the letter texts from an external file. Easiest 
solution: instead of simply \input knuth, try this:

{\pushcatcodetable
 \catcodetable\ctxcatcodes\input knuth
 \popcatcodetable}

As you can see, changing the catcode regime processes the file correctly. 
“Expansion” means something different in TeX speak.

Other possibilities: write your letter body in xml, or write the letters in 
buffers and use \processTEXbuffer.

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] letters in context mkiv

2017-08-01 Thread r . ermers
Your suggestion with foregroundstyle and foregroundcolor works. Thank you!

\setlayer[AddressBg]
  {\framed[width=55mm,height=30mm,
  align=right,background=color,
  backgroundcolor=lightgray,
foregroundcolor=red,foregroundstyle=\ss\tfa]{\xmlall{#1}{/address}}}


My question (my ’need’) was quite simple: how I can have a workflow in which I 
can produce serial letters based upon contextmkiv (as I did in mkii).

I encountered a number of difficulties (in steps):

1. I first noticed that I could not add a letter text, either in the file 
itself, or by means of \input.

At that point the sample knuth file was not processed, nor were my own external 
letter files.

I did write that I use external letter files, but perhaps failed to mention 
that my texts contain to my mind regular Context commands (like {\bf bold} and 
\startitemize … \stopitemize). I use these commands to improve the look of my 
letter.

2. The import problem itself was caused by a wrongful position of the 
\starttext … \stoptext commands. This problem was solved with help of Thomas, 
Wolfgang and Pablo.

3. A second problem I signalled was to have the addres moved to the desired 
place. I could solve this problem by reference to the contextgarden website. 
Thomas helped me finetune the style instruction.

4. Only when the input files were processed, it became obvious that these files 
(including the knuth file) in a general sense are not rendered correctly.

The knuth sample document (\input knuth) contains only one single command 
(\TeX\), which is not expanded. For this reason, my sample letters, which 
contain regular codes, are not processed correctly either. Pablo Rodriguez 
suggested that the problem was that for some reason there is only one 
‘expansion’ level.

Thomas, in his last mail, now writes that according to him within the xml 
setups the ‘catcodes' are changed, and, as a result, the backslash is 
interpreted as a normal character rather than as introducing a command.

While understanding what it means, I guess this might imply that it is 
difficult (?) or impossible (?) to correctly process files such as the knuth 
text and for that matter any other letter text that contains regular Context 
commands.

Nevertheless, for the moment this problem remains unsolved.

What would you advise as the next step?

Should the letter be somehow set-up outside xml setups rather than inside?
Should the letter texts (and a specific knuth sample text) be reformatted as 
xml?

So in sum, I sincerely do not think I kept anyone guessing about my needs. The 
technical problems presented themselves one by one, step by step. Yet if I did, 
I apologize.

Kind regards,

Robert


> Op 1 aug. 2017, om 10:46 heeft Schmitz Thomas A.  
> het volgende geschreven:
> 
>> However, the color and style instructions (\ss\tfa) have no effect. I tried 
>> to solve that, as a first step, by putting \ss before the \xmlall 
>> instruction:
>> 
>> \startxmlsetups xlm:contact
>> \setlayer[AddressBg]  {\framed[width=55mm,height=30mm,  
>> align=right,background=color,
>> backgroundcolor=lightgray]{\ss\xmlall{#1}{/address}}}
>> \strut
>> ...
>> \stopxmlsetups
>> 
>> This works (see pdf), but there are probably other and better ways.
>> 
> Have a look at the framed/setupframed command; they have foregroundstyle and 
> foregroundcolor keys; that would be the most idiomatic way to set the style.
> 
> 
> 
>> Another persisting problem is that the commands are still not ‘expanded’ 
>> (see Pablo’s remarks). According to Pablo for some reason there is only one 
>> expansion level.
>> 
>> This means that after an \input command, all other commands are not expanded 
>> (see pdf).
>> 
>> This also applies to your suggestions (see pdf brieven2mkiv5.pdf): in the 
>> Knuth sample text the only command \TeX\, is not expanded either.
> 
> You’re working within xml setups, which means that the catcodes are not the 
> same as in TeX, which means that the backslash is just a normal character. 
> The question is: why would you need TeX commands from an external file? Is 
> this where your letter text comes from? You keep us guessing and are not 
> describing what your needs are.
> 
> 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  : 

Re: [NTG-context] letters in context mkiv

2017-08-01 Thread Schmitz Thomas A.
> However, the color and style instructions (\ss\tfa) have no effect. I tried 
> to solve that, as a first step, by putting \ss before the \xmlall instruction:
> 
> \startxmlsetups xlm:contact
> \setlayer[AddressBg]  {\framed[width=55mm,height=30mm,  
> align=right,background=color,
>  backgroundcolor=lightgray]{\ss\xmlall{#1}{/address}}}
> \strut
> ...
> \stopxmlsetups
> 
> This works (see pdf), but there are probably other and better ways.
> 
Have a look at the framed/setupframed command; they have foregroundstyle and 
foregroundcolor keys; that would be the most idiomatic way to set the style.



> Another persisting problem is that the commands are still not ‘expanded’ (see 
> Pablo’s remarks). According to Pablo for some reason there is only one 
> expansion level.
> 
> This means that after an \input command, all other commands are not expanded 
> (see pdf).
> 
> This also applies to your suggestions (see pdf brieven2mkiv5.pdf): in the 
> Knuth sample text the only command \TeX\, is not expanded either.

You’re working within xml setups, which means that the catcodes are not the 
same as in TeX, which means that the backslash is just a normal character. The 
question is: why would you need TeX commands from an external file? Is this 
where your letter text comes from? You keep us guessing and are not describing 
what your needs are.

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] letters in context mkiv

2017-08-01 Thread r . ermers
Hi Thomas,

Thanks for your new suggestions.

As a matter of fact, I yesterday found the following suggestion 
(http://wiki.contextgarden.net/Layers):

\definelayer[AddressBg] [location={right,top},   y=6cm,  x=12cm,  color=red,   
style=\ss\tfa].

I used this in the sample suggested by you yesterday. The address actually 
moves to the desired place!

However, the color and style instructions (\ss\tfa) have no effect. I tried to 
solve that, as a first step, by putting \ss before the \xmlall instruction:

\startxmlsetups xlm:contact
\setlayer[AddressBg]  {\framed[width=55mm,height=30mm,  
align=right,background=color,
  backgroundcolor=lightgray]{\ss\xmlall{#1}{/address}}}
\strut
...
\stopxmlsetups

This works (see pdf), but there are probably other and better ways.



brieven2mkiv.pdf
Description: Adobe PDF document


Another persisting problem is that the commands are still not ‘expanded’ (see 
Pablo’s remarks). According to Pablo for some reason there is only one 
expansion level.

This means that after an \input command, all other commands are not expanded 
(see pdf).

This also applies to your suggestions (see pdf brieven2mkiv5.pdf): in the Knuth 
sample text the only command \TeX\, is not expanded either.



brieven2mkiv5.pdf
Description: Adobe PDF document


Regards,

Robert


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

\xmlregistersetup{xml:setups}

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

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

\startxmlsetups xml:contact
  
\setlayer[address][x=20mm,y=40mm]{\framed[width=74mm,height=35mm,frame=on,offset=2mm,align=right]{\ignorespaces\xmltext{#1}{/address}}}
  \strut
  \blank [35mm]
  Subject: your life in \xmltext{#1}{/city}
  \blank [2*line]
  Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},
  \blank [line]
%  \input knuth \relax

  This is a {\bf bold} test. \TeX\
  \startitemize
  \item item
  \item item
  \stopitemize

\input brieftekst-test.tex \relax
\par
%this \par is needed, for the last word of the file merges with Kind regards.

  Kind regards
  \blank [line]
  X
  \page
\stopxmlsetups

\setuppagenumbering [state=stop]

\definelayer[address][width=\paperwidth,height=\paperheight]

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

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

\stoptext




brieftekst-test.tex
Description: Binary data





> Op 31 jul. 2017, om 23:57 heeft Schmitz Thomas A. 
>  het volgende geschreven:
> 
> 
>> On 31. Jul 2017, at 18:58, r.erm...@hccnet.nl wrote:
>> 
>> Would it be wise to perhaps follow the path set out by Thomas? In that case 
>> there should be a way to shift the address.
> 
> What efforts have you made to “shift the address”? Here is one way:
> 
> \startbuffer[participants]
> 
>  
>Hendriks
>Karel
>mr.
>K.
>Arnhem
>
>  Mr. K. Hendriks
>  Grotestraat 5
>  1234 BB Arnhem
>
>1234bb5
>  
>  
>Janssen
>Piet
>P.
>mr.
>Nijmegen
>
> Mr. P. Janssen
> Kortestraat 8
> 1234 AA Nijmegen
>
>1234aa8
>  
> 
> \stopbuffer
> 
> \startxmlsetups xml:setups
> \xmlsetsetup{#1}{contacts|contact|p}{xml:*}
> \stopxmlsetups
> 
> \xmlregistersetup{xml:setups}
> 
> \startxmlsetups xml:contacts
>   \xmlflush{#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:p
>   \xmlflush{#1}\par
> \stopxmlsetups
> 
> \startxmlsetups xml:contact
>   
> \setlayer[address][x=20mm,y=40mm]{\framed[width=74mm,height=35mm,frame=on,offset=2mm,align=right]{\ignorespaces\xmltext{#1}{/address}}}
>   \strut
>   \blank [35mm]
>   Subject: your life in \xmltext{#1}{/city}
>   \blank [2*line]
>   Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},
>   \blank [line]
>   \input knuth \relax
> 
>   Kind regards
>   \blank [line]
>   X
>   \page
> \stopxmlsetups
> 
> \setuppagenumbering [state=stop]
> 
> \definelayer[address][width=\paperwidth,height=\paperheight]
> 
> \setupbackgrounds [page][background={address}]
> 
> \starttext
> \xmlprocessbuffer{main}{participants}{}
> 
> \stoptext
> 
> I still don’t see you trying to learn a new language one step at a time. 
> 
> 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

Re: [NTG-context] letters in context mkiv

2017-07-31 Thread Schmitz Thomas A.

> On 31. Jul 2017, at 18:58, r.erm...@hccnet.nl wrote:
> 
> Would it be wise to perhaps follow the path set out by Thomas? In that case 
> there should be a way to shift the address.

What efforts have you made to “shift the address”? Here is one way:

\startbuffer[participants]

  
Hendriks
Karel
mr.
K.
Arnhem

  Mr. K. Hendriks
  Grotestraat 5
  1234 BB Arnhem

1234bb5
  
  
Janssen
Piet
P.
mr.
Nijmegen

 Mr. P. Janssen
 Kortestraat 8
 1234 AA Nijmegen

1234aa8
  

\stopbuffer

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

\xmlregistersetup{xml:setups}

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

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

\startxmlsetups xml:contact

\setlayer[address][x=20mm,y=40mm]{\framed[width=74mm,height=35mm,frame=on,offset=2mm,align=right]{\ignorespaces\xmltext{#1}{/address}}}
\strut
\blank [35mm]
Subject: your life in \xmltext{#1}{/city}
\blank [2*line]
Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},
\blank [line]
\input knuth \relax

Kind regards
\blank [line]
X
\page
\stopxmlsetups

\setuppagenumbering [state=stop]

\definelayer[address][width=\paperwidth,height=\paperheight]

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

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

\stoptext

I still don’t see you trying to learn a new language one step at a time. 

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] letters in context mkiv

2017-07-31 Thread Pablo Rodriguez
On 07/31/2017 06:58 PM, r.erm...@hccnet.nl wrote:
> Dear Pablo,
> 
> Thank you for your insightful remarks. I tried your suggestions. As
> you predicted, the Knuth tex is processed when put here, without using
> the buffer mechanism.

Dear Robert,

it wasn’t a prediction, I tested it myself ;-).

> Yet any codes (\TeX\) are not. 
> 
> Nevertheless, I consider this a step forward. In the same way, my
> letter texts, which contain regular codes, such as \startitemize …
> \stopitemize and {\bf bold} are not processed properly.
> 
> The whole thing is much more complicated than I thought. Wolfgang
> already mentioned that the letter module is not specifically equipped
> for xml.

What I would like to know is how one can get full expansion (I
experienced your issue before in another scenario).

Or at least, I want to know why only the first level of commands is
expanded. (An \expandafter or something like that?)

> Would it be wise to perhaps follow the path set out by Thomas? In
> that case there should be a way to shift the address.

You may use layers to locate the address where you want.

Or even you may use an extra margin (it cannot be that hard).

Just in case it helps,

Pablo
-- 
http://www.ousia.tk
___
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] letters in context mkiv

2017-07-31 Thread r . ermers
Dear Pablo,

Thank you for your insightful remarks. I tried your suggestions. As you 
predicted, the Knuth tex is processed when put here, without using the buffer 
mechanism.

\startsetups[letter:section:content]
\input knuth \relax
\stopsetups

Yet any codes (\TeX\) are not. 

Nevertheless, I consider this a step forward. In the same way, my letter texts, 
which contain regular codes, such as \startitemize … \stopitemize and {\bf 
bold} are not processed properly.

The whole thing is much more complicated than I thought. Wolfgang already 
mentioned that the letter module is not specifically equipped for xml.

Would it be wise to perhaps follow the path set out by Thomas? In that case 
there should be a way to shift the address.

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
___

Re: [NTG-context] letters in context mkiv

2017-07-31 Thread Pablo Rodriguez
On 07/31/2017 12:48 PM, r.erm...@hccnet.nl wrote:
> Dear Contex’ers,
> 
> This morning I have been experimenting with the solutions suggested by
> Thomas and Wolfgang.
> 
> Thomas’ solution works, it produces two distinct letters, yet the
> address is probably on another layer. This means that it is not shifted
> to the right, at least not with the command
> (\setupletterlayer[address]), so that it will be visible through the
> envelope window.
> 
> With Wolfgang’s solution the address is moved to its desired place, and
> the letter text is printed as well.
> 
> However, inserting a text (by means of \input) is problematic (see pdf),
> with or without \relax.

Hi Robert,

it isn’t the use of \input. The problem is that you only get one level
of expansion.

If you add \input directly to letter:section:content, such as in:

\startsetups[letter:section:content]
\input knuth \relax
\stopsetups

You will have \input expanded. But in the text itself \TeX\ and
large||scale won’t be expanded.

I have no idea why this happens. And I don’t know how to fix it. Maybe
Wolfgang knows what is happening here.

If I had to guess, it might be that \directsetups only allows a level of
expansion. But I may be plainly wrong.

A way to avoid the issue is to add the letter content directly to the
\startsetups[letter:section:context]. And rememmber that you have only
one level of expansion.

Just in case it might help,

Pablo
-- 
http://www.ousia.tk
___
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] letters in context mkiv

2017-07-31 Thread r . ermers
Dear Contex’ers,This morning I have been experimenting with the solutions suggested by Thomas and Wolfgang.Thomas’ solution works, it produces two distinct letters, yet the address is probably on another layer. This means that it is not shifted to the right, at least not with the command (\setupletterlayer[address]), so that it will be visible through the envelope window.With Wolfgang’s solution the address is moved to its desired place, and the letter text is printed as well.However, inserting a text (by means of \input) is problematic (see pdf), with or without \relax.I then experimented with alternatives like \startbuffer[lettercontent] … endbuffer. The \input problem remains: it appears that the buffer takes any command (\foo) as literal text.I tried moving the setbuffer … endbuffer part to elswhere in the document. I also experimented with \input a sample text of my own on my harddisk. I tried deleting the \placeletter command - no difference.So, I feel I am close, but not yet there, one more step …Robert\usemodule[letter]\startbuffer[participants]      Hendriks    Karel    mr.    K.    Arnhem      Mr. K. Hendriks  Grotestraat 5  1234 BB Arnhem        1234bb5        Janssen    Piet    P.    mr.    Nijmegen     Mr. P. Janssen Kortestraat 8 1234 AA Nijmegen        1234aa8  \stopbuffer\startxmlsetups xml:setups\xmlsetsetup{#1}{document|contacts|contact|prefix|initials|address|city|text|kix|p}{xml:*}\stopxmlsetups\xmlregistersetup{xml:setups}\setuplettersection[content][alternative=setups]\startsetups[letter:layer:address]    \correspondenceparameter{toname}\\    \correspondenceparameter{toaddress}\stopsetups\setuplettertext[en][date=]\setuplettertext[nl][date=]\startxmlsetups xml:contacts\xmlflush{#1}\stopxmlsetups\startxmlsetups xml:p\xmlflushtext{#1}\par\stopxmlsetups\setupletterlayer  [address]  [alternative=setups,   y=6cm,   x=12cm,   color=red,   style=\ss\tfa]\startsetups[letter:section:content]    \getbuffer[lettercontent]\stopsetups%\startbuffer[lettercontent]%content of the letter \xmltext{#1}{/city}%\input knuth \relax%\stopbuffer\startxmlsetups xml:contact    \setupletter  [toaddress={\xmlall{#1}{/address/p}\par  \xmltext{#1}{/kix}}, opening={Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},}, closing={Kind regards,}, subject={subject: your life in \xmltext{#1}{/city}},   signature={Herman}]\setbuffer[lettercontent]%This is the content of the letter.\input knuth \relax\endbuffer\placeletter\stopxmlsetups\setuppagenumbering [state=stop]\starttext\xmlprocessbuffer{main}{participants}{}\stoptext

brieven2mkiv3.pdf
Description: Adobe PDF document
___
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] letters in context mkiv

2017-07-31 Thread r . ermers
Thank you Thomas and Wolfgang,

About startletter / starttext: the contents of my test file reflect a moment. I 
have made numerous tests with and without starttext/stoptext. The state of the 
test file is one in an endless row of tests.

I am not without total experience in programing. I more or less understand 
program scripts when they are not too complicated and I like tweaking them, yet 
I cannot think up a new program from scratch.

But anyway, I will go ahead with your suggestions!

Thank you very much again!

Robert



> Op 30 jul. 2017, om 17:38 heeft Schmitz Thomas A. 
>  het volgende geschreven:
> 
> 
>> On 30. Jul 2017, at 14:15, r.erm...@hccnet.nl wrote:
>> 
>> Let me as a turcologist compare my problem to learning Kazakh: I am prepared 
>> to give you a manual with the grammatical rules, provide you with lists of 
>> nouns, verbs, adjectives and postpositions, explain the application of 
>> phonological rules, transliterations of the alphabet, give you a insight in 
>> the nominal cases and verb structure, and read with you a text in Kazakh. 
>> Nevertheless, without being rude, I bet that even then you are unable to 
>> flawlessly produce a poem or even a brief text in Kazakh yourself.
> 
> OK, I see your desperation, and I take your analogy (I’m a scholar myself, 
> not a programmer): if someone came to you with the Iliad and explained that 
> he doesn’t know a word of Kazakh but wants all of Homer’s poem, every line, 
> every word, every nuance, expressed in Kazakh with the help of a grammar and 
> a dictionary, you’d reply that this is not how learning languages works. You 
> begin with simple sentences and work your way up. You have shown us several 
> times examples that don’t work, and I have expressed my suspicion that this 
> may be due to using the correspondence module. You weren’t sure whether you 
> need it or not; which is something only you can know. What does this module 
> offer that can’t be accomplished otherwise? If you look at the documentation 
> of the module, you see that the \startletter … \stopletter pair starts an 
> environment within a \starttext … \stoptext context document. When you look 
> at your setup, you will see that you have a \startletter … \stopletter, then 
> a few setups, and then a \starttext … \stoptext document. I’m not a 
> programmer, but I see that this will not work. 
> 
> So for some simple rules: when you process an xml buffer (or document), you 
> define xmlsetups for the different xml elements. When you write 
> \xmlprocessbuffer, that’s when these elements will be processed - which 
> means: that’s when your document will be built. You can’t go through your xml 
> buffer/document and then add further text (well you can, but that’s more 
> complicated), so what you have to do is add your text (for the sake of this 
> example: \input knuth) WITHING THESE SETUPS. So let’s start with a simple 
> document that will work:
> 
> \startbuffer[participants]
> 
>  
>Hendriks
>Karel
>mr.
>K.
>Arnhem
>
>  Mr. K. Hendriks
>  Grotestraat 5
>  1234 BB Arnhem
>
>1234bb5
>  
>  
>Janssen
>Piet
>P.
>mr.
>Nijmegen
>
> Mr. P. Janssen
> Kortestraat 8
> 1234 AA Nijmegen
>
>1234aa8
>  
> 
> \stopbuffer
> 
> \startxmlsetups xml:setups
> \xmlsetsetup{#1}{contacts|contact|formalname|informalname|prefix|initials|address|city|text|kix|p}{xml:*}
> \stopxmlsetups
> 
> \xmlregistersetup{xml:setups}
> 
> \startxmlsetups xml:contacts
>   \xmlflush{#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:p
>   \xmlflush{#1}\par
> \stopxmlsetups
> 
> \startxmlsetups xml:contact
>   \xmltext{#1}{/address}
>   \blank [3*line]
>   Subject: your life in \xmltext{#1}{/city}
>   \blank [2*line]
>   Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},
>   \blank [line]
>   \input knuth \relax
> 
>   Kind regards
>   \blank [line]
>   X
>   \page
> \stopxmlsetups
> 
> \setuppagenumbering [state=stop]
> 
> \starttext
> \xmlprocessbuffer{main}{participants}{}
> \stoptext
> 
> So you see what I’m doing here: I process every simple  element, and 
> I add all the stuff that will go into the letter for every single contact. 
> Start with this document and then find out what you need in addition: a logo, 
> some fancy lines across the letters, a special placement for the address and 
> the subject, etc.? I’m guessing that it would be easier to do this with 
> simple setup commands rather than using the correspondence module, but we 
> have no idea what you need to accomplish. Once you find out what’s missing, 
> you can modify the example and ask additional questions. But, to take your 
> analogy: don’t start with irregular verbs and special cases that will 
> complicate the picture. How is this line
> 
> \setuplanguage[nl][date={year, –, mm, –, dd}] % ISO 8601 date
> 
> from your original example relevant to your problem? And again: 

Re: [NTG-context] letters in context mkiv

2017-07-30 Thread Schmitz Thomas A.

> On 30. Jul 2017, at 14:15, r.erm...@hccnet.nl wrote:
> 
> Let me as a turcologist compare my problem to learning Kazakh: I am prepared 
> to give you a manual with the grammatical rules, provide you with lists of 
> nouns, verbs, adjectives and postpositions, explain the application of 
> phonological rules, transliterations of the alphabet, give you a insight in 
> the nominal cases and verb structure, and read with you a text in Kazakh. 
> Nevertheless, without being rude, I bet that even then you are unable to 
> flawlessly produce a poem or even a brief text in Kazakh yourself.

OK, I see your desperation, and I take your analogy (I’m a scholar myself, not 
a programmer): if someone came to you with the Iliad and explained that he 
doesn’t know a word of Kazakh but wants all of Homer’s poem, every line, every 
word, every nuance, expressed in Kazakh with the help of a grammar and a 
dictionary, you’d reply that this is not how learning languages works. You 
begin with simple sentences and work your way up. You have shown us several 
times examples that don’t work, and I have expressed my suspicion that this may 
be due to using the correspondence module. You weren’t sure whether you need it 
or not; which is something only you can know. What does this module offer that 
can’t be accomplished otherwise? If you look at the documentation of the 
module, you see that the \startletter … \stopletter pair starts an environment 
within a \starttext … \stoptext context document. When you look at your setup, 
you will see that you have a \startletter … \stopletter, then a few setups, and 
then a \starttext … \stoptext document. I’m not a programmer, but I see that 
this will not work. 

So for some simple rules: when you process an xml buffer (or document), you 
define xmlsetups for the different xml elements. When you write 
\xmlprocessbuffer, that’s when these elements will be processed - which means: 
that’s when your document will be built. You can’t go through your xml 
buffer/document and then add further text (well you can, but that’s more 
complicated), so what you have to do is add your text (for the sake of this 
example: \input knuth) WITHING THESE SETUPS. So let’s start with a simple 
document that will work:

\startbuffer[participants]

  
Hendriks
Karel
mr.
K.
Arnhem

  Mr. K. Hendriks
  Grotestraat 5
  1234 BB Arnhem

1234bb5
  
  
Janssen
Piet
P.
mr.
Nijmegen

 Mr. P. Janssen
 Kortestraat 8
 1234 AA Nijmegen

1234aa8
  

\stopbuffer

\startxmlsetups xml:setups
\xmlsetsetup{#1}{contacts|contact|formalname|informalname|prefix|initials|address|city|text|kix|p}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:setups}

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

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

\startxmlsetups xml:contact
\xmltext{#1}{/address}
\blank [3*line]
Subject: your life in \xmltext{#1}{/city}
\blank [2*line]
Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},
\blank [line]
\input knuth \relax

Kind regards
\blank [line]
X
\page
\stopxmlsetups

\setuppagenumbering [state=stop]

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

So you see what I’m doing here: I process every simple  element, and I 
add all the stuff that will go into the letter for every single contact. Start 
with this document and then find out what you need in addition: a logo, some 
fancy lines across the letters, a special placement for the address and the 
subject, etc.? I’m guessing that it would be easier to do this with simple 
setup commands rather than using the correspondence module, but we have no idea 
what you need to accomplish. Once you find out what’s missing, you can modify 
the example and ask additional questions. But, to take your analogy: don’t 
start with irregular verbs and special cases that will complicate the picture. 
How is this line

\setuplanguage[nl][date={year, –, mm, –, dd}] % ISO 8601 date

from your original example relevant to your problem? And again: please don’t 
give me the “I’m not a programmer” response; I’m not a programmer either, but I 
know that you have to reduce the complexity in problems to find a solution. 
You’re adding extra complexity.

The way I describe above is the easiest path. There are other approaches, of 
course: you can combine elements from several xml documents, or you can process 
the xml data with Lua. All of this may be unnecessary in your case, but nobody 
will be able to help unless we understand what you need. And to explain this, 
you will have to start with simple examples, not with a complex document.

Sorry for being somewhat stern, but I’m sure you would give similar advice to 
your students…

All best

Thomas

___
If your question is 

[NTG-context] letters in context mkiv

2017-07-30 Thread r . ermers
Dear Contex’ers,I still desperately need your help. I would like to use Context mkiv for compiling serial letters with an xml database of addresses. I used to do this in mkii.The problem may seem trivial to experienced programmers like yourselves, but yes, I am stuck.I have several mkiv manuals, I tried dozens of lines of luacode, but somehow ...Let me as a turcologist compare my problem to learning Kazakh: I am prepared to give you a manual with the grammatical rules, provide you with lists of nouns, verbs, adjectives and postpositions, explain the application of phonological rules, transliterations of the alphabet, give you a insight in the nominal cases and verb structure, and read with you a text in Kazakh. Nevertheless, without being rude, I bet that even then you are unable to flawlessly produce a poem or even a brief text in Kazakh yourself.The same applies to information on complicated programming languages such as lua and TeX (steep learning curves - remember!).Yet even for non-programmers it it is fun to use TeX and Context.Therefore, knowledgeable list members, please help us. Have compassion and patience with the non-programmers amongst you who struggle with the application of the available information on Context. Who sometimes do not know how to accurately formulate their problems in programmer-ish. Who are  specialists in their own fields, but feel humble in this area.….Regarding my file, I have found out how to process the xml data from an xml file (now in the buffer). The recipient’s address neatly shows up in the designed place. (See pdf). So far, everything seems OK. Yet when I add text, only the text appears, and all address data from the xml file disappear.You can try it out by uncommenting the %\input knuth or %tekst lines.I have tried various options, but for now I have no idea how to proceed further.Context Version: 2017.07.17 00:20Lua 5.2.4, This is LuaTeX, Version 1.05.0.Your help is much appreciated!Раһмет!Kind regards,Robert\usemodule[letter]\setuplanguage[nl][date={year, –, mm, –, dd}] % ISO 8601 date\setupletteroptions[language=netherlands,bodyfont={rm,10pt},whitespace=1.5ex]\startbuffer[participants]      Hendriks    Karel    mr.    K.    Arnhem          Mr. K. Hendriks      Grotestraat 5      1234 BB Arnhem        1234bb5        Janssen    Piet    P.    mr.    Nijmegen         Mr. P. Janssen     Kortestraat 8     1234 AA Nijmegen        1234aa8  \stopbuffer\startxmlsetups xml:setups\xmlsetsetup{#1}{document|contacts|contact|prefix|initials|address|city|text|kix|p}{xml:*}%\xmlsetsetup{\xmldocument}{text:p}{xml:paragraph}\stopxmlsetups\xmlregistersetup{xml:setups}\startxmlsetups xml:contacts\xmlflush{#1}\stopxmlsetups\startxmlsetups xml:contact\setupletter[toaddress={\xmlall{#1}{/address/p}\par\xmltext{#1}{/kix}}]\defineletterelement[layer][address][example]%    {\correspondenceparameter{toname}\\\correspondenceparameter{toaddress}\par}%toname is not used in setupletter because toaddress contains all data.%kix is used for adding a barcode to the address.\setupletterlayer[address][alternative=example,y=6cm,x=12cm,color=red,style=\tfa\sans]\startletter  [opening={Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},},   closing={Kind regards,},   subject={subject: your life in \xmltext{#1}{/city}},   signature={X}]\stopletter\stopxmlsetups\startxmlsetups xml:address\xmlflush{#1}\stopxmlsetups\startxmlsetups xml:p\xmlflushtext{#1}\par\stopxmlsetups\starttext%\input knuth%tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst\xmlprocessbuffer{main}{participants}{}\stoptext___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-contextwebpage  : http://www.pragma-ade.nl / http://context.aanhet.netarchive  : https://bitbucket.org/phg/context-mirror/commits/wiki : http://contextgarden.net___

brieven2mkiv.pdf
Description: Adobe PDF document
___
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] letters in context mkiv

2017-07-28 Thread r . ermers
Dear Contex’ers,I have used the letter module of mkii for serial letters with an xml database (see example), but now I would like to step forward to mkiv.I have found out how to process the xml data from an xml file (now in the buffer). The recipient’s address neatly shows up in the designed place. (See pdf). So far, everything seems OK. Yet when I add text, only the text appears, and all address data from the xml file disappear.You can try it out by uncommenting the %\input knuth or %tekst lines.I have tried various options, but for now I have no idea how to proceed further.Context Version: 2017.07.17 00:20Lua 5.2.4, This is LuaTeX, Version 1.05.0.Your help is much appreciated!Kind regards,Robert

brieven2mkiv.pdf
Description: Adobe PDF document
\usemodule[letter]\setuplanguage[nl][date={year, –, mm, –, dd}] % ISO 8601 date\setupletteroptions[language=netherlands,bodyfont={rm,10pt},whitespace=1.5ex]\startbuffer[participants]      Hendriks    Karel    mr.    K.    Arnhem          Mr. K. Hendriks      Grotestraat 5      1234 BB Arnhem        1234bb5        Janssen    Piet    P.    mr.    Nijmegen         Mr. P. Janssen     Kortestraat 8     1234 AA Nijmegen        1234aa8  \stopbuffer\startxmlsetups xml:setups\xmlsetsetup{#1}{document|contacts|contact|prefix|initials|address|city|text|kix|p}{xml:*}%\xmlsetsetup{\xmldocument}{text:p}{xml:paragraph}\stopxmlsetups\xmlregistersetup{xml:setups}\startxmlsetups xml:contacts\xmlflush{#1}\stopxmlsetups\startxmlsetups xml:contact\setupletter[toaddress={\xmlall{#1}{/address/p}\par\xmltext{#1}{/kix}}]\defineletterelement[layer][address][example]%    {\correspondenceparameter{toname}\\\correspondenceparameter{toaddress}\par}%toname is not used in setupletter because toaddress contains all data.%kix is used for adding a barcode to the address.\setupletterlayer[address][alternative=example,y=6cm,x=12cm,color=red,style=\tfa\sans]\startletter  [opening={Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},},   closing={Kind regards,},   subject={subject: your life in \xmltext{#1}{/city}},   signature={X}]\stopletter\stopxmlsetups\startxmlsetups xml:address\xmlflush{#1}\stopxmlsetups\startxmlsetups xml:p\xmlflushtext{#1}\par\stopxmlsetups\starttext%\input knuth%tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst\xmlprocessbuffer{main}{participants}{}\stoptext___
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] letters in context mkiv

2017-07-28 Thread r . ermers
Dear Contex’ers,I have used the letter module of mkii for serial letters with an xml database (see example), but now I would like to step forward to mkiv.I have found out how to process the xml data from an xml file (now in the buffer). The recipient’s address neatly shows up in the designed place. (See pdf). So far, everything seems OK. Yet when I add text, only the text appears, and all address data from the xml file disappear.You can try it out by uncommenting the %\input knuth or %tekst lines.I have tried various options, but for now I have no idea how to proceed further.Context Version: 2017.07.17 00:20Lua 5.2.4, This is LuaTeX, Version 1.05.0.Your help is much appreciated!Kind regards,Robert\usemodule[letter]\setuplanguage[nl][date={year, –, mm, –, dd}] % ISO 8601 date\setupletteroptions[language=netherlands,bodyfont={rm,10pt},whitespace=1.5ex]\startbuffer[participants]      Hendriks    Karel    mr.    K.    Arnhem          Mr. K. Hendriks      Grotestraat 5      1234 BB Arnhem        1234bb5        Janssen    Piet    P.    mr.    Nijmegen         Mr. P. Janssen     Kortestraat 8     1234 AA Nijmegen        1234aa8  \stopbuffer\startxmlsetups xml:setups\xmlsetsetup{#1}{document|contacts|contact|prefix|initials|address|city|text|kix|p}{xml:*}%\xmlsetsetup{\xmldocument}{text:p}{xml:paragraph}\stopxmlsetups\xmlregistersetup{xml:setups}\startxmlsetups xml:contacts\xmlflush{#1}\stopxmlsetups\startxmlsetups xml:contact\setupletter[toaddress={\xmlall{#1}{/address/p}\par\xmltext{#1}{/kix}}]\defineletterelement[layer][address][example]%    {\correspondenceparameter{toname}\\\correspondenceparameter{toaddress}\par}%toname is not used in setupletter because toaddress contains all data.%kix is used for adding a barcode to the address.\setupletterlayer[address][alternative=example,y=6cm,x=12cm,color=red,style=\tfa\sans]\startletter  [opening={Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},},   closing={Kind regards,},   subject={subject: your life in \xmltext{#1}{/city}},   signature={X}]\stopletter\stopxmlsetups\startxmlsetups xml:address\xmlflush{#1}\stopxmlsetups\startxmlsetups xml:p\xmlflushtext{#1}\par\stopxmlsetups\starttext%\input knuth%tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst\xmlprocessbuffer{main}{participants}{}\stoptext

brieven2mkiv.pdf
Description: Adobe PDF document
___
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] letters in context mkiv

2017-07-25 Thread r . ermers
Dear Contex’ers,I use Context for many things. One of them is letters.I have used the letter module of mkii with an xml database (see example), but now I would like to step forward to mkiv.I have found out how to process the xml data from an xml file (now in the buffer). The recipient’s address neatly shows up in the designed place. (See pdf). So far, everything seems OK. Yet when I add text, only the text appears, and all address data from the xml file disappear.You can try it out by uncommenting the %\input knuth or %tekst lines.I have tried various options, but for now I have no idea how to proceed further.Context Version: 2017.07.17 00:20Lua 5.2.4, This is LuaTeX, Version 1.05.0.Your help is much appreciated!Kind regards,Robert

brieven2mkiv.pdf
Description: Adobe PDF document
\usemodule[letter]\setuplanguage[nl][date={year, –, mm, –, dd}] % ISO 8601 date\setupletteroptions[language=netherlands,bodyfont={rm,10pt},whitespace=1.5ex]\startbuffer[participants]      Hendriks    Karel    mr.    K.    Arnhem          Mr. K. Hendriks      Grotestraat 5      1234 BB Arnhem        1234bb5        Janssen    Piet    P.    mr.    Nijmegen         Mr. P. Janssen     Kortestraat 8     1234 AA Nijmegen        1234aa8  \stopbuffer\startxmlsetups xml:setups\xmlsetsetup{#1}{document|contacts|contact|prefix|initials|address|city|text|kix|p}{xml:*}%\xmlsetsetup{\xmldocument}{text:p}{xml:paragraph}\stopxmlsetups\xmlregistersetup{xml:setups}\startxmlsetups xml:contacts\xmlflush{#1}\stopxmlsetups\startxmlsetups xml:contact\setupletter[toaddress={\xmlall{#1}{/address/p}\par\xmltext{#1}{/kix}}]\defineletterelement[layer][address][example]%    {\correspondenceparameter{toname}\\\correspondenceparameter{toaddress}\par}%toname is not used in setupletter because toaddress contains all data.%kix is used for adding a barcode to the address.\setupletterlayer[address][alternative=example,y=6cm,x=12cm,color=red,style=\tfa\sans]\startletter  [opening={Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},},   closing={Kind regards,},   subject={subject: your life in \xmltext{#1}{/city}},   signature={X}]\stopletter\stopxmlsetups\startxmlsetups xml:address\xmlflush{#1}\stopxmlsetups\startxmlsetups xml:p\xmlflushtext{#1}\par\stopxmlsetups\starttext%\input knuth%tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst\xmlprocessbuffer{main}{participants}{}\stoptext___
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
___