Re: [NTG-context] custom zig zag sidebars

2021-04-29 Thread Hans Hagen

On 4/29/2021 11:08 PM, Otared Kavian wrote:

Hi Massi,

Thank you and Hans for this nice feature: is it going to be included in the 
built-in sidebar ?


At some point yes.

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] custom zig zag sidebars

2021-04-29 Thread Otared Kavian
Hi Massi,

Thank you and Hans for this nice feature: is it going to be included in the 
built-in sidebar ?

Best regards: Otared

> On 29 Apr 2021, at 11:52, mf  wrote:
> 
> Il 28/04/21 17:53, Hans Hagen ha scritto:
>> On 4/28/2021 5:27 PM, mf wrote:
>>> Hello,
>>> 
>>> I made an experiment to add alternatives to sidebars (see attachment).
>>> 
>>> I discovered the sidebar is drawn by anch_sidebars_draw in 
>>> metapost/context/base/mpiv/mp-apos.mpiv.
>>> 
>>> I've redefined it locally to add alternatives.
>>> 
>>> To make fancy, zig zag bars I defined a macro, draw_pattern_bar, that draws 
>>> a bar repeating a pattern which is a path connecting (0,0) and (1,0).
>>> 
>>> The macro has 3 parameters (actually it has more params, but the remainder 
>>> are anch_sidebars_draw params):
>>> 
>>> - a pattern, which is a path from (0,0) to (1,0) that should have a 
>>> vertical size = 1; it's a sort of waveform
>>> 
>>> - a pattern length, by which the pattern is xsized
>>> 
>>> - a pattern width, by which the pattern is ysized
>>> 
>>> Then the pattern is rotated along the bar direction (so -90 degrees) and 
>>> drawn many times until it covers the bar length.
>>> 
>>> A proposal and a question:
>>> 
>>> - patternlength and patternwidth could become \setupsidebar params; 
>>> alternative (=2,3,4...) could be used to specify the pattern (a sort of 
>>> waveform); currently alternative=0 is a solid bar and alternative=1 is a 
>>> dashed one
>>> 
>>> - in case of long patterns (a patternlength spanning more lines of text) 
>>> the last replica of the pattern should be clipped not to exceed the last 
>>> line of the sidebarred text (see the last example): how can that be done?
>> how about
>> def draw_pattern_bar(expr a, b, pattern, patternlength, patternheight, 
>> linewidth, linecolor) =
>>draw image (
>>begingroup ;
>>save p, q, stp ;
>>pair p, q, stp ;
>>stp := ( ( b - a ) / arclength( a -- b ) ) * patternlength ;
>>path q ; q := pattern xscaled patternlength yscaled patternheight 
>> rotated (angle(stp)) ;
>>p := a ;
>>forever :
>>draw
>>q shifted p
>>withpen pencircle scaled linewidth
>>withcolor linecolor ;
>>p := p + stp ;
>>exitif arclength( a -- p ) > arclength( a -- b ) ;
>>endfor ;
>>endgroup ;
>>clip currentpicture to
>>(xpart llcorner currentpicture, ypart b) --
>>(xpart lrcorner currentpicture, ypart b) --
>>(xpart urcorner currentpicture, ypart a) --
>>(xpart ulcorner currentpicture, ypart a) -- cycle ;
>>) ;
>> enddef ;
> Thank you, Hans.
> 
> To save this example, I wikified \setupsidebar, \definesidebar and 
> \startsidebar...\stopsidebar.
> 
> If you do something on alternatives, let me know.
> 
> Massi
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] latest standalone—lua error

2021-04-29 Thread Wolfgang Schuster

Alan Bowen schrieb am 29.04.2021 um 18:29:
With  ConTeXt  ver: 2021.04.28 18:39 LMTX  fmt: 2021.4.29  int, I am 
now getting the following error on compiling with files that were OK 
previously. Is there something that I need to change?


The error is caused by the fallback font for math but you have create a 
minimal example because I'm unable to reproduce it (copy all font 
settings to a new document and run ConTeXt).


Can you also check if the font files are found by ConTeXt:

        mtxrun --script fonts --list --all stixtwotext*

Wolfgang

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] latest standalone—lua error

2021-04-29 Thread Alan Bowen
With  ConTeXt  ver: 2021.04.28 18:39 LMTX  fmt: 2021.4.29  int, I am now
getting the following error on compiling with files that were OK
previously. Is there something that I need to change?

Alan

lua error   > lua error on line 232 in file ../../env_Aestimatio-00.tex:

registered function call [1151]:
...TeX/tex/texmf-context/tex/context/base/mkiv/font-sel.lua:648: attempt to
index a nil value (field 'tf')
stack traceback:
...TeX/tex/texmf-context/tex/context/base/mkiv/font-sel.lua:648: in field
'filefallback'
...TeX/tex/texmf-context/tex/context/base/mkiv/font-sel.lua:666: in field
'mathfallback'
...TeX/tex/texmf-context/tex/context/base/mkiv/font-sel.lua:692: in field
'fallback'
...TeX/tex/texmf-context/tex/context/base/mkiv/font-sel.lua:782: in
function <...TeX/tex/texmf-context/tex/context/base/mkiv/font-sel.lua:777>
(...tail calls...)

222 expansion=quality,
223 mode=node,
224 force=yes,
225 ]
226 \definefallbackfamily[mainface] [mm] [STIX Two Text]
227 [range=digitsnormal,
228 force=yes,
229 features=f:oldstyle]
230
231 \definefontfamily[mainface][mm][STIX Two Math]
232 >>
233 \setupbodyfont[mainface, 10pt]
234
235 \setupalign[hanging, stretch, hz]
236
237 %% French
238 %At beginning insert:
239 % \mainlanguage[fr]
240 % \setcharacterspacing[frenchpunctuation]
241 % \startsetups[footnote:french]
242 %\setcharacterspacing[frenchpunctuation]

mtx-context | fatal error: return code: 256
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] calculating optimal height of textblock

2021-04-29 Thread Hans Hagen

On 4/29/2021 11:59 AM, denis.ma...@ub.unibe.ch wrote:

One thing, I've noticed:
Lines=40 seems to add more space than strictly necessary.

line heights, depths and topskip delta



-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] calculating optimal height of textblock

2021-04-29 Thread denis.maier
One thing, I've noticed: 
Lines=40 seems to add more space than strictly necessary.

Why is that?

Example:

===
\setupbodyfont[10pt]

\definepapersize[test][width=140mm,height=208mm]
\setuppapersize[test][test]

\setuppagenumbering[location={footer,middle}]

\setuplayout[reset]
\setuplayout[backspace=17mm,
topspace=19mm,
header=0mm,
headerdistance=0mm,
footerdistance=4mm,
footer=5mm,
width=105mm,
%height=177mm, % does not suffice for a complete line
height=178mm, % enough for a complete line
%lines=40, % adds a bit of extra whitespace below the 
last line
rightmargin=0mm,
leftmargin=0mm,
]

% \setupalign[line]
% \setuptolerance[vertical,verytolerant,stretch]
% \setupinterlinespace[stretch=0.01]

\startsetups[mypenalties]
\setdefaultpenalties
\setpenalties\clubpenalties{2}{0}
\setpenalties\widowpenalties{2}{0}
\setpenalties\displaywidowpenalties{2}{0}
\stopsetups
\setuplayout[setups=mypenalties]

%\showframe
\showmakeup
\showsetups

\starttext

\dorecurse{5}{\input knuth\par}

\stoptext

===

> -Ursprüngliche Nachricht-
> Von: Maier, Denis Christian (UB)
> Gesendet: Donnerstag, 29. April 2021 10:03
> An: 'Hans Hagen' ; mailing list for ConTeXt users  cont...@ntg.nl>
> Betreff: AW: [NTG-context] calculating optimal height of textblock
> 
> Thanks, Hans. That's really helpful.
> 
> Denis
> 
> > -Ursprüngliche Nachricht-
> > Von: Hans Hagen 
> > Gesendet: Mittwoch, 28. April 2021 17:58
> > An: mailing list for ConTeXt users ; Maier, Denis
> > Christian (UB) 
> > Betreff: Re: [NTG-context] calculating optimal height of textblock
> >
> > On 4/28/2021 2:07 PM, denis.ma...@ub.unibe.ch wrote:
> >
> > > how do you usually calcultate your layouts? For example in this
> > > example, the third value for height is not really helpful as there
> > > will never be a complete line :
> >
> > you can use
> >
> >lines=40,
> >
> > instead of height
> >
> > Hans
> >
> > -
> >Hans Hagen | PRAGMA ADE
> >Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> > -
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] custom zig zag sidebars

2021-04-29 Thread mf

Il 28/04/21 17:53, Hans Hagen ha scritto:

On 4/28/2021 5:27 PM, mf wrote:

Hello,

I made an experiment to add alternatives to sidebars (see attachment).

I discovered the sidebar is drawn by anch_sidebars_draw in 
metapost/context/base/mpiv/mp-apos.mpiv.


I've redefined it locally to add alternatives.

To make fancy, zig zag bars I defined a macro, draw_pattern_bar, that 
draws a bar repeating a pattern which is a path connecting (0,0) and 
(1,0).


The macro has 3 parameters (actually it has more params, but the 
remainder are anch_sidebars_draw params):


- a pattern, which is a path from (0,0) to (1,0) that should have a 
vertical size = 1; it's a sort of waveform


- a pattern length, by which the pattern is xsized

- a pattern width, by which the pattern is ysized

Then the pattern is rotated along the bar direction (so -90 degrees) 
and drawn many times until it covers the bar length.


A proposal and a question:

- patternlength and patternwidth could become \setupsidebar params; 
alternative (=2,3,4...) could be used to specify the pattern (a sort 
of waveform); currently alternative=0 is a solid bar and alternative=1 
is a dashed one


- in case of long patterns (a patternlength spanning more lines of 
text) the last replica of the pattern should be clipped not to exceed 
the last line of the sidebarred text (see the last example): how can 
that be done?

how about

def draw_pattern_bar(expr a, b, pattern, patternlength, patternheight, 
linewidth, linecolor) =

    draw image (
    begingroup ;
    save p, q, stp ;
    pair p, q, stp ;
    stp := ( ( b - a ) / arclength( a -- b ) ) * patternlength ;
    path q ; q := pattern xscaled patternlength yscaled 
patternheight rotated (angle(stp)) ;

    p := a ;
    forever :
    draw
    q shifted p
    withpen pencircle scaled linewidth
    withcolor linecolor ;
    p := p + stp ;
    exitif arclength( a -- p ) > arclength( a -- b ) ;
    endfor ;
    endgroup ;
    clip currentpicture to
    (xpart llcorner currentpicture, ypart b) --
    (xpart lrcorner currentpicture, ypart b) --
    (xpart urcorner currentpicture, ypart a) --
    (xpart ulcorner currentpicture, ypart a) -- cycle ;
    ) ;
enddef ;



Thank you, Hans.

To save this example, I wikified \setupsidebar, \definesidebar and 
\startsidebar...\stopsidebar.


If you do something on alternatives, let me know.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] calculating optimal height of textblock

2021-04-29 Thread denis.maier
Thanks, Hans. That's really helpful. 

Denis

> -Ursprüngliche Nachricht-
> Von: Hans Hagen 
> Gesendet: Mittwoch, 28. April 2021 17:58
> An: mailing list for ConTeXt users ; Maier, Denis
> Christian (UB) 
> Betreff: Re: [NTG-context] calculating optimal height of textblock
> 
> On 4/28/2021 2:07 PM, denis.ma...@ub.unibe.ch wrote:
> 
> > how do you usually calcultate your layouts? For example in this
> > example, the third value for height is not really helpful as there
> > will never be a complete line :
> 
> you can use
> 
>lines=40,
> 
> instead of height
> 
> Hans
> 
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___