[NTG-context] Strange behavior in somewhat complex layout

2019-06-23 Thread Andres Conrado Montoya
Hello list, I'm trying to make something using bits and examples found here
and elsewhere, but I'm hitting a wall. I know there's a flawed logic in my
approach, but I can't figure it out. Any help is appreciated.

Expected behavior of the following MWE:
When starting a new chapter, check if the page is even (left page), if so,
fill it with color, and start the chapter in the next odd page (right
page), removing the header but leaving the footer in that start-chapter
page; and if this is a start-chapter page, use a specific graphic overlay
for the page, but if if not (if its a regular page), use another graphic.

Result:
The header still appears in the start-chapter page, if it comes after the
color filled page. But, if the start-chapter page comes after a regular
(even) page, everything works as expected (no color-filled page, no header
in the start-chapter page).

MWE:

%% START MWE

\definecolor[rojo][h=ED553B]
\definehighlight[rojo][color=rojo]

\startMPinclusions
numeric u ; u := 1.125pt ;
numeric i ; i := 0.125in ;
string prevChapterTitle, currentChapterTitle;
prevChapterTitle := "";
currentChapterTitle := "";
\stopMPinclusions

\startuseMPgraphic{page:background}
StartPage;
currentChapterTitle := "\namedstructurevariable{chapter}{title}";

if currentChapterTitle <> prevChapterTitle :

fill (topboundary Page -- cycle)
enlarged(0,8i)
shifted (0,-4i)
withcolor transparent(4, 0.2, \MPcolor{rojo}) ;

fill (bottomboundary Page -- cycle)
enlarged(0,1u)
shifted (0,6i)
withcolor \MPcolor{rojo} ;

prevChapterTitle := currentChapterTitle ;

else:

fill (topboundary Page -- cycle)
enlarged(0,0.25u)
shifted (0,-7i+3u)
withcolor \MPcolor{rojo} ;

fill (bottomboundary Page -- cycle)
enlarged(0,0.25u)
shifted (0,6i)
withcolor \MPcolor{rojo} ;

fi;
StopPage;
\stopuseMPgraphic

\defineoverlay
  [chapter:background]
  [\useMPgraphic{page:background}]

\setupbackgrounds[page][background=chapter:background]

\definepagebreak[firstpagebreak][yes,header]

\startsetups [chapter:before]
   \doifoddpageelse
 {}
 {\pushbackground[page]
\setupbackgrounds[page][background=color,backgroundcolor=rojo]
\page[yes,right]
  \popbackground}
\stopsetups

\setuphead[chapter]
  [width=20em,
  before=\directsetup{chapter:before},
  align={flushleft,nothyphenated,verytolerant},
  style={\tfd\sansbold},
  header=empty,
  page=yes,
  commandbefore={\blank[1.75in]},
  after={\blackrule[color=rojo,height=4pt,width=6em]\blank[1.25in]}]


\setuppagenumbering[alternative=doublesided,location=]

\setupheadertexts
[]
[{{\small\sans\getmarking[chapter]}}]
[{{\small\sans\getmarking[chapter]}}]
[]

\setupfootertexts
[]
[{\rojo{\small\sansbold\pagenumber}}]
[{\rojo{\small\sansbold\pagenumber}}]
[]

\starttext

\dorecurse{4}{%
  \startchapter[title={A chapter with a really long, long title}]
  \dorecurse{9}{\input{tufte}}
  \stopchapter
  \startchapter[title={A different chapter with a really long, long title}]
  \dorecurse{6}{\input{tufte}}
  \stopchapter}

\stoptext

%% STOP MWE

Thank you for your time.

Andrés Conrado Montoya
___
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] CrossWords Puzzles with context

2019-06-23 Thread Martin Althoff
Thanks for sharing this! Great help for me as a teacher :)

On Sun, 2019-06-23 at 19:06 +0100, Jorge Manuel wrote:
> After some attempts to build crosswords puzzles with context, I found this 
> approach:
> 
> 

___
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 Markdown – Part 4: Theme Style

2019-06-23 Thread Thangalin
Hi all!

This part of the series describes a way to define colours, fonts, and
layout such that content is separated from presentation.

https://dave.autonoma.ca/blog/2019/06/23/typesetting-markdown-part-4/

Questions, corrections, and improvements are welcome.
___
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] ntg-context Digest, Vol 180, Issue 23

2019-06-23 Thread Andres Conrado
ber=no]
>
> but neither of these seems to work in mkiv
>
>
> Minimal example:
>
> \setupsection[section-3][previousnumber=no]
> \setuphead[section][partnumber=no,chapternumber=no]
>
> \starttext
> \part{Part}
> Part
> \chapter{Chapter}
> Chapter
> \section{Section}
> Section
> \subsection{Subsection}
> Subsection
> \stoptext
>
> Many thanks for any pointers.
>
> Duncan
> -- next part --
> An HTML attachment was scrubbed...
> URL: <
> http://mailman.ntg.nl/pipermail/ntg-context/attachments/20190623/b2e70a35/attachment-0001.html
> >
>
> --
>
> Message: 4
> Date: Sun, 23 Jun 2019 11:08:52 +0200
> From: Hans Hagen 
> To: "ntg-context@ntg.nl >> mailing list for ConTeXt users"
> 
> Subject: Re: [NTG-context] mkii to mkiv - section numbering with
> minimal example
> Message-ID: <79ccf634-041b-2c9a-df66-75289e8a7...@xs4all.nl>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> On 6/23/2019 10:26 AM, Duncan Hothersall wrote:
> > Further to my previous query about updating from mkii to mkiv, I have
> > solved some of the issues by trial and error but am beginning to
> > identify the ones I can't resolve. My first minimal example is below.
> >
> > I want the sections and subsections not to prefix the part and chapter
> > numbering, giving me this output:
> >
> > Part 1
> > Chapter 1.1
> > Section 1
> > Subsection 1.1
> >
> > The line that used to achieve this result was
> >
> > \setupsection[section-3][previousnumber=no]
> >
> > and there was also
> >
> > \setuphead[section][partnumber=no,chapternumber=no]
> >
> > but neither of these seems to work in mkiv
> >
> >
> > Minimal example:
> >
> > \setupsection[section-3][previousnumber=no]
> > \setuphead[section][partnumber=no,chapternumber=no]
> >
> > \starttext
> > \part{Part}
> > Part
> > \chapter{Chapter}
> > Chapter
> > \section{Section}
> > Section
> > \subsection{Subsection}
> > Subsection
> > \stoptext
> >
> > Many thanks for any pointers.
> in the test suite there are all kind of examples (zip can be downloaded
> from the website)
>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
>
>
> --
>
> Subject: Digest Footer
>
>
> ___
> 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  : https://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
>
> ___
>
>
> --
>
> End of ntg-context Digest, Vol 180, Issue 23
> 
>
___
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] mkii to mkiv - section numbering with minimal example

2019-06-23 Thread Duncan Hothersall
On Sun, 23 Jun 2019 at 19:08,  wrote:

>
> Hi Duncan,
>
> I guess this may be what you want to do:
>
> \setuphead[part][placehead=yes]
> \setuphead[section][sectionsegments=section]
> \setuphead[subsection][sectionsegments=section:subsection]
> \starttext
> \part{Part}
> \chapter{Chapter}
> \section{Section}
> \subsection{Subsection}
> \stoptext
>
> I hope it helps,
>
> Pablo
> --
> http://www.ousia.tk
>
>
> Belated thanks Pablo, I get the digest so I had posted my discovery of
this precise solution before I saw you supplying that answer. Apologies! It
works well.

Duncan
___
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] CrossWords Puzzles with context

2019-06-23 Thread Jorge Manuel
After some attempts to build crosswords puzzles with context, I found this 
approach:

1) Create the puzzle with  genxword
https://github.com/riverrun/genxword  

2) Edit the output table and change all {}  to  *

3) Save the table in a file (p.e. crosswords.txt) 

3) In context use this script (Revised By Wolfgang Schuster)

\startluacode
context.startmidaligned()
context.bTABLE( { rulethickness = ".25pt", width = ".8cm", height = 
".8cm", align = "{lohi, middle}" } )
for line in io.lines("crosswords.txt") do
for w in (line .. "|"):gmatch("([^|]*)|") do 
-- print (w)
if w == ' ' then
context.bTR()
elseif w == '.' then
context.eTR()
else
if w == '* ' then 
context.bTD( { frame = "off" } )
context.eTD()
else 
ww = string.match (w, "%d+")
print (ww)
if ww then
context.bTD( { foregroundstyle = "\\bfxx" } )
context("%s",ww)
context.eTD()
else
context.bTD()
 -- context("%s",w)
context.eTD()
end
end
end
end
end
context.eTABLE()
context.stopmidaligned()
\stopluacode


Files: 

crossword.txt file:

 |* |* |[2]T|* |* |* |* |* |* |* |* |* |* |* |* |* |.
 |[1]A|D|R|I|A|N|O|* |* |* |* |* |* |* |* |* |.
 |* |* |A|* |* |* |* |* |* |* |* |* |* |* |* |* |.
 |[6]H|* |J|* |* |* |[4]T|* |* |* |* |* |* |* |* |* |.
 |[3]I|T|A|L|I|C|A|* |* |* |* |* |* |* |* |* |.
 |S|* |N|* |* |* |R|* |* |* |* |* |* |* |* |* |.
 |P|* |O|* |* |* |G|* |[10]S|* |* |[7]P|* |* |* |* |.
 |A|* |* |* |[5]G|U|A|D|A|L|Q|U|I|[9]V|I|[8]R|.
 |L|* |* |* |* |* |R|* |N|* |* |B|* |E|* |O|.
 |I|* |* |* |* |* |Y|* |T|* |* |L|* |N|* |M|.
 |S|* |* |* |* |* |E|* |I|* |* |I|* |U|* |A|.
 |* |* |* |* |* |* |N|* |P|* |* |O|* |S|* |N|.
 |* |* |* |* |* |* |* |* |O|* |* |* |* |* |* |O|.
 |* |* |* |* |* |* |* |* |N|* |* |* |* |* |* |S|.
 |* |* |* |* |* |* |* |* |C|* |* |* |* |* |* |* |.
 |* |* |* |[11]A|N|F|I|T|E|A|T|R|O|* |* |* |.

Output






___
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] mkii to mkiv - section numbering with minimal example

2019-06-23 Thread Duncan Hothersall
On Sun, 23 Jun 2019 at 11:00, Hans Hagen wrote:

>
> in the test suite there are all kind of examples (zip can be downloaded
> from the website)
>
>
Thanks Hans. After some searching in the test suite I found the answer,
which I'll put here in case someone else is searching for it, which is:

\setuphead[section][sectionsegments=section]
\setuphead[subsection][sectionsegments=section:subsection]

which sets up sections to just be numbered with the section number instead
of the part, chapter and section number, and sets up subsections to just be
numbered with the section and subsection number.

Now that I know how to do it I see mkiv is much cleaner on this code and
the change gets reflected in tables of contents etc. This was much harder
in mkii. Thanks again.

Duncan
___
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] italic correction (before the glyph)

2019-06-23 Thread Pablo Rodriguez
Dear list,

I have the following sample:

\def\DesiredFont{TeX Gyre Termes}
\definefontfeature[italic][itlc=yes,textitalics=yes]
\setupitaliccorrection[global, always]
\definefontfamily
[mainface]
[rm]
[\DesiredFont]
\definefontfamily
[mainface_corrected]
[rm]
[\DesiredFont]
[features={italic}]
\setupbodyfont[mainface]
\setupitaliccorrection[global,always]
\starttext
\startbuffer[chars]
\startTEXpage[offset=1em]
\dorecurse{26}
{\setupbodyfont[mainface]%
[{\em \recurselevel}]
[{\em \characters{\recurselevel}}]
[{\em \Characters{\recurselevel}}]
({\em \characters{\recurselevel}})
({\em \Characters{\recurselevel}})
\hfill
\setupbodyfont[mainface_corrected]
[{\em \recurselevel}]
[{\em \characters{\recurselevel}}]
[{\em \Characters{\recurselevel}}]
({\em \characters{\recurselevel}})
({\em \Characters{\recurselevel}})
\par}
\stopTEXpage
\stopbuffer
\getbuffer[chars]
\def\DesiredFont{TeX Gyre Pagella}
\getbuffer[chars]
\stoptext

This shows that sequences such as ({\em f}) are corrected with the
closing parenthesis, but not with the opening one.

Wouldn’t it be possible that italic correction could be enabled also
before the italic glyph(s)?

BTW, I wonder why the second definition of \DesiredFont doesn’t change
the font for the buffer used after 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] mkii to mkiv - section numbering with minimal example

2019-06-23 Thread Pablo Rodriguez
On 6/23/19 10:26 AM, Duncan Hothersall wrote:
> Further to my previous query about updating from mkii to mkiv, I have
> solved some of the issues by trial and error but am beginning to
> identify the ones I can't resolve. My first minimal example is below.
>
> I want the sections and subsections not to prefix the part and chapter
> numbering, giving me this output:
>
> Part 1
> Chapter 1.1
> Section 1
> Subsection 1.1

Hi Duncan,

I guess this may be what you want to do:

\setuphead[part][placehead=yes]
\setuphead[section][sectionsegments=section]
\setuphead[subsection][sectionsegments=section:subsection]
\starttext
\part{Part}
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\stoptext

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] mkii to mkiv - section numbering with minimal example

2019-06-23 Thread Hans Hagen

On 6/23/2019 10:26 AM, Duncan Hothersall wrote:
Further to my previous query about updating from mkii to mkiv, I have 
solved some of the issues by trial and error but am beginning to 
identify the ones I can't resolve. My first minimal example is below.


I want the sections and subsections not to prefix the part and chapter 
numbering, giving me this output:


Part 1
Chapter 1.1
Section 1
Subsection 1.1

The line that used to achieve this result was

\setupsection[section-3][previousnumber=no]

and there was also

\setuphead[section][partnumber=no,chapternumber=no]

but neither of these seems to work in mkiv


Minimal example:

\setupsection[section-3][previousnumber=no]
\setuphead[section][partnumber=no,chapternumber=no]

\starttext
\part{Part}
Part
\chapter{Chapter}
Chapter
\section{Section}
Section
\subsection{Subsection}
Subsection
\stoptext

Many thanks for any pointers.
in the test suite there are all kind of examples (zip can be downloaded 
from the website)


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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] mkii to mkiv - section numbering with minimal example

2019-06-23 Thread Duncan Hothersall
Further to my previous query about updating from mkii to mkiv, I have
solved some of the issues by trial and error but am beginning to identify
the ones I can't resolve. My first minimal example is below.

I want the sections and subsections not to prefix the part and chapter
numbering, giving me this output:

Part 1
Chapter 1.1
Section 1
Subsection 1.1

The line that used to achieve this result was

\setupsection[section-3][previousnumber=no]

and there was also

\setuphead[section][partnumber=no,chapternumber=no]

but neither of these seems to work in mkiv


Minimal example:

\setupsection[section-3][previousnumber=no]
\setuphead[section][partnumber=no,chapternumber=no]

\starttext
\part{Part}
Part
\chapter{Chapter}
Chapter
\section{Section}
Section
\subsection{Subsection}
Subsection
\stoptext

Many thanks for any pointers.

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