Re: [NTG-context] Couple of questions

2017-07-28 Thread Gerion Entrup
Am Freitag, 28. Juli 2017, 17:05:59 CEST schrieb Pablo Rodriguez:
> On 07/28/2017 02:22 AM, Gerion Entrup wrote:
> > 2. Own title format
> > I've set an own title format for chapters, like described in the wiki. 
> > Unfortunately this applies to the table of contents and bibliography as 
> > well.
> > Below a minimal example, that reproduces it:
> > ```
> > \setupinteraction[state=start]
> > 
> > \define[2]\MyChapter{\framed[frame=off,bottomframe=on,topframe=on]
> > {\vbox{\headtext{chapter} #1\blank#2}}}
> > 
> > \setuphead[chapter][command=\MyChapter, style={\switchtobodyfont[24pt,ss]}, 
> > header=empty, page=mychapterpagebreak]
> > \setupheadtext[chapter=Chapter, content=Table of Contents]
> > 
> > \starttext
> > \completecontent
> > \page[yes]
> > 
> > \startchapter[title=foo]
> > 
> > \stoptext
> > ```
> > How can I prevent the printing of "Chapter" in the table of contents and
> > bibliography?
> 
> Hi Gerion,
> 
> play with the sample, in order to see what fits you best:
> 
> \setupinteraction[state=start]
> 
> \define[2]\MyChapter{\framed[frame=off,bottomframe=on,topframe=on]
> {\vbox{\headtext{chapter} #1\blank[small]#2}}}
> 
> \setuphead[chapter][command=\MyChapter,
> style={\switchtobodyfont[24pt,ss]}, header=empty, page=mychapterpagebreak]
> 
> \startsectionblockenvironment[bodypart]
> \setupheadtext[chapter=Chapter]
> \stopsectionblockenvironment
> 
> \startsectionblockenvironment[appendix]
> \setupheadtext[chapter=Appendix]
> \stopsectionblockenvironment
> 
> \starttext
> \startfrontmatter
> \chapter{Table of Contents}\placecontent
> \stopfrontmatter
> 
> \startbodymatter
> \startchapter[title=foo]
> \stopbodymatter
> 
> \startappendices
> \chapter{Bibliography}
> \stopappendices
> 
> \startbackmatter
> \chapter{Bibliography}
> \stopbackmatter
> 
> \stoptext
Thank you, that works for me.


> > 5. Numbering of floats
> > I want a numbering for my figures in this format:
> > way=bychapter, prefixsegments=chapter
> > 
> > I guess, this is the default, but I've explicitly set it.
> > In some captions the prefix is ignored. For example there are 5 figures in 
> > chapter 2, then the captions of the figures (the text is in German) are:
> > Abbildung 2.1   foo
> > Abbildung 2.2   bar
> > Abbildung 3foobar
> > Abbildung 4otherfoo
> > Abbildung 5lastfoo
> > 
> > Is there anything, I can do, to prevent this?
> 
> I cannot reproduce the problem you mention:
> 
> \mainlanguage[de]
> \starttext
> \dorecurse{5}{\chapter{Kapitel}
> \placefigure{Eine Kuh}{\externalfigure[cow.pdf]}}
> \chapter{Kapitel}
> \dorecurse{5}{\placefigure{Eine andere Kuh}
> {\externalfigure[cow.pdf]}}
> \dorecurse{5}{\chapter{Kapitel}
> \placefigure{Noch eine andere Kuh}{\externalfigure[cow.pdf]}}
> \stoptext
> 
> In general, please provide minimal samples of code that show your problem.
Was not that simple, but I found the problem, that causes it:
subsubsections without numbers.

Here is a minimal example:
```
\mainlanguage[de]
\setuphead[subsubsection][number=off]
\setupcaptions[way=bychapter,
   prefixsegments=chapter]

\starttext

\startchapter[title=Kapitel]
\placefigure{Eine Kuh}{\externalfigure[cow.pdf]}

\startsection[title=Abschnitt]
\startsubsection[title=Unterabschnitt]
\placefigure{Eine Kuh}{\externalfigure[cow.pdf]}

\startsubsubsection[title=Und hier gibts ein Problem]
\placefigure{Eine Kuh}{\externalfigure[cow.pdf]}
\stopsubsubsection

\startsubsubsection[title=Und hier gibts ein Problem]
\stopsubsubsection

\stopsubsection
\stopsection
\stopchapter

\stoptext
```
Is there a way to fix this?

Gerion


___
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] texture as background?

2017-07-28 Thread Aditya Mahajan

On Fri, 28 Jul 2017, Henning Hraban Ramm wrote:


Ahoi,

is there are way to use a texture (i.e. a repeated pixel image) as a background 
of a frame?


Use \backgroundimage

See https://tex.stackexchange.com/a/69138/323

Aditya
___
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] source code and result side by side

2017-07-28 Thread Aditya Mahajan

On Fri, 28 Jul 2017, Henning Hraban Ramm wrote:


Ahoi again,

I’m preparing some ConTeXt docs with a lot of examples and would like to 
reproduce what we have in the wiki as


...


i.e. sourcecode beside the result.

Often the shown source is exactly what I want to show, in other cases I 
need some additional setup that I don’t want to show.


Which approach would you suggest? Combinations?


\startbuffer[example-1]
 
\stopbuffer


\placesidebyside
{\typebuffer[example-1]}
{\getbuffer[setups, example-1]}


Aditya___
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] ligatures/substituation at word boundaries

2017-07-28 Thread Hans Hagen

On 7/27/2017 8:09 PM, Ulrike Fischer wrote:

Is it possible to refer in fonts.handlers.otf.addfeature to the word
boundary? The luatex manual speaks of a virtual "left_boundary"
char, but I couldn't find a way to use it.

\startluacode
 fonts.handlers.otf.addfeature {
 name = "ltest",
 type = "ligature",
 data = {
 ['1'] = { "a", "b" },
 ['2'] = { "d", "a" },
 }
 }
\stopluacode

%how to replace only the start a

\startluacode
 fonts.handlers.otf.addfeature {
 name = "wtest",
 type = "ligature",
 data = {
 ['1'] = { "left_boundary", "a" },
 }
 }
\stopluacode

\definefontfeature[wtest][wtest=yes]
\definefontfeature[ltest][ltest=yes]
\starttext

 \definedfont[file:dejavu-serif.ttf*default]%


 {\addff{ltest} ababa\par}

 {\addff{wtest} ababa\par}


\stoptext
It is possible to check against spaces in contextual lookups. There 
isn't something like left boundary. I added some test code to the beta 
but keep in mind that this will only work with self-made features. (I 
have to check performance impact because I don't like making contextual 
lookups measurable slower due to some hardly used feature. First test 
show that it behaves ok.) In the test code below 0xFFFC is the boundary 
(this 0xFFFC check is the new thing). I adapted a few more things in the 
loader so best check that out too.


I'll upload a beta.

Hans

\starttext

\startluacode
fonts.handlers.otf.addfeature {
name= "test-a",
type= "chainsubstitution",
lookups = {
{
type = "substitution",
data = {
["a"] = "A",
["b"] = "B",
["c"] = "C",
["d"] = "D",
},
},
{
type = "ligature",
data = {
['1'] = { "a", "b" },
['2'] = { "c", "d" },
},
},
},
data = {
rules = {
{
before  = { { " ", 0xFFFC } },
current = { { "a" }, { "b" } },
lookups = { 2 },
},
{
current = { { "c" }, { "d" } },
after   = { { 0xFFFC, " " } },
lookups = { 2 },
},
{
current = { { "a" } },
after   = { { "b" } },
lookups = { 1 },
},
{
current = { { "c" } },
after   = { { "d" } },
lookups = { 1 },
},
},
},
}

fonts.handlers.otf.addfeature {
name= "test-b",
type= "chainsubstitution",
lookups = {
{
type = "ligature",
data = {
['1'] = { "a", "b" },
['2'] = { "c", "d" },
},
},
},
data = {
rules = {
{
-- the space is redundant as 0xFFFC contains it
before  = { { " ", 0xFFFC } },
current = { { "a" }, { "b" } },
lookups = { 1 },
},
{
current = { { "c" }, { "d" } },
-- the space is redundant as 0xFFFC contains it
after   = { { 0xFFFC, " " } },
lookups = { 1 },
},
},
},
}

fonts.handlers.otf.addfeature {
name= "test-c",
type= "chainsubstitution",
lookups = {
{
type = "ligature",
data = {
['1'] = { "a", "b" },
['2'] = { "c", "d" },
},
},
},
data = {
rules = {
{
before  = { { " " } },
current = { { "a" }, { "b" } },
lookups = { 1 },
},
{
current = { { "c" }, { "d" } },
after   = { { " " } },
lookups = { 1 },
},
},
},
}

\stopluacode

\definefontfeature[test-a][test-a=yes]
\definefontfeature[test-b][test-b=yes]
\definefontfeature[test-c][test-c=yes]

\startbuffer
abababcdcd abababcdcd abababcdcd
\stopbuffer

\typebuffer

\definedfont[file:dejavu-serif.ttf*default,test-a] \getbuffer \blank
\definedfont[file:dejavu-serif.ttf*default,test-b] \getbuffer \blank
\definedfont[file:dejavu-serif.ttf*default,test-c] \getbuffer \blank

\stoptext



-
  Hans Hagen | PRAGMA ADE
  

[NTG-context] source code and result side by side

2017-07-28 Thread Henning Hraban Ramm
Ahoi again,

I’m preparing some ConTeXt docs with a lot of examples and would like to 
reproduce what we have in the wiki as


...


i.e. sourcecode beside the result.

Often the shown source is exactly what I want to show, in other cases I need 
some additional setup that I don’t want to show.

Which approach would you suggest? Combinations?


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
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] width of floats

2017-07-28 Thread Henning Hraban Ramm
Ahoi,
I wonder how I can limit the width of a custom float, neither "width" nor 
"maxwidth" seems to have any effect:


\definefloat[Beispiel][Beispiele]
\setupfloat[Beispiel][
%width=36mm,
maxwidth=.6\textwidth,
offset=1em,
background=color,backgroundcolor=yellow,
]
\setupcaption[Beispiel][
location=none,number=no
]

\starttext

\input knuth

\startplaceBeispiel
\input tufte
\stopplaceBeispiel

\input knuth

\stoptext


While it’s nice that the "Beispiel" paragraphs stays the same width as the main 
text, even with "offset", I’d like to limit the whole box to the textwidth (or 
any other measure).



Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
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] texture as background?

2017-07-28 Thread Henning Hraban Ramm
Ahoi,

is there are way to use a texture (i.e. a repeated pixel image) as a background 
of a frame?


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
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] (bug?) itlc removes liga

2017-07-28 Thread Pablo Rodriguez
Dear list,

using latest beta (2017.07.28 14:24), I have the following sample:

\definefontfeature
[default]
[default]
[script=latn,
 itlc=yes]

\setupitaliccorrection
[global, always]

\definefontfamily
[mainfont]
[rm]
[EB Garamond]

\startbuffer[words]
office final floor affliction
\stopbuffer

\startbuffer[ligatures]
{\em \getbuffer[words]}\\
{\bi \getbuffer[words]}\\
{\getbuffer[words]}\\
{\bf \getbuffer[words]}\\
\stopbuffer

\starttext
\startTEXpage[offset=1em]
\getbuffer[ligatures]
\setupbodyfont[pagella]
\getbuffer[ligatures]
\setupbodyfont[mainfont]
\getbuffer[ligatures]
\stopTEXpage
\stoptext

In Latin Modern italics (and TeX Gyre typefaces), the “ffi” ligature
isn’t added.

With EB Garamond, italics don’t get the “ffl” ligature.

The previous beta from 2017.07.27 16:17 doesn’t have the issue that I
describe.

Could anyone be so kind to confirm the bug with latest beta?

Many thanks for your 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] Couple of questions

2017-07-28 Thread Gerion Entrup
Am Freitag, 28. Juli 2017, 16:34:01 CEST schrieb Pablo Rodriguez:
> On 07/28/2017 02:22 AM, Gerion Entrup wrote:
> > [...]
> > 6. Multiple references
> > I want to create the same footnote on multiple locations in the text. 
> > Therefore I used:
> > ```
> > \setupinteraction[state=start]
> > 
> > \starttext
> > This\footnote[letter-s]{"s" is a letter.} is\note[letter-s] a 
> > nons\note[letter-s]ens\note[letter-s]e text.
> > \stoptext
> > 
> > ```
> > But this uses different fonts for the number in the text. Is there a way to 
> > fix 
> > this or do it better?
> 
> Hi Gerion,
> 
> the easiest way is to disable bold in links:
> 
> \setupinteraction[state=start, style=]
> 
> Or I guess you would have to enable bold in the footnote reference numbers.
Ah ok, then both types of references are treated different.
Your solution works, thank you.

Gerion


___
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] inline code in XML

2017-07-28 Thread Pablo Rodriguez
Hans,

many  thanks for having added \xmlprettyprinttext to ConTeXt.

I have now another problem with inline code:

\definetype[TeX][option=TEX, lines=hyphenated]
\starttext
\startTEXpage[offset=1em]
This is inline code: \TeX{\command[option=value]{final text}}

\startXML
Inline code: \TeX[option=value]{final text}
\stopXML
\stopTEXpage
\stoptext

I need the \TeX command from the first text paragraph, but I have to
make it work with an XML source such as the second one (the code element).

Would it be possible to have something like \xmlprettyinlinetext (it is
essential to have consistent marking in code blocks and in inline code?

I have tried to find out a solution, but \typebuffer requires a separate
paragraph (or I didn’t know how to disable it).

Many thanks for your 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] Couple of questions

2017-07-28 Thread Pablo Rodriguez
On 07/28/2017 02:22 AM, Gerion Entrup wrote:
> 2. Own title format
> I've set an own title format for chapters, like described in the wiki. 
> Unfortunately this applies to the table of contents and bibliography as well.
> Below a minimal example, that reproduces it:
> ```
> \setupinteraction[state=start]
> 
> \define[2]\MyChapter{\framed[frame=off,bottomframe=on,topframe=on]
> {\vbox{\headtext{chapter} #1\blank#2}}}
> 
> \setuphead[chapter][command=\MyChapter, style={\switchtobodyfont[24pt,ss]}, 
> header=empty, page=mychapterpagebreak]
> \setupheadtext[chapter=Chapter, content=Table of Contents]
> 
> \starttext
> \completecontent
> \page[yes]
> 
> \startchapter[title=foo]
> 
> \stoptext
> ```
> How can I prevent the printing of "Chapter" in the table of contents and
> bibliography?

Hi Gerion,

play with the sample, in order to see what fits you best:

\setupinteraction[state=start]

\define[2]\MyChapter{\framed[frame=off,bottomframe=on,topframe=on]
{\vbox{\headtext{chapter} #1\blank[small]#2}}}

\setuphead[chapter][command=\MyChapter,
style={\switchtobodyfont[24pt,ss]}, header=empty, page=mychapterpagebreak]

\startsectionblockenvironment[bodypart]
\setupheadtext[chapter=Chapter]
\stopsectionblockenvironment

\startsectionblockenvironment[appendix]
\setupheadtext[chapter=Appendix]
\stopsectionblockenvironment

\starttext
\startfrontmatter
\chapter{Table of Contents}\placecontent
\stopfrontmatter

\startbodymatter
\startchapter[title=foo]
\stopbodymatter

\startappendices
\chapter{Bibliography}
\stopappendices

\startbackmatter
\chapter{Bibliography}
\stopbackmatter

\stoptext

> 5. Numbering of floats
> I want a numbering for my figures in this format:
> way=bychapter, prefixsegments=chapter
> 
> I guess, this is the default, but I've explicitly set it.
> In some captions the prefix is ignored. For example there are 5 figures in 
> chapter 2, then the captions of the figures (the text is in German) are:
> Abbildung 2.1   foo
> Abbildung 2.2   bar
> Abbildung 3foobar
> Abbildung 4otherfoo
> Abbildung 5lastfoo
> 
> Is there anything, I can do, to prevent this?

I cannot reproduce the problem you mention:

\mainlanguage[de]
\starttext
\dorecurse{5}{\chapter{Kapitel}
\placefigure{Eine Kuh}{\externalfigure[cow.pdf]}}
\chapter{Kapitel}
\dorecurse{5}{\placefigure{Eine andere Kuh}
{\externalfigure[cow.pdf]}}
\dorecurse{5}{\chapter{Kapitel}
\placefigure{Noch eine andere Kuh}{\externalfigure[cow.pdf]}}
\stoptext

In general, please provide minimal samples of code that show your problem.

I hope 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] Couple of questions

2017-07-28 Thread Pablo Rodriguez
On 07/28/2017 02:22 AM, Gerion Entrup wrote:
> [...]
> 6. Multiple references
> I want to create the same footnote on multiple locations in the text. 
> Therefore I used:
> ```
> \setupinteraction[state=start]
> 
> \starttext
> This\footnote[letter-s]{"s" is a letter.} is\note[letter-s] a 
> nons\note[letter-s]ens\note[letter-s]e text.
> \stoptext
> 
> ```
> But this uses different fonts for the number in the text. Is there a way to 
> fix 
> this or do it better?

Hi Gerion,

the easiest way is to disable bold in links:

\setupinteraction[state=start, style=]

Or I guess you would have to enable bold in the footnote reference numbers.

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
___

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