[NTG-context] Fira Math: goodies needed?

2023-07-21 Thread Leah Neukirchen
Hi,

I'm trying to use Fira Math (https://github.com/firamath/firamath).

But this small example yields both limits on the same horizontal axis,
i.e. the 0 is far away from the integral sign:


\definefontfamily [mainface] [mm] [Fira Math]
\setupbodyfont[mainface]

\starttext
\startformula
  \int_0^1 e^x
\stopformula
\stoptext


Meanwhile, when I use LaTeX, the 0 is moved to the left and close to
the integral sign:


\documentclass{article}
\usepackage{amsmath}
\usepackage[mathrm=sym]{unicode-math}
\setmathfont{Fira Math}

\begin{document}
\[
  \int_0^1 e^x
\]
\end{document}


In both cases
/opt/texlive/2023/texmf-dist/fonts/opentype/public/firamath/FiraMath-Regular.otf
is used...

-- 
Leah Neukirchenhttps://leahneukirchen.org/
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Re: Par Builder Tests

2023-07-21 Thread Keith McKay

Thanks Hans!

I'll have a play and keep an eye on updates

Best Wishes

Keith

On 21/07/2023 17:10, Hans Hagen via ntg-context wrote:

Hi Keith,

Here an example that Mikael made for such a book:

\showframe

% let's very strict

\startsetups [*default]

    \directsetup{*reset}

    \frozen\widowpenalty    1
    \frozen\clubpenalty 1
    \frozen\displaywidowpenalty 1
    \frozen\brokenpenalty   0 % \defaultbrokenpenalty

\stopsetups

% we enable the use of expansion (this feature might become preset
% because we now delay setting the vectors anyway so less overhead)

\definefontfeature
  [default]
  [default]
  [expansion=quality,
   protrusion=quality,
   itlc=yes]

% vertical expansion

\setuplayout
  [vz=2]

% for which we need:

% \setupalign[hanging,depth,stretch,granular]

\setupalign[depth,stretch,granular]

% here are the passes:

\startsetups align:pass:test4
    \pretolerance 100
    \tolerance    200
    \parpasses    4
    classes  \indecentparpassclasses
    threshold    0.025pt
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink    5
    adjustspacingstretch  10
    next
    classes  \indecentparpassclasses
    threshold    0.025pt
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink   10
    adjustspacingstretch  20
    next
    classes  \indecentparpassclasses
    threshold    0.025pt
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink   25
    adjustspacingstretch  50
    next
    classes  \indecentparpassclasses
    threshold    0.025pt
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink   50
    adjustspacingstretch 100
    \relax
\stopsetups

\setupalignpass[test4]

\starttext
    ...
\stoptext

(work in progress so keep an eye on updates)

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://www.ntg.nl/mailman/listinfo/ntg-context

webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: Par Builder Tests

2023-07-21 Thread Hans Hagen via ntg-context

Hi Keith,

Here an example that Mikael made for such a book:

\showframe

% let's very strict

\startsetups [*default]

\directsetup{*reset}

\frozen\widowpenalty1
\frozen\clubpenalty 1
\frozen\displaywidowpenalty 1
\frozen\brokenpenalty   0 % \defaultbrokenpenalty

\stopsetups

% we enable the use of expansion (this feature might become preset
% because we now delay setting the vectors anyway so less overhead)

\definefontfeature
  [default]
  [default]
  [expansion=quality,
   protrusion=quality,
   itlc=yes]

% vertical expansion

\setuplayout
  [vz=2]

% for which we need:

% \setupalign[hanging,depth,stretch,granular]

\setupalign[depth,stretch,granular]

% here are the passes:

\startsetups align:pass:test4
\pretolerance 100
\tolerance200
\parpasses4
classes  \indecentparpassclasses
threshold0.025pt
adjustspacing  3
adjustspacingstep  1
adjustspacingshrink5
adjustspacingstretch  10
next
classes  \indecentparpassclasses
threshold0.025pt
adjustspacing  3
adjustspacingstep  1
adjustspacingshrink   10
adjustspacingstretch  20
next
classes  \indecentparpassclasses
threshold0.025pt
adjustspacing  3
adjustspacingstep  1
adjustspacingshrink   25
adjustspacingstretch  50
next
classes  \indecentparpassclasses
threshold0.025pt
adjustspacing  3
adjustspacingstep  1
adjustspacingshrink   50
adjustspacingstretch 100
\relax
\stopsetups

\setupalignpass[test4]

\starttext
...
\stoptext

(work in progress so keep an eye on updates)

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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Re: Par Builder Tests

2023-07-21 Thread Hans Hagen

On 7/21/2023 5:34 PM, Keith McKay wrote:

Hi all,

At the end of June, Hans uploaded a new lmtx version which included 
improvements to par building which he and Mikael had been working on in 
math mode. Hans suggested in the online chat that these improvements may 
be useful in typesetting novels. I was keen to try these since I have 
typset novels in the past.


I have ran some tests on two novels which I downloaded from the 
Gutenberg Project site as epubs and extracted them to get the original 
xhtml files which I then typeset in context. I made very little in the 
way of changes to the files so that my setup for xml was very simple.


Here are my setups for the layout of the novels showing some trackers 
that were used as well:


\definepapersize[pagee][width=5.06in,height=7.81in]
\setuppapersize[pagee]
% XML setups here
\startsetups[grid][mypenalties]
\setdefaultpenalties
\setpenalties\widowpenalties{1}{150}
\setpenalties\clubpenalties {1}{150}
\stopsetups
\setuplayout[
width=10cm,
topspace=0.5in,
backspace=2.0cm,
header=7.5mm,
footer=0.25in,
location={middle,middle},
vs=2,
grid=yes,
setups=mypenalties
]
%\enabletrackers[makeup]
%\enabletrackers[builders.hpack.quality]
\enabletrackers[builders.hpack.overflow]
%\enabletrackers[layout.vz]
%\enabletrackers[paragraphs.passes]
\enabletrackers[paragraphs.passes=summary]
%\enabletrackers[paragraphs.passes=details]
\setupalign[granular]
%\setupalign[nothyphenated,hz,verytolerant]
%\setupalign[vertical,height]
%\setupalignpass[decent]
%\setupalignpass[quality]
%\setupalignpass[test1]
\setupalignpass[test2]
%\setupalignpass[test3]
%\setupalignpass[test4]
%\setupalignpass[test5]
%\setupalignpass[optional1]
%\setupalignpass[test2b]
\starttext
\setuppagenumbering[location={footer,middle},alternative=doublesided,state=start]
\setcounter[userpage][1]
%\showmakeup[vbox]
%\showlayout
\dostepwiserecurse{0}{30}{1}{
\xmlprocessfile{mysetups}{/path to xhtml 
files/4439720318703948998_84-h-\recurselevel.htm.xhtml}{}

}
\stoptext

Below are the result showing the number of overfull boxes for these 
novels using the setups in the file spac-imp-tests.mkxl . See the manual 
Low Level - Lines


Test    Novel1   Novel2
Test1    70    35
Test2    30    8
Test3    62    23
Test4    89    40
Test5    28    9
Optional1 55    19
Quality  74    32
Decent  39    11

 From these initial tests one can see that Test2 gave the lowest number 
of overfull boxes. So I edited test two, ran it, and the results are below.


Test    Novel1   Novel2

Test2b  11    0

My setup for test 2b is as follows:
\startsetups align:pass:test2b
     \pretolerance 100
     \tolerance    200
     \parpasses  3
     classes  \indecentparpassclasses
     threshold    0.025pt
     tolerance    800
     extrahyphenpenalty    50
   next
     threshold    0.025pt
     tolerance    900
     adjustspacing  3
     adjustspacingstep  1
     adjustspacingshrink   10
     adjustspacingstretch  15
     next
     threshold    0.025pt
     tolerance    1000
     adjustspacing  3
     adjustspacingstep  1
     adjustspacingshrink   20
     adjustspacingstretch  40
     emergencystretch .25\bodyfontsize
     \relax
% \linebreakpasses\plusone
\stopsetups
The only difference between test 2 and 2b are that I increased the 
tolerance in each of the three passes.
In novel 2 this was successful in eliminating the overfull boxes but not 
in Novel 1 although I noticed that majority of overfull boxes were above 
1pt with the largest about 12pt in Novel 1.


I am at the stage now where I need some kind of strategy to 
reduce/eliminate overfull boxes, other than changing the tolerance, and 
I'm hoping for some advice from the community. Suggestions for further 
reading particularly on the commands in \setupalignpass and their usage 
would be appreciated and on the best way to tackle overfull boxes.
you're too tolerant (stick to 200), you can even start out with 
pretolerance 50 and tolerance 150 and then in the passes 200


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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net

[NTG-context] Fwd: Re: Replacing %20 with spaces in xml attributes

2023-07-21 Thread Hans Hagen via ntg-context





 Forwarded Message 
Subject: Re: [NTG-context] Re: Replacing %20 with spaces in xml attributes
Date: Fri, 21 Jul 2023 17:50:04 +0200
From: Hans Hagen 
To: denis.ma...@unibe.ch

On 7/21/2023 5:27 PM, denis.ma...@unibe.ch wrote:

Thanks, but I'm still getting the same error. I'm thinking that it has 
something to do with the percent characters...

This here works just fine:

\startluacode
function test(s)
   result = string.gsub(s, 'x20', 'MATCH')
   context(result)
end
\stopluacode

\define[1]\test{\ctxlua{test("#1")}}

\starttext
\test{asdfx20} % -> asdfMATCH
\stoptext

But this here won't:

\startluacode
function test(s)
   result = string.gsub(s, '%%20', 'MATCH')
   context(result)
end
\stopluacode

\define[1]\test{\ctxlua{test("#1")}}

\starttext
\test{asdf%20} % -> does not work
\stoptext

Any ideas?

\startluacode
function xml.finalizers.tex.url(e,a)
local u = #e > 0 and e[1].at[a]
local s = u and lpeg.match(lpeg.patterns.urlunescaper,u)
context(s)
end
\stopluacode

\startxmlsetups xml:something
\xmlatt{#1}{xlink:href}\par
\xmlfilter{#1}{./url('xlink:href')}
\stopxmlsetups

i'll add this

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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Par Builder Tests

2023-07-21 Thread Keith McKay

Hi all,

At the end of June, Hans uploaded a new lmtx version which included 
improvements to par building which he and Mikael had been working on in 
math mode. Hans suggested in the online chat that these improvements may 
be useful in typesetting novels. I was keen to try these since I have 
typset novels in the past.


I have ran some tests on two novels which I downloaded from the 
Gutenberg Project site as epubs and extracted them to get the original 
xhtml files which I then typeset in context. I made very little in the 
way of changes to the files so that my setup for xml was very simple.


Here are my setups for the layout of the novels showing some trackers 
that were used as well:


\definepapersize[pagee][width=5.06in,height=7.81in]
\setuppapersize[pagee]
% XML setups here
\startsetups[grid][mypenalties]
\setdefaultpenalties
\setpenalties\widowpenalties{1}{150}
\setpenalties\clubpenalties {1}{150}
\stopsetups
\setuplayout[
width=10cm,
topspace=0.5in,
backspace=2.0cm,
header=7.5mm,
footer=0.25in,
location={middle,middle},
vs=2,
grid=yes,
setups=mypenalties
]
%\enabletrackers[makeup]
%\enabletrackers[builders.hpack.quality]
\enabletrackers[builders.hpack.overflow]
%\enabletrackers[layout.vz]
%\enabletrackers[paragraphs.passes]
\enabletrackers[paragraphs.passes=summary]
%\enabletrackers[paragraphs.passes=details]
\setupalign[granular]
%\setupalign[nothyphenated,hz,verytolerant]
%\setupalign[vertical,height]
%\setupalignpass[decent]
%\setupalignpass[quality]
%\setupalignpass[test1]
\setupalignpass[test2]
%\setupalignpass[test3]
%\setupalignpass[test4]
%\setupalignpass[test5]
%\setupalignpass[optional1]
%\setupalignpass[test2b]
\starttext
\setuppagenumbering[location={footer,middle},alternative=doublesided,state=start]
\setcounter[userpage][1]
%\showmakeup[vbox]
%\showlayout
\dostepwiserecurse{0}{30}{1}{
\xmlprocessfile{mysetups}{/path to xhtml 
files/4439720318703948998_84-h-\recurselevel.htm.xhtml}{}

}
\stoptext

Below are the result showing the number of overfull boxes for these 
novels using the setups in the file spac-imp-tests.mkxl . See the manual 
Low Level - Lines


Test    Novel1   Novel2
Test1    70    35
Test2    30    8
Test3    62    23
Test4    89    40
Test5    28    9
Optional1 55    19
Quality  74    32
Decent  39    11

From these initial tests one can see that Test2 gave the lowest number 
of overfull boxes. So I edited test two, ran it, and the results are below.


Test    Novel1   Novel2

Test2b  11    0

My setup for test 2b is as follows:
\startsetups align:pass:test2b
    \pretolerance 100
    \tolerance    200
    \parpasses  3
    classes  \indecentparpassclasses
    threshold    0.025pt
    tolerance    800
    extrahyphenpenalty    50
  next
    threshold    0.025pt
    tolerance    900
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink   10
    adjustspacingstretch  15
    next
    threshold    0.025pt
    tolerance    1000
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink   20
    adjustspacingstretch  40
    emergencystretch .25\bodyfontsize
    \relax
% \linebreakpasses\plusone
\stopsetups
The only difference between test 2 and 2b are that I increased the 
tolerance in each of the three passes.
In novel 2 this was successful in eliminating the overfull boxes but not 
in Novel 1 although I noticed that majority of overfull boxes were above 
1pt with the largest about 12pt in Novel 1.


I am at the stage now where I need some kind of strategy to 
reduce/eliminate overfull boxes, other than changing the tolerance, and 
I'm hoping for some advice from the community. Suggestions for further 
reading particularly on the commands in \setupalignpass and their usage 
would be appreciated and on the best way to tackle overfull boxes.


Best Wishes

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

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

[NTG-context] Re: Replacing %20 with spaces in xml attributes

2023-07-21 Thread denis.maier
Thanks, but I'm still getting the same error. I'm thinking that it has 
something to do with the percent characters...

This here works just fine:

\startluacode
function test(s)
  result = string.gsub(s, 'x20', 'MATCH')
  context(result)
end
\stopluacode

\define[1]\test{\ctxlua{test("#1")}}

\starttext
\test{asdfx20} % -> asdfMATCH
\stoptext

But this here won't:

\startluacode
function test(s)
  result = string.gsub(s, '%%20', 'MATCH')
  context(result)
end
\stopluacode

\define[1]\test{\ctxlua{test("#1")}}

\starttext
\test{asdf%20} % -> does not work
\stoptext

Any ideas?

Best,
Denis


Von: Hans van der Meer via ntg-context 
Gesendet: Freitag, 21. Juli 2023 16:26
An: NTG ConTeXt 
Cc: Hans van der Meer 
Betreff: [NTG-context] Re: Replacing %20 with spaces in xml attributes

Here in Terminal on my Mac:


21 ~: lua

Lua 5.4.6  Copyright (C) 1994-2023 Lua.org, PUC-Rio

> string.gsub('a%20b', '%%20', ' ')

a b1

> (string.gsub('a%20b', '%%20', ' '))

a b

> ^D

21 ~:


The first call returns the 1 giving the match, the extra ()'s get rid of that 
second return value.


yours sincerely
dr. Hans van der Meer




On 21 Jul 2023, at 12:37, denis.ma...@unibe.ch 
wrote:

Hi,

I'm typesetting an XML document where the links to the images contain spaces 
which are encoded as %20


Using this works in cases without spaces:

\startxmlsetups xml:fig:graphic
  \externalfigure[\xmlatt{#1}{xlink:href}]
\stopxmlsetups

This also works for normal spaces, but is there a way to decode/expand the %20s 
to regular spaces?

I've tried with some Lua, but I don't really know how to pass data around.

%
\startluacode
function replaceSpaces(s)
  result = string.gsub(s, "%%20", " ")
  context(result)
end
\stopluacode

\define[1]\replaceSpaces{\ctxlua{replaceSpaces("#1")}}

\startxmlsetups xml:fig:graphic
  \externalfigure[\replaceSpaces{\xmlatt{#1}{xlink:href}}]
\stopxmlsetups
%

Any hints, why this does not work?`

Also, maybe there's a simpler way for this kind of scenario?

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

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

[NTG-context] Re: OSFONTDIR

2023-07-21 Thread Alan Braslau via ntg-context

Thomas,

I actually set OSFONTDIR=.
which seems to be a sane default. I store specific font files with 
projects (along with a copy of the ConTeXt distribution used to typeset 
the project). This way, I can come back to a project later and make 
minor corrections without running into surprises or the need to update 
my sources.


Alan



On 21/07/23 21/07/23, 16:43, Alan Braslau wrote:

On 19/07/23 19/07/23, 22:51, Hans Hagen via ntg-context wrote:
is looking for system fonts by default the new standard? Is it a good 
idea?


Thank you and all best
it is a tex live thing; you can just set that variable to nothing, in 
the environment or in a local file like in


../tex/texmf-local/web2c/texmfcnf.lua

normally texmf-fonts is where i put fonts and that one should win


A TeX-live thing can be the default for TeX live.

I agree with Thomas, not explicitly including the system fonts by 
default is preferable. Maybe the standalone installation still does this 
- I hope so - but have not checked. If it defauts to including the 
system fonts, I would suggest that this is not necessarily a good idea.


Alan



--
Alan Braslau
816 West Mountain Avenue
Fort Collins, CO 80521 USA
mobile: (970) 237-0957

Conserve energy! ;-)

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

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


[NTG-context] Re: OSFONTDIR

2023-07-21 Thread Alan Braslau via ntg-context

On 19/07/23 19/07/23, 22:51, Hans Hagen via ntg-context wrote:
is looking for system fonts by default the new standard? Is it a good 
idea?


Thank you and all best
it is a tex live thing; you can just set that variable to nothing, in 
the environment or in a local file like in


../tex/texmf-local/web2c/texmfcnf.lua

normally texmf-fonts is where i put fonts and that one should win


A TeX-live thing can be the default for TeX live.

I agree with Thomas, not explicitly including the system fonts by 
default is preferable. Maybe the standalone installation still does this 
- I hope so - but have not checked. If it defauts to including the 
system fonts, I would suggest that this is not necessarily a good idea.


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

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


[NTG-context] Re: Replacing %20 with spaces in xml attributes

2023-07-21 Thread Hans van der Meer via ntg-context
Here in Terminal on my Mac:

21 ~: lua
Lua 5.4.6  Copyright (C) 1994-2023 Lua.org, PUC-Rio
> string.gsub('a%20b', '%%20', ' ')
a b 1
> (string.gsub('a%20b', '%%20', ' '))
a b
> ^D
21 ~: 

The first call returns the 1 giving the match, the extra ()'s get rid of that 
second return value.

yours sincerely
dr. Hans van der Meer



> On 21 Jul 2023, at 12:37, denis.ma...@unibe.ch wrote:
> 
> Hi,
>  
> I’m typesetting an XML document where the links to the images contain spaces 
> which are encoded as %20
> 
>  
> Using this works in cases without spaces:
>  
> \startxmlsetups xml:fig:graphic
>   \externalfigure[\xmlatt{#1}{xlink:href}]
> \stopxmlsetups
>  
> This also works for normal spaces, but is there a way to decode/expand the 
> %20s to regular spaces?
>  
> I’ve tried with some Lua, but I don’t really know how to pass data around.
>  
> %
> \startluacode
> function replaceSpaces(s)
>   result = string.gsub(s, "%%20", " ")
>   context(result)
> end
> \stopluacode
>  
> \define[1]\replaceSpaces{\ctxlua{replaceSpaces("#1")}}
>  
> \startxmlsetups xml:fig:graphic
>   \externalfigure[\replaceSpaces{\xmlatt{#1}{xlink:href}}]
> \stopxmlsetups
> %
>  
> Any hints, why this does not work?`
>  
> Also, maybe there’s a simpler way for this kind of scenario?
> 
> Best,
> Denis
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl  / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl  / 
> http://context.aanhet.net 
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Convert tif to jpg (instead of pdf)

2023-07-21 Thread denis.maier
Hi,

According to the documentation, it is possible to automatically convert TIFF 
images to a format supported by LMTX via GraphicsMagick.
https://wiki.contextgarden.net/Using_Graphics#Image_Conversion

However, by default this produces pdf files which are quite huge. is it 
possible to instruct grapichsmagick to convert tiff images to jpg instead of to 
pdf ? There's an example on the linked page in the documentation, but I have to 
admit that I don't quite understand what I should do...

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

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

[NTG-context] Replacing %20 with spaces in xml attributes

2023-07-21 Thread denis.maier
Hi,

I'm typesetting an XML document where the links to the images contain spaces 
which are encoded as %20


Using this works in cases without spaces:

\startxmlsetups xml:fig:graphic
  \externalfigure[\xmlatt{#1}{xlink:href}]
\stopxmlsetups

This also works for normal spaces, but is there a way to decode/expand the %20s 
to regular spaces?

I've tried with some Lua, but I don't really know how to pass data around.

%
\startluacode
function replaceSpaces(s)
  result = string.gsub(s, "%%20", " ")
  context(result)
end
\stopluacode

\define[1]\replaceSpaces{\ctxlua{replaceSpaces("#1")}}

\startxmlsetups xml:fig:graphic
  \externalfigure[\replaceSpaces{\xmlatt{#1}{xlink:href}}]
\stopxmlsetups
%

Any hints, why this does not work?`

Also, maybe there's a simpler way for this kind of scenario?

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

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