[NTG-context] Problems with letter module

2018-07-19 Thread Lutz Haseloff
Hi Wolfgang, hi all,

I would like to use the letter module.

With my minimal letter i don't get pagenumbering and background working.
They don't appear in the pdf.

--
\setupbodyfont[cambria]
\usemodule[letter]
\useletterstyle[dinb]
\mainlanguage[de]
\starttext
\setupletter
[signature={Unterschrift},
fromname={Absender},
fromaddress={Straße\\Ort},
toname={An},
toaddress={Adresse}]
% correspondence.pdf, p. 73
\startsetups letter:head
\rightaligned{Seite \correspagenumber\ von \numberofcorrespages}
\stopsetups
% correspondence.pdf, p. 71
\startuseMPgraphic{dactylus}
draw unitsquare xyscaled (OverlayWidth-2cm,OverlayHeight-2cm)
smoothed 1cm withpen pencircle scaled 2 ;
fill fullcircle scaled 1.5cm shifted (1cm,1cm)
withcolor \MPcolor{orange} ;
\stopuseMPgraphic
\setupletterstyle[background=\useMPgraphic{dactylus}]

\startletter
[opening={Anrede},
subject={Betreff},
closing={Gruß}]
\input tufte

\input knuth

\input ward
\stopletter
\stoptext
--

Recent context beta, luatex 1.08 6731


Greetings Lutz___
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] title of index

2018-07-19 Thread Henri Menke



On 19/07/18 23:54, Hans van der Meer wrote:
The macro \completeregister[index] placed in 
\startbackmatter\startappendices typesets as “I Index”.

How can I change and format with my custom macro the part “Index”?
Such as using \mytitle{xyz} instead of Index?


Looks like the sectioning command is hardcoded: https://git.io/fNc1y



No solution found in the Context Wiki.

dr. Hans van der Meer




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

[NTG-context] Problem of compiling a file with Emacs

2018-07-19 Thread Fabrice Couvreur
Hello,
I'm starting a new discussion about compiling a file with Emacs. I will try
to be clear:

1. Compilation without Emacs in a terminal (Xterm):

 /home / aragorn / texlive / 2018 / bin / x86_64-linux / context Test.tex
Ok!

 / home / aragorn / context / tex / linux-64 / bin / context Test.tex Ok!

2. Compiling with a Emacs terminal shell command by having this in my ~ /
.emacs file

(setenv "PATH" "/ home / aragorn / context / tex / texmf-linux-64 / bin: $
PATH" t)

/ home / aragorn / texlive / 2018 / bin / x86_64-linux / context Test.tex
No Ok!

/ home / aragorn / context / tex / tex-linux-64 / bin / context Test.tex No
Ok!

3. Compiling with an Emacs terminal shell command by commenting this in my
~ / .emacs file

;; (setenv "PATH" "/ home / aragorn / context / tex / texmf-linux-64 / bin:
$ PATH" t)

/ home / aragorn / texlive / 2018 / bin / x86_64-linux / context Test.tex
Ok!

/ home / aragorn / context / tex / linux-64 / bin / context Test.tex Ok!

4. Compiling with the C-C C-C command by commenting this in my ~ / .emacs
file

;; (setenv "PATH" "/ home / aragorn / context / tex / texmf-linux-64 / bin:
$ PATH" t)

OK !

5. Coming with the C-c C-c command by having this in my ~ / .emacs file

(setenv "PATH" "/ home / aragorn / context / tex / texmf-linux-64 / bin: $
PATH" t) (that's what I do with all other files)

No OK !

Thanks.

My file Test.tex

% macros=mkvi
\setuppagenumbering[location=footer]

\startusableMPgraphic{NumberHead}
 draw outlinetext.f
 ("\bf\namedheadnumber{chapter}")
 (withcolor "lightgray")
 ysized 50pt ;
\stopusableMPgraphic

\unexpanded\def\processMPheadnumber#1%
  {\useMPgraphic{NumberHead}}

\setuphead
   [chapter]
   [command=\HeadTitle,
headstyle=\ss,
numbercommand=\processMPheadnumber,
   ]


\unexpanded\def\HeadTitle#1#2%
  {\framed
[frame=off,
 bottomframe=on,
 width=broad,
 align={broad,nothyphenated,left}]
{#1\blank[nowhite]#2}}

  \starttext
\starttitle[title={Sommaire}]

\start

\placelist
  [chapter,section,subsection]
  [criterium=all,
   alternative=c]

\stop

\stoptitle



\startchapter[title=Espaces probabilisés]

\startsubsection[title=Expérience aléatoire et univers]

\stopsubsection

\startsubsection[title=Événements]

\stopsubsection

\stopchapter

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

Re: [NTG-context] page ranges in \markpage

2018-07-19 Thread Hans Hagen

On 7/19/2018 9:56 PM, Pablo Rodriguez wrote:

On 07/18/2018 09:08 PM, Wolfgang Schuster wrote:


[...]
Afterwards you can use a loop where you add the markpage commands at
the begin and end of the range, below is a simple example but it’s easy
to write a better loop with Lua.

\setuplayout[page]
\setupinteraction[state=start]
\setupinteractionscreen[option={portrait, paper}, print=pages]
\starttext
\getfiguredimensions[i-context.pdf]
\dostepwiserecurse{1}{99}{1}{\externalfigure[i-context.pdf][height=\textheight,page=\recurselevel]}
\startmarkpages[page]
\dostepwiserecurse{100}{300}{1}{\externalfigure[i-context.pdf][height=\textheight,page=\recurselevel]}
\stopmarkpages
\dostepwiserecurse{301}{\noffigurepages}{1}{\externalfigure[i-context.pdf][height=\textheight,page=\recurselevel]}
\stoptext


Wolfgang

a different approach would be (code was mainly provided by anoter person):

 \startluacode
 function document.splitarray(inputstr, sep)
   local t={}
   for str in inputstr:gmatch("([^"..sep.."]+)") do
 table.insert(t, str)
   end
   return t
 end

 function document.getpagearray(page_ranges)
   local page_array={}
   local ranges = document.splitarray(page_ranges, ",")
   for _, pp in ipairs(ranges) do
 if string.find(pp, "-") then
   aux = document.splitarray(pp, "-")
   for i=tonumber(aux[1]), tonumber(aux[2]), 1 do
 table.insert(page_array, i)
   end
 else
table.insert(page_array, tonumber(pp))
 end
   end
   return page_array
 end

 function document.printmarkedpageranges(tag, page_ranges)
   page_array = document.getpagearray(page_ranges)
   context("\\markpage[" .. tag .. "][" ..
   table.concat(page_array, ", ") .. "]")
 end
 \stopluacode

 \def\getmarkedpageranges#1#2{%
 \ctxlua{document.printmarkedpageranges("#1","#2")}}
 \setuplayout[page]
 \setupinteraction[state=start]
 \setupinteractionscreen[option={portrait, paper}, print=pages]
 \getmarkedpageranges{pages}{5, 25-30, 100-200, 235, 298, 304}
 \starttext
 \insertpages[i-context.pdf][width=0pt]
 \stoptext

This makes easier to add more complex page intervals (such as the one
above).

Before adding this to the wiki, my question would be whether it might
not be easier to add page ranges to \markpage.


nicer code

local function getpagearray(page_ranges)
local list   = { }
local ranges = string.split(page_ranges, ",")
for i=1,#ranges do
local f = string.split(ranges[i], "-")
for i=tonumber(f[1]), tonumber(f[2] or f[1]) do
list[i] = true
end
end
return table.sortedkeys(list)
end

inspect(getpagearray("1-5,8,12-19"))

or even better

local function getpagearray(str,max)
local list = { }
local function add(i)
list[i] = true
end
if max then
utilities.parsers.stepper(str,max,add)
else
utilities.parsers.stepper(str,add)
end
return table.sortedkeys(list)
end

inspect(getpagearray("1-5,8,12-19,88-",100))

and then

function document.printmarkedpageranges(tag,str)
context.markpage({ tag }, getpagearray(str))
end


I mean, as a standard user I think there is too much code (which may be
improved and made part of ConTeXt) for such a simple need.

Of course, I may be missing the whole point in this issue.

I would really appreciate, if someone could explain me what is wrong in
my assumption that \markpages need also page intervals.



--

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

Re: [NTG-context] Issues with vertical spacing in simple case

2018-07-19 Thread Joseph Canedo
Finally I could make a MWE that reproduces the issue.


%\setuplayout[grid=both] % uncommenting this makes last line not indented. 
%\enabletrackers[vspacing.synchronizepage]

\starttext

\dorecurse{39}{ % other values like 40 do not show issue
A.

}

Chapitre.
\blank[0pt, samepage]
\hangindent=30pt\hangafter=-2Third par.\\
Second line.
\blank[0pt, samepage]
\hangindent=30pt\hangafter=-2 Fourth par not indented.\\ Second line not 
indented.

\stoptext

Thanks

De : Joseph Canedo
Envoyé le :jeudi 19 juillet 2018 22:26
À : Hans Hagen; mailing list for ConTeXt users
Objet :RE: [NTG-context] Issues with vertical spacing in simple case

Thanks for the extended explanation. I guess I need to figure out how to create 
a MWE that reproduces the issue.

Provenance : Courrier pour Windows 10

De : Hans Hagen
Envoyé le :jeudi 19 juillet 2018 09:35
À : Joseph Canedo; mailing list for ConTeXt users
Objet :Re: [NTG-context] Issues with vertical spacing in simple case

On 7/19/2018 8:55 AM, Joseph Canedo wrote:
> Thanks.
> 
> The problem happens in a case where there are no paragraph split between 
> 2 pages. All pars are entirely either in page 1 or page 2 (these numbers 
> are not actual page numbers, but it’s for clarity).
> 
> I am trying to create a MWE but it’s not trivial. The situation as far 
> as I understand it is like the following :
> 
> I’ve added tracers for vspacing.synchronizepage function.
> 
> When page 1 ships, there are 2 paragraphs (1 + 3 lines) still pending 
> because they do not fit in page 1 so they will be shipped in page 2 (I 
> think that what is in texlists.page_head variable). Hence tex.prevgraf 
> which was 0 is set to 4 (see this from traces in output log).

what do you mean with pending ... tex doesn't look ahead, only back

you probably need to look at the delta of pagegoal - pagetotal and evide 
that by the line height .. probably good enough for text without whitespace

even then, hyphenation penalties can make a page one or more lines 
shorter so you also need to disable some of that

> vspacing    > page 4, prevdepth 2.56577pt => 2.56577pt, prevgraf 0 => 4
> 
> vspacing    > list glue:topskip hlist:line penalty:userpenalty 
> penalty:userpenalty glue:baselineskip hlist:line 
> penalty:linebreakpenalty glue:baselineskip hlist:line 
> penalty:linebreakpenalty glue:baselineskip hlist:line glue:userskip
> 
> Next paragraph after the 2 pending pars I refer to above has a non zero 
> \hangindent and \hangafter (set to -1) and when it starts being 
> processed (in horizontal mode) prevgraf is already 4 so I think this 
> cancels out that hanging (that’s the effect I see in output, there is no 
> indent in 1st line of 3rd par), as IIRC TEX considers par has already 4 
> lines but in actuality it has 0. If I read correctly the TeXBook, 
> prevgraf value has some impact on \hangafter / \hangindent

you never really know what you look at: tex collects stuff and triggers 
the output routine when it thinks it makes sense

in context there is also the rather complex vertical spacing mechanism 
that needs to look back and forward while looking back can interfere 
with page breaks (and/or retrying)

these mechanisms evolved over time and are still nto perfect

> The value of \prevgraf affects line breaking only when TEX
> is dealing with nonstandard \parshape or \hangindent.

no, it's independent ... just th enumber of lines (hboxes) that make a 
paragraph after it's broken into lines

hangindent/after/parshape don't look at real dimensions, they only count 
lines

this is why a side float mechanism is so complex ... lots of border 
cases and trickery around page breaks (because not only the size of what 
goes side is important but also the preceding and following space, the 
height and depth of lines etc

> Joseph
> 
> *De : *Hans Hagen 
> *Envoyé le :*jeudi 19 juillet 2018 00:00
> *À : *Joseph Canedo ; mailing list for 
> ConTeXt users 
> *Objet :*Re: [NTG-context] Issues with vertical spacing in simple case
> 
> On 7/18/2018 10:33 PM, Joseph Canedo wrote:
> 
>  > Thanks Hans.
> 
>  >
> 
>  > Picked up today beta and some code I have relying on value of
> 
>  > tex.prevgraf starts breaking. This is lettrine related code that sets
> 
>  > hangafter for 1st paragraph and eventually subsequent if lettrine is
> 
>  > larger than 1st par.
> 
>  >
> 
>  > I see the function vspacing.synchronizepage() sets prevgraf value I
> 
>  > guess to avoid bleeding also paragraph lines.
> 
>  >
> 
>  > Is there any possibility to get original unchanged tex.prevgraf value,
> 
>  > possibly using some callback or some other tex. ?
> 
> you cannot rely on prevgraf crossing pages (so you get e.g. 8 at the top
> 
> of a page with 5 lines
> 
> where/how does it fail
> 
> Hans
> 
> -
> 
>     Hans Hagen | PRAGMA ADE
> 

Re: [NTG-context] Issues with vertical spacing in simple case

2018-07-19 Thread Joseph Canedo
Thanks for the extended explanation. I guess I need to figure out how to create 
a MWE that reproduces the issue.

Provenance : Courrier pour Windows 10

De : Hans Hagen
Envoyé le :jeudi 19 juillet 2018 09:35
À : Joseph Canedo; mailing list for ConTeXt users
Objet :Re: [NTG-context] Issues with vertical spacing in simple case

On 7/19/2018 8:55 AM, Joseph Canedo wrote:
> Thanks.
> 
> The problem happens in a case where there are no paragraph split between 
> 2 pages. All pars are entirely either in page 1 or page 2 (these numbers 
> are not actual page numbers, but it’s for clarity).
> 
> I am trying to create a MWE but it’s not trivial. The situation as far 
> as I understand it is like the following :
> 
> I’ve added tracers for vspacing.synchronizepage function.
> 
> When page 1 ships, there are 2 paragraphs (1 + 3 lines) still pending 
> because they do not fit in page 1 so they will be shipped in page 2 (I 
> think that what is in texlists.page_head variable). Hence tex.prevgraf 
> which was 0 is set to 4 (see this from traces in output log).

what do you mean with pending ... tex doesn't look ahead, only back

you probably need to look at the delta of pagegoal - pagetotal and evide 
that by the line height .. probably good enough for text without whitespace

even then, hyphenation penalties can make a page one or more lines 
shorter so you also need to disable some of that

> vspacing    > page 4, prevdepth 2.56577pt => 2.56577pt, prevgraf 0 => 4
> 
> vspacing    > list glue:topskip hlist:line penalty:userpenalty 
> penalty:userpenalty glue:baselineskip hlist:line 
> penalty:linebreakpenalty glue:baselineskip hlist:line 
> penalty:linebreakpenalty glue:baselineskip hlist:line glue:userskip
> 
> Next paragraph after the 2 pending pars I refer to above has a non zero 
> \hangindent and \hangafter (set to -1) and when it starts being 
> processed (in horizontal mode) prevgraf is already 4 so I think this 
> cancels out that hanging (that’s the effect I see in output, there is no 
> indent in 1st line of 3rd par), as IIRC TEX considers par has already 4 
> lines but in actuality it has 0. If I read correctly the TeXBook, 
> prevgraf value has some impact on \hangafter / \hangindent

you never really know what you look at: tex collects stuff and triggers 
the output routine when it thinks it makes sense

in context there is also the rather complex vertical spacing mechanism 
that needs to look back and forward while looking back can interfere 
with page breaks (and/or retrying)

these mechanisms evolved over time and are still nto perfect

> The value of \prevgraf affects line breaking only when TEX
> is dealing with nonstandard \parshape or \hangindent.

no, it's independent ... just th enumber of lines (hboxes) that make a 
paragraph after it's broken into lines

hangindent/after/parshape don't look at real dimensions, they only count 
lines

this is why a side float mechanism is so complex ... lots of border 
cases and trickery around page breaks (because not only the size of what 
goes side is important but also the preceding and following space, the 
height and depth of lines etc

> Joseph
> 
> *De : *Hans Hagen 
> *Envoyé le :*jeudi 19 juillet 2018 00:00
> *À : *Joseph Canedo ; mailing list for 
> ConTeXt users 
> *Objet :*Re: [NTG-context] Issues with vertical spacing in simple case
> 
> On 7/18/2018 10:33 PM, Joseph Canedo wrote:
> 
>  > Thanks Hans.
> 
>  >
> 
>  > Picked up today beta and some code I have relying on value of
> 
>  > tex.prevgraf starts breaking. This is lettrine related code that sets
> 
>  > hangafter for 1st paragraph and eventually subsequent if lettrine is
> 
>  > larger than 1st par.
> 
>  >
> 
>  > I see the function vspacing.synchronizepage() sets prevgraf value I
> 
>  > guess to avoid bleeding also paragraph lines.
> 
>  >
> 
>  > Is there any possibility to get original unchanged tex.prevgraf value,
> 
>  > possibly using some callback or some other tex. ?
> 
> you cannot rely on prevgraf crossing pages (so you get e.g. 8 at the top
> 
> of a page with 5 lines
> 
> where/how does it fail
> 
> Hans
> 
> -
> 
>     Hans Hagen | PRAGMA ADE
> 
>     Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> 
>      tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> 
> -
> 


-- 

-
   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 

Re: [NTG-context] page ranges in \markpage

2018-07-19 Thread Pablo Rodriguez
On 07/18/2018 09:08 PM, Wolfgang Schuster wrote:
> 
> [...]
> Afterwards you can use a loop where you add the markpage commands at
> the begin and end of the range, below is a simple example but it’s easy
> to write a better loop with Lua.
> 
> \setuplayout[page]
> \setupinteraction[state=start]
> \setupinteractionscreen[option={portrait, paper}, print=pages]
> \starttext
> \getfiguredimensions[i-context.pdf]
> \dostepwiserecurse{1}{99}{1}{\externalfigure[i-context.pdf][height=\textheight,page=\recurselevel]}
> \startmarkpages[page]
> \dostepwiserecurse{100}{300}{1}{\externalfigure[i-context.pdf][height=\textheight,page=\recurselevel]}
> \stopmarkpages
> \dostepwiserecurse{301}{\noffigurepages}{1}{\externalfigure[i-context.pdf][height=\textheight,page=\recurselevel]}
> \stoptext

Wolfgang

a different approach would be (code was mainly provided by anoter person):

\startluacode
function document.splitarray(inputstr, sep)
  local t={}
  for str in inputstr:gmatch("([^"..sep.."]+)") do
table.insert(t, str)
  end
  return t
end

function document.getpagearray(page_ranges)
  local page_array={}
  local ranges = document.splitarray(page_ranges, ",")
  for _, pp in ipairs(ranges) do
if string.find(pp, "-") then
  aux = document.splitarray(pp, "-")
  for i=tonumber(aux[1]), tonumber(aux[2]), 1 do
table.insert(page_array, i)
  end
else
   table.insert(page_array, tonumber(pp))
end
  end
  return page_array
end

function document.printmarkedpageranges(tag, page_ranges)
  page_array = document.getpagearray(page_ranges)
  context("\\markpage[" .. tag .. "][" ..
  table.concat(page_array, ", ") .. "]")
end
\stopluacode

\def\getmarkedpageranges#1#2{%
\ctxlua{document.printmarkedpageranges("#1","#2")}}
\setuplayout[page]
\setupinteraction[state=start]
\setupinteractionscreen[option={portrait, paper}, print=pages]
\getmarkedpageranges{pages}{5, 25-30, 100-200, 235, 298, 304}
\starttext
\insertpages[i-context.pdf][width=0pt]
\stoptext

This makes easier to add more complex page intervals (such as the one
above).

Before adding this to the wiki, my question would be whether it might
not be easier to add page ranges to \markpage.

I mean, as a standard user I think there is too much code (which may be
improved and made part of ConTeXt) for such a simple need.

Of course, I may be missing the whole point in this issue.

I would really appreciate, if someone could explain me what is wrong in
my assumption that \markpages need also page intervals.

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] title of index

2018-07-19 Thread Wolfgang Schuster

\definehead[mytitle][title]

\starttext

...

\mytitle{...}

\placeregister[index]

\stoptext


Wolfgang

Hans van der Meer 
19. Juli 2018 um 13:54
The macro \completeregister[index] placed in 
\startbackmatter\startappendices typesets as “I Index”.

How can I change and format with my custom macro the part “Index”?
Such as using \mytitle{xyz} instead of Index?

No solution found in the Context Wiki.

dr. Hans van der Meer


___
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] title of index

2018-07-19 Thread Hans van der Meer
Thanks. Putting \placeregister[index] inside a  
\startchapter[title=\mytitle{}]-\stopchapter pair does the ttrick.

> On 19 Jul 2018, at 14:19, Rik Kabel  wrote:
> 
> On 7/19/2018 07:54, Hans van der Meer wrote:
>> The macro \completeregister[index] placed in 
>> \startbackmatter\startappendices typesets as “I Index”. 
>> How can I change and format with my custom macro the part “Index”? 
>> Such as using \mytitle{xyz} instead of Index?
>> 
>> No solution found in the Context Wiki.
>> 
>> dr. Hans van der Meer
>> 
> 
> Try \placeindex or \placeregister[index] and your own section heading. This 
> is analagous to \completecontent and \placecontent.

dr. Hans van der Meer


___
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] title of index

2018-07-19 Thread Rik Kabel

On 7/19/2018 07:54, Hans van der Meer wrote:
The macro \completeregister[index] placed in 
\startbackmatter\startappendices typesets as “I Index”.

How can I change and format with my custom macro the part “Index”?
Such as using \mytitle{xyz} instead of Index?

No solution found in the Context Wiki.

dr. Hans van der Meer



Try \placeindex or \placeregister[index] and your own section heading. 
This is analagous to \completecontent and \placecontent.
___
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] title of index

2018-07-19 Thread Hans van der Meer
The macro \completeregister[index] placed in \startbackmatter\startappendices 
typesets as “I Index”. 
How can I change and format with my custom macro the part “Index”? 
Such as using \mytitle{xyz} instead of Index?

No solution found in the Context Wiki.

dr. Hans van der Meer


___
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] Issues with vertical spacing in simple case

2018-07-19 Thread Hans Hagen

On 7/19/2018 8:55 AM, Joseph Canedo wrote:

Thanks.

The problem happens in a case where there are no paragraph split between 
2 pages. All pars are entirely either in page 1 or page 2 (these numbers 
are not actual page numbers, but it’s for clarity).


I am trying to create a MWE but it’s not trivial. The situation as far 
as I understand it is like the following :


I’ve added tracers for vspacing.synchronizepage function.

When page 1 ships, there are 2 paragraphs (1 + 3 lines) still pending 
because they do not fit in page 1 so they will be shipped in page 2 (I 
think that what is in texlists.page_head variable). Hence tex.prevgraf 
which was 0 is set to 4 (see this from traces in output log).


what do you mean with pending ... tex doesn't look ahead, only back

you probably need to look at the delta of pagegoal - pagetotal and evide 
that by the line height .. probably good enough for text without whitespace


even then, hyphenation penalties can make a page one or more lines 
shorter so you also need to disable some of that



vspacing    > page 4, prevdepth 2.56577pt => 2.56577pt, prevgraf 0 => 4

vspacing    > list glue:topskip hlist:line penalty:userpenalty 
penalty:userpenalty glue:baselineskip hlist:line 
penalty:linebreakpenalty glue:baselineskip hlist:line 
penalty:linebreakpenalty glue:baselineskip hlist:line glue:userskip


Next paragraph after the 2 pending pars I refer to above has a non zero 
\hangindent and \hangafter (set to -1) and when it starts being 
processed (in horizontal mode) prevgraf is already 4 so I think this 
cancels out that hanging (that’s the effect I see in output, there is no 
indent in 1st line of 3rd par), as IIRC TEX considers par has already 4 
lines but in actuality it has 0. If I read correctly the TeXBook, 
prevgraf value has some impact on \hangafter / \hangindent


you never really know what you look at: tex collects stuff and triggers 
the output routine when it thinks it makes sense


in context there is also the rather complex vertical spacing mechanism 
that needs to look back and forward while looking back can interfere 
with page breaks (and/or retrying)


these mechanisms evolved over time and are still nto perfect


The value of \prevgraf affects line breaking only when TEX
is dealing with nonstandard \parshape or \hangindent.


no, it's independent ... just th enumber of lines (hboxes) that make a 
paragraph after it's broken into lines


hangindent/after/parshape don't look at real dimensions, they only count 
lines


this is why a side float mechanism is so complex ... lots of border 
cases and trickery around page breaks (because not only the size of what 
goes side is important but also the preceding and following space, the 
height and depth of lines etc



Joseph

*De : *Hans Hagen 
*Envoyé le :*jeudi 19 juillet 2018 00:00
*À : *Joseph Canedo ; mailing list for 
ConTeXt users 

*Objet :*Re: [NTG-context] Issues with vertical spacing in simple case

On 7/18/2018 10:33 PM, Joseph Canedo wrote:

 > Thanks Hans.

 >

 > Picked up today beta and some code I have relying on value of

 > tex.prevgraf starts breaking. This is lettrine related code that sets

 > hangafter for 1st paragraph and eventually subsequent if lettrine is

 > larger than 1st par.

 >

 > I see the function vspacing.synchronizepage() sets prevgraf value I

 > guess to avoid bleeding also paragraph lines.

 >

 > Is there any possibility to get original unchanged tex.prevgraf value,

 > possibly using some callback or some other tex. ?

you cannot rely on prevgraf crossing pages (so you get e.g. 8 at the top

of a page with 5 lines

where/how does it fail

Hans

-

    Hans Hagen | PRAGMA ADE

    Ridderstraat 27 | 8061 GH Hasselt | The Netherlands

     tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl

-




--

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

Re: [NTG-context] Issues with vertical spacing in simple case

2018-07-19 Thread Joseph Canedo
Thanks.
The problem happens in a case where there are no paragraph split between 2 
pages. All pars are entirely either in page 1 or page 2 (these numbers are not 
actual page numbers, but it’s for clarity). 

I am trying to create a MWE but it’s not trivial. The situation as far as I 
understand it is like the following :

I’ve added tracers for vspacing.synchronizepage function.
When page 1 ships, there are 2 paragraphs (1 + 3 lines) still pending because 
they do not fit in page 1 so they will be shipped in page 2 (I think that what 
is in texlists.page_head variable). Hence tex.prevgraf which was 0 is set to 4 
(see this from traces in output log).

vspacing> page 4, prevdepth 2.56577pt => 2.56577pt, prevgraf 0 => 4
vspacing> list glue:topskip hlist:line penalty:userpenalty 
penalty:userpenalty glue:baselineskip hlist:line penalty:linebreakpenalty 
glue:baselineskip hlist:line penalty:linebreakpenalty glue:baselineskip 
hlist:line glue:userskip

Next paragraph after the 2 pending pars I refer to above has a non zero 
\hangindent and \hangafter (set to -1) and when it starts being processed (in 
horizontal mode) prevgraf is already 4 so I think this cancels out that hanging 
(that’s the effect I see in output, there is no indent in 1st line of 3rd par), 
as IIRC TEX considers par has already 4 lines but in actuality it has 0. If I 
read correctly the TeXBook, prevgraf value has some impact on \hangafter / 
\hangindent

The value of \prevgraf affects line breaking only when TEX
is dealing with nonstandard \parshape or \hangindent.

Joseph

De : Hans Hagen
Envoyé le :jeudi 19 juillet 2018 00:00
À : Joseph Canedo; mailing list for ConTeXt users
Objet :Re: [NTG-context] Issues with vertical spacing in simple case

On 7/18/2018 10:33 PM, Joseph Canedo wrote:
> Thanks Hans.
> 
> Picked up today beta and some code I have relying on value of 
> tex.prevgraf starts breaking. This is lettrine related code that sets 
> hangafter for 1st paragraph and eventually subsequent if lettrine is 
> larger than 1st par.
> 
> I see the function vspacing.synchronizepage() sets prevgraf value I 
> guess to avoid bleeding also paragraph lines.
> 
> Is there any possibility to get original unchanged tex.prevgraf value, 
> possibly using some callback or some other tex. ?
you cannot rely on prevgraf crossing pages (so you get e.g. 8 at the top 
of a page with 5 lines

where/how does it fail

Hans

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