[NTG-context] Re: issue with "context --pages=reference"

2024-09-21 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 21.09.2024 um 16:59:

Dear list,

I have the following sample (sample.tex):

   \setuppagenumbering[alternative=doublesided]
   \setuphead[chapter][reference=ch\namedheadnumber{chapter}]
   \starttext
 \dorecurse{5}{%
   \startchapter[title={Chapter \namedheadnumber{chapter}}]
 \dorecurse{\randomnumber{10}{50}}
   {\input zapf\par}
   \stopchapter}
   \stoptext

I get no page numbers from:

   context --pages=ch3 sample.tex


Try this (without file extension): context --pages --list=ch3 sample

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] issue with "context --pages=reference"

2024-09-21 Thread Pablo Rodriguez via ntg-context
Dear list,

I have the following sample (sample.tex):

  \setuppagenumbering[alternative=doublesided]
  \setuphead[chapter][reference=ch\namedheadnumber{chapter}]
  \starttext
\dorecurse{5}{%
  \startchapter[title={Chapter \namedheadnumber{chapter}}]
\dorecurse{\randomnumber{10}{50}}
  {\input zapf\par}
  \stopchapter}
  \stoptext

I get no page numbers from:

  context --pages=ch3 sample.tex

BTW, sample.tuc contains:

 {
  ["metadata"]=6,
  ["numberdata"]=10,
  ["references"]={
   ["block"]="bodypart",
   ["internal"]=4,
   ["realpage"]=29,
   ["reference"]="ch3",
   ["section"]=4,
  },

Which is the right way to invoke "context --pages=[reference]" or what
am I missing here?

Many thanks for your help,

Pablo
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: How to tell a single *.tex file to produce separate PDFs?

2024-09-20 Thread Pablo Rodriguez via ntg-context
On 9/20/24 04:57, Joel via ntg-context wrote:
> [...]
> The perhaps "obvious" answer is just make 180  *.tex files, but since
> the minimal example above is like 0.01% of the complexity of the real
> file, that isn't so easy...

Hi Joel,

I tried to recreate a document with chapters that contain a different
number of pages each:

\setuppagenumbering[alternative=doublesided]
\setuphead[chapter][reference=ch\the\numexpr\namedheadnumber{chapter}+1]
\starttext
  \dorecurse{180}{%
\startchapter[title={Chapter \namedheadnumber{chapter}}]
  \dorecurse{\randomnumber{10}{50}}
{\input zapf\par}
\stopchapter}
\stoptext

The key above is setting a reference for each chapter, so that they may
be retrieved later automatically.

Then you should have the pages for any chapter from its reference with
the following command:

  context --pages=ch100 main-file.tex

But I must confess, I cannot get this working. I don’t know what I miss.

If you are on Unix, generating a bash loop would be similar to (once
your main PDF document has been generated):

  for i in {1..180}; do mutool merge -o chapter-$i.pdf main-file\
  "$(context --pages=ch$i main-file)"

But for that, you need to know first how "--pages=[reference]" may work.

Just in case it might help,

Pablo
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Margins using 2UP imposition schema

2024-09-16 Thread Willi Egger
Angel,

I used a lot of impositioning in the past. 

If you want to have small white space at the outer edge, then do not use 
width=fit. Control the inner whitespace with backspace=… Then calculate the 
width of the textarea you want and set this value in width=... There is no need 
to use cutspace in your approach.

Willi
> On 14 Sep 2024, at 19:08, Angel M Alganza  wrote:
> 
> Hello:
> 
> I'm composing an A5 booklet printed on an A4 paper using the 2UP imposition 
> schema.  I believe, in such case, margins should be controlled using 
> 'backspace' and 'cutspace' options of the \setuplayout command, but I'm 
> afraid I don't quite understand how to use those properl.  I want to make the 
> 'external' margin (right on odd pages and left on even pages) as small as 
> possible, and the 'internal' margin larger, so that I can hole punch the 
> booklet.
> 
> I believe, in such case, margins should be controlled using 'backspace' and 
> 'cutspace' options of the \setuplayout command, but I'm afraid I don't quite 
> understand how to use those properly.  Here's a minimal example:
> 
> \setuppapersize[A5][A4]
> \setuparranging[2UP,rotated]
> \setuplayout
> [topspace=13pt,
> backspace=30pt,
> cutspace=-20pt,
> width=fit,
> height=fit,
> header=0pt,
> footer=0pt]
> \setuppagenumbering[state=stop]
> \setupbodyfont[small]
> \starttext
> \dorecurse{20}{\input tufte \vskip 1em}
> \stoptext
> 
> I wonder how I could reduce the left margin and increase the left one on the 
> even pages.
> 
> Any pointers, please?
> 
> Thank you so much in advance.
> Ángel
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Margins using 2UP imposition schema

2024-09-15 Thread Wolfgang Schuster

Angel M Alganza schrieb am 14.09.2024 um 19:08:

Hello:

I'm composing an A5 booklet printed on an A4 paper using the 2UP 
imposition schema.  I believe, in such case, margins should be 
controlled using 'backspace' and 'cutspace' options of the 
\setuplayout command, but I'm afraid I don't quite understand how to 
use those properl.  I want to make the 'external' margin (right on odd 
pages and left on even pages) as small as possible, and the 'internal' 
margin larger, so that I can hole punch the booklet.


I believe, in such case, margins should be controlled using 
'backspace' and 'cutspace' options of the \setuplayout command, but 
I'm afraid I don't quite understand how to use those properly.  Here's 
a minimal example:


\setuppapersize[A5][A4]
\setuparranging[2UP,rotated]
\setuplayout
[topspace=13pt,
backspace=30pt,
cutspace=-20pt,
width=fit,
height=fit,
header=0pt,
footer=0pt]
\setuppagenumbering[state=stop]
\setupbodyfont[small]
\starttext
\dorecurse{20}{\input tufte \vskip 1em}
\stoptext

I wonder how I could reduce the left margin and increase the left one 
on the even pages.


Any pointers, please?


Create a normal document without imposition in A5 and use afterwards the 
arrange extra to produce your booklet.


You can get a short information block with an example when you write

    context --extras=arrange

in the terminal.

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Margins using 2UP imposition schema

2024-09-14 Thread Angel M Alganza

Hello:

I'm composing an A5 booklet printed on an A4 paper using the 2UP 
imposition schema.  I believe, in such case, margins should be 
controlled using 'backspace' and 'cutspace' options of the \setuplayout 
command, but I'm afraid I don't quite understand how to use those 
properl.  I want to make the 'external' margin (right on odd pages and 
left on even pages) as small as possible, and the 'internal' margin 
larger, so that I can hole punch the booklet.


I believe, in such case, margins should be controlled using 'backspace' 
and 'cutspace' options of the \setuplayout command, but I'm afraid I 
don't quite understand how to use those properly.  Here's a minimal 
example:


\setuppapersize[A5][A4]
\setuparranging[2UP,rotated]
\setuplayout
[topspace=13pt,
backspace=30pt,
cutspace=-20pt,
width=fit,
height=fit,
header=0pt,
footer=0pt]
\setuppagenumbering[state=stop]
\setupbodyfont[small]
\starttext
\dorecurse{20}{\input tufte \vskip 1em}
\stoptext

I wonder how I could reduce the left margin and increase the left one on 
the even pages.


Any pointers, please?

Thank you so much in advance.
Ángel
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: how do I get the correct page numbers and do the calculations with it?

2024-09-10 Thread Wolfgang Schuster

Bruce Horrocks schrieb am 09.09.2024 um 23:27:

On 9 Sep 2024, at 08:57, ai2472206...@yeah.net wrote:

As the title suggests, how do I get the correct page numbers?


There does seem to be an anomaly here. Simpler MWE:

\starttext
\dorecurse{15}{
\input knuth
%{\ssd\color[red]{\pagenumber}} % not as expected
{\color[red]{\pagenumber}}   % as expected
}
\stoptext

With the \ssd the first number at the top of the second and subsequent pages is 
one less than it should be. Without the \ssd then the numbers are as expected.

@Muyik: Are you able to use \pagenumber without using \ssd or similar to change 
the size? That might be a work-around for you. There is also \userpagenumber.


You can't use page counters in running text without problems because 
you're working against the way how TeX constructs pages.


The only reliable way are multipass solutions like the pagestate or 
reference mechanism.


Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: how do I get the correct page numbers and do the calculations with it?

2024-09-10 Thread Wolfgang Schuster

ai2472206...@yeah.net schrieb am 10.09.2024 um 06:05:

1. The usage of the command  "\definepagestate " is what I searched for in 
previous posts and source files.
I don't know exactly how he used it. (╥﹏╥)

2. I've devised a command that needs to get the current page number to 
determine if it's an odd or even page.
This is then used to get a certain width to determine the width of the command 
on that line.
Below I designed the command. The code related to this issue is mainly


You have to differentiate between odd and even and right hand and left 
hand pages.


When you want to check whether you have an right hand or left hand page 
you can use the following method.
To get the correct result ensure you start a paragraph before you set 
the flag with \signalrightpage.


 begin example
%\setuppagenumbering[alternative=doublesided]
%\setuppagenumbering[alternative={singlesided,doublesided}]

\starttext

\dorecurse{20}
  {\dontleavehmode\signalrightpage\doifelserightpage{\bold{Right 
page}}{\bold{Left page}}

   \samplefile{lorem}}

\stoptext
 end example

To have a check which works for odd and even pages you have to use the 
pagestate mechanism.
Even in this case it is important to start a paragraph before save the 
current state, afterwards

you can check the stored pagenumber.

 begin example
\definepagestate[warichu]

\starttext

\dorecurse{20}
  {\dontleavehmode\autosetpagestate{warichu}%
   \ifodd0\autopagestaterealpage{warichu}%
 \bold{Odd page}
   \else
 \bold{Even page}
   \fi
   \samplefile{lorem}}

\stoptext
 end example

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: how do I get the correct page numbers and do the calculations with it?

2024-09-10 Thread vm via ntg-context




On 10/09/2024 06:32, ai2472206...@yeah.net wrote:

I changed the command, and now I get the correct page number with this command, 
\
but how should he do the calculation?



this gives an interesting result with a colorful mix of page numbers,
although it is not obvious to me as why.


\setupinterlinespace[18pt]
\definepagestate[test][delay=yes]
\starttext
\dorecurse{15}{
{\ssd\color[red]{\setpagestate[test]\pagestaterealpage{test}{#1}}}
\input knuth
{\ssd\color[green]{\setpagestate[test]\pagestaterealpage{test}{#1}}}
}
\stoptext



___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: how do I get the correct page numbers and do the calculations with it?

2024-09-09 Thread ai2472206007
I changed the command, and now I get the correct page number with this command, 
\
but how should he do the calculation?

\starttext
\definepagestate[test][delay=yes]
\dorecurse{10}{%
\input knuth %
{\ssd\color[red]{\setpagestate[test]\pagestaterealpage{test}{#1}}}
}
\stoptext

Regards,
---
Muyik
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: how do I get the correct page numbers and do the calculations with it?

2024-09-09 Thread vm via ntg-context

this will go wrong as well:

\starttext
\dorecurse{15}{\ssd
\input knuth
{\color[red]{\pagenumber}}
}
\stoptext


and this as well:

\starttext
\dorecurse{15}{\tfb
\input knuth
{\color[red]{\pagenumber}}   % as expected
}
\stoptext


and so does this:

\setupinterlinespace[16pt]
\starttext
\dorecurse{15}{
\input knuth
{\color[red]{\pagenumber}}   % as expected
}
\stoptext



(and there is probably a valid reason to it ;-)


.F



On 09/09/2024 23:27, Bruce Horrocks wrote:

On 9 Sep 2024, at 08:57,ai2472206...@yeah.net wrote:

As the title suggests, how do I get the correct page numbers?


There does seem to be an anomaly here. Simpler MWE:

\starttext
\dorecurse{15}{
\input knuth
%{\ssd\color[red]{\pagenumber}} % not as expected
{\color[red]{\pagenumber}}   % as expected
}
\stoptext

With the \ssd the first number at the top of the second and subsequent pages is 
one less than it should be. Without the \ssd then the numbers are as expected.

@Muyik: Are you able to use \pagenumber without using \ssd or similar to change 
the size? That might be a work-around for you. There is also \userpagenumber.

Regards,
—
Bruce Horrocks
Hampshire, UK

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist :ntg-context@ntg.nl 
/https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  :https://www.pragma-ade.nl /https://context.aanhet.net (mirror)
archive  :https://github.com/contextgarden/context
wiki :https://wiki.contextgarden.net
___



___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: how do I get the correct page numbers and do the calculations with it?

2024-09-09 Thread Bruce Horrocks
On 9 Sep 2024, at 08:57, ai2472206...@yeah.net wrote:
> 
> As the title suggests, how do I get the correct page numbers? 


There does seem to be an anomaly here. Simpler MWE:

\starttext
\dorecurse{15}{
\input knuth
%{\ssd\color[red]{\pagenumber}} % not as expected
{\color[red]{\pagenumber}}   % as expected
}
\stoptext

With the \ssd the first number at the top of the second and subsequent pages is 
one less than it should be. Without the \ssd then the numbers are as expected.

@Muyik: Are you able to use \pagenumber without using \ssd or similar to change 
the size? That might be a work-around for you. There is also \userpagenumber.

Regards,
—
Bruce Horrocks
Hampshire, UK

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] how do I get the correct page numbers and do the calculations with it?

2024-09-09 Thread ai2472206007
Thank to all who answered my questions before. 
As the title suggests, how do I get the correct page numbers? 
For example, in the example below, 
the first line on the 2nd page, but the page number showed is 1,
In the meantime, I tried using \definepagestate, 
but it didn't seem to work either. 
What I can think of is to use citations to get the correct page number. 
But it seems that what is obtained is not a pure number, 
and it cannot do the calculations.

so ,how do I get the correct page numbers and do the calculations with it?

thanks.
%% start example
\starttext

%%% try page state
\definepagestate[test][delay=yes]
\newcount\test
\let\testfloatrealpage\realpageno
\def\testsavedata
  {\setpagestate[test][\number\test]}
\def\testloaddata % precedes save !
  {\global\advance\test\plusone
   \xdef\testfloatrealpage{\pagestaterealpage{test}{\number\test}}
   \ifx\testfloatrealpage\empty
\glet\testfloatrealpage\realpageno
   \fi}
\testsavedata%
%%%
\dorecurse{10}{%
\testloaddata%
\input knuth \pagereference[XX:#1]
{\ssd\color[red]{\the\pageno}}%   on page 2 and show page 1
{\ssd\color[red]{\the\testfloatrealpage}}%on page 2 and show page 1
{\ssd\color[red]{\ref[page][XX:#1]}}% on page 2 and show page 2
}
\stoptext
% stop example

  Muyik
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Inserting text between end notes

2024-09-03 Thread Rik Kabel

Thank you for that, Bruce.

While it is still a hack, as you note, it is less fraught since one does 
not have to keep track of the last end note in each chapter.


I would still like to see a real ability to add text to the note collection.

--
Rik

On 2024-09-01 14:31, Bruce Horrocks wrote:



On 1 Sep 2024, at 03:53, Rik Kabel wrote:

Hello all,
I am trying to implement some style-guide-defined (Chicago 17, and now, 18) 
requirements to the end notes in a book. The need is to insert non-end-note 
text into the list of end notes. But end notes are not a list (as far as I can 
see) and \writetolist and such are no help.
The text to be inserted is of two types. The first is the name of the chapter 
from which the following notes were generated. It would be nice to 
automatically generate these.
The second type is pseudo-end-notes crediting the book and chapter epigraphs, 
which should appear as unnumbered end notes (at the start of the note section 
and the start of each chapter's notes). Ideally these would be generated in the 
same way as regular end notes but will not increment the note numbers (and 
should not, at least in my use case, require cross-referencing or bookmarking).
I can hack the first requirement with:
\define[1]\EndNoteChapter{\testpage[3]
   \blank
   \midaligned{\tfa{Chapter #1}}
   \blank}
in the environment and
\EndNoteChapter{6 How I Saved the World}
at the end of the last end note in the preceding chapter, but this is obviously 
prone to mistakes. I would rather integrate the handling into the chapter 
heading environment.
I suppose that this hack might be extended to handle the epigraph notes as 
well, but it is just a hack.
Has anyone successfully dealt with this before? If not, is there the 
possibility of adding similar functionality to \writetolist and such for end 
note structures?

Here’s a bit of a hack for the chapter splitting and might also enable the 
epigraphs for you as well (not quite sure what these should look like from your 
description.)

\definenote[mynote]
\setupnote[mynote][location=text]
\setupnotation[mynote][]

\definenote[chapone][mynote]
\definenote[chaptwo][mynote]
\definenote[chapthree][mynote] % etc

\starttext

\startchapter[title={AAA}]
\def\note#1{\chapone{#1}}
\dorecurse{15}
{ See my note at \note{something important}. }
\stopchapter

\startchapter[title={BBB}]
\def\note#1{\chaptwo{#1}}
\dorecurse{5}
{ See my note at \note{something important}. }
\stopchapter

\title{Endnotes}
Chapter 1 notes
\placenotes[chapone]
\blank[2*line]

Chapter 2 notes
\placenotes[chaptwo]

\stoptext


—
Bruce Horrocks
Hampshire, UK

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist :ntg-context@ntg.nl 
/https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  :https://www.pragma-ade.nl /https://context.aanhet.net (mirror)
archive  :https://github.com/contextgarden/context
wiki :https://wiki.contextgarden.net
__
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Inserting text between end notes

2024-09-01 Thread Bruce Horrocks


> On 1 Sep 2024, at 03:53, Rik Kabel  wrote:
> 
> Hello all,
> I am trying to implement some style-guide-defined (Chicago 17, and now, 18) 
> requirements to the end notes in a book. The need is to insert non-end-note 
> text into the list of end notes. But end notes are not a list (as far as I 
> can see) and \writetolist and such are no help.
> The text to be inserted is of two types. The first is the name of the chapter 
> from which the following notes were generated. It would be nice to 
> automatically generate these.
> The second type is pseudo-end-notes crediting the book and chapter epigraphs, 
> which should appear as unnumbered end notes (at the start of the note section 
> and the start of each chapter's notes). Ideally these would be generated in 
> the same way as regular end notes but will not increment the note numbers 
> (and should not, at least in my use case, require cross-referencing or 
> bookmarking).
> I can hack the first requirement with:
> \define[1]\EndNoteChapter{\testpage[3]
>   \blank
>   \midaligned{\tfa{Chapter #1}}
>   \blank}
> in the environment and
> \EndNoteChapter{6 How I Saved the World}
> at the end of the last end note in the preceding chapter, but this is 
> obviously prone to mistakes. I would rather integrate the handling into the 
> chapter heading environment.
> I suppose that this hack might be extended to handle the epigraph notes as 
> well, but it is just a hack.
> Has anyone successfully dealt with this before? If not, is there the 
> possibility of adding similar functionality to \writetolist and such for end 
> note structures?

Here’s a bit of a hack for the chapter splitting and might also enable the 
epigraphs for you as well (not quite sure what these should look like from your 
description.)

\definenote[mynote]
\setupnote[mynote][location=text]
\setupnotation[mynote][]

\definenote[chapone][mynote]
\definenote[chaptwo][mynote]
\definenote[chapthree][mynote] % etc

\starttext

\startchapter[title={AAA}]
\def\note#1{\chapone{#1}}
\dorecurse{15}
{ See my note at \note{something important}. }
\stopchapter

\startchapter[title={BBB}]
\def\note#1{\chaptwo{#1}}
\dorecurse{5}
{ See my note at \note{something important}. }
\stopchapter

\title{Endnotes}
Chapter 1 notes
\placenotes[chapone]
\blank[2*line]

Chapter 2 notes
\placenotes[chaptwo]

\stoptext


—
Bruce Horrocks
Hampshire, UK

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Complete novice, why does it seem that LuaLaTeX (Compiled via LaTeX Workshop with MikTeX and added packages on Windows) will generate a more compact result than ConTeXt?

2024-08-13 Thread Hans Hagen

On 8/13/2024 8:30 PM, Wolfgang Schuster wrote:

Hans Hagen via ntg-context schrieb am 13.08.2024 um 17:40:

On 8/13/2024 4:49 PM, fm117...@students.panola.edu wrote:
Hello, ConTeXt mailing list! I have a question regarding a difference 
in the code that I have which uses the same paper size and margin 
settings, and also the same indentation rules and font size and font. 
It seems that ConTeXt (which I compiled via Windows Terminal, this 
*is* the proper way to compile ConTeXt docs, right?) seems to make 
text that is less... compact, and I am not sure if this is due to me 
not adding features that I **should** have turned on in ConTeXt when 
using Times New Roman that is installed by default on Windows. I also 
was not able to get a "proper (?)" single quote like when Word or 
LaTeX compiles "Don't", that ' is a straight quote in the compiled text.


I also heard that ConTeXT would be much better for typography since 
it does have a more advanced typographical engine as the base (and 
this is a big reason as to why I want to switch to ConTeXt, pretty 
much everything is built in, I just can't understand documentation 
that well), and this may be because my code is very basic and I do 
not know how do properly do ConTeXt. Is it possible that ConTeXt also 
has a more "correct" way of formatting? Anyways, thank you for 
reading and taking the time to read this post.


LuaLaTeX code: https://pastebin.com/p5aWxAyK

ConTeXt code: https://pastebin.com/DsMnxMvY

Can you explain what you mean with less compact?


The default baseline distance of LaTeX is AFAIK 1.2 times the font size, 
adding


     \setupinterlinespace [line=1.2\bodyfontsize]

to the document setup should produce similar results with ConTeXt.
that interlinespace is kind of bad as it can lead to inconsistent line 
spacing


[dp \the\strutdp] \dorecurse{"}{%
\ifdim\fontchardp\font#1>\strutdp
   \char#1 \space
\fi
}

[ht \the\strutht] \dorecurse{"}{%
\ifdim\fontcharht\font#1>\strutht
   \char#1 \space
\fi
}

So, if oen really wants to go that cramped, maybe try

\setupinterlinespace [line=1.2\bodyfontsize,height=.75,depth=.25]

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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] placement of float captions in margin

2024-08-01 Thread Henning Hraban Ramm
Hi, I think this related to Gerion’s problem, but I don’t want to occupy 
the thread.


I’m trying to get captions in the (inner) margin.

With the setup below it works for left (even) pages; on right pages, the 
caption is placed beside the image, but over the text and not in the 
margin. (Yes, the big distance of image and caption is suboptimal, but 
leftfloats are worse, and the layout in question doesn’t have much space 
in the outer margin.)


If I uncomment %command to use \margincaption, and comment location 
instead, the caption is correctly inside the inner margin, but the width 
is always that of the left margin, i.e. too small on left pages.

I didn’t find a combination of options that completely works.

Hraban


\showframe
\usemodule[visual]
\useMPlibrary[dum]

\setuplayout[
  backspace=40mm,
  rightmargin=20mm,
  leftmargin=30mm,
  width=fit,
  height=fit,
]
\setuppagenumbering[alternative=doublesided]

\definemargindata[margincaption][inner][
  margin=margin,
  %width=\innermarginwidth,
  align=flushleft,
  stack=yes,
  voffset=-.5em,
]
\setupmarginframed[inmargin][
  align={flushleft,low},
]

\definefloat[rightfigure][figure]
\setupfloat[rightfigure][
  default=right,
  width=.33\textwidth,
]

\setupcaption[rightfigure][
  align={flushleft},
  width=\innermarginwidth,
  location=innermargin, % comment this
%command={\margincaption[inner]}, % uncomment this
  frame=on,
  framecolor=red,
  style={\ss\tfx},
]

\starttext

\dorecurse{20}{

\section{\fakewords{1}{5}}

\fakewords{10}{100}

\startplacerightfigure[title={\fakewords{2}{10}}]
\externalfigure[dummy][width=.33\textwidth,lines=5]
\stopplacerightfigure

\fakewords{10}{100}

}

\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] About a pagination

2024-07-23 Thread Fabrice Couvreur
Hi,
I'm trying to get the same pagination as in the attached photos. Using the
wiki and Wolfgang's codes I get something interesting but not very elegant
(\ACFRAME{}). Only, I don't see how to emphasize the title of each chapter
in the same way.
Thanks.
Fabrice

\startcomponent[essai]

\setuplayout
  [
backspace=28mm,
topspace=35mm,
width=140mm
  ]

\setuppagenumbering[alternative=doublesided,location=]

\setupbodyfont[pagella,11pt]

\mainlanguage[fr]

\setcharacterspacing
  [frenchpunctuation]

\startuseMPgraphic{acframeleft}
 fill OverlayBox
 leftenlarged (BackSpace)
 rightenlarged 5mm
 withcolor "lightgray";
 setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay
   [acframeleft]
   [\useMPgraphic{acframeleft}]


\defineframed
   [ACFRAMELEFT]
   [frame=off,
width=fit,
height=1ex,
background=acframeleft,
location=,
   ]

\startuseMPgraphic{acframeright}
 fill OverlayBox
 leftenlarged 5mm
 rightenlarged 42mm
 withcolor "lightgray";
 setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay
   [acframeright]
   [\useMPgraphic{acframeright}]


\defineframed
   [ACFRAMERIGHT]
   [frame=off,
width=fit,
height=1ex,
background=acframeright,
location=hanging,
   ]

\setupheader[style=\tfx]

\startsetups [header:leftpage]
\setuplabeltext
 [fr]
 [chapter=\tfx Chapitre]
 \ACFRAMERIGHT{}
 \hfill
 \labeltext{chapter} \getmarking[chapternumber] \getmarking[chapter]
\stopsetups

\startsetups [header:rightpage]
\getmarking[sectionnumber]
\space
\getmarking[section]
\hfill
\ACFRAMERIGHT{}
\stopsetups

\setupheadertexts
 [\directsetup{header:rightpage}] [\prefixedpagenumber]
 [\prefixedpagenumber]  [\directsetup{header:leftpage}]



\defineframedtext
   [ChapterFrame]
   [frame=on,
width=local,
height=broad,
after={\blank[2*line]},
offset=0pt]


\startsetups [section:chapter]

\setuphead
   [chapter]
   [align=leftright,
textcommand=\groupedcommand{\blank[medium]}{},
numbercolor=,
textstyle=,
numberstyle=,
numbercommand=,
before=\startChapterFrame,
after=\stopChapterFrame,
header=nomarking]

\stopsetups

\startsectionblockenvironment [bodypart]
\directsetup{section:chapter}
\stopsectionblockenvironment

\doifmode{*component}{\directsetup{section:chapter}}

\setuplabeltext
   [fr]
   [chapter=\tf Chapitre\space]


\startchapter
  [title={Polynômes}]
  \startsection
[title={Forme réduite et identification}]
\dorecurse{6}{\input knuth}
  \stopsection
  \startsection
[title={Polynômes du second degré}]
  \dorecurse{6}{\input knuth}
  \stopsection
\stopchapter
\stopcomponent
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Install urbanist fonts

2024-07-22 Thread Taco Hoekwater
Here is what I did (and it worked)

* clone the repo
* mkdir [context root]/tex/texmf-fonts/fonts/data/urbanist
* copy the *.otfs there
* mtxrun —generate
* fix 3 errors in your typescript (“name:” => “file:”)
* done

(for Hraban: mtxrun —scripts fonts —reload will run automatically if a font 
cannot be found)


> On 22 Jul 2024, at 10:33, alan.caruanam...@gmail.com wrote:
> 
> Hello, I was trying to install the urbanist fonts 
> (https://github.com/coreyhu/Urbanist) but I couldn't get it to load and save 
> the fonts in the system folder and in the ConTeXt folder without success, I 
> could only get it to load when saving them in the current working directory 
> but that is annoying, help me by telling me the correct way to install it... 
> I leave you my code so you can review it and give me advice to improve it
> 
> \starttypescript [sans] [urbanist]
>\definefontsynonym 
> [Urbanist][file:urbanist-regular.otf*default][features=default]
>\definefontsynonym 
> [UrbanistItalic][name:urbanist-italic.otf*default][features=default]
>\definefontsynonym 
> [UrbanistBold][name:urbanist-bold.otf*default][features=default]
>\definefontsynonym 
> [UrbanistBoldItalic][name:urbanist-bolditalic.otf*default][features=default]
> \stoptypescript
> 
> \starttypescript [sans] [urbanist]
>\definefontsynonym [Sans][Urbanist][features=default]
>\definefontsynonym [SansItalic][UrbanistItalic][features=default]
>\definefontsynonym [SansBold][UrbanistBold][features=default]
>\definefontsynonym [SansBoldItalic][UrbanistBoldItalic][features=default]
> \stoptypescript
> 
> \definetypeface[urbanist][ss][sans][urbanist][default]
> 
> \setupbodyfont[urbanist,30pt]
> 
> \starttext
> \dorecurse{100}{\bf \input knuth \crlf}
> \stoptext
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___

— 
Taco Hoekwater  E: t...@bittext.nl
genderfluid (all pronouns)


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Install urbanist fonts

2024-07-22 Thread alan . caruanambom
Hello, I was trying to install the urbanist fonts 
(https://github.com/coreyhu/Urbanist) but I couldn't get it to load and save 
the fonts in the system folder and in the ConTeXt folder without success, I 
could only get it to load when saving them in the current working directory but 
that is annoying, help me by telling me the correct way to install it... I 
leave you my code so you can review it and give me advice to improve it

\starttypescript [sans] [urbanist]
\definefontsynonym 
[Urbanist][file:urbanist-regular.otf*default][features=default]
\definefontsynonym 
[UrbanistItalic][name:urbanist-italic.otf*default][features=default]
\definefontsynonym 
[UrbanistBold][name:urbanist-bold.otf*default][features=default]
\definefontsynonym 
[UrbanistBoldItalic][name:urbanist-bolditalic.otf*default][features=default]
\stoptypescript

\starttypescript [sans] [urbanist]
\definefontsynonym [Sans][Urbanist][features=default]
\definefontsynonym [SansItalic][UrbanistItalic][features=default]
\definefontsynonym [SansBold][UrbanistBold][features=default]
\definefontsynonym [SansBoldItalic][UrbanistBoldItalic][features=default]
\stoptypescript

\definetypeface[urbanist][ss][sans][urbanist][default]

\setupbodyfont[urbanist,30pt]

\starttext
\dorecurse{100}{\bf \input knuth \crlf}
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: table float split behavior

2024-07-08 Thread Henning Hraban Ramm

Am 08.07.24 um 15:48 schrieb vm via ntg-context:

There is a reason that the \recurselevel do not work in this context;
all \recurselevel show up as zero


   {\bTABLE
    \dorecurse{100}{
    \bTR \bTD \recurselevel \eTD \bTD one \eTD \eTR
    \bTR \bTD two \eTD \bTD \recurselevel \eTD \eTR
    }
    \eTABLE}


Any hint?


Something about expansion and maybe buffers.

Try #1, it often works where \recurselevel fails.

Hraban

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: table float split behavior

2024-07-08 Thread Henning Hraban Ramm

Am 08.07.24 um 14:39 schrieb Bruce Horrocks:




On 7 Jul 2024, at 19:34, Henning Hraban Ramm  wrote:

Am 07.07.24 um 20:22 schrieb Bruce Horrocks:

On 7 Jul 2024, at 10:51, Henning Hraban Ramm  wrote:

Also, is it possible to have different captions in first and other parts?

This previous thread might help.
<https://www.mail-archive.com/ntg-context@ntg.nl/msg102641.html>


Thank you, but that doesn’t fit my use case: In my ConTeXt book, there are many 
long tables of parameters. The caption says “Parameters of \setupsomething”, 
but I’d also give hints like “You can also use the parameters of \setupframed, 
see p.123.”. I’d like to have these hints only in the first caption, and 
they’re different for each table.

It’s not that important, I can move the text somewhere else, but often enough 
in ConTeXt there are obscure features for advanced stuff.


If I understand you correctly then this does what you want. It's a bit of a 
hack though.

\defineselector [caption] [max=2]

\starttext

\setupfloatsplitting [inbetween={\setupselector[caption][n=2]}]

\setupselector[caption][n=1]
\placetable[split]
   {\select{caption}
 {Parameters of \type{\setupsomething}. You can also use the parameters of 
\type{\setupframes}, see page. 123}
 {Parameters of \type{\setupsomething}.}
   }
   {\bTABLE
    \dorecurse{100}{
\bTR \bTD One \eTD \bTD two \eTD \eTR
\bTR \bTD One \eTD \bTD two \eTD \eTR
}
\eTABLE}

\stoptext


Thank you, that’s a good idea. (Another mechanism in ConTeXt that I 
didn’t know and need to document…)


Hraban

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: table float split behavior

2024-07-08 Thread vm via ntg-context




On 08/07/2024 14:39, Bruce Horrocks wrote:

\defineselector [caption] [max=2]

\starttext

\setupfloatsplitting [inbetween={\setupselector[caption][n=2]}]

\setupselector[caption][n=1]
\placetable[split]
   {\select{caption}
 {Parameters of \type{\setupsomething}. You can also use the parameters of 
\type{\setupframes}, see page. 123}
 {Parameters of \type{\setupsomething}.}
   }
   {\bTABLE
\dorecurse{100}{
\bTR \bTD One \eTD \bTD two \eTD \eTR
\bTR \bTD One \eTD \bTD two \eTD \eTR
}
\eTABLE}

\stoptext



There is a reason that the \recurselevel do not work in this context;
all \recurselevel show up as zero


  {\bTABLE
   \dorecurse{100}{
   \bTR \bTD \recurselevel \eTD \bTD one \eTD \eTR
   \bTR \bTD two \eTD \bTD \recurselevel \eTD \eTR
   }
   \eTABLE}


Any hint?

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: table float split behavior

2024-07-08 Thread Bruce Horrocks


> On 7 Jul 2024, at 19:34, Henning Hraban Ramm  wrote:
> 
> Am 07.07.24 um 20:22 schrieb Bruce Horrocks:
>>> On 7 Jul 2024, at 10:51, Henning Hraban Ramm  wrote:
>>> 
>>> Also, is it possible to have different captions in first and other parts?
>> This previous thread might help.
>> <https://www.mail-archive.com/ntg-context@ntg.nl/msg102641.html>
> 
> Thank you, but that doesn’t fit my use case: In my ConTeXt book, there are 
> many long tables of parameters. The caption says “Parameters of 
> \setupsomething”, but I’d also give hints like “You can also use the 
> parameters of \setupframed, see p.123.”. I’d like to have these hints only in 
> the first caption, and they’re different for each table.
> 
> It’s not that important, I can move the text somewhere else, but often enough 
> in ConTeXt there are obscure features for advanced stuff.

If I understand you correctly then this does what you want. It's a bit of a 
hack though.

\defineselector [caption] [max=2]

\starttext

\setupfloatsplitting [inbetween={\setupselector[caption][n=2]}]

\setupselector[caption][n=1]
\placetable[split]
  {\select{caption}
{Parameters of \type{\setupsomething}. You can also use the parameters of 
\type{\setupframes}, see page. 123}
{Parameters of \type{\setupsomething}.}
  }
  {\bTABLE
   \dorecurse{100}{
   \bTR \bTD One \eTD \bTD two \eTD \eTR
   \bTR \bTD One \eTD \bTD two \eTD \eTR
}
\eTABLE}

\stoptext

—
Bruce Horrocks
Hampshire, UK

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: table float split behavior

2024-07-07 Thread Henning Hraban Ramm

This is a long-time open issue. Am I the only one affected by this?

Also, \bTABLEfoot doesn’t repeat – I’d like to use it e.g for a line (rule).

Also, is it possible to have different captions in first and other parts?

Hraban

Am 17.06.24 um 18:36 schrieb Henning Hraban Ramm:

Table floats split in odd places, independent of top/page/here location.

There’s always a first part, then some not-float text, then the other 
parts.


Even if the table would fit on two pages (with location=page), it always 
gets split into three.


Can I influence this anyhow?

Hraban


\usemodule[visual]

\starttext

\samplefile{tufte}

\startplacetable[location={top,split},title=table split test]
\bTABLE%[setups=twoparamstable]
\bTABLEhead
\bTR\bTH One \eTH\bTH Two\eTH\bTH Three \eTH\eTR
\eTABLEhead
\bTABLEbody
\dorecurse{60}{%
\bTR\bTD #1\eTD\bTD \fakewords{1}{10}\eTD\bTD \fakewords{1}{10}\eTD\eTR
}
\eTABLEbody
\eTABLE
\stopplacetable

\samplefile{knuth}

\stoptext


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] table float split behavior

2024-06-17 Thread Henning Hraban Ramm

Table floats split in odd places, independent of top/page/here location.

There’s always a first part, then some not-float text, then the other parts.

Even if the table would fit on two pages (with location=page), it always 
gets split into three.


Can I influence this anyhow?

Hraban


\usemodule[visual]

\starttext

\samplefile{tufte}

\startplacetable[location={top,split},title=table split test]
\bTABLE%[setups=twoparamstable]
\bTABLEhead
\bTR\bTH One \eTH\bTH Two\eTH\bTH Three \eTH\eTR
\eTABLEhead
\bTABLEbody
\dorecurse{60}{%
\bTR\bTD #1\eTD\bTD \fakewords{1}{10}\eTD\bTD \fakewords{1}{10}\eTD\eTR
}
\eTABLEbody
\eTABLE
\stopplacetable

\samplefile{knuth}

\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Vanishing floats with location=split and \start ... \stopsplittext within

2024-06-04 Thread Kirill Davidov
On 6/4/24 21:22, Hans Hagen wrote:
> best add a missing \stopplacecodelisting
That one's on me, thank you. Unfortunately, this does not fix the main
issue. Checking the MWE's logs reveals that the splitting command found
nothing to split, even if there's enough text for multiple pages. My
best guess is that something goes awry when checking how much vertical
space is available, since uncommenting the filler line leaves no space
for an additional line in the page.

On 6/4/2024 3:57 PM, Давыдов, Кирилл Александрович wrote:
> On a related note, one can also observe that with specific amounts of
> text a float may end up being split in two on a single page, however I
> could not replicate it.
Replicated it:
\definefloat[codelisting][codelistings]
\setupcaption[codelisting][location=top]
\setuplabeltext[english][codelisting=Listing ]
\showboxes
\starttext
%\dorecurse{37}{line\crlf} % splits fine up to this point
\dorecurse{38}{line\crlf} % split on the same page
%\dorecurse{39}{line\crlf} % float vanishes, "there is nothing to split"
%\dorecurse{40}{line\crlf} % all fine
\startplacecodelisting[
    title=My great C program on display!,
    location=split,
]
\startsplittext
\tt\dorecurse{6}{\input zapf}
\stopsplittext
\stopplacecodelisting
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Draft vertical text in margins

2024-06-03 Thread ai2472206007
you can try 'setuptext' and '\setuptexttexts' to put "draft" in margin.and use 
'orientation' to change direction.


\defineframed[marginframe]
 [width=max, height=max,   style=\ss,
  corner=08, location=lohi,frame=off]
\setuptext [style={\ss}]
\setuptexttexts  [margin] []
[\marginframe{\hbox orientation 1 {DRAFT}}]
[\marginframe{\hbox orientation 1 {DRAFT}}]
   []

\starttext
\chapter{C:Some Word}
\dorecurse{5}{
\section{S:Some Word}
\input knuth}
\stoptext
%%%
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: page number

2024-05-26 Thread Wolfgang Schuster

Charles Doherty via ntg-context schrieb am 26.05.2024 um 11:27:

Dear Wolfgang,

I have a book in preparation with running heads.


Pagenumber  marking   |marking  Pagenumber

The chapter title page has empty headings.

The publisher would like the page number centered on the Chapter title page. I 
manage to put it there but I don’t want it to run on the following pages. I 
have made various attempts but can’t manage it.

I have

\setuplayout[location=doublesided]
\setuppagenumbering[location=,alternative=doublesided]

\setupheadertexts[chapter][][pagenumber]
\setupheadertexts[{\getmarking[chapter]}][pagenumber]


Please send a complete working example next time.


Can anyone show me code to achieve this?


1. You use \setupheadertexts to set the header for all pages.

2. You use \definetext to create a custom header for the chapter page 
and apply it with the header-key in \setuphead.


 begin example
\setuppagenumbering
  [location=,
   alternative=doublesided]

\setupheadertexts
  [chapter] [pagenumber]
  [pagenumber] [chapter]

\definetext
  [chapterheader]
  [header]
  [pagenumber]

\setuphead
  [chapter]
  [header=chapterheader]

\starttext
\dorecurse{10}
  {\startchapter[title=Chapter \convertnumber{Word}{#1}]
   \dorecurse{10}{\samplefile{lorem}}
   \stopchapter}

\stoptext
 end example

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Suppress pagenumber

2024-05-23 Thread Wolfgang Schuster

Thomas Meyer schrieb am 23.05.2024 um 16:34:

Need Help!

I'm standing in front of the barn door ...

How can I suppress the pagenumber only on the first page?


\starttext

\noheaderandfooterlines

\dorecurse{10}{\samplefile{lorem}}

\stoptext

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: LUA API for page numbers

2024-05-21 Thread Luc Chabassier
Excerpts from Wolfgang Schuster's message of May 21, 2024 3:54 pm:
> Luc Chabassier schrieb am 21.05.2024 um 15:35:
>> Excerpts from Hans Hagen's message of May 21, 2024 11:45 am:
>>> concerning notes in the margin ... did you try the built in magin text
>>> mechanisms?
>> I did, but as far as I know they place the text on the margin next to
>> the \inmargin invocation in the text, so they may overlap, which is what
>> I want to avoid.
> 
> \setupmarginblocks[inbetween=]
> 
> \starttext
> 
> \dorecurse{100}
>{\bold{#1:} \samplefile{ward}%
> \startmarginblock Note #1\stopmarginblock
> \par}
> 
> \stoptext
I did not know about margin blocks, they are nice. But is there a way to
place them next to the \startmarginblock invocation, instead of flushing
them all either to the top or bottom of the page ?
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: LUA API for page numbers

2024-05-21 Thread Wolfgang Schuster

vm via ntg-context schrieb am 21.05.2024 um 16:07:



On 21/05/2024 15:54, Wolfgang Schuster wrote:

\setupmarginblocks[inbetween=]

\starttext

\dorecurse{100}
   {\bold{#1:} \samplefile{ward}%
    \startmarginblock Note #1\stopmarginblock
    \par}

\stoptext



when I compile this, i get per page with
\par 1..10 -> the notes 1..11
\par 11..20 -> the notes 12..21
\par 21..30 -> the notes 32..31

...

is this expected standard?

i'd expect \par and notes synced on page.
1..10 -> 1..10


TeX was still on page 1 to collect text when it put note 11 into the 
buffer for the margin and the decision to make the break after block 10 
happened afterwards.


You can control page breaks to a certain degree with the \testpage 
command between paragraphs.


\starttext

\dorecurse{100}
  {\testpage[3]
   \bold{#1:} \samplefile{ward}%
   \startmarginblock Note #1\stopmarginblock
   \par}

\stoptext

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: LUA API for page numbers

2024-05-21 Thread vm via ntg-context
just noticed that if the notes need more margin space then are pages 
available by the text, they get lost. e.g. this mwe generates 10 pages 
with 100 par but only 80 notes will show up.



\setupmarginblocks[inbetween=]

\starttext

\dorecurse{100}
  {\bold{#1:} \samplefile{ward}%
   \startmarginblock {\bf #1} one two three four five six seven eight 
nine ten eleven twelve thirteen\stopmarginblock

   \par}

\stoptext


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: LUA API for page numbers

2024-05-21 Thread vm via ntg-context



On 21/05/2024 15:54, Wolfgang Schuster wrote:

\setupmarginblocks[inbetween=]

\starttext

\dorecurse{100}
   {\bold{#1:} \samplefile{ward}%
    \startmarginblock Note #1\stopmarginblock
    \par}

\stoptext



when I compile this, i get per page with
\par 1..10 -> the notes 1..11
\par 11..20 -> the notes 12..21
\par 21..30 -> the notes 32..31

...

is this expected standard?

i'd expect \par and notes synced on page.
1..10 -> 1..10



___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: LUA API for page numbers

2024-05-21 Thread Wolfgang Schuster

Luc Chabassier schrieb am 21.05.2024 um 15:35:

Excerpts from Hans Hagen's message of May 21, 2024 11:45 am:

you have to provide some mwe so that we can see what is intended; in
principle much info is available one way or the other

I joined a minimal working example. The lua function
`userdata.sidenotes_save_run` places the notes so that they do not
intersect (the method I actually use is more complicated, but the idea
is the same).


concerning notes in the margin ... did you try the built in magin text
mechanisms?

I did, but as far as I know they place the text on the margin next to
the \inmargin invocation in the text, so they may overlap, which is what
I want to avoid.


\setupmarginblocks[inbetween=]

\starttext

\dorecurse{100}
  {\bold{#1:} \samplefile{ward}%
   \startmarginblock Note #1\stopmarginblock
   \par}

\stoptext

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: compatibility between \startshapetext and \startsection ?

2024-05-15 Thread Garulfo

Thanks you Wolfgang.

If it's not possible to use \blank, it appears that using for example 
\strut\par\strut\par is OK (but \par\par is not, )


\dorecurse{5}{
\strut\par\strut\par
\leftaligned{Title for section{\recurselevel}}
\strut\par\strut\par
\darkred\input knuth \par
\darkblue\input ward}

Please, what would be a \setuphead that removes the introduction of 
these "uncompatible" verticals skips ?


I've tried several, but even this one isn't compatible.

\setuphead
  [section]
  [before={}, % also tried \blank[nowhite] and \blank[back]
   inbetween={},
   after={},
   beforesection={},
   aftersection={},
   alternative=text,
   style=\tf]


Le 15/05/2024 à 13:09, Wolfgang Schuster a écrit :

garu...@azules.eu schrieb am 14.05.2024 um 23:13:

Hi all,

\startshapetext works pretty well, but when I use \startsection 
\stopsection, shapes are not respected  anymore.
I use layers, to be able to place the content anywhere, but the issue 
remains without layers.


Any clues ?
(\placeinitial seems also to break the shaping)


Example : 2 pages without sectioning, and after 2 pages by 
uncommenting the \startsection and \stopsection commands.



[...]
\dorecurse{5}{
\startsection[title={Title for section{\recurselevel}}]
\darkred\input knuth \par
\darkblue\input ward
\stopsection
}



The problem aren't the section command but the vertical skips added 
before and after each section, you can reproduce the effect when you add 
\blank to your example.


\dorecurse{5}{
\blank
\leftaligned{Title for section{\recurselevel}}
\blank
\darkred\input knuth \par
\darkblue\input ward
}

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: compatibility between \startshapetext and \startsection ?

2024-05-15 Thread Wolfgang Schuster

garu...@azules.eu schrieb am 14.05.2024 um 23:13:

Hi all,

\startshapetext works pretty well, but when I use \startsection \stopsection, 
shapes are not respected  anymore.
I use layers, to be able to place the content anywhere, but the issue remains 
without layers.

Any clues ?
(\placeinitial seems also to break the shaping)


Example : 2 pages without sectioning, and after 2 pages by uncommenting the 
\startsection and \stopsection commands.


[...]
\dorecurse{5}{
\startsection[title={Title for section{\recurselevel}}]
\darkred\input knuth \par
\darkblue\input ward
\stopsection
}



The problem aren't the section command but the vertical skips added 
before and after each section, you can reproduce the effect when you add 
\blank to your example.


\dorecurse{5}{
\blank
\leftaligned{Title for section{\recurselevel}}
\blank
\darkred\input knuth \par
\darkblue\input ward
}

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] compatibility between \startshapetext and \startsection ?

2024-05-14 Thread garulfo
Hi all,

\startshapetext works pretty well, but when I use \startsection \stopsection, 
shapes are not respected  anymore.
I use layers, to be able to place the content anywhere, but the issue remains 
without layers.

Any clues ?
(\placeinitial seems also to break the shaping)


Example : 2 pages without sectioning, and after 2 pages by uncommenting the 
\startsection and \stopsection commands.


\setupbodyfont [pagella, 8pt]
\setupframed
  [frame=on,
   offset=0.000pt,
   rulethickness=0.000pt,
   location=top,
   align=normal,
   strut=yes,
   ]
\setuplayout [grid=yes]
\setupinteraction [state=start]

%--

\definemeasure [myheight] [{\the\dimexpr\baselineskip*33+\lineskip\relax}]
\definemeasure [myheighta][{\the\dimexpr\baselineskip*10+\lineskip*2\relax}]
\definemeasure [myheightb][{\the\dimexpr\baselineskip*20-\lineskip*2\relax}]

\startuseMPgraphic{mp1}
  path p ;
  numeric myheight  ; myheight := \measure{myheight};
  numeric myheighta ; myheighta := \measure{myheighta};
  numeric myheightb ; myheightb := \measure{myheightb};
  p := (0,0) -- (6cm,0) --
   (6cm,myheighta) -- (4cm,myheighta) -- (4cm,myheightb) -- (6cm,myheightb) 
--
   (6cm,myheight) -- (0cm,myheight) -- cycle;
  build_parshape(p,0,0,0,\baselinedistance,\strutheight,\strutdepth,\topskip) ;
  fill p withcolor \MPcolor{lightyellow};
\stopuseMPgraphic

\defineoverlay[ol1][\useMPgraphic{mp1}]


%==
\starttext
%==

{\sc\bfd Version A, without sectionning, pages 1\ampersand 2}

\startshapetext[mp1, mp1, mp1, mp1, mp1, mp1]
\setupalign[hz,hanging,verytolerant,stretch,normal]%
\setupindenting[yes,small]%
\strut%
\reference[myref1]{MyRef1}Here is the first reference.\par
See reference \in[myref2] on \at{page}[myref2]\par
%
\dorecurse{5}{
%\startsection[title={Title for section{\recurselevel}}]
\darkred\input knuth \par
\darkblue\input ward
%\stopsection
}

\reference[myref2]{MyRef2} Here is the second reference.\par
See reference \in[myref1] on \at{page}[myref1]\par

\stopshapetext

\definelayer[testA]

\setlayer[testA][x=-1cm,y=3cm]{\framed[background=ol1]{\strut\getshapetext}}
\setlayer[testA][x=9cm,y=3cm] {\framed[background=ol1]{\strut\getshapetext}}
\flushlayer[testA]

\page

\setlayer[testA][x=-1cm,y=3cm]{\framed[background=ol1]{\strut\getshapetext}}
\setlayer[testA][x=9cm,y=3cm] {\framed[background=ol1]{\strut\getshapetext}}
\flushlayer[testA]

\page
%==

{\sc\bfd Version B, with sectionning, pages 3\ampersand 4}

\startshapetext[mp1, mp1, mp1, mp1, mp1, mp1]
\setupalign[hz,hanging,verytolerant,stretch,normal]%
\setupindenting[yes,small]%
\strut%
\reference[myref3]{MyRef3}Here is the first reference.\par
See reference \in[myref4] on \at{page}[myref4]\par
%
\dorecurse{5}{
\startsection[title={Title for section{\recurselevel}}]
\darkred\input knuth \par
\darkblue\input ward
\stopsection
}

\reference[myref4]{MyRef4} Here is the second reference.\par
See reference \in[myref3] on \at{page}[myref3]\par

\stopshapetext

\definelayer[testB]

\setlayer[testB][x=-1cm,y=3cm]{\framed[background=ol1]{\strut\getshapetext}}
\setlayer[testB][x=9cm,y=3cm] {\framed[background=ol1]{\strut\getshapetext}}
\flushlayer[testB]

\page

\setlayer[testB][x=-1cm,y=3cm]{\framed[background=ol1]{\strut\getshapetext}}
\setlayer[testB][x=9cm,y=3cm] {\framed[background=ol1]{\strut\getshapetext}}
\flushlayer[testB]

%==
\stoptext
%==
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Errors with 2024-05-11 LMTX

2024-05-12 Thread Rik Kabel
I have come across an error that halts processing with the latest 
release. The following demonstrates this:


   \setuppagenumbering [location=]

   \starttext

 \dorecurse{36}{\dorecurse{19}{abc }}

 \startplacetable[location=split,title={Table}]
    \starttabulate[|p|p|]
    \HL
    \NC Heading \crlf
    heading
    \NC Heading \crlf
    heading
    \NC\AR
    \HL
    \NC abc \crlf
    abc
    \NC abc
    \NC\AR
    \NC abc \crlf
    abc
    \NC abc
    \NC\AR
    \NC abc \crlf
    abc
    \NC abc
    \NC\AR
    \NC abc \crlf
    abc
    \NC abc
    \NC\AR
    \HL
    \stoptabulate
    \stopplacetable

   \stoptext

while this version ends with the error : error (nodes): attempt to 
double-free rule node 55342, ignored


   \setuppagenumbering [location=]
   \starttext

 \dorecurse{37}{\dorecurse{19}{abc }}

 \startplacetable[location=split,title={Table}]

    \starttabulate[|p|p|]
    \HL
    \NC Heading \crlf
    heading
    \NC Heading \crlf
    heading
    \NC\AR
    \HL
    \NC abc \NC abc \NC\AR
    \NC abc \NC abc \NC\AR
    \NC abc \NC abc \NC\AR
    \HL
    \stoptabulate

    \stopplacetable

   \stoptext

--
Rik
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: more register questions!

2024-05-07 Thread Rik Kabel

Hello Wolfgang and all,

I have been trying to extend this to handle endnotes. So far, I have not 
succeeded; the number is always that of the last endnote.


I could possibly increment a counter for each endnote processed, but 
that seems a hack.


--
Rik

On 2024-05-03 06:18, Wolfgang Schuster wrote:

Thomas A. Schmitz schrieb am 02.05.2024 um 17:01:

Hi,

making wonderful progress on my registers and translating from xml. 
There is one thing I can't figure out (and I or some other good soul 
may have asked in the past...). Is it possible to mark occurrences in 
footnotes? Ideally, the entry in the register would look like


p. 100\high{20}

to show that the term occurs in note 20 on p. 100. But if that's 
asking too much, I would be content with applying a processor (say, 
italic) to these register entries. From the looks of the tuc file, 
Context doesn't appear to "know" that a register entry is within a 
footnote. But Hans never ceases to amaze me, so maybe there is a way 
(short of applying special markup to these notes in the source)?


You can play with the following example, the main point use to use the 
\setregisterentry command and pass the footnote counter with the third 
(optional) argument.


\def\IndexPageCommand#1%
  {#1\doifsomething
 {\currentregisterpageuserdata{footnote}}
 {\high{\currentregisterpageuserdata{footnote

\setupregister[index][pagecommand=\IndexPageCommand]

\starttext

\dorecurse{200}
{\samplefile{lorem}\expanded{\setregisterentry[index][entries=\recurselevel]}% 

\samplefile{lorem}\footnote{xxx\expanded{\setregisterentry[index][entries=\recurselevel][footnote={\rawcountervalue[footnote]}]}}% 


   \samplefile{lorem}}

\page \placeindex

\stoptext

Wolfgang

___ 

If your question is of interest to others as well, please add an entry 
to the Wiki!


maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net 
(mirror)

archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___ 
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: more register questions!

2024-05-03 Thread Thomas A. Schmitz

Hi Wolfgang,

powerful and elegant, as always! I think I have a solution with xml; I 
will have to test it more extensively with my complex real file; but 
here comes, also for Hraban (if it works in real life, I'll add it to 
the wiki...).


Thanks a lot!

Thomas

\startbuffer[test]

  
Dummy text.Dummy footnote.
  
  
Dummy text.Dummy footnote.
  
  

\stopbuffer

\startxmlsetups xml:testsetups
  \xmlsetsetup{#1}{*}{-}
  \xmlsetsetup{#1}{document|chapter|p|footnote|indexentry|index}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

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

\startxmlsetups xml:chapter
  \xmlflush {#1} \page
\stopxmlsetups

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

\startxmlsetups xml:footnote
  \footnote[\xmlatt{#1}{id}]{\xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:indexentry
  \xmldoiftext {#1} {ancestor::footnote}
   {\setregisterentry 
[index][keys:1=\xmlatt{#1}{key},entries:1=\xmlatt{#1}{key}][footnote={\rawcountervalue[footnote]}]}


{\setregisterentry[index][keys:1=\xmlatt{#1}{key},entries:1=\xmlatt{#1}{key}]}
\stopxmlsetups

\startxmlsetups xml:index
  \page \placeregister [index]
\stopxmlsetups

\def\IndexPageCommand#1%
  {#1\doifsomething
 {\currentregisterpageuserdata{footnote}}
 {\high{\currentregisterpageuserdata{footnote

\setupregister[index][pagecommand=\IndexPageCommand]
\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext




On 5/3/24 12:18, Wolfgang Schuster wrote:
You can play with the following example, the main point use to use the 
\setregisterentry command and pass the footnote counter with the third 
(optional) argument.


\def\IndexPageCommand#1%
   {#1\doifsomething
  {\currentregisterpageuserdata{footnote}}
  {\high{\currentregisterpageuserdata{footnote

\setupregister[index][pagecommand=\IndexPageCommand]

\starttext

\dorecurse{200}
{\samplefile{lorem}\expanded{\setregisterentry[index][entries=\recurselevel]}%
\samplefile{lorem}\footnote{xxx\expanded{\setregisterentry[index][entries=\recurselevel][footnote={\rawcountervalue[footnote]}]}}%
    \samplefile{lorem}}

\page \placeindex

\stoptext

Wolfgang


--
Prof. Dr. Thomas A. Schmitz
Institut für Klassische und Romanische Philologie
Universität Bonn
Rabinstr. 8
53111 Bonn
http://www.philologie.uni-bonn.de/de/personal/schmitz

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: more register questions!

2024-05-03 Thread Wolfgang Schuster

Thomas A. Schmitz schrieb am 02.05.2024 um 17:01:

Hi,

making wonderful progress on my registers and translating from xml. 
There is one thing I can't figure out (and I or some other good soul 
may have asked in the past...). Is it possible to mark occurrences in 
footnotes? Ideally, the entry in the register would look like


p. 100\high{20}

to show that the term occurs in note 20 on p. 100. But if that's 
asking too much, I would be content with applying a processor (say, 
italic) to these register entries. From the looks of the tuc file, 
Context doesn't appear to "know" that a register entry is within a 
footnote. But Hans never ceases to amaze me, so maybe there is a way 
(short of applying special markup to these notes in the source)?


You can play with the following example, the main point use to use the 
\setregisterentry command and pass the footnote counter with the third 
(optional) argument.


\def\IndexPageCommand#1%
  {#1\doifsomething
 {\currentregisterpageuserdata{footnote}}
 {\high{\currentregisterpageuserdata{footnote

\setupregister[index][pagecommand=\IndexPageCommand]

\starttext

\dorecurse{200}
{\samplefile{lorem}\expanded{\setregisterentry[index][entries=\recurselevel]}%
\samplefile{lorem}\footnote{xxx\expanded{\setregisterentry[index][entries=\recurselevel][footnote={\rawcountervalue[footnote]}]}}%
   \samplefile{lorem}}

\page \placeindex

\stoptext

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \par and \startlines

2024-04-26 Thread Pablo Rodriguez via ntg-context
On 4/26/24 19:52, Denis Maier via ntg-context wrote:
>> Wolfgang Schuster hat am 26.04.2024 19:29 CEST geschrieben:
>> The inbetween setting works because ConTeXt checks at the start of
>> each line whether it's empty (in this case the value is used) or not.
>>
>> When you add a \par you just end the current line/paragraph and it
>> doesn't matter how many \par's you use because TeX just ignores them.
>  
> I see. But there's no command that could be used to simulate an empty line?

Crappy code:

  \starttext
  a\dorecurse{25}{\par}b
  a\dorecurse{25}{\null\par}b
  \stoptext

Just to show it could be achieved,

Pablo
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: start/stopregister

2024-04-26 Thread Hans Hagen

On 4/26/2024 9:54 AM, Thomas A. Schmitz wrote:

On 4/26/24 9:30 AM, Thomas A. Schmitz wrote:
And here I am again! Both in mkiv and in mkxl, start/stopregister does 
not work when there is already an index entry before. Example below!


All best

Thomas

\setuppapersize [A6]

\starttext
 A\index{A} B \page
 A\startregister [index] {A} B\startregister [index] [B] {B}
 \dorecurse {10} {\input tufte}
 A\stopregister [index] {A} B\stopregister [index] [B]

\page

\placeregister[index]

\stoptext


And I'm not even sure if this is allowed to say anymore, but: works in 
mkii...

That's because mkii is AI enhanced. Can you try this:

\setuppapersize [A6]

\starttext

A\index{A} B \page


\stopregister [index] [A]
B>
\stopregister [index] [B]

\page

\placeregister[index]

\stoptext

(Watch the [A] vs {A} usage where [A] is the label used for matching the 
potentially weiord nested start/stop ... maybe we need different aliases 
for these, like \fromregister and \toregister.)


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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: start/stopregister

2024-04-26 Thread Thomas A. Schmitz

On 4/26/24 9:30 AM, Thomas A. Schmitz wrote:
And here I am again! Both in mkiv and in mkxl, start/stopregister does 
not work when there is already an index entry before. Example below!


All best

Thomas

\setuppapersize [A6]

\starttext
     A\index{A} B \page
     A\startregister [index] {A} B\startregister [index] [B] {B}
     \dorecurse {10} {\input tufte}
     A\stopregister [index] {A} B\stopregister [index] [B]

\page

\placeregister[index]

\stoptext


And I'm not even sure if this is allowed to say anymore, but: works in 
mkii...


Thomas
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: start/stopregister

2024-04-26 Thread Thomas A. Schmitz

On 4/25/24 6:27 PM, Thomas A. Schmitz wrote:
Ah, simple typo! After fixing abel to label, startregister gives the 
expected results again! Thanks Hans! I may be back with more register 
questions soon...


And here I am again! Both in mkiv and in mkxl, start/stopregister does 
not work when there is already an index entry before. Example below!


All best

Thomas

\setuppapersize [A6]

\starttext
A\index{A} B \page
A\startregister [index] {A} B\startregister [index] [B] {B}
\dorecurse {10} {\input tufte}
A\stopregister [index] {A} B\stopregister [index] [B]

\page

\placeregister[index]

\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: start/stopregister

2024-04-25 Thread Henning Hraban Ramm

Am 25.04.24 um 15:44 schrieb Thomas A. Schmitz:

Hi all,

has \startregister been superseded in luametatex or is it not yet 
implemented? I tried to read strc-reg.lmt but couldn't figure out what 
is going on. The following silly minimal test produces the expected 
result with mkiv but not in mkxl.


All best

Thomas

\setuppapersize [A6]

\starttext
 A\index{A} B\startregister [index] [B] {B}
 \dorecurse {10} {\input tufte}
 A\index{A} B\stopregister [index] [B]

\page

\placeregister[index]

\stoptext



I’m using it like

\startregister[index][bibliografie]{Bibliografie}
…
\stopregister[index][bibliografie]

i.e. very similar to your example, and can confirm it doesn’t result in 
a page range in the index. Also gives no error.


Hraban
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] start/stopregister

2024-04-25 Thread Thomas A. Schmitz

Hi all,

has \startregister been superseded in luametatex or is it not yet 
implemented? I tried to read strc-reg.lmt but couldn't figure out what 
is going on. The following silly minimal test produces the expected 
result with mkiv but not in mkxl.


All best

Thomas

\setuppapersize [A6]

\starttext
A\index{A} B\startregister [index] [B] {B}
\dorecurse {10} {\input tufte}
A\index{A} B\stopregister [index] [B]

\page

\placeregister[index]

\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: what are the interaction between \showframe and \realpageno in \startuseMPgraphic ?

2024-04-24 Thread Wolfgang Schuster

garu...@azules.eu schrieb am 20.04.2024 um 23:00:

I can not figure out why this progress bar only works when \showframe is 
activated.
When you comment on \showframe, it's as if \realpageno is at zero.
(current version: 2024.04.01 08:59)

\showframe

\startuseMPgraphic{MonGraphisme_MP}
   numeric n ; n := \number\realpageno ;
   numeric m ; m := \number\lastpageno ;
   numeric h ; h := \overlayheight ;
   numeric w ; w := \overlaywidth ;
   numeric e ; e := 3mm;
   numeric r ; r := (((n-1)/(m-1))*w);
   fill fullsquare xscaled w yscaled e shifted (w/2, h/2) withcolor darkblue ;
   fill fullsquare xscaled r yscaled e shifted (r/2, h/2) withcolor darkred;
\stopuseMPgraphic

\defineoverlay [MonGraphisme_OL] [\useMPgraphic{MonGraphisme_MP}]

\setupbackgrounds [footer] [rightmargin] [background={MonGraphisme_OL}]

\starttext
\dorecurse{10}{\input tufte\page}
\stoptext

Any clue is warmly welcome


You need

    \setupbackgrounds[state=repeat]

which is set when you use \showframe.

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Why don't footnotes appear in floats or figures?

2024-04-24 Thread Pablo Rodriguez via ntg-context


On 4/24/24 02:15, Joel via ntg-context wrote:
> [...] Any idea how I can get current footnote value?

Hi Joel,

current footnote value can be accessed with \rawcountervalue[footnote],
such as in:

  \starttext
  \dorecurse{25}
{\ \footnote{Footnote \recurselevel}:
 \rawcountervalue[footnote]\par}
  \stoptext

Just in case it helps,

Pablo
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Why don't footnotes appear in floats or figures?

2024-04-22 Thread Joel via ntg-context
 I've managed to get a minimum working example. If you check, you'll see the 
5th footnote inside a placefigure doesn't render anywhere:
\starttext

    \input knuth
    \placefigure{Caption\footnote{message 
A}}{\externalfigure[cow][width=\textwidth]}
    \input knuth
    \placefigure{Caption\footnote{message 
B}}{\externalfigure[cow][width=\textwidth]}
    \input knuth
    \placefigure{Caption\footnote{message 
C}}{\externalfigure[cow][width=\textwidth]}
    \input knuth
    \placefigure{Caption\footnote{message 
D}}{\externalfigure[cow][width=\textwidth]}
    \input knuth
    \placefigure{Caption\footnote{message 
E}}{\externalfigure[cow][width=\textwidth]}
    \input knuth
    \placefigure{Caption\footnote{message 
F}}{\externalfigure[cow][width=\textwidth]}

\stoptext


Is this the correct way to be using the \startpostponing code (see example 
below)?
\starttext
    \input knuth
\startpostponing
    \placefigure{Caption\footnote{message 
A}}{\externalfigure[cow][width=\textwidth]}
\stoppostponing
\stoppostponing
    \input knuth
\startpostponing
    \placefigure{Caption\footnote{message 
B}}{\externalfigure[cow][width=\textwidth]}
\stoppostponing
    \input knuth
\startpostponing
    \placefigure{Caption\footnote{message 
C}}{\externalfigure[cow][width=\textwidth]}
\stoppostponing
    \input knuth
\startpostponing
    \placefigure{Caption\footnote{message 
D}}{\externalfigure[cow][width=\textwidth]}
\stoppostponing
    \input knuth
\startpostponing
    \placefigure{Caption\footnote{message 
E}}{\externalfigure[cow][width=\textwidth]}
\stoppostponing
    \input knuth
\startpostponing
    \placefigure{Caption\footnote{message 
F}}{\externalfigure[cow][width=\textwidth]}
\stoppostponing
\stoptext




On Monday, April 22, 2024 at 02:31:30 AM MDT, Hans Hagen via ntg-context 
 wrote:  
 
 On 4/22/2024 2:45 AM, Joel via ntg-context wrote:
> I'm three days out from sending my work to an editor, and found some 
> serious problem: many footnotes just aren't rendering.
> 
> I have a history text that uses ConTeXt-SBL for the citations, as such, 
> it has lots of footnotes. Sometimes the footnotes are just in the main 
> text, but sometimes also in figure captions, inside floats, inside 
> tables that are inside floats, inside tabulations inside floats, etc.
> 
> What I find alarming is it is frequently not rendering all of the 
> footnote messages at the bottom of the page. The actual footnote number 
> within the body is rendered, but no number is listed in at the bottom of 
> the page. So I might see a list of footnotes, for instance, on page 1, I 
> only get footnotes 1, 2, 3, 5, and 6, but 4 was mysteriously skipped.
> 
> 
> ---
> 1 message
> 2 message
> 3 message
> 5 message
> 6 message
> 
> After a lot of trial-and-error and checking logs and checking my BibTeX 
> files for errors, running everything through BibTex Tidy, etc., and 
> failures to make a minimum working example, I found a single pattern:
> 
> If the footnote marker appears on the SAME page as the footnote text, it 
> has no problem rendering the footnote. But, if ConTeXt decides to move a 
> float a page or two later on--as it frequently seems to do---such that 
> the footnote marker and footnote text at bottom of page should be on 
> DIFFERENT pages, the footnote message at the bottom of the page won't 
> render.
> 
> I've seen some 2+ year old mailing list posts suggesting ConTeXt might 
> have issues with footnotes; they appear to be similar to my issue--is 
> that still a problem? Is there a fix or workaround? Old fixes I could 
> finding in the mailing list don't seem to work with current versions of 
> ConTeXt anymore.
you need to consider the complications of such notes ...

- tex needs to take the notes into account when determining a page break
- it does so by the insert mechanism
- when floats can't be placed they also become inserts (top and bottom)
- when there are inserts in inserts th eproblem becomes more complex (so 
notes inside floats)
- in traditional tex deeply burried inserts disappearm less so in lmtx

There are things that are hard to get right. This works:

\startpostponing
    \startplacefigure[location=here,title={test \footnote{oeps 1}}]
        \blackrule[width=1tw]
        here
        \footnote{hello 1} and
        \footnote{hello 2} and
        \footnote{hello 3} done
    \stopplacefigure
\stoppostponing

\dorecurse{10}{\samplefile{tufte}\par}

Because here the inserts (notes) will migrate but even then one can get 
them out of order (unless we renumber, which then is sensitiev for 
oscillation).

I occasionally wonder if top floats could be done more directly but 
bottom notes still would have an out-of-sync problem




-
                                       

[NTG-context] Re: Why don't footnotes appear in floats or figures?

2024-04-22 Thread Hans Hagen via ntg-context

On 4/22/2024 2:45 AM, Joel via ntg-context wrote:
I'm three days out from sending my work to an editor, and found some 
serious problem: many footnotes just aren't rendering.


I have a history text that uses ConTeXt-SBL for the citations, as such, 
it has lots of footnotes. Sometimes the footnotes are just in the main 
text, but sometimes also in figure captions, inside floats, inside 
tables that are inside floats, inside tabulations inside floats, etc.


What I find alarming is it is frequently not rendering all of the 
footnote messages at the bottom of the page. The actual footnote number 
within the body is rendered, but no number is listed in at the bottom of 
the page. So I might see a list of footnotes, for instance, on page 1, I 
only get footnotes 1, 2, 3, 5, and 6, but 4 was mysteriously skipped.



---
1 message
2 message
3 message
5 message
6 message

After a lot of trial-and-error and checking logs and checking my BibTeX 
files for errors, running everything through BibTex Tidy, etc., and 
failures to make a minimum working example, I found a single pattern:


If the footnote marker appears on the SAME page as the footnote text, it 
has no problem rendering the footnote. But, if ConTeXt decides to move a 
float a page or two later on--as it frequently seems to do---such that 
the footnote marker and footnote text at bottom of page should be on 
DIFFERENT pages, the footnote message at the bottom of the page won't 
render.


I've seen some 2+ year old mailing list posts suggesting ConTeXt might 
have issues with footnotes; they appear to be similar to my issue--is 
that still a problem? Is there a fix or workaround? Old fixes I could 
finding in the mailing list don't seem to work with current versions of 
ConTeXt anymore.

you need to consider the complications of such notes ...

- tex needs to take the notes into account when determining a page break
- it does so by the insert mechanism
- when floats can't be placed they also become inserts (top and bottom)
- when there are inserts in inserts th eproblem becomes more complex (so 
notes inside floats)

- in traditional tex deeply burried inserts disappearm less so in lmtx

There are things that are hard to get right. This works:

\startpostponing
\startplacefigure[location=here,title={test \footnote{oeps 1}}]
\blackrule[width=1tw]
here
\footnote{hello 1} and
\footnote{hello 2} and
\footnote{hello 3} done
\stopplacefigure
\stoppostponing

\dorecurse{10}{\samplefile{tufte}\par}

Because here the inserts (notes) will migrate but even then one can get 
them out of order (unless we renumber, which then is sensitiev for 
oscillation).


I occasionally wonder if top floats could be done more directly but 
bottom notes still would have an out-of-sync problem





-
  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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] what are the interaction between \showframe and \realpageno in \startuseMPgraphic ?

2024-04-20 Thread garulfo
I can not figure out why this progress bar only works when \showframe is 
activated.
When you comment on \showframe, it's as if \realpageno is at zero.
(current version: 2024.04.01 08:59)

\showframe

\startuseMPgraphic{MonGraphisme_MP}
  numeric n ; n := \number\realpageno ;
  numeric m ; m := \number\lastpageno ;
  numeric h ; h := \overlayheight ;
  numeric w ; w := \overlaywidth ;
  numeric e ; e := 3mm;
  numeric r ; r := (((n-1)/(m-1))*w);
  fill fullsquare xscaled w yscaled e shifted (w/2, h/2) withcolor darkblue ;
  fill fullsquare xscaled r yscaled e shifted (r/2, h/2) withcolor darkred;
\stopuseMPgraphic

\defineoverlay [MonGraphisme_OL] [\useMPgraphic{MonGraphisme_MP}]

\setupbackgrounds [footer] [rightmargin] [background={MonGraphisme_OL}]

\starttext
\dorecurse{10}{\input tufte\page}
\stoptext

Any clue is warmly welcome
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] preventing column break after section title

2024-04-18 Thread Peter Münster
Hi,

How could I prevent a column break after the second section title please?

Minimal example:

\starttext
\startcolumns[n=2]
  \section{title 1}
  \dorecurse{22}{bla\par}
  \section{title 2} % Here starts a new column.
  \startitemize
\dorecurse{15}{\item bla}
  \stopitemize
\stopcolumns
\stoptext

I’ve tried "\setuphead[section][after={\columnbreak[no]}]", but it does
not help.

TIA for any hints,
-- 
   Peter
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] \getmarking for top at the current page

2024-04-15 Thread Biblio--- via ntg-context
Dear list,

I've got a problem. Not the first one, but the first one to contribute to the 
list. ;)

system> ConTeXt  ver: 2024.04.01 08:59 LMTX  fmt: 2024.4.12  int: 
english/english
system> 'cont-new.mkxl' loaded

%==
%==
\definehead[Datum][subsubsubject]

\startsetups[Test]
  Pr=(\getmarking[Datum][previous])~
  Nx=(\getmarking[Datum][next])~
  Fi=(\getmarking[Datum][first])~
  La=(\getmarking[Datum][last])~
  Tp=(\getmarking[Datum][top])~
  Bt=(\getmarking[Datum][bottom])~
  Cu=(\getmarking[Datum][current])~
\stopsetups

\setupheadertexts[text]
  [\setups{Test}][]
  [\setups{Test}][]

\setuppagenumbering[location=footer]

\starttext

\startDatum[title={secA}]%

  \dorecurse{50}{aaa }

  \pagebreak
 
  \dorecurse{50}{aaa }

\stopDatum

\startDatum[title={secB}]%

  \dorecurse{630}{bbb }

\stopDatum

\startDatum[title={secC}]%

  \dorecurse{50}{ccc }

\stopDatum

\startDatum[title={secD}]%

  \dorecurse{50}{ddd }

\stopDatum

\startDatum[title={secE}]%

  \dorecurse{50}{eee }

\stopDatum


\stoptext
%==
%==


I'd like to write the marking of the very first text at the current page to the 
header. That seems to be a bit tricky, at least for me. (I'm afraid that 
\getmarking[xxx][top] was intended for that and it is not feasible at all.)

At page 1 the header should read "secA", at page 2 again "secA" (because the 
very first text belongs to "secA"), and at page 3 "secC" (because the very 
first text (the section title) belongs to "secC"). Unfortunatly \getmarking[][] 
does not behave like I expacted.

I understand the keywords of \getmarking in the wiki 
(https://wiki.contextgarden.net/Command/getmarking) as listed below:
• previous: marking at the bottom of the page BEFORE the current page (no page 
before then empty)
• next: marking at the top of the page AFTER the current page (no page after 
then bottom of current page)

• top: marking at the top of the current page
• bottom: marking at the bottom of the current page

• first: first marking that starts at the current page (no first than behaving 
like top)
• last: last marking that starts at the current page (no last than behaving 
like bottom)

• current: last stored marking while deciding on pagebreaking between the 
current page and the (potential) following page
• default: first

According to these thoughts, I started with \getmarking[Datum][top]. But "top" 
seems not to work, there is no difference between "top" and "first", "top" 
behaves like "first".

My second thought: Generally \getmarking[Datum][first] would be perfect, so 
I've thought something like

    \doifelse{\fetchmark[Datum][next] of the page before the current 
page}{\fetchmark[Datum][previous]}
      {\getmarking[Datum][previous]}
      {\getmarking[Datum][first]}

could work. (Honestly I don't know how to do "\fetchmark[Datum][next] of the 
page before the current page}". The first page would need a special treatment 
too.)

But: At page 2 \getmarking[Datum][next] (Nx) contains "secB" but at top of page 
3 is not "secB" but "secC". So \getmarking[Datum][next] does not seem to 
contain the correct information I need, therefore I don't get any further.


Any ideas: How do I write the marking of the very first text at the current 
page to the header?


Thank you in advance, Matthias

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: last page number for a list

2024-04-03 Thread Wolfgang Schuster

Alan Bowen schrieb am 30.03.2024 um 20:59:

How can I get the last page number of a chapter for a list (ToC)?

Outside of a list, I use \lastpagenumber.
But that does not work in a list such as the ToC.

Any tips or pointers will be gladly received.


You can try this:

\definepagestate[alanpage]
\definecounter  [alanindex]

\setuphead
  [chapter]
  [insidesection={\setpagestate[alanpage]},
   aftersection={\setpagestate[alanpage]}]

\setuphead
  [title]
  [insidesection=,
   aftersection=]

\define[1]\ChapterListPage

{\pagestaterealpage{alanpage}{\number\numexpr\incrementedcounter[alanindex]\relax}%
   \thinspace --\thinspace

\pagestaterealpage{alanpage}{\number\numexpr\incrementedcounter[alanindex]\relax}}

\setuplist[chapter][pagecommand=\ChapterListPage]
\setuplist[chapter][pagecommand=\ChapterListPage]

\showgrid

\starttext

\completecontent

\startchapter [title=Knuth]
\dorecurse{12}{\samplefile{knuth}}
\stopchapter

\startchapter [title=Zapf]
\dorecurse{12}{\samplefile{zapf}}
\stopchapter

\stoptext

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: last page number for a list

2024-04-03 Thread Alan Bowen
Hi, Bruce—
This does not quite work—the page numbers are those of the first page of
the chapter, not the last. But thanks for the tip about \writetolist.
Perhaps I can get that to work.

What I need are ToC entries like
AuthorName
ShortTitle   1–6

I need this pagination because one of the requirements of continuous
publication on the OJS is that once an item is published changes are not
permitted. So I cannot go with normal continuous publication since, for us
anyway, items are not processed in strict sequential order (e,g., we may
have, paper+paper+ review+paper...)

If it helps: I currently have

\startFMTitle[reference=\Reference, title={}][itemAuthor=AuthorName,
itemTitle=ShortTitle,...]
\setuplist[FMTitle][state=start, alternative=startendfmpages,
criterium=all,]
(\Reference is defined at the in the preamble to input of the
file/component.)

\definelistalternative[startendfmpages][renderingsetup=list:startendfmpages]

\startsetups[list:startendfmpages]
  \structurelistuservariable{itemAuthor}\crlf
  \structurelistuservariable{itemTitle}\hfill%
   \at[\currentlistentrypagenumber]–\at[\lastpagenumber]
\vglue1pc
\stopsetups
where I have \reference[\lastpagenumber]{} at the end of the file. But this
gives me ??–viii (the viii is correct and interactive) for the FMTitle.
Sadly the entries for all my other Titles (SourceTitle, StudyTitle...) is
??–viii.
(Each title is a modified chapter.)

Curiously, \at[\Reference]–\convertnumber{r}{\lastpagenumber}  and
\at[\Reference]–\at[\lastpagenumber] work properly in the body text.
The overall structure is project-product sort with many components in the
product.

This is probably TMI. The bottom line is that I am truly stumped.

All best,
Alan

On Wed, Apr 3, 2024 at 6:56 AM Bruce Horrocks  wrote:

>
>
> > On 30 Mar 2024, at 19:59, Alan Bowen  wrote:
> >
> > How can I get the last page number of a chapter for a list (ToC)?
> >
> > Outside of a list, I use \lastpagenumber.
> > But that does not work in a list such as the ToC.
> >
> > Any tips or pointers will be gladly received.
>
>
> I'm not quite sure what you want to do with these numbers: something like
> printing out a contents page but instead of the start page of a chapter it
> shows the last page of the chapter?
>
> If so then try creating a custom list and use \writetolist immediately
> before each \stopchapter command?
>
> \definelist[LastPages][criterium=all]
> \starttext
> \completecontent
> \page
> \completelist[LastPages]
> \page
> \dorecurse{10}{
>   \startchapter[title={This is my chapter}]
>   This is a chapter\par \dorecurse{6}{\input knuth } \input
> math-kontinuitet-sv
>
>   \writetolist[LastPages]{3.}{\namedstructurevariable{chapter}{title}}
>   \stopchapter
> }
> \stoptext
>
> But I can't get the number option of \writetolist to work - the "3." above
> is ignored. :-(
>
> —
> Bruce Horrocks
> Hampshire, UK
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: last page number for a list

2024-04-03 Thread Bruce Horrocks


> On 30 Mar 2024, at 19:59, Alan Bowen  wrote:
> 
> How can I get the last page number of a chapter for a list (ToC)?
> 
> Outside of a list, I use \lastpagenumber. 
> But that does not work in a list such as the ToC.
> 
> Any tips or pointers will be gladly received.


I'm not quite sure what you want to do with these numbers: something like 
printing out a contents page but instead of the start page of a chapter it 
shows the last page of the chapter?

If so then try creating a custom list and use \writetolist immediately before 
each \stopchapter command?

\definelist[LastPages][criterium=all]
\starttext
\completecontent
\page
\completelist[LastPages]
\page
\dorecurse{10}{
  \startchapter[title={This is my chapter}]
  This is a chapter\par \dorecurse{6}{\input knuth } \input math-kontinuitet-sv

  \writetolist[LastPages]{3.}{\namedstructurevariable{chapter}{title}}
  \stopchapter
}
\stoptext

But I can't get the number option of \writetolist to work - the "3." above is 
ignored. :-(

—
Bruce Horrocks
Hampshire, UK

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Visually balanced columns

2024-03-27 Thread Wolfgang Schuster

Alexey Kryukov schrieb am 27.03.2024 um 14:02:

Hi list,

I'd like to know if its is possible to get visually balanced
mixedcolumns in lmtx. For example, if I have \blank's between
paragraphs, I would like them to be stretched or expanded by
a such way that the bottommost lines have the same vertical
position -- no matter, how many lines there are in each column and how
exactly they are aligned.

If I understand correctly, that's how the multicols environment in
LaTeX works, and that's how old-multicolumns worked -- but this module
seems to be no longer supported in lmtx.

I tried to disable gridfitting for startcolumns, but it produces a
completely distorted output.


The pagecolumns environment supports bottom aligned content.

\setupwhitespace[medium]

\setupalign[depth]

\starttext

\startpagecolumns
\dorecurse{20}{\samplefile{jojomayer}\par}
\stoppagecolumns

\stoptext

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Headertext

2024-03-27 Thread Thomas Meyer

Thank you, Wolfgang,

that's exactly what I wanted.

Greetings
Thomas

Am 26.03.24 um 17:12 schrieb Wolfgang Schuster:
When you use "header=high" you can't have a header because the block 
for it no longer exists, compare the results for "header=high" and 
"header=empty" in the following example.


 begin example
\showframe

\starttext

\setuphead[chapter][header=high]

\chapter{Lorem Ipsum}

\dorecurse{10}{\samplefile{lorem}}

\setuphead[chapter][header=empty]

\chapter{Lorem Ipsum}

\dorecurse{10}{\samplefile{lorem}}

\stoptext
 end example

As you have guessed \definetext is the way to create a custom header 
for the first page of your \chapter, the command has like 
\setupheadertexts a variable number of arguments.


The third argument with the horizontal position can only be used when 
you use two or four arguments to set texts on the left and right side 
but isn't in my example because a) the text position is the default 
and b) I pass only one argument for the content because I wan't the 
text in the middle.


 begin example
\showframe

\definetext
  [chapterheader] % identifier
  [header]    % vertical position (header/footer)
% [text]  % horizontal position (text/margin)
  [This is a custom header for \tex{chapter}] % content

\setuphead[chapter][header=chapterheader]

\starttext

\chapter{Lorem Ipsum}

\dorecurse{10}{\samplefile{lorem}}

\stoptext 
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] start/end pages in ToC

2024-03-26 Thread Alan Bowen
Our journal is currently in the process of moving to continuous publication
of items in a given volume as they are ready. This entails re-jigging the
ToC so that it now includes the start and end page numbers of each item. So
far, I have everything pretty much in the right place, but for the page
numbers I am getting only “??”. I am not sure why this is happening and
would be grateful if someone could tell me why or point me to
documentation that explains the problem and how to solve it.

Many thanks in advance.

My minimalish working example:

\definehead[SourceTitle][chapter]
\setuphead[SourceTitle][page=yes,
footer={ItemData}]

\definehead[StudyTitle][chapter]
\setuphead[StudyTitle][page=yes,
footer={ItemData}]

\definetext[ItemData][footer][
{\at[\Reference]–
\at[\namedstructureuservariable{}{authorInitials}endPage]}
]
\setuplist[SourceTitle][
state=start,
textcolor=black,
alternative=startendpages,
criterium=all,
headnumber=no,
interaction=page,
numberalign=flushright,
before={\blank[2.2ex, fixed]},
inbetween=\endgraf,
]

\setuplist[StudyTitle][
state=start,
textcolor=black,
alternative=startendpages,
criterium=all,
headnumber=no,
interaction=all,
numberalign=flushright,
before={\blank[2.2ex, fixed]},
inbetween=\endgraf,
]

\define\ToCEntry{%
\structurelistuservariable{author}\crlf
\structurelistuservariable{title}\hfill%
\at[\structurelistuservariable{reference}]–%
\at[\structurelistuservariable{authorInitials}endPage]
}

\definelistalternative[startendpages]
[renderingsetup=list:startendpages]

\startsetups[list:startendpages]
{\ToCEntry}
\vglue1pc
\stopsetups

\starttext

{\tfa\bf Contents}

\blank[line, fixed]
\WORD{Sources}
\blank[halfline, fixed]
\placelist[SourceTitle][criterium=all]

\blank[line, fixed]
\WORD{Studies}
\blank[halfline, fixed]
\placelist[StudyTitle][criterium=all]

\page[makeup]

\setnumber[userpage][1]
\def\Reference{RefSo01}
\startSourceTitle[reference={\Reference},
bookmark=Source01,
title={}][
title=Source01,
author=Author01,
authorInitials=ABC,
reference={\Reference},
]
\input knuth
\page
\dorecurse{25}{\input ward\par}
\reference[ABCendPage]{}
\stopSourceTitle
\page[makeup]

\setnumber[userpage][1]
\def\Reference{RefSo02}
\startSourceTitle[reference={\Reference},
bookmark=Source02,
title={}][
author=Author02,
title=Source02,
authorInitials=PQR,
reference={\Reference},
]

\input knuth
\page
\dorecurse{10}{\input ward\par}
\reference[PQRendPage]{}
\stopSourceTitle
\page[makeup]

\setnumber[userpage][1]
\def\Reference{RefSt01}
\startStudyTitle[reference={\Reference},
bookmark=Study01,
title={}][
author=Author03,
title=Study01,
authorInitials=XYZ,
reference={\Reference},
]
\input knuth
\blank[big]
\page
\dorecurse{15}{\input ward\par}
\reference[XYZendPage]{}
\stopStudyTitle
\page[makeup]
\stoptext

Alan
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Headertext

2024-03-26 Thread Wolfgang Schuster

Thomas Meyer schrieb am 26.03.2024 um 16:28:

Hi folks,

I know, with

\setuphead[chapter][header=high]

I can suppress the header text on the first page. But what can I do if I 
still want to have part of the header text on the first page?

Is there something I can do with \definetext and if so, how?


When you use "header=high" you can't have a header because the block for 
it no longer exists, compare the results for "header=high" and 
"header=empty" in the following example.


 begin example
\showframe

\starttext

\setuphead[chapter][header=high]

\chapter{Lorem Ipsum}

\dorecurse{10}{\samplefile{lorem}}

\setuphead[chapter][header=empty]

\chapter{Lorem Ipsum}

\dorecurse{10}{\samplefile{lorem}}

\stoptext
 end example

As you have guessed \definetext is the way to create a custom header for 
the first page of your \chapter, the command has like \setupheadertexts 
a variable number of arguments.


The third argument with the horizontal position can only be used when 
you use two or four arguments to set texts on the left and right side 
but isn't in my example because a) the text position is the default and 
b) I pass only one argument for the content because I wan't the text in 
the middle.


 begin example
\showframe

\definetext
  [chapterheader] % identifier
  [header]% vertical position (header/footer)
% [text]  % horizontal position (text/margin)
  [This is a custom header for \tex{chapter}] % content

\setuphead[chapter][header=chapterheader]

\starttext

\chapter{Lorem Ipsum}

\dorecurse{10}{\samplefile{lorem}}

\stoptext
 end example

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Use of marking

2024-03-21 Thread Thomas Meyer

Hi Pablo and Bruce,

thank you very much for your two solutions. That helps me enormously now.

Greetings
Thomas

Am 21.03.24 um 16:34 schrieb Bruce Horrocks:

\startsetups[doc:header]
   \getmarking[chapternumber] \space - \space \getmarking[chapter]
   \space :: \space
   \getmarking[sectionnumber] \space - \space \getmarking[section]
\stopsetups
\setupheadertexts[\setup{doc:header}]

\starttext
\dorecurse{10}{
   \startchapter[title={This is my chapter}]
   This is a chapter\par \dorecurse{6}{\input knuth } \input math-kontinuitet-sv

   \startsection[title={This is my section}]
This is a section\par \dorecurse{6}{\input knuth }\input math-kontinuitet-sv
   \stopsection
   \stopchapter
}
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Use of marking

2024-03-21 Thread Bruce Horrocks


> On 20 Mar 2024, at 18:45, Andres Conrado Montoya  
> wrote:
> 
> 2. As far as I have found, including the chapter/section number in the 
> marking is not really a trivial task. I usually hack something using 
> \headnumber and \getmarking, like so: 

You can do the following:

\startsetups[doc:header]
  \getmarking[chapternumber] \space - \space \getmarking[chapter]
  \space :: \space
  \getmarking[sectionnumber] \space - \space \getmarking[section]
\stopsetups
\setupheadertexts[\setup{doc:header}]

\starttext
\dorecurse{10}{
  \startchapter[title={This is my chapter}]
  This is a chapter\par \dorecurse{6}{\input knuth } \input math-kontinuitet-sv

  \startsection[title={This is my section}]
   This is a section\par \dorecurse{6}{\input knuth }\input math-kontinuitet-sv
  \stopsection
  \stopchapter
}
\stoptext

Caveat: it needs an if...then test around the section number for when a section 
hasn't started.
—
Bruce Horrocks
Hampshire, UK

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Use of marking

2024-03-20 Thread Andres Conrado Montoya
As I understand, Thomas needs a layout in which the header shows something
like

1. Chapter title -- 1.1. Section title (including the numbers! *This is the
important bit!*)

There are a couple things about this:

1. In a section (part, chapter, section, etc.) you can introduce three
versions of the title for that section. title= is the general one and if
nothing else is specified, this will be used in markings (headers or footer
or wherever you want to put therm) and in listings (contents). If you give
those arguments, marking= and listing=, you will get those texts in those
places: marking= on markings (you can call them with \getmarking) and
listing= in the table of contents.

2. As far as I have found, including the chapter/section number in the
marking is *not really a trivial task*. I usually hack something using
\headnumber and \getmarking, like so:

\setuppagenumbering[alternative=doublesided,location=,]

\setupheadertexts[{\headnumber[section].~\getmarking[section]}---{\headnumber[chapter].~\getmarking[chapter]}]
\setupfootertexts[][pagenumber][pagenumber][]
\setuphead[chapter][header=high]

\starttext
\dorecurse{10}{
  \startchapter[title={This is my chapter}]
  This is a chapter\par \dorecurse{6}{\input knuth } \input
math-kontinuitet-sv

  \startsection[title={This is my section}]
   This is a section\par \dorecurse{6}{\input knuth }\input
math-kontinuitet-sv
  \stopsection
  \stopchapter
}
\stoptext

But with a caveat: the `header=high` setting in setuphead for the chapter
needs to be included, or you will get a section number in the first page,
even if there is no section. I have not found a better mechanism yet, but
I'm quite sure there is a correct solution for this... I just haven't found
it yet. Checking for the presence of \getmarking[section] with
\doifsomething does not work, or I could not make it work.

A little bit more info here:
https://wiki.contextgarden.net/Command/getmarking
https://wiki.contextgarden.net/Command/headnumber


El mié, 20 mar 2024 a las 9:23, Hraban Ramm () escribió:

> \setupheadtext[de][section=Aufgabe]
> Rename the section, then you don’t need marking.
>
> Sorry, I'm in a hurry and must look up how to get the number…
>
>
> Am 20.03.24 um 12:18 schrieb Thomas Meyer:
>
> Hi Hraban,
>
> and thanks.
>
> setuphead[chapter,section][numberwidth=2em] or "fit"
> works!
>
> I know \setupheadertexts, but do not know what shall I write here:
> \startsection[titel=Aufgabe, marking=?]
> If I write marking=Aufgabe I get Aufgabe, no number! For chapter the same.
>
> \setupheadertexts
>[] [{\getmarking[chapter]} - {\getmarking[section]}]
> [{\getmarking[chapter]} - {\getmarking[section]}] []
> > Kapitel - Aufgabe
>
>
> Thanks in advance
> Greetings
> Thomas
>
>
> Am 20.03.24 um 09:09 schrieb Hraban Ramm:
>
>
> Am 20.03.24 um 08:18 schrieb Thomas Meyer:
>
> HI folks,
>
> yesterday while reading along I learned how to suppress the chapter
> numbers in sections. That was something I was looking for myself.
>
> But how do you use marking correctly in startsection? I would like to see
> "1. Kapitel - 1. Aufgabe" in the header on the right. How can I automate
> this with marking?
> And how can I reduce the space between the number (1.) and the title
> (Kapitel or Aufgabe)?
>
> Thanks for your help
> Thomas
>
> Hi Thomas,
>
> do you know how to use \setupheadertexts?
>
> https://wiki.contextgarden.net/Command/setupheadertexts
>
> I guess you're using the section level for "Aufgabe"?
>
> Then something like {\getmarking{chapter} – \getmarking{section}} might
> fit your request.
>
> The formatting should be possible with
> \setuphead[chapter,section][numberwidth=2em] or "fit".
>
> Hraban
>
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
>
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___
>
>
>
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
>
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.c

[NTG-context] Re: command line arguments

2024-03-20 Thread Hraban Ramm


Am 19.03.24 um 23:53 schrieb Wolfgang Schuster:

Hraban Ramm schrieb am 19.03.2024 um 21:41:
Following up on the other imposition question, I'm trying to make an 
example file that shows an imposition schema according to command 
line arguments.


This way it works for the number of pages, as used in 
\dorecurse{\Pages}{…}, but not for the imposition schema. Typesetting 
\Schema looks right, but \setuparranging doesn’t work. Where's my error?


You forgot about expansion and in your case \doifelsedocumentargument 
is not fully expandable. This doesn't matter for \dorecurse where the 
number parser ignores the flag because \setuparranging does care and 
\Schema fails to expand.

Thank you! Well, I tried \expanded in a few places, and that didn’t work.


\def\Schema{\doifelsedocumentargument{schema}{\getdocumentargument{schema}}{1*8}} 



\def\Pages{\doifelsedocumentargument{numberofpages}{\getdocumentargument{numberofpages}}{16}} 



\setuparranging[\Schema]


\doifelsedocumentargument{schema}
  {\setuparranging[\getdocumentargument{schema}]}
  {\setuparranging[1*8]}


Ok, that works. (Of course, if you say so.)



It does also help to look at the included extra files (e.g. 
mtx-context-arrange.tex) written by Hans.


Well, I don’t know how to use that, it doesn’t compile on its own, any 
hints?


Hraban

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: command line arguments

2024-03-19 Thread Wolfgang Schuster

Hraban Ramm schrieb am 19.03.2024 um 21:41:
Following up on the other imposition question, I'm trying to make an 
example file that shows an imposition schema according to command line 
arguments.


This way it works for the number of pages, as used in 
\dorecurse{\Pages}{…}, but not for the imposition schema. Typesetting 
\Schema looks right, but \setuparranging doesn’t work. Where's my error?


You forgot about expansion and in your case \doifelsedocumentargument is 
not fully expandable. This doesn't matter for \dorecurse where the 
number parser ignores the flag because \setuparranging does care and 
\Schema fails to expand.



\def\Schema{\doifelsedocumentargument{schema}{\getdocumentargument{schema}}{1*8}}

\def\Pages{\doifelsedocumentargument{numberofpages}{\getdocumentargument{numberofpages}}{16}}

\setuparranging[\Schema]


\doifelsedocumentargument{schema}
  {\setuparranging[\getdocumentargument{schema}]}
  {\setuparranging[1*8]}

It does also help to look at the included extra files (e.g. 
mtx-context-arrange.tex) written by Hans.


Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: command line arguments

2024-03-19 Thread Willi Egger
Hello Hraban,

I puzzled a while. To me the —arguments= option does not work. I saw then on 
the Wiki, that one can also add documentarguments as —schema=2UP 
—numberofpages=16.

I further changed to \startdocument … \stopdocument.

Please look at the attached file

Willi

impositiontest-2.tex
Description: Binary data


> On 19 Mar 2024, at 21:41, Hraban Ramm  wrote:
> 
> Following up on the other imposition question, I'm trying to make an example 
> file that shows an imposition schema according to command line arguments.
> 
> This way it works for the number of pages, as used in \dorecurse{\Pages}{…}, 
> but not for the imposition schema. Typesetting \Schema looks right, but 
> \setuparranging doesn’t work. Where's my error?
> 
> \def\Schema{\doifelsedocumentargument{schema}{\getdocumentargument{schema}}{1*8}}
> \def\Pages{\doifelsedocumentargument{numberofpages}{\getdocumentargument{numberofpages}}{16}}
> 
> \setuparranging[\Schema]
> 
> 
> Find the full example attached, I call it like
> 
> context --autopdf=auto --arrange impositiontest.tex --schema=TRYPTICHON 
> --numberofpages=32
> 
> Hraban
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] command line arguments

2024-03-19 Thread Hraban Ramm
Following up on the other imposition question, I'm trying to make an 
example file that shows an imposition schema according to command line 
arguments.


This way it works for the number of pages, as used in 
\dorecurse{\Pages}{…}, but not for the imposition schema. Typesetting 
\Schema looks right, but \setuparranging doesn’t work. Where's my error?


\def\Schema{\doifelsedocumentargument{schema}{\getdocumentargument{schema}}{1*8}}

\def\Pages{\doifelsedocumentargument{numberofpages}{\getdocumentargument{numberofpages}}{16}}

\setuparranging[\Schema]

Find the full example attached, I call it like

context --autopdf=auto --arrange impositiontest.tex --schema=TRYPTICHON 
--numberofpages=32

Hraban
% context --autopdf=auto --arrange --arguments=schema=2\*4,pages=16

\def\Schema{\doifelsedocumentargument{schema}{\getdocumentargument{schema}}{1*8}}
\def\Pages{\doifelsedocumentargument{numberofpages}{\getdocumentargument{numberofpages}}{16}}

\setuppapersize[A9,landscape][A7,landscape]

\setuparranging[\Schema]

\setupbodyfont[ss,10pt]

\setuplayout[margin=0pt, width=fit, header=2.8ex, footer=2.8ex]
\setupalign[middle,hilo]
\setuppagenumbering [alternative=doublesided,location=footer]
\setupheadertexts[\CONTEXT\ imposition test]

\showframe
\setupbackgrounds [text][text][background=color,backgroundcolor=lightgray]

% Where the block of pages is placed on the sheet
% (relevant if there is space left over.)
\setuplayout [location=middle,marking=on]

\startbuffer[Fakepage]
\strut
\blank
\bold{[\Schema]}
\vfill
This is page \recurselevel
\vfill
\stopbuffer

\starttext
\dorecurse{\Pages}{\getbuffer[Fakepage]\page}
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: imposition: getting to the last page of a booklet

2024-03-06 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 04.03.2024 um 20:00:

On 2/28/24 19:28, Wolfgang Schuster wrote:

[...]
\def\beforequadruplenumber#1%
{\ifcase\numexpr#1+1;4\relax
   \number\numexpr#1+4\relax
 \else
   \number\numexpr#1+3-#1;4\relax
 \fi}


Sorry for not having answered before, Wolfgang.

I’m afraid I don’t get how \ifcase is deployed with as conditional
(being \ifcase used to give numbers for weekdays or months).


The \ifcase command is the TeX version of a switch statement from other 
programming languages.


The first case in \ifcase checks against zero which is shorter than 
writing "\ifnum ... = 0".



The semicolon is also mysterious to me, I don’t know what it does there
in plain language.


The semicolon is a undocumented extension (I noticed it in the 
definition of \page[quadruple]) of \numexpr in Luametatex for the 
modulus operator.



Sorry, I know it has to be simple, but the syntax is too cryptic for me.

Could you write the first line in plain language?


Look at the second example of the Lua code in the example below for each 
command (the first example is your version), the third example is just a 
condensed version of example 2.



Sorry for asking that. I’m afraid this would be the only way I could get
what \ifcase is doing there.


As was mentioned above I used it as a check when the remainder was 0.

 begin example
\startluacode

--~ interfaces.implement {
--~ name  = "beforequadruplenumber",
--~ arguments = "integer",
--~ actions   = function(n)
--~ if n % 4 == 0 then
--~ context(n + 3)
--~ elseif n % 4 == 1 then
--~ context(n + 2)
--~ elseif n % 4 == 2 then
--~ context(n + 1)
--~ elseif n % 4 == 3 then
--~ context(n + 4)
--~ end
--~ end
--~ }

--~ interfaces.implement {
--~ name  = "beforequadruplenumber",
--~ arguments = "integer",
--~ actions   = function(n)
--~ if (n + 1) % 4 == 0 then
--~ context(n + 4)
--~ else
--~ context(n + 3 - n % 4)
--~ end
--~ end
--~ }

interfaces.implement {
name  = "beforequadruplenumber",
arguments = "integer",
actions   = function(n)
context(n + (((n + 1) % 4 == 0) and 4 or (3 - n % 4)))
end
}

--~ interfaces.implement {
--~ name  = "afterquadruplenumber",
--~ arguments = "integer",
--~ actions   = function(n)
--~ if n % 4 == 0 then
--~ context(n + 1)
--~ elseif n % 4 == 1 then
--~ context(n + 4)
--~ elseif n % 4 == 2 then
--~ context(n + 3)
--~ elseif n % 4 == 3 then
--~ context(n + 2)
--~ end
--~ end
--~ }

--~ interfaces.implement {
--~ name  = "afterquadruplenumber",
--~ arguments = "integer",
--~ actions   = function(n)
--~ if n % 4 == 0 then
--~   context(n + 1)
--~ else
--~   context(n + 5 - n % 4)
--~ end
--~ end
--~ }

interfaces.implement {
name  = "afterquadruplenumber",
arguments = "integer",
actions   = function(n)
context(n + ((n % 4 == 0) and 1 or (5 - n % 4)))
end
}

\stopluacode

\unprotect
\def\beforequadruplenumber#1{\clf_beforequadruplenumber\numexpr#1\relax}
\def\afterquadruplenumber #1{\clf_afterquadruplenumber \numexpr#1\relax}
\protect

\starttext
\dorecurse{20}{\recurselevel\space = 
\beforequadruplenumber{\recurselevel}\par}\page
\dorecurse{20}{\recurselevel\space = \afterquadruplenumber 
{\recurselevel}\par}

\stoptext
 end example

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Structuring a magazine or booklet

2024-02-29 Thread Jean-Pierre Delange

Thank you very much Pablo !

I have to play with this canvas.

Many thanks.

JP

Le 28/02/2024 à 19:10, Pablo Rodriguez via ntg-context a écrit :


On 2/28/24 15:27, Jean-Pierre Delange wrote:

Sorry for the noise : I did'nt see the ConTeXt imposition schemas here :

https://wiki.contextgarden.net/Imposition

I'll read and test it.

Hi Jean-Pierre,

in its simplest form, a booklet may be:

   \setuppapersize[A4][A3, landscape]
   \setuparranging[2UP]
   \starttext
   \dorecurse{28}{\section{Section}\input zapf}
   \stoptext

I think this seems to be what you may be aiming at.

Just in case it might help,

Pablo
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Structuring a magazine or booklet

2024-02-28 Thread Pablo Rodriguez via ntg-context
On 2/28/24 15:27, Jean-Pierre Delange wrote:
> Sorry for the noise : I did'nt see the ConTeXt imposition schemas here :
>
> https://wiki.contextgarden.net/Imposition
>
> I'll read and test it.

Hi Jean-Pierre,

in its simplest form, a booklet may be:

  \setuppapersize[A4][A3, landscape]
  \setuparranging[2UP]
  \starttext
  \dorecurse{28}{\section{Section}\input zapf}
  \stoptext

I think this seems to be what you may be aiming at.

Just in case it might help,

Pablo
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: imposition: getting to the last page of a booklet

2024-02-28 Thread Pablo Rodriguez via ntg-context
On 2/28/24 12:24, Pablo Rodriguez via ntg-context wrote:
> [...]
> This is why beforequadruple would make sense. I guess some Lua magic
> could do that, computing x to the follwing page that "x % 4 = 3" (and
> then \page[x]).
>
> I will try to find a trick for that, but not now.

Replying to myself, this is a command to compute next numbers before and
after quadruples (with application to \realpageno):

 \starttext
  \def\beforequadruplenumber#1%
{\ifnum\modulonumber{4}{#1} = 1
   \the\numexpr #1 + 2
 \orelse\ifnum\modulonumber{4}{#1} = 2
   \the\numexpr #1 + 1
 \orelse\ifnum\modulonumber{4}{#1} = 3
   \the\numexpr #1 + 4
  \else
   \the\numexpr #1 + 3
 \fi}

  \def\afterquadruplenumber#1%
{\ifnum\modulonumber{4}{#1} = 1
   \the\numexpr #1 + 4
 \orelse\ifnum\modulonumber{4}{#1} = 2
   \the\numexpr #1 + 3
 \orelse\ifnum\modulonumber{4}{#1} = 3
   \the\numexpr #1 + 2
  \else
   \the\numexpr #1 +1
 \fi}

  \dorecurse{25}{\recurselevel: \beforequadruplenumber{\recurselevel}\\}
  \dorecurse{25}{\recurselevel: \afterquadruplenumber{\recurselevel}\\}

  %\page[123]
  %\null
  \page[\beforequadruplenumber{\realpageno}]
  before quadruple
  \page[\afterquadruplenumber{\realpageno}]
  afterquadruple
  \stoptext

Michael, if this fits your needs, please add it to the wiki.

I hope it helps,

Pablo
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Hyperlinks cease working after page selection

2024-02-26 Thread Michael Guravage
Greetings,

The document in question compiles correctly. Its hyperlinks are correct and
work as expected. However, if I apply a page selection, the hyperlinks in
the resulting document, while correctly coloured, no longer work.

Any suggestions on how to correct or work around this would be greatly
appreciated.

\setupinteraction[state=start, color=darkblue]
\setupwhitespace [big]
\starttext
  Consult the \goto{\ConTeXt\ wiki}[url(https://wiki.contextgarden.net/)]
.\par
  \dorecurse{5}{\samplefile{lorem}\par}
\stoptext

Processed as follows:

context  mwe.tex
context --extra=select --selection=1 --result=foobar.pdf mwe.pdf


-- 
With kind regards,

Michael Guravage
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: MetaPost lines in tables?

2024-02-22 Thread Henning Hraban Ramm

Am 22.02.24 um 18:35 schrieb Hans Hagen via ntg-context:

On 2/21/2024 7:47 PM, Henning Hraban Ramm wrote:

(I’m sure I already used that somewhere… Must document…)
ok, new feature dedicated to Hraban ... who then of course has to 
document it.


This is nice.
Thank you, will do.

(Actually I’m not much interested in dashed borders but to have lines 
affected by my sketchy style - courtesy of Aditya et al., see below)


Taco, will the syntax pages in the wiki update automatically to a newer 
version?



"""
\startuseMPgraphic{mp:sketchy}
input mp-sketch.mp;
sketchypaths;

sketch_amount := 1 + (uniformdeviate 2);
sketch_passes := 3;
sketch_segments := 2 + (uniformdeviate 3);
sketch_length := OverlayWidth / 3;

draw topboundary withpen pensquare withcolor lightgray;
naturalizepaths;
\stopuseMPgraphic

\defineoverlay[sketchylines][\useMPgraphic{mp:sketchy}]

\setupTABLE[r][first][style=bold]
\setupTABLE[r][each][
topoffset=1em,bottomoffset=0.5em,
background=sketchylines,
% would be nice if the background wouldn’t start at each column
]
\setupTABLE[c][each][frame=off]
\bTABLE[]
\bTR
\bTD{Stadt}\eTD
\bTD{Land}\eTD
\bTD{Fluss}\eTD
\eTR
\dorecurse{10}{
\bTR
\bTD\strut \eTD\bTD \eTD\bTD \eTD
\eTR
}
\eTABLE
"""


Hraban%D \module
%D   [   file=mp-sketch.mp
%Dversion=2021.05.13
%D  title=\CONTEXT\ \METAPOST\ graphics,
%D   subtitle=Sketch drawing,
%D author=Aditya Mahajan,
%D   date=\currentdate,
%D  copyright={Aditya Mahajan}]

%D This metapost module is inspired by a TeX.SE question:
%D http://tex.stackexchange.com/q/39296/323
%D
%D I thought that it would be fun to implement a similar feature in MetaPost.
%D
%D To use this package in MetaPost:
%D
%D \starttyping
%Dinput mp-sketch;
%D
%Dbeginfig(1)
%D  sketchypaths; % Make draw and fill sketchy
%D  ...
%D  naturalizepaths; % Restore the value of draw and fill
%D  ...
%Dendfig
%D \stoptyping
%D
%D The code is heavily inspired by Hans Hagen's Metafun macros.
%D
%D The macro \type{sketchypaths} is modeled after \type{visualizepaths} from
%D \filename{mp-tool}.

def sketchypaths =
let draw = sketchdraw ;
let fill = sketchfill ;
enddef ;

%D Check if \filename{mp-tool} is loaded
if not known context_tool :
  let normaldraw = draw;
  let normalfill = fill;

  def naturalizepaths =
  let fill = normalfill ;
  let draw = normaldraw ;
  enddef ;
fi

%D The variable \type{sketch_amount} determines the amount of randomness in the
%D drawing
numeric sketch_amount; sketch_amount := 0.75bp;

%D The variable \type{sketch_passes} determines the number of times the path
%D is drawn
numeric sketch_passes; sketch_passes := 1;

%D Based on \type{randomized}. Assumes p is path:
numeric sketch_segments; sketch_segments := 20;

%D Length (time) of line segments:
numeric sketch_length; sketch_length := 5mm;

primarydef p sketchrandomized s = (
if path p :
for t = 0 step 1/sketch_segments until 1-1/sketch_segments :
((point   (t*arclength(p)) on p) 
randomshifted s) .. controls
((postcontrol (t*arclength(p)) on p) 
randomshifted s) and
((precontrol  ((t+1/sketch_segments)*arclength(p)) on p) 
randomshifted s) ..
endfor
% TODO: beide Ansätze kombinieren. Eckpunkte erhalten!

%for t = 0 step sketch_length until arclength p:
%  (point (arctime t of p) of p) randomshifted s ..
%endfor
if cycle p : % funktioniert nicht
  cycle
else :
  ((point   (arclength(p)) on p) randomshifted 
s)
  %(point (arctime t of p) of p) randomshifted s
fi
else :
p
fi
) enddef ;



%D The macro \type{sketchdraw} draws the randomized path. The
%D \type{expr} ... \type{text} trick is copied from the definition of
%D \type{drawarrow}
def sketchdraw expr p =
   do_sketchdraw(p)
enddef;

def do_sketchdraw(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normaldraw p
   sketchrandomized sketch_amount
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normaldraw p t;
  fi
enddef;

%D The macro \type{sketchfill} randomizes the path before filling it.
def sketchfill expr p =
  do_sketchfill(p)
enddef ;

def do_sketchfill(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normalfill p
   sketchrandomized sketch_amount
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normalfill p t;
  fi
enddef;

picture NoisePattern;
NoisePattern := image(
  pickup pencircle xyscaled 0.5bp;
  numeric pmax ; pmax := 7 ;
  numeric x ; numeric y ;
for i = 1 upto pmax:
for j = 1 upto pmax:
 

[NTG-context] Re: Fwd: Re: Working with layer sets with Metapost

2024-02-19 Thread Emanuel Han via ntg-context
Thanks Mikael. This helped indeed.
I updated my example on the Metapost page in the wiki accordingly.

The`pagestate=start` functionality is not documented in the wiki. It's not 
clear for which context commands it can or should be used. Who is willing to 
help out here?
Best regards
Emanuel
On Feb. 19 2024, at 2:39 pm, Mikael Sundqvist  wrote:
> Hi,
>
> Try
> \startTEXpage[pagestate=start]
> /Mikael
> On Mon, Feb 19, 2024 at 2:31 PM Emanuel Han via ntg-context
>  wrote:
> >
> >  I just made a strange observation in the output pdf of the attached 
> > layer_set.tex, which is that when opening it with a pdf viewer like skim or 
> > macos preview and showing miniatures, all pages except the last one show 
> > page number 1 (the last showing page number 2).
> >
> > Which was not the case with the output pdf of the attached 
> > multipage_metapost_mwe-very_simple.tex.
> >
> > How can I change my code to have proper consecutive page numbering in a pdf 
> > viewer?
> >
> > On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context 
> >  wrote:
> >
> > I think I could solve all the problems. Attached the finalized working 
> > example. I created the 
> > https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages 
> > entry with it. Feel free to modify.
> >
> > Cheers
> > Emanuel
> >
> > On Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:
> >
> > Hi,
> >
> > not sure I get what you are missing. But you can try
> >
> > setbounds currentpicture to (fullsquare scaled 200) ;
> >
> > in base. And then do
> >
> > \dorecurse{5}{
> > \startTEXpage[offset=1DK]
> > \useMPgraphic{layerset#1}
> > \stopTEXpage
> > }
> >
> > if that is the looping you are after.
> >
> > /Mikael
> >
> > On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Resp. the solution should be such that each generated PDF page has the 
> > > same dimension, the same background colour and a page number and the 
> > > metapost content on each page has the same scaling factor.
> > >
> > > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
> > >  wrote:
> > >
> > > Dear Mikael,
> > >
> > > I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> > > on), because I need the "setbounds currentpicture to TheFrame" and also 
> > > because I need page numbering inside the MPpage, as done with draw 
> > > textext(decimal(currentime)).
> > >
> > > So, how can I use the \useMPgraphic{layerset1} etc. inside the 
> > > \dorecurse, assuming I name my layersets "layerset1", "layerset2", 
> > > "layerset3" etc.?
> > >
> > > Emanuel
> > >
> > > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
> > >  wrote:
> > >
> > > Dear Mikael,
> > > thanks a lot!
> > > this seems to be the solution! And it looks beatiful enough to me 😄
> > > I'll try to port all my layers to this new method and see if I run into 
> > > new problems again 😅
> > >
> > > Emanuel
> > >
> > >
> > > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> > >
> > > Hi
> > >
> > > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> > >  wrote:
> > > >
> > > > Dear list,
> > > >
> > > > the attached .tex file is the minimal working example we discussed 
> > > > today in the online meeting.
> > > >
> > > > I realized that the approach of looping through k of p[k] is not 
> > > > fitting my needs, because it's not flexible enough.
> > > >
> > > > I need another approach, one which works with layer sets.
> > > >
> > > > I would stop using p as an array, because with the layer sets approach 
> > > > we don't have a fixed order of the layers.
> > > >
> > > > So the definition of the layers would be something like
> > > >
> > > > picture layerA;
> > > > layerA:=image(
> > > > label("Word 1", z1);
> > > > );
> > > >
> > > > picture layerW;
> > > > layerW:=image(
> > > > label("Mot 2", z2);
> > > > );
> > > >
> > > > picture layerM;
> > > > layerM:=image(
> > > > label(&qu

[NTG-context] Re: Fwd: Re: Working with layer sets with Metapost

2024-02-19 Thread Mikael Sundqvist
Hi,

Try

\startTEXpage[pagestate=start]

/Mikael

On Mon, Feb 19, 2024 at 2:31 PM Emanuel Han via ntg-context
 wrote:
>
>  I just made a strange observation in the output pdf of the attached 
> layer_set.tex, which is that when opening it with a pdf viewer like skim or 
> macos preview and showing miniatures, all pages except the last one show page 
> number 1 (the last showing page number 2).
>
> Which was not the case with the output pdf of the attached 
> multipage_metapost_mwe-very_simple.tex.
>
> How can I change my code to have proper consecutive page numbering in a pdf 
> viewer?
>
> On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context 
>  wrote:
>
> I think I could solve all the problems. Attached the finalized working 
> example. I created the 
> https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages entry 
> with it. Feel free to modify.
>
> Cheers
> Emanuel
>
> On Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:
>
> Hi,
>
> not sure I get what you are missing. But you can try
>
> setbounds currentpicture to (fullsquare scaled 200) ;
>
> in base. And then do
>
> \dorecurse{5}{
> \startTEXpage[offset=1DK]
> \useMPgraphic{layerset#1}
> \stopTEXpage
> }
>
> if that is the looping you are after.
>
> /Mikael
>
> On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Resp. the solution should be such that each generated PDF page has the same 
> > dimension, the same background colour and a page number and the metapost 
> > content on each page has the same scaling factor.
> >
> > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> >
> > I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> > on), because I need the "setbounds currentpicture to TheFrame" and also 
> > because I need page numbering inside the MPpage, as done with draw 
> > textext(decimal(currentime)).
> >
> > So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> > assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
> >
> > Emanuel
> >
> > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> > thanks a lot!
> > this seems to be the solution! And it looks beatiful enough to me 😄
> > I'll try to port all my layers to this new method and see if I run into new 
> > problems again 😅
> >
> > Emanuel
> >
> >
> > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> >
> > Hi
> >
> > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Dear list,
> > >
> > > the attached .tex file is the minimal working example we discussed today 
> > > in the online meeting.
> > >
> > > I realized that the approach of looping through k of p[k] is not fitting 
> > > my needs, because it's not flexible enough.
> > >
> > > I need another approach, one which works with layer sets.
> > >
> > > I would stop using p as an array, because with the layer sets approach we 
> > > don't have a fixed order of the layers.
> > >
> > > So the definition of the layers would be something like
> > >
> > > picture layerA;
> > > layerA:=image(
> > > label("Word 1", z1);
> > > );
> > >
> > > picture layerW;
> > > layerW:=image(
> > > label("Mot 2", z2);
> > > );
> > >
> > > picture layerM;
> > > layerM:=image(
> > > label("Parola 3", z3);
> > > );
> > >
> > > picture layerC;
> > > layerC:=image(
> > > label("Wort 4", z3+z1);
> > > );
> > >
> > > picture layerY;
> > > layerY:=image(
> > > label("Nummer 5", z2+z3);
> > > );
> > >
> > > picture layerU;
> > > layerU:=image(
> > > label("number 6", z2+z1);
> > > );
> > >
> > > After that, I would define layer sets and layer subsets. This will be 
> > > done manually for each layer set and each layer subset.
> > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > variable type called "myset".
> > >
> > > myset layersubsetGamma;
> > > layersubsetGamma:={layerU,layerM};
> > >
> > > In my logic, the layers will

[NTG-context] Fwd: Re: Working with layer sets with Metapost

2024-02-19 Thread Emanuel Han via ntg-context
 I just made a strange observation in the output pdf of the attached layer_set.tex, which is that when opening it with a pdf viewer like skim or macos preview and showing miniatures, all pages except the last one show page number 1 (the last showing page number 2). Which was not the case with the output pdf of the attached multipage_metapost_mwe-very_simple.tex. How can I change my code to have proper consecutive page numbering in a pdf viewer?On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context  wrote:I think I could solve all the problems. Attached the finalized working example. I created the https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages entry with it. Feel free to modify.CheersEmanuelOn Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:Hi,not sure I get what you are missing. But you can trysetbounds currentpicture to (fullsquare scaled 200) ;in base. And then do\dorecurse{5}{\startTEXpage[offset=1DK]\useMPgraphic{layerset#1}\stopTEXpage}if that is the looping you are after./MikaelOn Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context wrote:>> Resp. the solution should be such that each generated PDF page has the same dimension, the same background colour and a page number and the metapost content on each page has the same scaling factor.>> On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context  wrote:>> Dear Mikael,>> I actually need to keep the \dorecurse mechanism of the mwe (from line 44 on), because I need the "setbounds currentpicture to TheFrame" and also because I need page numbering inside the MPpage, as done with draw textext(decimal(currentime)).>> So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?>> Emanuel>> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context  wrote:>> Dear Mikael,> thanks a lot!> this seems to be the solution! And it looks beatiful enough to me 😄> I'll try to port all my layers to this new method and see if I run into new problems again 😅>> Emanuel>>> On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:>> Hi>> On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context>  wrote:> >> > Dear list,> >> > the attached .tex file is the minimal working example we discussed today in the online meeting.> >> > I realized that the approach of looping through k of p[k] is not fitting my needs, because it's not flexible enough.> >> > I need another approach, one which works with layer sets.> >> > I would stop using p as an array, because with the layer sets approach we don't have a fixed order of the layers.> >> > So the definition of the layers would be something like> >> > picture layerA;> > layerA:=image(> > label("Word 1", z1);> > );> >> > picture layerW;> > layerW:=image(> > label("Mot 2", z2);> > );> >> > picture layerM;> > layerM:=image(> > label("Parola 3", z3);> > );> >> > picture layerC;> > layerC:=image(> > label("Wort 4", z3+z1);> > );> >> > picture layerY;> > layerY:=image(> > label("Nummer 5", z2+z3);> > );> >> > picture layerU;> > layerU:=image(> > label("number 6", z2+z1);> > );> >> > After that, I would define layer sets and layer subsets. This will be done manually for each layer set and each layer subset.> > I don't know the proper syntax to do that. Let's assume we could use a variable type called "myset".> >> > myset layersubsetGamma;> > layersubsetGamma:={layerU,layerM};> >> > In my logic, the layers will be drawn in the order of their appearance within the {}. In the example, drawn content of layerM might cover drawn content of layerU.> >> > Contrary to a layer subset, each layer set will result in a PDF page, and thus the layer sets are related to each other by an inner order. That's why I would use an array variable here with [].> >> > I don't know how to append a set. In the following example, I assumed there would be a function myappend(, )> >> > myset layerset[];> > layerset1 := {layerW,layerA};> > layerset2 := myappend{layerset1, layerY};> > layerset3 := myappend{layerset2, layersubsetGamma};> > layerset4 := myappend{layerset2, layerU};> > layerset5 := myappend{layerset4, layersubsetGamma};> >> > Finally, I would need each layerset[k] typeset on its own pdf page. And of course on each page k, only the layers which appear in the definition of the layerset[k] should be drawn on top of each other in the order as t

[NTG-context] Re: Working with layer sets with Metapost

2024-02-17 Thread Emanuel Han via ntg-context
I think I could solve all the problems. Attached the finalized working example. 
I created the 
https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages entry 
with it. Feel free to modify.

Cheers
Emanuel

On Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:
> Hi,
>
> not sure I get what you are missing. But you can try
> setbounds currentpicture to (fullsquare scaled 200) ;
> in base. And then do
> \dorecurse{5}{
> \startTEXpage[offset=1DK]
> \useMPgraphic{layerset#1}
> \stopTEXpage
> }
>
> if that is the looping you are after.
> /Mikael
> On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Resp. the solution should be such that each generated PDF page has the same 
> > dimension, the same background colour and a page number and the metapost 
> > content on each page has the same scaling factor.
> >
> > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> >
> > I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> > on), because I need the "setbounds currentpicture to TheFrame" and also 
> > because I need page numbering inside the MPpage, as done with draw 
> > textext(decimal(currentime)).
> >
> > So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> > assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
> >
> > Emanuel
> >
> > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> > thanks a lot!
> > this seems to be the solution! And it looks beatiful enough to me 😄
> > I'll try to port all my layers to this new method and see if I run into new 
> > problems again 😅
> >
> > Emanuel
> >
> >
> > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> >
> > Hi
> >
> > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Dear list,
> > >
> > > the attached .tex file is the minimal working example we discussed today 
> > > in the online meeting.
> > >
> > > I realized that the approach of looping through k of p[k] is not fitting 
> > > my needs, because it's not flexible enough.
> > >
> > > I need another approach, one which works with layer sets.
> > >
> > > I would stop using p as an array, because with the layer sets approach we 
> > > don't have a fixed order of the layers.
> > >
> > > So the definition of the layers would be something like
> > >
> > > picture layerA;
> > > layerA:=image(
> > > label("Word 1", z1);
> > > );
> > >
> > > picture layerW;
> > > layerW:=image(
> > > label("Mot 2", z2);
> > > );
> > >
> > > picture layerM;
> > > layerM:=image(
> > > label("Parola 3", z3);
> > > );
> > >
> > > picture layerC;
> > > layerC:=image(
> > > label("Wort 4", z3+z1);
> > > );
> > >
> > > picture layerY;
> > > layerY:=image(
> > > label("Nummer 5", z2+z3);
> > > );
> > >
> > > picture layerU;
> > > layerU:=image(
> > > label("number 6", z2+z1);
> > > );
> > >
> > > After that, I would define layer sets and layer subsets. This will be 
> > > done manually for each layer set and each layer subset.
> > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > variable type called "myset".
> > >
> > > myset layersubsetGamma;
> > > layersubsetGamma:={layerU,layerM};
> > >
> > > In my logic, the layers will be drawn in the order of their appearance 
> > > within the {}. In the example, drawn content of layerM might cover drawn 
> > > content of layerU.
> > >
> > > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > > thus the layer sets are related to each other by an inner order. That's 
> > > why I would use an array variable here with [].
> > >
> > > I don't know how to append a set. In the following example, I assumed 
> > > there would be a function myappend(,  > > initial set should be appended with>)
> > >
> > > myset layerset[];
> > > layerset1 := {layerW,layerA};
> > > layerset2 := myappend{layerset1, layerY}

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Mikael Sundqvist
Hi,

not sure I get what you are missing. But you can try

setbounds currentpicture to (fullsquare scaled 200) ;

in base. And then do

\dorecurse{5}{
\startTEXpage[offset=1DK]
\useMPgraphic{layerset#1}
\stopTEXpage
}

if that is the looping you are after.

/Mikael

On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
 wrote:
>
> Resp. the solution should be such that each generated PDF page has the same 
> dimension, the same background colour and a page number and the metapost 
> content on each page has the same scaling factor.
>
> On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
>  wrote:
>
> Dear Mikael,
>
> I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> on), because I need the "setbounds currentpicture to TheFrame" and also 
> because I need page numbering inside the MPpage, as done with draw 
> textext(decimal(currentime)).
>
> So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
>
> Emanuel
>
> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
>  wrote:
>
> Dear Mikael,
> thanks a lot!
> this seems to be the solution! And it looks beatiful enough to me 😄
> I'll try to port all my layers to this new method and see if I run into new 
> problems again 😅
>
> Emanuel
>
>
> On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
>
> Hi
>
> On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Dear list,
> >
> > the attached .tex file is the minimal working example we discussed today in 
> > the online meeting.
> >
> > I realized that the approach of looping through k of p[k] is not fitting my 
> > needs, because it's not flexible enough.
> >
> > I need another approach, one which works with layer sets.
> >
> > I would stop using p as an array, because with the layer sets approach we 
> > don't have a fixed order of the layers.
> >
> > So the definition of the layers would be something like
> >
> > picture layerA;
> > layerA:=image(
> > label("Word 1", z1);
> > );
> >
> > picture layerW;
> > layerW:=image(
> > label("Mot 2", z2);
> > );
> >
> > picture layerM;
> > layerM:=image(
> > label("Parola 3", z3);
> > );
> >
> > picture layerC;
> > layerC:=image(
> > label("Wort 4", z3+z1);
> > );
> >
> > picture layerY;
> > layerY:=image(
> > label("Nummer 5", z2+z3);
> > );
> >
> > picture layerU;
> > layerU:=image(
> > label("number 6", z2+z1);
> > );
> >
> > After that, I would define layer sets and layer subsets. This will be done 
> > manually for each layer set and each layer subset.
> > I don't know the proper syntax to do that. Let's assume we could use a 
> > variable type called "myset".
> >
> > myset layersubsetGamma;
> > layersubsetGamma:={layerU,layerM};
> >
> > In my logic, the layers will be drawn in the order of their appearance 
> > within the {}. In the example, drawn content of layerM might cover drawn 
> > content of layerU.
> >
> > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > thus the layer sets are related to each other by an inner order. That's why 
> > I would use an array variable here with [].
> >
> > I don't know how to append a set. In the following example, I assumed there 
> > would be a function myappend(,  > set should be appended with>)
> >
> > myset layerset[];
> > layerset1 := {layerW,layerA};
> > layerset2 := myappend{layerset1, layerY};
> > layerset3 := myappend{layerset2, layersubsetGamma};
> > layerset4 := myappend{layerset2, layerU};
> > layerset5 := myappend{layerset4, layersubsetGamma};
> >
> > Finally, I would need each layerset[k] typeset on its own pdf page. And of 
> > course on each page k, only the layers which appear in the definition of 
> > the layerset[k] should be drawn on top of each other in the order as they 
> > appear in that definition.
> >
> > I'm very curious to hear your suggestions.
> >
>
> Not beautiful, perhaps, but maybe something like this could work? I
> think there is no way out of doing some manual work to tell what you
> want included on each page.
>
> \startuseMPgraphic{base}
> z1 = origin ;
> z2 = (10,50) ;
> z3 = (40,30) ;
>
> picture layerA;
> layerA:=ima

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Emanuel Han via ntg-context
Resp. the solution should be such that each generated PDF page has the same 
dimension, the same background colour and a page number and the metapost 
content on each page has the same scaling factor.

On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context  
wrote:
> Dear Mikael,
>
> I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> on), because I need the "setbounds currentpicture to TheFrame" and also 
> because I need page numbering inside the MPpage, as done with draw 
> textext(decimal(currentime)).
> So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
> Emanuel
> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
>  wrote:
> > Dear Mikael,
> > thanks a lot!
> > this seems to be the solution! And it looks beatiful enough to me 😄
> > I'll try to port all my layers to this new method and see if I run into new 
> > problems again 😅
> >
> > Emanuel
> >
> > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> > > Hi
> > >
> > > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> > >  wrote:
> > > >
> > > > Dear list,
> > > >
> > > > the attached .tex file is the minimal working example we discussed 
> > > > today in the online meeting.
> > > >
> > > > I realized that the approach of looping through k of p[k] is not 
> > > > fitting my needs, because it's not flexible enough.
> > > >
> > > > I need another approach, one which works with layer sets.
> > > >
> > > > I would stop using p as an array, because with the layer sets approach 
> > > > we don't have a fixed order of the layers.
> > > >
> > > > So the definition of the layers would be something like
> > > >
> > > > picture layerA;
> > > > layerA:=image(
> > > > label("Word 1", z1);
> > > > );
> > > >
> > > > picture layerW;
> > > > layerW:=image(
> > > > label("Mot 2", z2);
> > > > );
> > > >
> > > > picture layerM;
> > > > layerM:=image(
> > > > label("Parola 3", z3);
> > > > );
> > > >
> > > > picture layerC;
> > > > layerC:=image(
> > > > label("Wort 4", z3+z1);
> > > > );
> > > >
> > > > picture layerY;
> > > > layerY:=image(
> > > > label("Nummer 5", z2+z3);
> > > > );
> > > >
> > > > picture layerU;
> > > > layerU:=image(
> > > > label("number 6", z2+z1);
> > > > );
> > > >
> > > > After that, I would define layer sets and layer subsets. This will be 
> > > > done manually for each layer set and each layer subset.
> > > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > > variable type called "myset".
> > > >
> > > > myset layersubsetGamma;
> > > > layersubsetGamma:={layerU,layerM};
> > > >
> > > > In my logic, the layers will be drawn in the order of their appearance 
> > > > within the {}. In the example, drawn content of layerM might cover 
> > > > drawn content of layerU.
> > > >
> > > > Contrary to a layer subset, each layer set will result in a PDF page, 
> > > > and thus the layer sets are related to each other by an inner order. 
> > > > That's why I would use an array variable here with [].
> > > >
> > > > I don't know how to append a set. In the following example, I assumed 
> > > > there would be a function myappend(,  > > > initial set should be appended with>)
> > > >
> > > > myset layerset[];
> > > > layerset1 := {layerW,layerA};
> > > > layerset2 := myappend{layerset1, layerY};
> > > > layerset3 := myappend{layerset2, layersubsetGamma};
> > > > layerset4 := myappend{layerset2, layerU};
> > > > layerset5 := myappend{layerset4, layersubsetGamma};
> > > >
> > > > Finally, I would need each layerset[k] typeset on its own pdf page. And 
> > > > of course on each page k, only the layers which appear in the 
> > > > definition of the layerset[k] should be drawn on top of each other in 
> > >

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Emanuel Han via ntg-context
Dear Mikael,

I actually need to keep the \dorecurse mechanism of the mwe (from line 44 on), 
because I need the "setbounds currentpicture to TheFrame" and also because I 
need page numbering inside the MPpage, as done with draw 
textext(decimal(currentime)).
So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
Emanuel
On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context  
wrote:
> Dear Mikael,
> thanks a lot!
> this seems to be the solution! And it looks beatiful enough to me 😄
> I'll try to port all my layers to this new method and see if I run into new 
> problems again 😅
>
> Emanuel
>
> On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> > Hi
> >
> > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Dear list,
> > >
> > > the attached .tex file is the minimal working example we discussed today 
> > > in the online meeting.
> > >
> > > I realized that the approach of looping through k of p[k] is not fitting 
> > > my needs, because it's not flexible enough.
> > >
> > > I need another approach, one which works with layer sets.
> > >
> > > I would stop using p as an array, because with the layer sets approach we 
> > > don't have a fixed order of the layers.
> > >
> > > So the definition of the layers would be something like
> > >
> > > picture layerA;
> > > layerA:=image(
> > > label("Word 1", z1);
> > > );
> > >
> > > picture layerW;
> > > layerW:=image(
> > > label("Mot 2", z2);
> > > );
> > >
> > > picture layerM;
> > > layerM:=image(
> > > label("Parola 3", z3);
> > > );
> > >
> > > picture layerC;
> > > layerC:=image(
> > > label("Wort 4", z3+z1);
> > > );
> > >
> > > picture layerY;
> > > layerY:=image(
> > > label("Nummer 5", z2+z3);
> > > );
> > >
> > > picture layerU;
> > > layerU:=image(
> > > label("number 6", z2+z1);
> > > );
> > >
> > > After that, I would define layer sets and layer subsets. This will be 
> > > done manually for each layer set and each layer subset.
> > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > variable type called "myset".
> > >
> > > myset layersubsetGamma;
> > > layersubsetGamma:={layerU,layerM};
> > >
> > > In my logic, the layers will be drawn in the order of their appearance 
> > > within the {}. In the example, drawn content of layerM might cover drawn 
> > > content of layerU.
> > >
> > > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > > thus the layer sets are related to each other by an inner order. That's 
> > > why I would use an array variable here with [].
> > >
> > > I don't know how to append a set. In the following example, I assumed 
> > > there would be a function myappend(,  > > initial set should be appended with>)
> > >
> > > myset layerset[];
> > > layerset1 := {layerW,layerA};
> > > layerset2 := myappend{layerset1, layerY};
> > > layerset3 := myappend{layerset2, layersubsetGamma};
> > > layerset4 := myappend{layerset2, layerU};
> > > layerset5 := myappend{layerset4, layersubsetGamma};
> > >
> > > Finally, I would need each layerset[k] typeset on its own pdf page. And 
> > > of course on each page k, only the layers which appear in the definition 
> > > of the layerset[k] should be drawn on top of each other in the order as 
> > > they appear in that definition.
> > >
> > > I'm very curious to hear your suggestions.
> > >
> >
> > Not beautiful, perhaps, but maybe something like this could work? I
> > think there is no way out of doing some manual work to tell what you
> > want included on each page.
> >
> > \startuseMPgraphic{base}
> > z1 = origin ;
> > z2 = (10,50) ;
> > z3 = (40,30) ;
> >
> > picture layerA;
> > layerA:=image(
> > label("Word 1", z1);
> > );
> >
> > picture layerW;
> > layerW:=image(
> > label("Mot 2", z2);
> > );
> >
> > picture layerM;
> > layerM:=image(
> > lab

[NTG-context] Re: context version 20240118 ("Registerhaltigkeit")

2024-01-23 Thread Thomas Meyer
That's it! Many thanks to Hans, Hraban and especially Wolfgang for his 
solution. This environment should become part of ConTeXt!


I have been a LaTeX/XeTeX/LuaLaTeX user for over 30 years and used it to 
write my papers during my studies and use it for almost all my writing.
Now I wanted to try ConTeXt and will be glad if anyone can help me. As I 
said, I am only a user.


Many thanks and best regards
Thomas


Am 22.01.24 um 20:24 schrieb Wolfgang Schuster:

Thomas Meyer schrieb am 22.01.2024 um 13:04:



Am 22.01.24 um 12:06 schrieb Henning Hraban Ramm:

Am 22.01.24 um 11:46 schrieb Thomas Meyer:
I might get a bit impatient if I have the impression that others 
get an answer faster. Sorry for that.


It’s not unusual to get that impression. It depends on the current 
attention, capacity and mood of the few who can answer your questions.


So the problem is still \hfill that the last paragraph is not on 
grid in the new and the old version (and comma).


Grid is not as easy as it looks first. Low level tricks like fills 
or skips can mess it up.



Maybe \startlinecorrection helps… (No, it doesn’t.)

It also doesn’t help to add a \blank or \par after \vfill.


I know it, i tried it. And I tried \snaptogrid \vbox {}, it doesn't 
work too.


Only counting empty rows and set the number in \blank[ *big] works!



You need a fixed space (multiple of the line distance) between the 
text blocks and \vfill is a variable space which isn't what you want 
here.


TO get the desired space between the blocks you have to measure the 
height of the text at the bottom and calculate the number of lines 
which have to be added in the gap. Below is a simple solution which 
adds the required number of \blank lines.


\def\PlaceAtBottom
  {\par
   \dowithnextbox
  {\scratchdimen\dimexpr\pagegoal-\pagetotal\relax
   \ifdim\nextboxht>\scratchdimen
 \page
 \getnoflines{\dimexpr\textheight-\nextboxht\relax}%
\dontleavehmode\blank[\number\numexpr\noflines-2\relax*line]%
 \unvbox\nextbox
   \else
 \getnoflines{\dimexpr\scratchdimen-\nextboxht\relax}%
 \blank[\number\numexpr\noflines-1\relax*line]%
 \unvbox\nextbox
   \fi}
  \vbox}

\let\stopPlaceAtBottom\egroup

\def\startPlaceAtBottom
  {\PlaceAtBottom\bgroup}

\mainlanguage[de]
\setupbodyfont[libertinus, 12pt]

\setuppagenumbering
  [location={footer,middle}]

\setuplayout
  [grid=yes]

\showgrid

\starttext

\samplefile{lorem}

\startPlaceAtBottom
{\sl\samplefile{lorem}}
\stopPlaceAtBottom

\page

\dorecurse{4}{\samplefile{lorem}}

\startPlaceAtBottom
{\sl\samplefile{lorem}}
\stopPlaceAtBottom

\stoptext

Wolfgang
___ 

If your question is of interest to others as well, please add an entry 
to the Wiki!


maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net 
(mirror)

archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___ 

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: context version 20240118 ("Registerhaltigkeit")

2024-01-22 Thread Wolfgang Schuster

Thomas Meyer schrieb am 22.01.2024 um 13:04:



Am 22.01.24 um 12:06 schrieb Henning Hraban Ramm:

Am 22.01.24 um 11:46 schrieb Thomas Meyer:
I might get a bit impatient if I have the impression that others get 
an answer faster. Sorry for that.


It’s not unusual to get that impression. It depends on the current 
attention, capacity and mood of the few who can answer your questions.


So the problem is still \hfill that the last paragraph is not on grid 
in the new and the old version (and comma).


Grid is not as easy as it looks first. Low level tricks like fills or 
skips can mess it up.



Maybe \startlinecorrection helps… (No, it doesn’t.)

It also doesn’t help to add a \blank or \par after \vfill.


I know it, i tried it. And I tried \snaptogrid \vbox {}, it doesn't work 
too.


Only counting empty rows and set the number in \blank[ *big] works!



You need a fixed space (multiple of the line distance) between the text 
blocks and \vfill is a variable space which isn't what you want here.


TO get the desired space between the blocks you have to measure the 
height of the text at the bottom and calculate the number of lines which 
have to be added in the gap. Below is a simple solution which adds the 
required number of \blank lines.


\def\PlaceAtBottom
  {\par
   \dowithnextbox
  {\scratchdimen\dimexpr\pagegoal-\pagetotal\relax
   \ifdim\nextboxht>\scratchdimen
 \page
 \getnoflines{\dimexpr\textheight-\nextboxht\relax}%
 \dontleavehmode\blank[\number\numexpr\noflines-2\relax*line]%
 \unvbox\nextbox
   \else
 \getnoflines{\dimexpr\scratchdimen-\nextboxht\relax}%
 \blank[\number\numexpr\noflines-1\relax*line]%
 \unvbox\nextbox
   \fi}
  \vbox}

\let\stopPlaceAtBottom\egroup

\def\startPlaceAtBottom
  {\PlaceAtBottom\bgroup}

\mainlanguage[de]
\setupbodyfont[libertinus, 12pt]

\setuppagenumbering
  [location={footer,middle}]

\setuplayout
  [grid=yes]

\showgrid

\starttext

\samplefile{lorem}

\startPlaceAtBottom
{\sl\samplefile{lorem}}
\stopPlaceAtBottom

\page

\dorecurse{4}{\samplefile{lorem}}

\startPlaceAtBottom
{\sl\samplefile{lorem}}
\stopPlaceAtBottom

\stoptext

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Why LuaMetaTex is so slow?

2024-01-19 Thread Hans Hagen

On 1/19/2024 1:33 AM, Aditya Mahajan wrote:


\starttext

\dorecurse{5000}{\ReadFile{knuth}}

\stoptext

I'll send you the PDFs offlist.

lmtx defaults to 'modern' so you need to

\setupbodyfont[modern]

for mkiv

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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Why LuaMetaTex is so slow?

2024-01-18 Thread Aditya Mahajan
On Fri, 19 Jan 2024, Hans Hagen via ntg-context wrote:

> On 1/19/2024 12:34 AM, Aditya Mahajan wrote:
> > On Thu, 18 Jan 2024, Hans Hagen wrote:
> > 
> >> Of course we'll never be as fast as (pure) plain tex (no layers added) or
> >> latex (which often is advocated as faster than context).
> > 
> > I was curious, so did a quick experiment: typeset \input knuth 500 times.
> > Here are the results:
> > 
> > pdflatex: 547 pages/sec
> > lualatex: 308 pages/sec
> 
> opentype or type 1 ?

type 1. I did not change anything in the defaults. I'll try to figure out how 
to load opentype fonts in latex, and test lualatex. 

> > MKIV: 130 pages/sec
> > LMTX: 147 pages/sec
> 
> that is weird as lmtx is always faster here (we loose some 15% on the backend
> compared to luatex, maybe even more, but we gain back quite a bit elsewhere
> for various reasons)

LMTX is faster for me as well.

> > Interestingly, pdflatex, lualatex, and MkIV all generated pdf with 1112
> > pages, while LMTX generated a pdf with 1250 pages. Both MkIV and LMTX take
> > the same time to run (8.5 sec) but LMTX generates more pages so it is
> > faster.
> 
> puzzling
> 
> > Of course, this is a meaningless experiment from a practical point of view
> > as a 1000 page document will be more complex than just text.
> % engine=pdftex  1.2
> % engine=luatmetatex 1.6
> % engine=luatex  1.8
> % engine=xetex   2.4
> 
> \starttext
> 
> \dorecurse{500} {
> \input knuth \par
> }
> 
> \stoptext
> 
> 125 pages, so how does your test file look

5000 recursions (not 500, sorry about that). 


\starttext

\dorecurse{5000}{\ReadFile{knuth}}

\stoptext

I'll send you the PDFs offlist. 

Aditya
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Why LuaMetaTex is so slow?

2024-01-18 Thread Hans Hagen via ntg-context

On 1/19/2024 12:34 AM, Aditya Mahajan wrote:

On Thu, 18 Jan 2024, Hans Hagen wrote:


Of course we'll never be as fast as (pure) plain tex (no layers added) or
latex (which often is advocated as faster than context).


I was curious, so did a quick experiment: typeset \input knuth 500 times. Here 
are the results:

pdflatex: 547 pages/sec
lualatex: 308 pages/sec


opentype or type 1 ?


MKIV: 130 pages/sec
LMTX: 147 pages/sec


that is weird as lmtx is always faster here (we loose some 15% on the 
backend compared to luatex, maybe even more, but we gain back quite a 
bit elsewhere for various reasons)



Interestingly, pdflatex, lualatex, and MkIV all generated pdf with 1112 pages, 
while LMTX generated a pdf with 1250 pages. Both MkIV and LMTX take the same 
time to run (8.5 sec) but LMTX generates more pages so it is faster.


puzzling


Of course, this is a meaningless experiment from a practical point of view as a 
1000 page document will be more complex than just text.

% engine=pdftex  1.2
% engine=luatmetatex 1.6
% engine=luatex  1.8
% engine=xetex   2.4

\starttext

\dorecurse{500} {
\input knuth \par
}

\stoptext

125 pages, so how does your test file look

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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] How to Create Asymmetrical Continuous Columns in ConTeXt?

2024-01-18 Thread seyal . zavira
Hi all,

I have a lengthy text that I wish to seamlessly incorporate using the 
\input{mytext} command in ConTeXt. 
Additionally, I aim to present it in asymmetrical continuous columns, where the 
text flows over several pages.

I have tried paragraphs and columns, but in paragraphs, I can't flow text 
across several pages without manually breaking it, and in columns, I haven't 
found a way to implement asymmetric columns.

How can I achieve this layout in ConTeXt? this is a MWE but it does not work 
properly:

\definecolumnset[mymixedcolumn][n=2]
\setupcolumnset[mymixedcolumn:1][width=4cm]
\setupcolumnset[mymixedcolumn:2][width=7cm]

\starttext
\startcolumnset[mymixedcolumn]
\dorecurse{5}{
\input{knuth}
}
\stopcolumnset
\stoptext

also is there a mechanism to automatically continue text between desired 
frames? For example, is there a way to write a function that, if the text 
reaches the end of the line and there is not enough space for another line in 
that frame, it continues the text in another frame that is already specified? 
in other word How do you make text flow to another part of a page?

Thanks in advance.
Best regards,
Seyal
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: conversion from realpage to pagenumber

2024-01-14 Thread mf

Thank you Wolfgang,

but my problem is getting back the page of the document starting from a 
"realpage" value picked from structures.registers.collected in the .tuc 
file.


Anyway, looking at the .tuc file produced by your example, I found that 
structures.pages.collected has all the information I need to reconstruct 
the printed page number.


Here's an excerpt of the .tuc file:

utilitydata.structures.pages.collected={
 {
  ["block"]="frontpart",
  ["number"]=1,
  ["numberdata"]=1,
  ["prefixdata"]=2,
  ["state"]="start",
 },
 {
  ["block"]="frontpart",
  ["number"]=2,
  ["numberdata"]=1,
  ["prefixdata"]=2,
  ["state"]="start",
 },
...

 {
  ["block"]="bodypart",
  ["number"]=1,
  ["numberdata"]=1,
  ["prefixdata"]=2,
  ["state"]="start",
 },
 {
  ["block"]="bodypart",
  ["number"]=2,
  ["numberdata"]=1,
  ["prefixdata"]=2,
  ["state"]="start",
 },
...

So your answer was not the solution, but it's been the way to the solution.

Thank you again,

Massi


Il 12/01/24 12:02, Wolfgang Schuster ha scritto:

mf schrieb am 12.01.2024 um 10:18:

Hello list,

how do I convert the realpage number to a page number?

Suppose you have a document with a frontmatter of 20 pages in roman 
numerals, followed by the main text starting from page 1 in arabic 
numerals.


So the twelfth page is 'XII', while the twenty-second is '2'.

How do I get 'XII' from 12 and '2' from 22?


\defineconversionset
  [frontpart:pagenumber] [] [romannumerals]

\setuppagenumber
  [way=byblock]

% Alternative method for "way=byblock" when you have an appendix where
% the pagenumber of the bodypart continues rather than being reset
%
% \startsectionblockenvironment[bodypart]
%   \resetuserpagenumber
% \stopsectionblockenvironment

\starttext

\startfrontmatter
\dorecurse{20}{\samplefile{lorem}\page}
\stopfrontmatter

\startbodymatter
\dorecurse{20}{\samplefile{lorem}\page}
\stopbodymatter

\stoptext

Wolfgang


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Asking help for better way to make tickets.

2024-01-12 Thread Marco Patzer
On Fri, 12 Jan 2024 23:05:14 +0900
Jeong Dal via ntg-context  wrote:

> I’d like to make a ticket on A4 as follows:
> 
> 1. Use all of A4(no margin, no header, no footer,…)
> 2. Arange 12 tickets in the form of 3 x 4 on one page,
> 3. Two rows are same,
> 4. Numbers in the center of the ticket which is increasing.
> 
> I use the following code to make it.

Here's a suggestion:

\definepapersize
  [jeong]
  [width=67mm,
   height=73mm]

\setuppapersize
  [jeong]
  [A4]

\setuppaper
  [nx=3, ny=4,
   dx=4.4mm, dy=1.5mm]

\setuparranging
  [XY]

\setuplayout
  [page]

\setuppagenumbering
  [state=stop]

\setupmakeup
  [standard]
  [align=middle]

\setupblank
  [2*line]

\showframe
\starttext
  \dorecurse{12}{%%
\startstandardmakeup
Text \blank
{\tfd\recurselevel} \blank
Text
\stopstandardmakeup
\page}
\stoptext

That's how I'd approach it. Not sure if it meets all your
requirements, though.

Marco
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Asking help for better way to make tickets.

2024-01-12 Thread Jeong Dal via ntg-context
Dear all,I’d like to make a ticket on A4 as follows:1. Use all of A4(no margin, no header, no footer,…)2. Arange 12 tickets in the form of 3 x 4 on one page,3. Two rows are same,4. Numbers in the center of the ticket which is increasing.I use the following code to make it.but I think that there is a better and simpler way to do it which I don’t know.I hope that someone give me a nicer way to do it.Thank you for reading.Best regards,Dalyoung\setuppapersize[A4]%[A4]\setuplayout[  width=210mm,  height=297mm,  topspace=0pt,  backspace=0pt,  header=0mm,  footer=0mm,  margin=0mm,  bottomspace=0mm   ]\startuseMPgraphic{ticket}{i,j}path p,q;pair A,B;p := unitsquare xyscaled (67mm,73mm);A := point 0.5 of p;B := point 2.5 of p;draw p;label(textext("Text"), .25A+.75B );label(textext("\tfd " & decimal (3*\MPvar{i}-\MPvar{j})), center p);label(textext("Text"), .75A + .25B);\stopuseMPgraphic\starttext\dorecurse{4}{\startcombination[3*1]%distance=0mm]{\useMPgraphic{ticket}{i=\recurselevel,j=2}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=1}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=0}}{}\stopcombination\startcombination[3*1]%distance=0mm]{\useMPgraphic{ticket}{i=\recurselevel,j=2}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=1}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=0}}{}\stopcombination}\page\dostepwiserecurse{5}{8}{1}{\startcombination[3*1]%distance=0mm]{\useMPgraphic{ticket}{i=\recurselevel,j=2}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=1}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=0}}{}\stopcombination\startcombination[3*1]%distance=0mm]{\useMPgraphic{ticket}{i=\recurselevel,j=2}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=1}}{}{\useMPgraphic{ticket}{i=\recurselevel,j=0}}{}\stopcombination}\stoptext

test.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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: conversion from realpage to pagenumber

2024-01-12 Thread Wolfgang Schuster

mf schrieb am 12.01.2024 um 10:18:

Hello list,

how do I convert the realpage number to a page number?

Suppose you have a document with a frontmatter of 20 pages in roman 
numerals, followed by the main text starting from page 1 in arabic 
numerals.


So the twelfth page is 'XII', while the twenty-second is '2'.

How do I get 'XII' from 12 and '2' from 22?


\defineconversionset
  [frontpart:pagenumber] [] [romannumerals]

\setuppagenumber
  [way=byblock]

% Alternative method for "way=byblock" when you have an appendix where
% the pagenumber of the bodypart continues rather than being reset
%
% \startsectionblockenvironment[bodypart]
%   \resetuserpagenumber
% \stopsectionblockenvironment

\starttext

\startfrontmatter
\dorecurse{20}{\samplefile{lorem}\page}
\stopfrontmatter

\startbodymatter
\dorecurse{20}{\samplefile{lorem}\page}
\stopbodymatter

\stoptext

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: multipage metapost output from ConTeXt

2024-01-06 Thread Emanuel Han via ntg-context
Hi Mikael,

with the solution provided by you, I could work on my graphic which grows from 
page to page. So far I have already 28 pages. Now I would like to go back to 
the summed graphic of p1 to p21 and add the coming p29, p30 etc. to only that 
(that means contents of p22 to p28 should not be visible on pages 29 and 
forward).
I don't bother you with my code which is too long. Let's use the mwe provided 
by you (I added it here for convenience), where we have 3 pages. How can I have 
the content of p2 not be added on page 3 and forward?
\startuseMPgraphic{base}
picture p[];
path TheFrame ;
TheFrame := fullsquare scaled 5in ;
z1 = (60,40);
z2 = (40,90);
z3 = (10,70);

p1:=image(
label("Word 1", z1);
);

p2:=image(
label("Mot 2", z2);
);

p3:=image(
label("Parola 3", z3);
);

\stopuseMPgraphic
\starttext
\dorecurse{3}{ % Frame
\startMPpage[pagestate=start]
\includeMPgraphic{base}
currentime := #1 ;
% Just for learning :
draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
draw textext("T="&decimal(currentime)) scaled 2 shifted(0,2in)
withcolor magenta ;
for k=1 upto currentime: addto currentpicture also p[k]; endfor
setbounds currentpicture to TheFrame ;

desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
currentpicture := currentpicture xysized (desiredformat ,desiredformat );
\stopMPpage
}

\stoptext
On Dez. 2 2023, at 7:46 pm, Mikael Sundqvist  wrote:
> Hi,
>
> I don't know if \startMPinclusions \stopMPinclusions shall work with
> \startMPpage and \stopMPpage. In this case, one can use a separate
> graphics:
>
> \startuseMPgraphic{base}
> picture p[];
> path TheFrame ;
> TheFrame := fullsquare scaled 5in ;
> z1 = (60,40);
> z2 = (40,90);
> z3 = (10,70);
>
> p1:=image(
> label("Word 1", z1);
> );
>
> p2:=image(
> label("Mot 2", z2);
> );
>
> p3:=image(
> label("Parola 3", z3);
> );
>
> \stopuseMPgraphic
> \starttext
> \dorecurse{3}{ % Frame
> \startMPpage[pagestate=start]
> \includeMPgraphic{base}
> currentime := #1 ;
> % Just for learning :
> draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
> draw textext("T="&decimal(currentime)) scaled 2 shifted(0,2in)
> withcolor magenta ;
> for k=1 upto currentime: addto currentpicture also p[k]; endfor
> setbounds currentpicture to TheFrame ;
>
> desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
> currentpicture := currentpicture xysized (desiredformat ,desiredformat );
> \stopMPpage
> }
>
> \stoptext
> /Mikael
> On Sat, Dec 2, 2023 at 6:14 PM Emanuel Han via ntg-context
>  wrote:
> >
> > Hi Mikael,
> >
> > here's a very simple mwe for the label(textext()) issue. On page 1, the 
> > text "Word 1" should be drawn in position z1. On page 2, the same text in 
> > the same position should be visible, and the text "Mot 2" in position p2 
> > should be added. And so on.
> >
> > \startMPinclusions
> >
> > picture p[];
> > path TheFrame ;
> > TheFrame := fullsquare scaled 5in ;
> >
> > z1 = (60,40);
> > z2 = (40,90);
> > z3 = (10,70);
> >
> > p1:=image(
> > label(textext("Word 1"), z1);
> > );
> >
> > p2:=image(
> > label(textext("Mot 2"), z2);
> > );
> >
> > p3:=image(
> > label(textext("Parola 3"), z3);
> > );
> >
> > \stopMPinclusions
> >
> > \starttext
> >
> > \dorecurse{3}{ % Frame
> > \startMPpage[pagestate=start]
> > currentime := #1 ;
> > % Just for learning :
> > draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
> > draw textext("T="&decimal(currentime)) scaled 2 shifted(0,2in) withcolor 
> > magenta ;
> > for k=1 upto currentime: draw p[k]; endfor
> > setbounds currentpicture to TheFrame ;
> >
> > desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
> > currentpicture := currentpicture xysized (desiredformat ,desiredformat );
> >
> > \stopMPpage
> > }
> >
> > \stoptext
> >
> > On Dez. 2 2023, at 5:22 pm, Mikael Sundqvist  wrote:
> >
> > Hi Emanuel,
> >
> > I am not sure I understand your question, and since you use fonts that
> > i do not have, I cannot test your example as is. But, maybe, if you
> > want to redraw a picture, you can do
> >
> > addto currentpicture also p1;
> >
> > where you want it.
> >
> > /Mikael
> >
> > PS For the text thing, I did not get it. Could one have a _very
> > simple_ example showing only that problem and no

[NTG-context] Re: Problem with \startlinenumbering left and right arguments

2023-12-09 Thread Wolfgang Schuster

Marcus Vinicius Mesquita schrieb am 07.12.2023 um 19:21:

Dear List,

In the MWE below, the left and right arguments are not applied in the
last chapter. How can this be fixed?

\starttext
\startlinenumbering[left={[},right={]}]

\dorecurse{5}{%
\startchapter[title={Knuth}]
\samplefile{knuth}
\stopchapter
}

\stoplinenumbering
\stoptext


When you have a single linenumbering block in your document you can set
the left/right values at the begin of your document with

    \setuplinenumbering[left={[},right={]}]

When you have multiple linenumbering blocks in your document you can
ensure the values stay also on the last page with a forced page break before
the block ends, e.g.

    \page
    \stoplinenumbering

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Problem with \startlinenumbering left and right arguments

2023-12-07 Thread Marcus Vinicius Mesquita
Dear List,

In the MWE below, the left and right arguments are not applied in the
last chapter. How can this be fixed?

\starttext
\startlinenumbering[left={[},right={]}]

\dorecurse{5}{%
\startchapter[title={Knuth}]
\samplefile{knuth}
\stopchapter
}

\stoplinenumbering
\stoptext

Kind regards

Marcus Vinicius

-- 
Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o
corpo nem seus membros, por ser descanso da alma, primavera do
coração, distração do aflito, entretenimento do solitário, e viático
do viajante.

Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik)
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: (again) wrong destination types?

2023-12-04 Thread Bruce Horrocks


> On 3 Dec 2023, at 15:26, Pablo Rodriguez via ntg-context  
> wrote:
> 
> On 11/22/23 00:06, Bruce Horrocks wrote:
>> [...]
>> I changed your example to the following:
>> \setupinteraction[state=start, page=name, focus=standard]
>> \starttext
>> \input knuth \par
>> a\footnote{b} \par
>> \dorecurse{7}{\input knuth \par}
>> \stoptext
> 
> Many thanks for your fast reply, Bruce.
> 
> I wanted to reply much sooner, but it was really impossible for me.
> 
>> From your explanation, the first link (body to footnote, your point b)
> has destination to fit the whole page inside the viewer.
> 
> The second link (footnote to body, your point c) has the destination to
> reach a position inside the page (where the destination lies). This is
> what "focus=standard" should achieve.
> 
> In PDF terms (simplified), fit to page destinations are /Fit
> destinations and placed destinations are /XYZ destinations.
> 
> This sample shows what might be the root issue here:
> 
>  \setupinteraction[state=start, page=name, focus=standard]
>  \starttext
>  \completecontent
>  \chapter{Chapter}
>  a\footnote{b}
>  \stoptext
> 
> ConTeXt handles internally links in categories. For some reason unknown
> to me, "page=name" triggers that special operation links contain /Fit
> instead /XYZ destinations.
> 
> This is similar to the wrong link destinations (fit instead of standard)
> from TOC (but not in footnotes [which are right]) when compiled with MkIV:
> 
>  \setupinteraction[state=start, focus=standard]
>  \starttext
>  \completecontent
>  \chapter{Chapter}
>  a\footnote{b}
>  \stoptext
> 
> I hope it is clearer now. Let me know if it is not.
> 
> My issue is that I cannot avoid having "page=name" for links to external
> documents, but this breaks footnotes and other special operation links.

What are you using for links to external documents? If just a single command 
such as \goto then you might be able to get away with defining a wrapper (e.g. 
\myGoto) that does \setupinteraction[state=start,page=name,focus=standard] then 
the \goto command then \setupinteraction[state=start,page=fit,focus=standard] 
afterwards.

(Assuming calling \setupinteraction that many times does not cause problems in 
itself.)

—
Bruce Horrocks
Hampshire, UK

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-04 Thread Fabrice L
Dear Emanuel,

> Le 2 déc. 2023 à 12:08, Emanuel Han via ntg-context  a 
> écrit :
> 
> Hi Mikael,
> 
> here's a very simple mwe for the label(textext()) issue. On page 1, the text 
> "Word 1" should be drawn in position z1. On page 2, the same text in the same 
> position should be visible, and the text "Mot 2" in position p2 should be 
> added. And so on.
> 
> \startMPinclusions
> 
> picture p[];
>  path TheFrame ;
>  TheFrame := fullsquare scaled 5in ;
>  
>  z1 = (60,40);
>  z2 = (40,90); 
>  z3 = (10,70);
> 
> p1:=image(
> label(textext("Word 1"), z1);
> );
> 
> p2:=image(
> label(textext("Mot 2"), z2);
> );
> 
> p3:=image(
> label(textext("Parola 3"), z3);
> );
> 
> \stopMPinclusions
> 
> \starttext
> 
> \dorecurse{3}{ % Frame
> \startMPpage[pagestate=start]  
>  currentime := #1 ;
>  % Just for learning :
>  draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
>  draw textext("T="&decimal(currentime)) scaled 2 shifted(0,2in) withcolor 
> magenta ;
>  for k=1 upto currentime: draw p[k]; endfor
>  setbounds currentpicture to TheFrame ;
> 
>  desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
>  currentpicture := currentpicture xysized (desiredformat ,desiredformat );
>  
> \stopMPpage
> }
> 
> \stoptext
> 
> On Dez. 2 2023, at 5:22 pm, Mikael Sundqvist  wrote:
> Hi Emanuel,
> 
> I am not sure I understand your question, and since you use fonts that
> i do not have, I cannot test your example as is. But, maybe, if you
> want to redraw a picture, you can do
> 
> addto currentpicture also p1;
> 
> where you want it.
> 
> /Mikael
> 
> PS For the text thing, I did not get it. Could one have a _very
> simple_ example showing only that problem and no other problem?
> 
> On Sat, Dec 2, 2023 at 12:58 PM fv leung  wrote:
> >
> > You didn't specify the color of path A in p2 and p4. So it's drawn in black.
> > The other issue, I can't help.
> >
> > Emanuel Han via ntg-context  於 2023年12月2日 週六 下午7:23寫道:
> >>
> >> So is there a way to circumvent these issues? Or an explanation for this 
> >> behavior, so that I can try to find a solution by myself?
> >>
> >> Thanks
> >> Emanuel
> >>
> >> On Nov. 29 2023, at 12:25 pm, Emanuel Han via ntg-context 
> >>  wrote:
> >>
> >> Dear Aditya and Fabrice,
> >> thanks for your responses.
> >>
> >> I included some of Fabrice's code into mine for testing purpose, and 
> >> indeed the multipage works now.
> >> What is bizarre is that issues appear now that didn't appear before:
> >>
> >> Path A is drawn with color red on page 1, and in color black on all 
> >> following pages, while it should stay red.
> >> textext(, ) is overwriting  with 
> >> "T="&decimal(currentime) which has been used previously in textext() 
> >> before the for k=1 endfor loop. This overwriting happens only for the 
> >> first textext() which occurs inside the for k=1 endfor loop. All other 
> >> textext() inside the for k=1 endfor loop are not drawn at all. If the line 
> >> « draw textext("T="&decimal(currentime)) scaled 2 shifted(0,2in) withcolor 
> >> magenta ; » is commented out, the first textext() inside the for k=1 
> >> endfor loop is not drawn neither. It must be an issue with textext(), 
> >> because when I replace textext() by lmt_outline[], the text is drawn.
> >>
> >> Adjusted mwe:
> >>
> >> \enableregime[utf] % enable unicoded input
> >>
> >> \definefontfamily [RomanFont] [rm] [calluna]
> >>
> >> \definefontfamily [KoreanFont] [rm] [applemyungjo]
> >>
> >> \definefontfamily [JapaneseFont] [rm] [hannotatesc]
> >>
> >> \definefontfeature
> >> [fea]
> >> [mode=node,language=dflt,script=arab,
> >> init=yes,
> >> medi=yes,
> >> fina=yes,
> >> isol=yes,
> >> calt=yes,
> >> rlig=yes,
> >> tlig=yes,
> >> trep=yes,
> >> curs=yes,
> >> kern=yes,
> >> mark=yes
> >> ]
> >>
> >> \starttypescript [serif] [notonaskharabic]
> >> \definefontsynonym [notonaskharabic-Light] [name:notonaskharabic] 
> >> [features=fea]
> >> \definefontsynonym [notonaskharabic-Bold] [name:notonaskharabic] 
> >> [features=fea]
> >> \definefontsynonym [notonaskharabic-Italic] [

[NTG-context] Re: Inline math spacing

2023-12-04 Thread Hans Hagen via ntg-context

On 12/4/2023 6:43 AM, Alexandre Christe wrote:

Hi,

Here’s a MWE:

\setupinterlinespace[line=3ex]

\definefontfeature[default][default][lnum=yes,tnum=yes]
\usetypescriptfile[alegreya_libertinus]
\setupbodyfont[alegreya-light,ss,10pt]
\setupmathematics[autopunctuation={all}]

% math definitions
\enablemathautospacing % more global
% \enablemathautofencing % more global
\enablemathautonumbers % more global
% \autofences % more local

\usemodule[ipsum]

\starttext

\ipsum

\stoptext

And I attach the two files to setup the font.

no math ... anyway

\showglyphs

\dorecurse{100}{test \im{\frac{#1}{3}} test }

\setupmathematics[textdistance=.25em plus .1em minus .1em]

\dorecurse{100}{test \im{\frac{#1}{3}} test }

will give more space but it's mostly optical that the math related 
spacing looks doferent from regular spaces.


-
  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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: (again) wrong destination types?

2023-12-03 Thread Pablo Rodriguez via ntg-context
On 11/22/23 00:06, Bruce Horrocks wrote:
> [...]
> I changed your example to the following:
> \setupinteraction[state=start, page=name, focus=standard]
> \starttext
> \input knuth \par
> a\footnote{b} \par
> \dorecurse{7}{\input knuth \par}
> \stoptext

Many thanks for your fast reply, Bruce.

I wanted to reply much sooner, but it was really impossible for me.

>From your explanation, the first link (body to footnote, your point b)
has destination to fit the whole page inside the viewer.

The second link (footnote to body, your point c) has the destination to
reach a position inside the page (where the destination lies). This is
what "focus=standard" should achieve.

In PDF terms (simplified), fit to page destinations are /Fit
destinations and placed destinations are /XYZ destinations.

This sample shows what might be the root issue here:

  \setupinteraction[state=start, page=name, focus=standard]
  \starttext
  \completecontent
  \chapter{Chapter}
  a\footnote{b}
  \stoptext

ConTeXt handles internally links in categories. For some reason unknown
to me, "page=name" triggers that special operation links contain /Fit
instead /XYZ destinations.

This is similar to the wrong link destinations (fit instead of standard)
from TOC (but not in footnotes [which are right]) when compiled with MkIV:

  \setupinteraction[state=start, focus=standard]
  \starttext
  \completecontent
  \chapter{Chapter}
  a\footnote{b}
  \stoptext

I hope it is clearer now. Let me know if it is not.

My issue is that I cannot avoid having "page=name" for links to external
documents, but this breaks footnotes and other special operation links.

Many thanks for your help,

Pablo

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread Emanuel Han via ntg-context
Thank you Mikael,
this works!
Emanuel

On Dez. 2 2023, at 7:46 pm, Mikael Sundqvist  wrote:
> Hi,
>
> I don't know if \startMPinclusions \stopMPinclusions shall work with
> \startMPpage and \stopMPpage. In this case, one can use a separate
> graphics:
>
> \startuseMPgraphic{base}
> picture p[];
> path TheFrame ;
> TheFrame := fullsquare scaled 5in ;
> z1 = (60,40);
> z2 = (40,90);
> z3 = (10,70);
>
> p1:=image(
> label("Word 1", z1);
> );
>
> p2:=image(
> label("Mot 2", z2);
> );
>
> p3:=image(
> label("Parola 3", z3);
> );
>
> \stopuseMPgraphic
> \starttext
> \dorecurse{3}{ % Frame
> \startMPpage[pagestate=start]
> \includeMPgraphic{base}
> currentime := #1 ;
> % Just for learning :
> draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
> draw textext("T="&decimal(currentime)) scaled 2 shifted(0,2in)
> withcolor magenta ;
> for k=1 upto currentime: addto currentpicture also p[k]; endfor
> setbounds currentpicture to TheFrame ;
>
> desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
> currentpicture := currentpicture xysized (desiredformat ,desiredformat );
> \stopMPpage
> }
>
> \stoptext
> /Mikael
> On Sat, Dec 2, 2023 at 6:14 PM Emanuel Han via ntg-context
>  wrote:
> >
> > Hi Mikael,
> >
> > here's a very simple mwe for the label(textext()) issue. On page 1, the 
> > text "Word 1" should be drawn in position z1. On page 2, the same text in 
> > the same position should be visible, and the text "Mot 2" in position p2 
> > should be added. And so on.
> >
> > \startMPinclusions
> >
> > picture p[];
> > path TheFrame ;
> > TheFrame := fullsquare scaled 5in ;
> >
> > z1 = (60,40);
> > z2 = (40,90);
> > z3 = (10,70);
> >
> > p1:=image(
> > label(textext("Word 1"), z1);
> > );
> >
> > p2:=image(
> > label(textext("Mot 2"), z2);
> > );
> >
> > p3:=image(
> > label(textext("Parola 3"), z3);
> > );
> >
> > \stopMPinclusions
> >
> > \starttext
> >
> > \dorecurse{3}{ % Frame
> > \startMPpage[pagestate=start]
> > currentime := #1 ;
> > % Just for learning :
> > draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
> > draw textext("T="&decimal(currentime)) scaled 2 shifted(0,2in) withcolor 
> > magenta ;
> > for k=1 upto currentime: draw p[k]; endfor
> > setbounds currentpicture to TheFrame ;
> >
> > desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
> > currentpicture := currentpicture xysized (desiredformat ,desiredformat );
> >
> > \stopMPpage
> > }
> >
> > \stoptext
> >
> > On Dez. 2 2023, at 5:22 pm, Mikael Sundqvist  wrote:
> >
> > Hi Emanuel,
> >
> > I am not sure I understand your question, and since you use fonts that
> > i do not have, I cannot test your example as is. But, maybe, if you
> > want to redraw a picture, you can do
> >
> > addto currentpicture also p1;
> >
> > where you want it.
> >
> > /Mikael
> >
> > PS For the text thing, I did not get it. Could one have a _very
> > simple_ example showing only that problem and no other problem?
> >
> > On Sat, Dec 2, 2023 at 12:58 PM fv leung  wrote:
> > >
> > > You didn't specify the color of path A in p2 and p4. So it's drawn in 
> > > black.
> > > The other issue, I can't help.
> > >
> > > Emanuel Han via ntg-context  於 2023年12月2日 週六 下午7:23寫道:
> > >>
> > >> So is there a way to circumvent these issues? Or an explanation for this 
> > >> behavior, so that I can try to find a solution by myself?
> > >>
> > >> Thanks
> > >> Emanuel
> > >>
> > >> On Nov. 29 2023, at 12:25 pm, Emanuel Han via ntg-context 
> > >>  wrote:
> > >>
> > >> Dear Aditya and Fabrice,
> > >> thanks for your responses.
> > >>
> > >> I included some of Fabrice's code into mine for testing purpose, and 
> > >> indeed the multipage works now.
> > >> What is bizarre is that issues appear now that didn't appear before:
> > >>
> > >> Path A is drawn with color red on page 1, and in color black on all 
> > >> following pages, while it should stay red.
> > >> textext(, ) is overwriting  with 
> > >> "T="&decimal(currenti

  1   2   3   4   5   6   7   8   9   10   >