[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: LUA API for page numbers

2024-05-21 Thread Hans Hagen

On 5/21/2024 10:26 AM, Luc Chabassier wrote:

Hi everyone,

I have recently migrated my PhD dissertation from LaTeX to ConTeXt. In
LaTeX I was using kaobook, a template with lots of margin notes, but I
was frustrated with the automatic placement of the notes.

I implemented a system using overlays that automatically places the
notes using lua. To know where the ideal placement should be (if they do
not interact with each other), I use lua to insert a latelua whatsit
that uses lpdf.getpos() to get the coordinate on the rendered page.
However, I haven't found a way to get the page number using lua, and the
tex macro \pagenumber is unreliable near pagebreaks.

Furthermore, it would be helpful to know if there is a way to access the
position and sizes of figures at the end.
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


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


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
___