[NTG-context] supp-ran.lua makes code unable to work in ConTeXt

2020-04-30 Thread Jairo A. del Rio
I've adapted the following code to make mazes in LuaLaTeX and ConTeXt:
https://www.rosettacode.org/wiki/Maze_generation#Lua

I defined a modified version to make content visible to TeX and I saved in
a file named maze.lua:

function make_maze_tex(w, h, m)
  w = w or 16
  h = h or 8

  local map = initialize_grid(w*2+1, h*2+1)

  function walk(x, y)
map[y][x] = false

local d = { 1, 2, 3, 4 }
shuffle(d)
for i, dirnum in ipairs(d) do
  local xx = x + dirs[dirnum].x
  local yy = y + dirs[dirnum].y
  if map[yy] and map[yy][xx] then
map[avg(y, yy)][avg(x, xx)] = false
walk(xx, yy)
  end
end
  end

  walk(math.random(1, w)*2, math.random(1, h)*2)

 tex.print([[\bgroup]])
 tex.print([[\baselineskip ]]..m)
  local s = {}
  for i = 1, h*2+1 do
--table.insert(s, [[\hbox{]])
tex.print([[\hbox{]])
for j = 1, w*2+1 do
 -- table.insert(s, [[\hbox{]])
  if (j == 1 and i == 2) or (j == 2*w + 1 and i == 2*h) then
tex.print([[\hskip ]]..m)
  elseif map[i][j] then
--table.insert(s, [[\vrule width ]]..m..[[ height ]]..m)
tex.print([[\vrule width ]]..m..[[ height ]]..m)
  else
--table.insert(s, [[\hskip ]]..m)
tex.print([[\hskip ]]..m)
  end
--  table.insert(s, [[}]].."\n")
end
--table.insert(s, [[}]])
  tex.print([[}]])
  end
 --tex.print(table.concat(s))
 tex.print([[\egroup]])
end

And I executed the folowing in LuaLaTeX and ConTeXt:

%\documentclass{article}
%\usepackage{luacode}
%\begin{document}
\starttext
%\begin{luacode*}
\startluacode
mz = dofile("maze.lua")
local count = 0
for i=10,109 do
count = count + 1
tex.print([[\subject{Laberinto ]]..count..[[}]])
mz.make_maze_tex(i, i, [[\dimexpr\textwidth/]]..(2*i+1)..[[\relax]])
tex.print([[\pagebreak]])
end
%\end{luacode*}
\stopluacode
%\end{document}
\stoptext

Whereas it works very fast in LuaLaTeX it crashes on ConTeXt and outputs
the following:

token call, execute:
...ext/tex/texmf-context/tex/context/base/mkiv/supp-ran.lua:30: C stack
overflow


Why does it happen? I guess it has something to do with math.randomseed,
but I don't know how to avoid this error message.
local mazegen = {}

math.randomseed( os.time() )
 
-- Fisher-Yates shuffle from http://santos.nfshost.com/shuffling.html
local function shuffle(t)
  for i = 1, #t - 1 do
local r = math.random(i, #t)
t[i], t[r] = t[r], t[i]
  end
end

mazegen.shuffle = shuffle 
-- builds a width-by-height grid of trues
local function initialize_grid(w, h)
  local a = {}
  for i = 1, h do
table.insert(a, {})
for j = 1, w do
  table.insert(a[i], true)
end
  end
  return a
end
 
mazegen.initialize_grid = initialize_grid
-- average of a and b
local function avg(a, b)
  return (a + b) / 2
end
 
 
local dirs = {
  {x = 0, y = -2}, -- north
  {x = 2, y = 0}, -- east
  {x = -2, y = 0}, -- west
  {x = 0, y = 2}, -- south
}
 
local function make_maze(w, h)
  w = w or 16
  h = h or 8
 
  local map = initialize_grid(w*2+1, h*2+1)
 
  function walk(x, y)
map[y][x] = false
 
local d = { 1, 2, 3, 4 }
shuffle(d)
for i, dirnum in ipairs(d) do
  local xx = x + dirs[dirnum].x
  local yy = y + dirs[dirnum].y
  if map[yy] and map[yy][xx] then
map[avg(y, yy)][avg(x, xx)] = false
walk(xx, yy)
  end
end
  end
 
  walk(math.random(1, w)*2, math.random(1, h)*2)
 
  local s = {}
  for i = 1, h*2+1 do
for j = 1, w*2+1 do
  if map[i][j] then
table.insert(s, '#')
  else
table.insert(s, ' ')
  end
end
table.insert(s, '\n')
  end
  return table.concat(s)
end

mazegen.make_maze = make_maze

function make_maze_tex(w, h, m)
  w = w or 16
  h = h or 8
 
  local map = initialize_grid(w*2+1, h*2+1)
 
  function walk(x, y)
map[y][x] = false
 
local d = { 1, 2, 3, 4 }
shuffle(d)
for i, dirnum in ipairs(d) do
  local xx = x + dirs[dirnum].x
  local yy = y + dirs[dirnum].y
  if map[yy] and map[yy][xx] then
map[avg(y, yy)][avg(x, xx)] = false
walk(xx, yy)
  end
end
  end
 
  walk(math.random(1, w)*2, math.random(1, h)*2)
 
 tex.print([[\bgroup]])
 tex.print([[\baselineskip ]]..m)
  local s = {}
  for i = 1, h*2+1 do
--table.insert(s, [[\hbox{]])
tex.print([[\hbox{]])
for j = 1, w*2+1 do
 -- table.insert(s, [[\hbox{]])
  if (j == 1 and i == 2) or (j == 2*w + 1 and i == 2*h) then 
tex.print([[\hskip ]]..m)
  elseif map[i][j] then
--table.insert(s, [[\vrule width ]]..m..[[ height ]]..m)
tex.print([[\vrule width ]]..m..[[ height ]]..m)
  else
--table.insert(s, [[\hskip ]]..m)
tex.print([[\hskip ]]..m)
  end
--  table.insert(s, [[}]].."\n")
end
--table.insert(s, [[}]])
  tex.print([[}]])
  end
 --tex.print(table.concat(s))
 tex.print([[\egroup]])
end

mazegen.make_maze_tex = make_maze_tex

return mazegen
 \starttext
\startluacode
mz = dofile("maze.lua")
local count = 0
for i=10,109 do

Re: [NTG-context] How do I get an empty line in a \framed[align=flushleft]{} item?

2020-04-30 Thread Gerben Wierda

> On 30 Apr 2020, at 22:54, Wolfgang Schuster 
>  wrote:
> 
> Gerben Wierda schrieb am 30.04.2020 um 22:47:
>> In normal TeX, when I type
>> AapAap
>> I get something like
>> Aap
>> Aap
>> But inside a \framed[align=]{} the empty line disappears. How do I get it 
>> back?
>> Minimal example:
>> \starttext
>> TestingTesting
>> \page
>> \framed[align=flushleft]{TestingTesting}
>> \stoptext
> 
> Use \blank

Too happy too soon. And I recall I ran into this earlier a while ago in another 
setting ago. But I thought of a solution.

Background:

I am automatically converting input from an XML file to METAPOST/ConTeXt. The 
input may contain one or more newlines.The text must end up in 
\framed[align=??, width=??] to be typeset.

I use lua to convert and make it safe to pass to METAPOST as a string argument 
that METAPOST can pass on to textext(), using the following function:

function doubleQuotableEscapedConTeXtString( str)
  local rep = lpeg.replacer {
   { '\n', '\\blank ' },
   { '{', '{\\textbraceleft}' },
   { '}', '{\\textbraceright}' },
   { '#', '{\\texthash}' },
   { '$', '{\\textdollar}' },
   { '&', '{\\textampersand}' },
   { '%', '{\\textpercent}' },
   { '\\','{\\textbackslash}' },
   { '|', '{\\textbar}' },
   { '_', '{\\textunderscore}' },
   { '~', '{\\textasciitilde}' },
   { '^', '{\\textasciicircum}' },
   { '"', "\"&\"" },
  }
  return rep:match(str)
end

Where it now says \\blank, it used to say .

Problem

 gets me what I want if there is one \n (it turns into one new line), but 
with two \n in succession it still gets me only a single ’newline'
\\blank gets me what I want if there are multiple newlines, but gets me an 
extra empty line when I only want ’next line’ and multiple \blanks do not work 

But I found the solution by using \strut\\ instead of \blank. In the above 
table:

   { ‘\n', ‘\\strut' },

This fools ConTeXt in thinking there actually is something on that line and so 
multiple \\ will work.

G___
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] How do I get an empty line in a \framed[align=flushleft]{} item?

2020-04-30 Thread Gerben Wierda


> On 30 Apr 2020, at 22:51, Henning Hraban Ramm  wrote:
> 
> 
> 
>> Am 30.04.2020 um 22:47 schrieb Gerben Wierda :
>> 
>> In normal TeX, when I type 
>> 
>> AapAap
>> 
>> I get something like 
>> 
>> Aap
>> 
>> Aap
>> 
>> But inside a \framed[align=]{} the empty line disappears. How do I get it 
>> back?
> 
> Try \framedtext instead; multi line text needs a \vbox, and \framedtext does 
> that. (If I understood correctly.)
> 
> Maybe you need to set the align option.

I did set the align option to get a vbox.

G

> 
> Best, Hraban
> ___
> 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] Trouble setting PDF boxes

2020-04-30 Thread Jack Steyn
Hi Hans, using that produces a pdf which fails compliance with PDF/X-1a as
the BleedBox is not set. But notice that if it did work, the sizes of
TrimBox and BleedBox would be based off printpaperwidth and
printpaperheight. I need them to be based off paperwidth and paperheight
(for my documents all have printpaperwidth – paperwidth ≠ printpaperheight
– paperheight).

(Apologies, I initially replied to just you and not the list as well.)

On Fri, 1 May 2020 at 05:44, Hans Hagen  wrote:

> On 4/30/2020 5:51 PM, Jack Steyn wrote:
> > Hello, I'm happy to report that I got this working after much trawling
> > through the source and documentation. The code below produces a pdf with
> > the MediaBox, CropBox, BleedBox and TrimBox all in the places I
> > specified in my original message. I hope it helps illustrate how to set
> > these PDF boxes using Lua. I would much appreciate any feedback on how
> > the Lua code can be cleaned up or made more flexible (the bleed is
> > hard-coded in because I didn't know how to obtain the user-specified
> > bleedoffset, for example), or made better in any other way.
> can you try this
>
> \setuplayout
>[cropoffset=30pt,
> bleedoffset=20pt,
> trimoffset=10pt]
>
> \setupinteractionscreen
>[width=max,height=max]
>
> -
>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] How do I get an empty line in a \framed[align=flushleft]{} item?

2020-04-30 Thread Gerben Wierda
Brilliant! Thank you!

> On 30 Apr 2020, at 22:54, Wolfgang Schuster 
>  wrote:
> 
> Gerben Wierda schrieb am 30.04.2020 um 22:47:
>> In normal TeX, when I type
>> AapAap
>> I get something like
>> Aap
>> Aap
>> But inside a \framed[align=]{} the empty line disappears. How do I get it 
>> back?
>> Minimal example:
>> \starttext
>> TestingTesting
>> \page
>> \framed[align=flushleft]{TestingTesting}
>> \stoptext
> 
> Use \blank
> 
> 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
___


Re: [NTG-context] How do I get an empty line in a \framed[align=flushleft]{} item?

2020-04-30 Thread Wolfgang Schuster

Gerben Wierda schrieb am 30.04.2020 um 22:47:

In normal TeX, when I type

AapAap

I get something like

Aap

Aap

But inside a \framed[align=]{} the empty line disappears. How do I get 
it back?


Minimal example:

\starttext

TestingTesting
\page

\framed[align=flushleft]{TestingTesting}
\stoptext


Use \blank

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
___


Re: [NTG-context] How do I get an empty line in a \framed[align=flushleft]{} item?

2020-04-30 Thread Henning Hraban Ramm


> Am 30.04.2020 um 22:47 schrieb Gerben Wierda :
> 
> In normal TeX, when I type 
> 
> AapAap
> 
> I get something like 
> 
> Aap
> 
> Aap
> 
> But inside a \framed[align=]{} the empty line disappears. How do I get it 
> back?

Try \framedtext instead; multi line text needs a \vbox, and \framedtext does 
that. (If I understood correctly.)

Maybe you need to set the align option.

Best, Hraban
___
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] How do I get an empty line in a \framed[align=flushleft]{} item?

2020-04-30 Thread Gerben Wierda
In normal TeX, when I type 

AapAap

I get something like 

Aap

Aap

But inside a \framed[align=]{} the empty line disappears. How do I get it back?

Minimal example:

\starttext

TestingTesting
\page

\framed[align=flushleft]{TestingTesting}
\stoptext___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Unicode normalization and Hebrew in ConTeXt

2020-04-30 Thread Joey McCollum
Okay! I have not figured out how to add a new page to the wiki, but I was
able to add a section to the end of the "Arabic and Hebrew" page (
https://www.contextgarden.net/Arabic_and_Hebrew) discussing the issue,
providing a test, and briefly describing the fix.

Joey

On Thu, Apr 30, 2020 at 11:14 AM Hans Hagen  wrote:

> On 4/30/2020 4:28 PM, Joey McCollum wrote:
> > Thanks so much, Hans! I should be able to add a wiki page summarizing
> > the tests before the end of the week.
> >
> > For reference purposes, do you know which version of ConTeXt has (or
> > will have) this update included?
> todays upload
>
>
> -
>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] Trouble setting PDF boxes

2020-04-30 Thread Hans Hagen

On 4/30/2020 5:51 PM, Jack Steyn wrote:
Hello, I'm happy to report that I got this working after much trawling 
through the source and documentation. The code below produces a pdf with 
the MediaBox, CropBox, BleedBox and TrimBox all in the places I 
specified in my original message. I hope it helps illustrate how to set 
these PDF boxes using Lua. I would much appreciate any feedback on how 
the Lua code can be cleaned up or made more flexible (the bleed is 
hard-coded in because I didn't know how to obtain the user-specified 
bleedoffset, for example), or made better in any other way.

can you try this

\setuplayout
  [cropoffset=30pt,
   bleedoffset=20pt,
   trimoffset=10pt]

\setupinteractionscreen
  [width=max,height=max]

-
  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] Fwd: Unicode normalization and Hebrew in ConTeXt

2020-04-30 Thread Arthur Reutenauer
On Tue, Apr 28, 2020 at 08:21:01PM +0200, Hans Hagen wrote:
> On 4/28/2020 6:16 PM, Joey McCollum wrote:
>> https://raw.githubusercontent.com/michal-h21/uninormalize/master/char-def-with-ccc.lua),
> looks like an ancient copy of char-def.lua

  I recognise this file name :-)  That was from my Google Summer of Code
project in 2008.  The combining classes were not in char-def.lua at the
time, so it was simplest to work with a copy.  It’s interesting that it
stayed around so long.

Best,

Arthur
___
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] Problem including svg files with Inkscape 1.0~rc1-4

2020-04-30 Thread Hans Hagen

On 4/30/2020 6:06 PM, mf wrote:

Il 30/04/20 17:21, Hans Hagen ha scritto:

On 4/30/2020 3:15 PM, mf wrote:

Il 30/04/20 14:09, Romain Diss ha scritto:

Hi,

The last release candidat of Inkscape (1.0~rc1-4 on my Debian sid)
doesn't provide the `--export-pdf=` option anymore. So context can not
convert svg files into the corresponding `m_k_i_v_*` pdf.

It seems that the `--export-filename=` option does the job.

Thank in advance.



The command line syntax has changed in version 1. See this:

http://wiki.inkscape.org/wiki/index.php/Release_notes/1.0#Command_Line

So it's --export-filename in Inkscape 1.00, and --export-pdf in 
previous versions.


I tried to specify both options with Inkscape 0.92 hoping the wrong 
one would be ignored, without success; you get only a warning, not an 
error, but the conversion fails anyway.


To make ConTeXt work with both versions, it should run "inkscape 
--version" before doing the actual conversion, to decide the right 
option.


If the conversion you need is done by

tex/texmf-context/scripts/context/ruby/graphics/inkscape.rb

you should edit that file and replace "--export-pdf" with 
"--export-filename".


There are two other files where that option is used:

tex/texmf-context/tex/generic/context/luatex/luatex-fonts-merged.lua
tex/texmf-context/tex/context/base/mkiv/font-ocl.lua

it's font-related code; if you need it, do the same replacement of 
"--export-pdf" in those two files and then remake the format with


context --make

and the export to pdf will work with Inkscape 1.00.
But it won't work with Inkscape 0.92.
As I don't wan to waste code for testing the version, when do we 
change this? Now? I downloaded version 1 so it is available for all 
platforms.




1.0 is a release candidate. Romain is using the unstable version of 
Debian (sid), so he's using Inkscape 1.00rc.


Anyway Inkscape 0.92 will be around for some time, so a better solution 
would be defaulting to the export option of the current version of 
Inkscape unless the user sets an environment variable (INKSCAPE_VERSION?).


So a test of an environment variable instead of spawning a process to 
run "inkscape --version".


hm, we can have for a while

\enabledirectives[graphics.inkscape.oldversion]

and use new as default (and of course you will wikify that, okay?)

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] Problem including svg files with Inkscape 1.0~rc1-4

2020-04-30 Thread Hans Hagen

On 4/30/2020 5:35 PM, Romain Diss wrote:

Hi,


Il 30/04/20 14:09, Romain Diss ha scritto:

Hi,

The last release candidat of Inkscape (1.0~rc1-4 on my Debian sid)
doesn't provide the `--export-pdf=` option anymore. So context can not
convert svg files into the corresponding `m_k_i_v_*` pdf.

The command line syntax has changed in version 1. See this:
http://wiki.inkscape.org/wiki/index.php/Release_notes/1.0#Command_Line

So it's --export-filename in Inkscape 1.00, and --export-pdf in previous
versions.
If the conversion you need is done by
tex/texmf-context/scripts/context/ruby/graphics/inkscape.rb
you should edit that file and replace "--export-pdf" with
"--export-filename".

Thanks for this workaround but I suppose I'll need to edit that file
again after each context update…

However, the change in `inkscape.rb` has no effect, even after updating
the format with `context --make`… Any idea ?

Hi,

just wondering ... do you need that script when you use 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 / 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] Project setup query

2020-04-30 Thread Henning Hraban Ramm
Hi Alan!

> Am 30.04.2020 um 15:07 schrieb Alan Bowen :
> 
> Is there a way to identify the TEX root for each of the common files (in 
> Directory02) so that
> the file will be processed when I process any one of the prd files in 
> Directory01?
> 
> I have tried 
> % !TEX root=../prd_\mystring.tex

Processing single components won’t work in your project, since I defined 
several metadata macros in the product. More off list.

> with, e.g., \def\mystring{Name01} in the prd_Name01.tex file, but that does 
> not seem to work—the various .tex files re not found.

Comment lines are not handled by TeX, and therefore don’t get expanded.


Best, Hraban
___
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] Problem including svg files with Inkscape 1.0~rc1-4

2020-04-30 Thread mf

Il 30/04/20 17:21, Hans Hagen ha scritto:

On 4/30/2020 3:15 PM, mf wrote:

Il 30/04/20 14:09, Romain Diss ha scritto:

Hi,

The last release candidat of Inkscape (1.0~rc1-4 on my Debian sid)
doesn't provide the `--export-pdf=` option anymore. So context can not
convert svg files into the corresponding `m_k_i_v_*` pdf.

It seems that the `--export-filename=` option does the job.

Thank in advance.



The command line syntax has changed in version 1. See this:

http://wiki.inkscape.org/wiki/index.php/Release_notes/1.0#Command_Line

So it's --export-filename in Inkscape 1.00, and --export-pdf in 
previous versions.


I tried to specify both options with Inkscape 0.92 hoping the wrong 
one would be ignored, without success; you get only a warning, not an 
error, but the conversion fails anyway.


To make ConTeXt work with both versions, it should run "inkscape 
--version" before doing the actual conversion, to decide the right 
option.


If the conversion you need is done by

tex/texmf-context/scripts/context/ruby/graphics/inkscape.rb

you should edit that file and replace "--export-pdf" with 
"--export-filename".


There are two other files where that option is used:

tex/texmf-context/tex/generic/context/luatex/luatex-fonts-merged.lua
tex/texmf-context/tex/context/base/mkiv/font-ocl.lua

it's font-related code; if you need it, do the same replacement of 
"--export-pdf" in those two files and then remake the format with


context --make

and the export to pdf will work with Inkscape 1.00.
But it won't work with Inkscape 0.92.
As I don't wan to waste code for testing the version, when do we change 
this? Now? I downloaded version 1 so it is available for all platforms.




1.0 is a release candidate. Romain is using the unstable version of 
Debian (sid), so he's using Inkscape 1.00rc.


Anyway Inkscape 0.92 will be around for some time, so a better solution 
would be defaulting to the export option of the current version of 
Inkscape unless the user sets an environment variable (INKSCAPE_VERSION?).


So a test of an environment variable instead of spawning a process to 
run "inkscape --version".


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] Trouble setting PDF boxes

2020-04-30 Thread Jack Steyn
Hello, I'm happy to report that I got this working after much trawling
through the source and documentation. The code below produces a pdf with
the MediaBox, CropBox, BleedBox and TrimBox all in the places I specified
in my original message. I hope it helps illustrate how to set these PDF
boxes using Lua. I would much appreciate any feedback on how the Lua code
can be cleaned up or made more flexible (the bleed is hard-coded in because
I didn't know how to obtain the user-specified bleedoffset, for example),
or made better in any other way.

Jack

\setuppapersize[A5][A4]

\setuplayout[location=middle, marking=on]

\setupinteraction
  [title={TestDoc},
   author={Anon}]

\setupbackend
  [format=PDF/X-1a:2003,
   intent={ISO Coated v2 300\letterpercent\space (ECI)}]

\setupinteractionscreen[width=max,height=max]

\startluacode
moduledata.mystuff={}
respecify_pdf_boxes = function()
local pdfverbose = lpdf.verbose
local factor = number.dimenfactors.bp
local f_value = string.formatters["\letterpercent.6N"]

local function boxvalue(n)
return pdfverbose(f_value(factor * n))
end

local paperwidth = tex.dimen.printpaperwidth
local paperheight = tex.dimen.printpaperheight
local pagewidth = tex.dimen.paperwidth
local pageheight = tex.dimen.paperheight
local bleedoffset = 3 / number.dimenfactors.mm
local pdfarray = lpdf.array

lpdf.addtopageattributes("MediaBox", pdfarray {
boxvalue(0),
boxvalue(0),
boxvalue(paperwidth),
boxvalue(paperheight),})

lpdf.addtopageattributes("CropBox", pdfarray {
boxvalue(0),
boxvalue(0),
boxvalue(paperwidth),
boxvalue(paperheight),})

lpdf.addtopageattributes("TrimBox", pdfarray {
boxvalue((paperwidth - pagewidth) / 2),
boxvalue((paperheight - pageheight) / 2),
boxvalue((paperwidth + pagewidth) / 2),
boxvalue((paperheight + pageheight) / 2),})

lpdf.addtopageattributes("BleedBox", pdfarray {
boxvalue((paperwidth - pagewidth) / 2 - bleedoffset),
boxvalue((paperheight - pageheight) / 2 - bleedoffset),
boxvalue((paperwidth + pagewidth) / 2 + bleedoffset),
boxvalue((paperheight + pageheight) / 2 + bleedoffset),})
end

moduledata.mystuff.respecify_pdf_boxes = respecify_pdf_boxes

lpdf.registerpagefinalizer(moduledata.mystuff.respecify_pdf_boxes,
"respecify pdf boxes")
\stopluacode

\starttext
test
\stoptext

On Sun, 26 Apr 2020 at 02:42, Jack Steyn  wrote:

> After much searching, my probably laughable attempt consists of combining
> the answer to the question at
> https://tex.stackexchange.com/questions/433110/setting-page-attributes-of-every-page-in-a-generated-context-file
>  with
> what I can see in the source at
> https://source.contextgarden.net/tex/context/base/mkiv/lpdf-mis.lua:
>
> \appendtoks
>   \startluacode
>   local formatters = string.formatters
>
>   local pdfverbose = lpdf.verbose
>   local pdfarray = lpdf.array
>
>   local factor  = number.dimenfactors.bp
>   local f_value = formatters["\letterpercent.6N"]
>
>   local function boxvalue(n)
>   return pdfverbose(f_value(factor * n))
>   end
>
>   lpdf.addtopageattributes("TrimBox", pdfarray {
>   boxvalue(30),
>   boxvalue(30),
>   boxvalue(180),
>   boxvalue(267),})
>   \stopluacode
> \to \aftereverypage
>
> This code throws no errors, but unfortunately it also has no effect. What
> am I doing wrong?
>
> Jack
>
> On Sat, 25 Apr 2020 at 22:37, Jack Steyn  wrote:
>
>> Hi,
>>
>> I am having trouble setting the PDF boxes to my desired dimensions.
>> Suppose I have \setuppapersize[*a*][*b*]. I want CropBox = MediaBox = *b*.
>> So far, so good: I can just use cropoffset=0mm in \setuplayout. But I want
>> TrimBox = *a*. However, as far as I can see, I can't achieve this using
>> trimoffset in \setuplayout unless (width of *b*) – (width of *a*) =
>> (height of *b*) – (height of *a*), which does not hold in my case. So it
>> looks like I need to find another way to set the TrimBox (and the BleedBox,
>> which I want to be 3mm wider and taller than the TrimBox). Does anyone know
>> how to do this?
>>
>> Best,
>>
>> Jack
>>
>
___
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] Problem including svg files with Inkscape 1.0~rc1-4

2020-04-30 Thread Romain Diss
Hi,

> Il 30/04/20 14:09, Romain Diss ha scritto:
> > Hi,
> > 
> > The last release candidat of Inkscape (1.0~rc1-4 on my Debian sid)
> > doesn't provide the `--export-pdf=` option anymore. So context can not
> > convert svg files into the corresponding `m_k_i_v_*` pdf.
> The command line syntax has changed in version 1. See this:
> http://wiki.inkscape.org/wiki/index.php/Release_notes/1.0#Command_Line
> 
> So it's --export-filename in Inkscape 1.00, and --export-pdf in previous
> versions.
> If the conversion you need is done by
> tex/texmf-context/scripts/context/ruby/graphics/inkscape.rb
> you should edit that file and replace "--export-pdf" with
> "--export-filename".
Thanks for this workaround but I suppose I'll need to edit that file
again after each context update…

However, the change in `inkscape.rb` has no effect, even after updating
the format with `context --make`… Any idea ?

Best.

-- 
Romain Diss
___
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] Problem including svg files with Inkscape 1.0~rc1-4

2020-04-30 Thread Hans Hagen

On 4/30/2020 3:15 PM, mf wrote:

Il 30/04/20 14:09, Romain Diss ha scritto:

Hi,

The last release candidat of Inkscape (1.0~rc1-4 on my Debian sid)
doesn't provide the `--export-pdf=` option anymore. So context can not
convert svg files into the corresponding `m_k_i_v_*` pdf.

It seems that the `--export-filename=` option does the job.

Thank in advance.



The command line syntax has changed in version 1. See this:

http://wiki.inkscape.org/wiki/index.php/Release_notes/1.0#Command_Line

So it's --export-filename in Inkscape 1.00, and --export-pdf in previous 
versions.


I tried to specify both options with Inkscape 0.92 hoping the wrong one 
would be ignored, without success; you get only a warning, not an error, 
but the conversion fails anyway.


To make ConTeXt work with both versions, it should run "inkscape 
--version" before doing the actual conversion, to decide the right option.


If the conversion you need is done by

tex/texmf-context/scripts/context/ruby/graphics/inkscape.rb

you should edit that file and replace "--export-pdf" with 
"--export-filename".


There are two other files where that option is used:

tex/texmf-context/tex/generic/context/luatex/luatex-fonts-merged.lua
tex/texmf-context/tex/context/base/mkiv/font-ocl.lua

it's font-related code; if you need it, do the same replacement of 
"--export-pdf" in those two files and then remake the format with


context --make

and the export to pdf will work with Inkscape 1.00.
But it won't work with Inkscape 0.92.
As I don't wan to waste code for testing the version, when do we change 
this? Now? I downloaded version 1 so it is available for all platforms.


there's one more file: grph-con.lua ... (the merged file is not relevant 
as it is for generic but no one uses that one for fonts (like emoji) 
that use svg and the merged file is generated from other files anyway)


Here I also need to adapt the font-ocl replacement file (font-ocm) which 
reminds me that i need to add some already long pending code to the 
luatex binary one of these days.


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] Problem including svg files with Inkscape 1.0~rc1-4

2020-04-30 Thread Hans Hagen

On 4/30/2020 3:15 PM, mf wrote:

Il 30/04/20 14:09, Romain Diss ha scritto:

Hi,

The last release candidat of Inkscape (1.0~rc1-4 on my Debian sid)
doesn't provide the `--export-pdf=` option anymore. So context can not
convert svg files into the corresponding `m_k_i_v_*` pdf.

It seems that the `--export-filename=` option does the job.

Thank in advance.



The command line syntax has changed in version 1. See this:

http://wiki.inkscape.org/wiki/index.php/Release_notes/1.0#Command_Line

So it's --export-filename in Inkscape 1.00, and --export-pdf in previous 
versions.


I tried to specify both options with Inkscape 0.92 hoping the wrong one 
would be ignored, without success; you get only a warning, not an error, 
but the conversion fails anyway.


To make ConTeXt work with both versions, it should run "inkscape 
--version" before doing the actual conversion, to decide the right option.


If the conversion you need is done by

tex/texmf-context/scripts/context/ruby/graphics/inkscape.rb

you should edit that file and replace "--export-pdf" with 
"--export-filename".


There are two other files where that option is used:

tex/texmf-context/tex/generic/context/luatex/luatex-fonts-merged.lua
tex/texmf-context/tex/context/base/mkiv/font-ocl.lua

it's font-related code; if you need it, do the same replacement of 
"--export-pdf" in those two files and then remake the format with


context --make

and the export to pdf will work with Inkscape 1.00.
But it won't work with Inkscape 0.92.
As I don't wan to waste code for testing the version, when do we change 
this? Now? I downloaded version 1 so it is available for all platforms.


there's one more file: grph-con.lua ... (the merged file is not relevant 
as it is for generic but no one uses that one for fonts (like emoji) 
that use svg and the merged file is generated from other files anyway)


Here I also need to adapt the font-ocl replacement file (font-ocm) which 
reminds me that i need to add some already long pending code to the 
luatex binary one of these days.


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] Unicode normalization and Hebrew in ConTeXt

2020-04-30 Thread Hans Hagen

On 4/30/2020 4:28 PM, Joey McCollum wrote:
Thanks so much, Hans! I should be able to add a wiki page summarizing 
the tests before the end of the week.


For reference purposes, do you know which version of ConTeXt has (or 
will have) this update included?

todays upload


-
  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] Getting page width and height in Lua

2020-04-30 Thread Wolfgang Schuster

Jack Steyn schrieb am 30.04.2020 um 16:36:
If I want to get the paper width and height to use in some Lua code, I 
can use:


local paperwidth, paperheight = 
backends.pdf.codeinjections.getpagedimensions()


But what if I want to get the page width and height? That is, the width 
and height of the first argument in the two-argument version of 
\setuppapersize. Does anyone know how I can obtain these using Lua?


You can use tex.dimen[...] or tex.dimen. but all values are in 
scaled points.


\setuppapersize[A5][A4]

\setuplayout[location=middle]

\showframe

\starttext

\startluacode

local pagedimensions = {
"paperwidth",
"paperheight",
"printpaperwidth",
"printpaperheight",
}

context.starttabulate()
for _, pagedimension in next, pagedimensions do
context.NC()
context.Word(pagedimension)
context.NC()

context((number.tomillimeters(tex.dimen[pagedimension],"%.F%s")))
context.NC()
context.NR()
end
context.stoptabulate()

\stopluacode

\stoptext

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] Getting page width and height in Lua

2020-04-30 Thread Jack Steyn
If I want to get the paper width and height to use in some Lua code, I can
use:

local paperwidth, paperheight =
backends.pdf.codeinjections.getpagedimensions()

But what if I want to get the page width and height? That is, the width and
height of the first argument in the two-argument version of
\setuppapersize. Does anyone know how I can obtain these using Lua?

Many thanks,

Jack
___
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] Unicode normalization and Hebrew in ConTeXt

2020-04-30 Thread Joey McCollum
Thanks so much, Hans! I should be able to add a wiki page summarizing the
tests before the end of the week.

For reference purposes, do you know which version of ConTeXt has (or will
have) this update included?

Joey

On Thu, Apr 30, 2020 at 5:26 AM Hans Hagen  wrote:

> On 4/28/2020 1:59 PM, Joey McCollum wrote:
>
>  > ...
>
> > My question is, can ConTeXt with LuaTeX handle the same situation
> > correctly? In the following minimal example, ConTeXt typesets pointed
> > Hebrew correctly when the characters are in the typographically
> > recommended order, but not when they are in Unicode canonical order:
> We (Joey and I) figured out how to best deal with this. As a result the
> predefined hebrew feature now will do the right thing for fonts that
> assume some specific ordering. So, this should work okay:
>
> \definefontfamily[hebrew] [rm] [SBL Hebrew] [features=hebrew]
>
> in the most recent upload.
>
> Maybe there should be a wiki page that summarizes tests with hebrew
> fonts (but I leave that up to Joey).
>
> 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] Problem including svg files with Inkscape 1.0~rc1-4

2020-04-30 Thread mf

Il 30/04/20 14:09, Romain Diss ha scritto:

Hi,

The last release candidat of Inkscape (1.0~rc1-4 on my Debian sid)
doesn't provide the `--export-pdf=` option anymore. So context can not
convert svg files into the corresponding `m_k_i_v_*` pdf.

It seems that the `--export-filename=` option does the job.

Thank in advance.



The command line syntax has changed in version 1. See this:

http://wiki.inkscape.org/wiki/index.php/Release_notes/1.0#Command_Line

So it's --export-filename in Inkscape 1.00, and --export-pdf in previous 
versions.


I tried to specify both options with Inkscape 0.92 hoping the wrong one 
would be ignored, without success; you get only a warning, not an error, 
but the conversion fails anyway.


To make ConTeXt work with both versions, it should run "inkscape 
--version" before doing the actual conversion, to decide the right option.


If the conversion you need is done by

tex/texmf-context/scripts/context/ruby/graphics/inkscape.rb

you should edit that file and replace "--export-pdf" with 
"--export-filename".


There are two other files where that option is used:

tex/texmf-context/tex/generic/context/luatex/luatex-fonts-merged.lua
tex/texmf-context/tex/context/base/mkiv/font-ocl.lua

it's font-related code; if you need it, do the same replacement of 
"--export-pdf" in those two files and then remake the format with


context --make

and the export to pdf will work with Inkscape 1.00.
But it won't work with Inkscape 0.92.

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
___


[NTG-context] Project setup query

2020-04-30 Thread Alan Bowen
This is a minor issue—to which I expect the answer will be simple,
something I should know by now but do not. I am just trying to see if I can
streamline a working directory.

In Directory01, I have a number of prd_NameXX.tex files as well as a
Directory02 which contains .tex files  that are to be called on by each one
of the prd_Name.tex files.

Is there a way to identify the TEX root for each of the common files (in
Directory02) so that
the file will be processed when I process any one of the prd files in
Directory01?

I have tried
% !TEX root=../prd_\mystring.tex

with, e.g., \def\mystring{Name01} in the prd_Name01.tex file, but that does
not seem to work—the various .tex files re not found.

What puzzles me is that the environment files in Directory02 are found.
(That they are identified in a prj file in Directory01 does not seem to be
the reason why.)

There is no problem if I move the contents of Directory02 into Directory01.

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

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


[NTG-context] Problem including svg files with Inkscape 1.0~rc1-4

2020-04-30 Thread Romain Diss
Hi,

The last release candidat of Inkscape (1.0~rc1-4 on my Debian sid)
doesn't provide the `--export-pdf=` option anymore. So context can not
convert svg files into the corresponding `m_k_i_v_*` pdf.

It seems that the `--export-filename=` option does the job.

Thank in advance.

-- 
Romain Diss
___
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] Is this a MetaFun bug or intended behaviour?

2020-04-30 Thread Gerben Wierda
I wanted to use the macro simplified to remove duplicate points from a path, 
but it removes more than that:

metapost log> (127,-107)..controls (117,-107) and (107,-107)
metapost log>  ..(97,-107)..controls (97,-130.34) and 
(97,-153.66)
metapost log>  ..(97,-177)..controls (117,-177) and (137,-177)
metapost log>  ..(157,-177)..controls (157,-170.34) and 
(157,-163.66)
metapost log>  ..(157,-157)
metapost log> 
metapost log> >> Path at line 0:
metapost log> (97,-177)..controls (117,-177) and (137,-177)
metapost log>  ..(157,-177)..controls (157,-170.34) and 
(157,-163.66)
metapost log>  ..(157,-157)

First is path, second is simplified path.

Is simplified maybe only supposed to work with cycles?

G___
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] image across 2 page spread

2020-04-30 Thread Hans Hagen

On 4/30/2020 2:05 AM, jbf wrote:

Hi list,

With 99% of work complete on a book, including single page images, I now 
find myself confronted with a final problem: how to run one image across 
facing pages or in other words, one image (plus its caption) across a 
two-page spread, such that there is no gap.


I have tried a number of fairly crass attempts (obviously too simple) to 
see if I could get somewhere near what I want, e.g.


\externalfigure[plate12.jpg][width=\paperwidth, height=.7\paperheight, 
frame=none] {\tfx \sc Plates 12, 13. \tfx Twenty trucks from the 
Netherlands setting off}


\externalfigure[plate13.jpg][width=\paperwidth, height=.7\paperheight, 
frame=none] {\tfx for their first mission amongst the German diaspora.}


My thinking here was that \paperwidth might help extend the image to the 
inner edge on the left-hand page, but it doesn't work that way for the 
right-hand page, since there it extends to the outer edge, not the inner 
edge! The .7\paperheight was to provide room for the caption. But all in 
all, this is no solution!


If it is any help, the setup dimensions for the book are US Digest:

\definepapersize
   [ACN][width=5.5in,height=8.5in] %  w140mm x h216mm

I then looked up how one might do it in LaTeX, and found the following 
link: 
https://tex.stackexchange.com/questions/23860/how-to-include-a-picture-over-two-pages-left-part-on-left-side-right-on-right


How much of that would be transferable to ConTeXt? (I am thinking 
particularly of the |\newcommand*{\twopagepicture}[4]| bit.


There are explanations for how to do this in InDesign, and since it is 
something someone might often want to do (e.g. in magazines), I also 
thought it might be easier to find reference to it on Contextgarden, yet 
haven't found anything there. But I am sure ConTeXt has a way to do this.


Could someone point me in the right direction with this please?

\setuppagenumbering
  [alternative=doublesided]

\starttext

\dorecurse{3}{\input tufte \par}

\startpostponing
\setuppagenumbering[state=stop]
\startspread
\startplacefigure[location=here,title={This is a cow!}]
\externalfigure[cow.pdf][height=\textheight]%
\stopplacefigure
\stopspread
\setuppagenumbering[state=start]
\stoppostponing

\dorecurse{10}{\input tufte \par}

\stoptext

-
  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] Unicode normalization and Hebrew in ConTeXt

2020-04-30 Thread Hans Hagen

On 4/28/2020 1:59 PM, Joey McCollum wrote:

> ...

My question is, can ConTeXt with LuaTeX handle the same situation 
correctly? In the following minimal example, ConTeXt typesets pointed 
Hebrew correctly when the characters are in the typographically 
recommended order, but not when they are in Unicode canonical order:
We (Joey and I) figured out how to best deal with this. As a result the 
predefined hebrew feature now will do the right thing for fonts that 
assume some specific ordering. So, this should work okay:


\definefontfamily[hebrew] [rm] [SBL Hebrew] [features=hebrew]

in the most recent upload.

Maybe there should be a wiki page that summarizes tests with hebrew 
fonts (but I leave that up to Joey).


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] image across 2 page spread

2020-04-30 Thread Henning Hraban Ramm


> Am 30.04.2020 um 02:05 schrieb jbf :
> 
> Hi list,
> 
> With 99% of work complete on a book, including single page images, I now find 
> myself confronted with a final problem: how to run one image across facing 
> pages or in other words, one image (plus its caption) across a two-page 
> spread, such that there is no gap.

You need to use \clip and calculate the sections.
Thangalin already gave you an example. Here’s a convoluted one that I use:

% full double page image
% usage:
% \startpostponing[pagenumber]
% \doublepagefig[reference][left/right/width/height*]{caption}{filename}
% \stoppostponing
% * lw,lh,rw,rh - place as left/right page, adapt image to width/height
% default is lw
% postponing is important, otherwise the page numbering gets wrong

\newdimen\Bleed
\newdimen\maxWidth
\newdimen\maxHeight
\newdimen\doubleWidth
\newdimen\topOffset
\newdimen\bottomOffset

\Bleed=3mm
\setupbleeding[offset=\Bleed]
\maxWidth=\dimexpr\paperwidth + \Bleed\relax
\maxHeight=\dimexpr\paperheight + 2\Bleed\relax
\doubleWidth=\dimexpr2\maxWidth\relax
\topOffset=\dimexpr\topspace + \headerheight + \Bleed\relax
\bottomOffset=\dimexpr\bottomheight + \footerheight + \Bleed\relax

\definelayer[bgpicleft][x=-\Bleed,y=-\Bleed,width=\maxWidth,height=\maxHeight] 
% inkl. Beschnitt
\definelayer[bgpicright][x=0mm,y=-\Bleed,width=\maxWidth,height=\maxHeight] % 
inkl. Beschnitt

\definemakeup[fullpage][
  page=no,
  doublesided=no,
  headerstate=empty,
  footerstate=empty,
  pagestate=start,
]

\def\doublepagefig{\dodoubleempty\doDoublePagefig}
\def\doDoublePagefig[#1][#2]#3#4{
\startfullpagemakeup
\setlayer[bgpicleft]{\textreference[#1]{}%
\clip[
hoffset=0mm, voffset=0mm,
width=\maxWidth,
height=\maxHeight,
]{%
\doifinstringelse{h}{#2}{%
\externalfigure[#4][height=\maxHeight]%
}{%
\externalfigure[#4][width=\doubleWidth]%
}%
}%
}
% set caption into footer (left page)
  \doiftext{#3}{\doifinstring{l}{#2}{%
\setlayer[bgpicleft][
  x=\backspace,
  y=\dimexpr\makeupheight + \footerheight\relax,
]{%
  \doifmodeelse{blackcaption}{%
\tfx\vbox{#3}%
  }{%
\inframed[
frame=off,background=shadow,
foregroundcolor=captioncolor,]{%
  \bfx{#3}%\vbox{#3}%
}%
  }%
}%
}}
% debugging information
\setlayer[bgpicleft][x=0mm,y=-\Bleed]{%
\color[debugcolor]{~\tt\bfx #1 / #2 / #4}
}
\stopfullpagemakeup
\startfullpagemakeup
\setlayer[bgpicright]{%
\clip[
hoffset=\maxWidth,
voffset=0mm,
width=\maxWidth,
height=\maxHeight,
]{%
\doifinstringelse{h}{#2}{%
\externalfigure[#4][height=\maxHeight]%
}{%
\externalfigure[#4][width=\doubleWidth]%
}%
}%
}
% set caption into footer (right page)
  \doiftext{#3}{\doifinstring{r}{#2}{%
\setlayer[bgpicright][
  x=\backspace,
  y=\dimexpr\makeupheight + \footerheight\relax,
]{%
  \doifmodeelse{blackcaption}{%
\tfx\vbox{#3}%
  }{%
\inframed[
  frame=off,background=shadow,foregroundcolor=captioncolor]{%
  \bfx{#3}%\vbox{#3}%
}%
  }%
}%
}}%
% debugging information
\setlayer[bgpicright][x=0mm,y=-\Bleed]{%
\color[captioncolor]{~\tt\bfx #1 / #2 / #4}
}
\stopfullpagemakeup
} % doublepagefig


You can see the outcome here:
https://www.dreiviertelhaus.de/architekturfuehrer/hicog/


Have fun,
Hraban

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