[NTG-context] floats disturb grid setting

2022-10-03 Thread Henning Hraban Ramm via ntg-context

As soon as I use floats, text isn’t typeset on the grid any more:


\setuppaper[A5]
\setuplayout[grid=yes]
\showframe\showgrid

\setupexternalfigure[
  location={local,global,default},
]

\starttext
\samplefile{lorem}
\startplacefigure[location=left,title=left]%
\externalfigure[mill][width=.25\textwidth]
\stopplacefigure

\samplefile{lorem}
\startplacefigure[location=bottom,title=bottom]%
\externalfigure[cow][width=.25\textwidth]
\stopplacefigure

\startplacefigure[location=right,title=right]%
\externalfigure[mill][width=.25\textwidth]
\stopplacefigure
\samplefile{lorem}

\startplacefigure[location=left,title=left]%
\externalfigure[mill][width=.25\textwidth]
\stopplacefigure
\samplefile{lorem}

\stoptext


Hraban
___
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] remote images

2022-10-03 Thread Henning Hraban Ramm via ntg-context

Hi,

fetching images per URI was supported (and is also documented in the 
wiki), but with LMTX 2022.09.11 and one of


\externalfigure[http://tug.org/images/logobw.jpg]
or
\externalfigure[https://picsum.photos/300/200]

I only get the usual grey box. No error message.

Do I need any setup, was this discarded in LMTX, or what’s wrong?

Hraban
___
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] ConTeXt meeting and the annotated cow

2022-09-18 Thread Axel Kielhorn via ntg-context
Hello,

last week I learned something about MetaPost at the context meeting.
Thanks Taco!

First a little background:

I write a lot of documentation and sometimes I need to include a picture with 
annotations.
Until now I used a drawing program to add text and arrows.
This has one disadvantage, these annotations are not translated.
I have to prepare a set of pictures for every language.

Well, that changed last week.
Here is my first try (actually the 4th iteration):

%%%
\setupexternalfigures[location=default]
\starttext

\startMPinclusions
%draft := 0;
draft := 1;

color mycolor;

if draft = 1 :
mycolor := red ;
else:
mycolor := .4white ;
fi ;

% Draw a grid to count locations

def gridscaled =
pair ur;
ur = urcorner currentpicture;

width :=  xpart ur;
height := ypart ur;

xstep := ceiling(width / 10);
ystep := ceiling(height / 10);

if draft = 1:
counter := 1;
for i = xstep step xstep until width :
draw (i, 0 ) -- (i, height);
label.rt(counter, (i , 0.5 cm));
counter := counter + 1 ;
endfor;

counter := 1;
for i = ystep step ystep until height :
draw (0, i) -- (width, i);
label.top(counter, (0.5 cm, i ));
counter := counter + 1 ;
endfor;
fi;
enddef;
% Bottom: The annotation is at the bottom of the start point
  
def annotb (expr a,  b, c, d) (text t) =
label.bot (t, (a * xstep,  b * ystep));
drawarrow (a * xstep, b * ystep) -- ( c * xstep, d * ystep)
withpen pencircle scaled .8mm withcolor white;
drawarrow (a * xstep, b * ystep) -- ( c * xstep, d * ystep)
withpen pencircle scaled .5mm withcolor mycolor;
enddef ;
% Top: The annotation is on top of the start point  
def annott (expr a,  b, c, d) (text t) =
label.top (t, (a * xstep,  b * ystep));
drawarrow (a * xstep, b * ystep) -- ( c * xstep, d * ystep)
withpen pencircle scaled .8mm withcolor white;
drawarrow (a * xstep, b * ystep) -- ( c * xstep, d * ystep)
withpen pencircle scaled .5mm withcolor mycolor;
enddef ;
% Right: The annotation is on the right of the start point  

def annotr (expr a,  b, c, d) (text t) =
label.rt (t, (a * xstep,  b * ystep));
drawarrow (a * xstep, b * ystep) -- ( c * xstep, d * ystep)
withpen pencircle scaled .8mm withcolor white;
drawarrow (a * xstep, b * ystep) -- ( c * xstep, d * ystep)
withpen pencircle scaled .5mm withcolor mycolor;
enddef ;
% Left: The annotation is on the left of the start point
  
def annotl (expr a,  b, c, d) (text t) =
label.lft (t, (a * xstep,  b * ystep));
drawarrow (a * xstep, b * ystep) -- ( c * xstep, d * ystep)
withpen pencircle scaled .8mm withcolor white;
drawarrow (a * xstep, b * ystep) -- ( c * xstep, d * ystep)
withpen pencircle scaled .5mm withcolor mycolor;
enddef ;
\stopMPinclusions

\startMPpage
% Picture
draw externalfigure "cow.pdf" xsized 16cm;
% Grid
gridscaled;
% Text
annotb (1, 5, .8, 7.3, "Maul");
annotb (6, 2, 7, 3.2, "Euter");
annott (9.2, 9.5, 9.6, 3, "Schwanz");
annotb (3, -.5, 3.1, .9, "Huf");
annotb (3, -.5, 3.9, 1.1, "");

\stopMPpage

\startMPpage
% Picture
draw externalfigure "cow.pdf" xsized 10cm;
% Grid
gridscaled;
% Text
annotb (1, 5, .8, 7.3, "Maul");
annotb (6, 2, 7, 3.2, "Euter");
annott (9.2, 9.5, 9.6, 3, "Schwanz");
annotb (3, -.5, 3.1, .9, "Huf");
annotb (3, -.5, 3.9, 1.1, "");

\stopMPpage

\stoptext

%%%

There are still some further ideas and a lot to learn for me:
- multi line annotations
- a transparent white background
- a frame around the text
- a link to the section where the part is explained 
- moving to one command with the orientation as an argument

Comments and improvements are welcome.

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


Re: [NTG-context] setupexternalfigures and resoĺution

2022-09-02 Thread Keith McKay via ntg-context
Thanks for this code Hraban. I tried this last night and it worked really
well. I did have one stumbling block when I noticed that those image files
with a space in their names were not found, however renaming  without a
space solved the problem. Is this a bug or a feature?
Thanks
Keith McKay

On Thu, 1 Sep 2022, 09:52 Henning Hraban Ramm via ntg-context, <
ntg-context@ntg.nl> wrote:

> Am 01.09.22 um 10:44 schrieb juh+ntg-context--- via ntg-context:
> >
> > Hi,
> >
> > what is resolution meant to do?
> >
> > Whatever I insert as resolution, I get no change.
> >
> > \setupexternalfigure[location={default,local},resolution=30]
> > \starttext
> > \externalfigure[hacker]
> > \stoptext
> >
> > What am I missing?
>
> The resolution parameter is still not used by default ConTeXt, sorry.
>
> But you can use it with the attached lua file like:
>
>
> \loadluafile[grph-downsample]
> \doifmodeelse{print}{%
> \def\Resolution{300}
> }{%
> \def\Resolution{96}
> }%
>
> \setupexternalfigures[
>%directory={./Logos,img},
>conversion=lowres.jpg,
>resolution=\Resolution,
> ]
>
>
> Hraban
>
> ___
> 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
___


Re: [NTG-context] setupexternalfigures and resoĺution

2022-09-01 Thread Henning Hraban Ramm via ntg-context

Am 01.09.22 um 10:44 schrieb juh+ntg-context--- via ntg-context:


Hi,

what is resolution meant to do?

Whatever I insert as resolution, I get no change.

\setupexternalfigure[location={default,local},resolution=30]
\starttext
\externalfigure[hacker]
\stoptext

What am I missing?


The resolution parameter is still not used by default ConTeXt, sorry.

But you can use it with the attached lua file like:


\loadluafile[grph-downsample]
\doifmodeelse{print}{%
\def\Resolution{300}
}{%
\def\Resolution{96}
}%

\setupexternalfigures[
  %directory={./Logos,img},
  conversion=lowres.jpg,
  resolution=\Resolution,
]


Hraban
if not modules then modules = { } end modules ['grph-downsample'] = {
  version   = 1.100,
  comment   = "companion to grph-inc.mkiv",
  author= "Peter Münster", -- adapted to LMTX by Hraban
  copyright = "PRAGMA ADE / ConTeXt Development Team",
  license   = "see context related readme files"
}

assert(not figures.getinfo2)

figures.getinfo2 = function(name, page) -- [ [NTG-context] Pdf info with 
Lua/Ctx API ]
 if type(name) == "string" then
   name = { name = name, page = page }
 end

 if name.name then
   local data = figures.push(name)
   local info = figures.identify()

   if info.status.status ~= 0 then
 figures.check() -- !Counts pages here!
   end

   figures.pop()

   return --data
  info
 end
end


local format = string.format
-- figures.cachepaths.path = "cache" -- should be setup-option
local function sample_down(oldname, newname, resolution)
  print("DOWNSAMPLE sample_down " .. oldname .. " to " .. newname)
  local request = figures.current().request
  local width = request.width
  local height = request.height
  if resolution == "" then -- or (not width and not height) then
print(format("DOWNSAMPLE Nothing to do: %s, %s, %s dpi, %s x %s px", 
oldname, newname, resolution, width, height))
return
  end
  local TEXpt = 65536
  local inch = 72.27

  -- MkIV:
  -- local image = img.scan{filename = oldname}

  -- LMTX:
  local image = figures.getinfo(oldname,1)
  image = image.status.private

  local xy = image.xsize / image.ysize
  if (not width and not height) then
-- no size requested? use default width
width = 300 * TEXpt
  end
  if not width then
height = height / TEXpt
width = height * xy
  end
  if not height then
width = width / TEXpt
height = width / xy
  end
  width = math.floor(width)
  height = math.floor(height)
  print(format("DOWNSAMPLE image size %dx%dpx. requested %dx%d?", image.xsize, 
image.ysize, width, height))
  local xsize = math.floor(resolution * width / inch)
  local ysize = math.floor(resolution * height / inch)
  print(format("DOWNSAMPLE size %d x %d to %d x %d", image.xsize, image.ysize, 
xsize, ysize))
  if xsize < image.xsize or ysize < image.ysize then
local s = format("gm convert -resize %dx%d -resample %dx%d %s %s",
 xsize, ysize, resolution, resolution, oldname, newname)
print("DOWNSAMPLE Conversion: " .. s)
os.execute(s)
  else
print(format("DOWNSAMPLE Nothing to do: %s, %s, %s dpi, %d x %d px", 
oldname, newname, resolution, width, height))
print(format("DOWNSAMPLE xsize = %d, ysize = %d", xsize, ysize))
  end
end

local formats = {"png", "jpg", "gif"}

for _, s in ipairs(formats) do
  figures.converters[s] = figures.converters[s] or {}
  figures.converters[s]["lowres." .. s] = sample_down
end
___
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] setupexternalfigures and resoĺution

2022-09-01 Thread juh+ntg-context--- via ntg-context


Hi,

what is resolution meant to do?

Whatever I insert as resolution, I get no change.

\setupexternalfigure[location={default,local},resolution=30]
\starttext
\externalfigure[hacker]
\stoptext

What am I missing?

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


Re: [NTG-context] Clipping multiple PDFs

2022-08-23 Thread Aditya Mahajan via ntg-context
On Tue, 23 Aug 2022, Pablo Rodriguez via ntg-context wrote:

> On 8/23/22 17:27, Aditya Mahajan via ntg-context wrote:
> > [...]
> > For a more low-level interface to finding the number of pages, see:
> >
> > https://adityam.github.io/context-blog/post/include-multi-page-pdf/
> 
> Hi Aditya,
> 
> I wonder whether your final definition should be rewritten as:
> 
>  \unexpanded\def\includePDF[#1]%
> {\getfiguredimensions[#1]
>  \dorecurse{\noffigurepages}
> {\startTEXpage
> \externalfigure[#1][page=\recurselevel]
>  \stopTEXpage}}
> 
> At least, otherwise it will only work with "talk.pdf".
> 
> Or am I missing something?

Thanks. That was a typo and is now fixed.

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


Re: [NTG-context] Clipping multiple PDFs

2022-08-23 Thread Pablo Rodriguez via ntg-context
On 8/23/22 17:27, Aditya Mahajan via ntg-context wrote:
> [...]
> For a more low-level interface to finding the number of pages, see:
>
> https://adityam.github.io/context-blog/post/include-multi-page-pdf/

Hi Aditya,

I wonder whether your final definition should be rewritten as:

 \unexpanded\def\includePDF[#1]%
{\getfiguredimensions[#1]
 \dorecurse{\noffigurepages}
{\startTEXpage
    \externalfigure[#1][page=\recurselevel]
 \stopTEXpage}}

At least, otherwise it will only work with "talk.pdf".

Or am I missing something?

Many thanks for your comment,

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


Re: [NTG-context] Clipping multiple PDFs

2022-08-23 Thread Jethro Djan via ntg-context
Hello,

Thanks to Pablo and Aditya for the solutions. Sometimes it is very
difficult to find the right manuals and info for what you want to achieve
for those of us new to ConTeXt. I found the stuff on
context(context.noffigurepages) here (
https://wiki.contextgarden.net/Image_Placement) and I didn’t know the
manual you linked to existed. I have also been searching for stuff about
“low-level” stuff in ConTexT like the \doloopoverlist command.

I hope to contribute to the online wiki as I become a better user of
ConTeXt.

On Tue, Aug 23, 2022 at 3:58 PM Pablo Rodriguez via ntg-context <
ntg-context@ntg.nl> wrote:

> On 8/22/22 17:46, Jethro Djan via ntg-context wrote:
> > Thanks for the solution Pablo. It works well.
>
> Glad to read it worked for you, Jethro.
>
> > I wanted to add more pdfs (which also has many pages) and found it
> > was easier for me to reason in the lua side of things. This is what I
> > have at the moment:
>
> I think this might be what you intend:
>
>   \setuplayout[page]
>   \starttext
>   \doloopoverlist{ass1,ass2,ass3,ass4,ass5,ass6,ass7,ass8}
> {\def\Doc{\recursestring.pdf}
>  \getfiguredimensions[\Doc]
>  \dorecurse{\noffigurepages}
>  {\externalfigure[\Doc]
>[page=\recurselevel, width=20cm, scale=950]}}
>   \stoptext
>
> > I didn’t know how to get an array (or indexed table or whatever you
> > call it) in ConTeXt/Tex.
>
> \doloopoverlist & \recursestring are your friends here.
>
> > My problem is now with context(context.noffigurepages). Am I calling
> > it wrong? All I want to do is call \noffigurepages from the lua side.
> > Is there something I am missing?
>
> The approach is totally different: "getnofpages"
> (
> http://www.pragma-ade.com/general/manuals/luametatex.pdf#search=getnofpages
> ).
>
> BTW, your code crashed my session, CPU goes to 100% and RAM usage too. I
> wonder how your sample could be compiled fine by your system.
>
> I hope it helps,
>
> Pablo
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://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
___


Re: [NTG-context] Clipping multiple PDFs

2022-08-23 Thread Pablo Rodriguez via ntg-context
On 8/22/22 17:46, Jethro Djan via ntg-context wrote:
> Thanks for the solution Pablo. It works well.

Glad to read it worked for you, Jethro.

> I wanted to add more pdfs (which also has many pages) and found it
> was easier for me to reason in the lua side of things. This is what I
> have at the moment:

I think this might be what you intend:

  \setuplayout[page]
  \starttext
  \doloopoverlist{ass1,ass2,ass3,ass4,ass5,ass6,ass7,ass8}
{\def\Doc{\recursestring.pdf}
 \getfiguredimensions[\Doc]
 \dorecurse{\noffigurepages}
 {\externalfigure[\Doc]
   [page=\recurselevel, width=20cm, scale=950]}}
  \stoptext

> I didn’t know how to get an array (or indexed table or whatever you
> call it) in ConTeXt/Tex.

\doloopoverlist & \recursestring are your friends here.

> My problem is now with context(context.noffigurepages). Am I calling
> it wrong? All I want to do is call \noffigurepages from the lua side.
> Is there something I am missing?

The approach is totally different: "getnofpages"
(http://www.pragma-ade.com/general/manuals/luametatex.pdf#search=getnofpages).

BTW, your code crashed my session, CPU goes to 100% and RAM usage too. I
wonder how your sample could be compiled fine by your system.

I hope it helps,

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

maillist : ntg-context@ntg.nl / https://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
___


Re: [NTG-context] Clipping multiple PDFs

2022-08-22 Thread Jethro Djan via ntg-context

Thanks for the solution Pablo. It works well.

I wanted to add more pdfs (which also has many pages) and found it was easier 
for me to reason in the lua side of things. This is what I have at the moment:

\starttext
\startluacode
  local function doc(fil)
return fil..[[.pdf]]
  end

  local function disppdf(fname)
n = 1 
repeat 
  context.externalfigure({fname},{
page = n,
width = "200mm",
scale = "950"
  })
  n = n + 1
until n == context(context.noffigurepages)
  end

  local pdffiles = {"ass1", "ass2", "ass3", "ass4", "ass5", "ass6", "ass7", 
"ass8"}
  for index=1,#pdffiles do 
local f = doc(pdffiles[index])
context.getfiguredimensions({f})
disppdf(pdffiles[index])
  end
\stopluacode
\stoptext

I didn’t know how to get an array (or indexed table or whatever you call it) in 
ConTeXt/Tex. My problem is now with context(context.noffigurepages). It doesn’t 
produce an integer so n is being compared to nil. Am I calling it wrong? All I 
want to do is call \noffigurepages from the lua side. Is there something I am 
missing?

Jethro

> On 21 Aug 2022, at 4:41 PM, Pablo Rodriguez via ntg-context 
>  wrote:
> 
> On 8/18/22 02:13, jethro Reuel via ntg-context wrote:
>> Hello,
>> 
>> I am trying to put multiple PDF’s that were typeset differently into
>> one document without modifying the individual files themselves.
>> [...]
>> The problem is the original page numbers show and I’d prefer that it
>> did not. So I thought maybe I could clip all the page numbers from
>> every page (since they are all in the same position across all the
>> pages) but I don’t know how to do this with the \clip command. Any
>> ideas? I already tried using \input but it gives some weird output in
>> some places. It doesn’t have to use this method as long as it does
>> what I need it to do.
> 
> Hi Jethro,
> 
> it works using \clip with \externalfigure inside a loop (\dorecurse).
> 
> With \getfiguredimensions you get the number of pages of each PDF
> document (\noffigurepages).
> 
> The following source both generates the source PDF document and the
> imposed result with clipped pages (just to see a sample of the commands
> mentioned above):
> 
>  \startbuffer[newbuff]
>  \setuppapersize[A3]
>  \setupbodyfont[sans, 1200pt]
>  \starttext
>  \dorecurse{8}
>  {\startmakeup[page][pagestate=start, align=center, style=\bf]
>\recurselevel
>   \stopmakeup}
>  \stoptext
>  \stopbuffer
>  \startmode[*first]
>  \savebuffer[newbuff][source_page.tex, prefix=no]
>  \executesystemcommand{context --purgeall source_page.tex}
>  \stopmode
>  \setuplayout[page]
>  \setuppapersize[A6][A4]
>  \setuppaper[nx=2, ny=2]
>  \setuparranging [XY]
>  \starttext
>  \startnotmode[*first]
>  \def\Doc{source_page.pdf}
>  \getfiguredimensions[\Doc]
>  \dorecurse{\noffigurepages}
>{\clip[hoffset=96mm, voffset=136mm, width=105mm, height=148mm]
>{\externalfigure[\Doc][page=\recurselevel]}}
>  \stopnotmode
>  \stoptext
> 
> Just in case it might help,
> 
> Pablo
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://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
___


Re: [NTG-context] Clipping multiple PDFs

2022-08-22 Thread Jethro Djan via ntg-context

Thanks for the solution Pablo. It works well.

I wanted to add more pdfs (which also has many pages) and found it was easier 
for me to reason in the lua side of things. This is what I have at the moment:

\starttext
\startluacode
  local function doc(fil)
return fil..[[.pdf]]
  end

  local function disppdf(fname)
n = 1 
repeat 
  context.externalfigure({fname},{
page = n,
width = "200mm",
scale = "950"
  })
  n = n + 1
until n == context(context.noffigurepages)
  end

  local pdffiles = {"ass1", "ass2", "ass3", "ass4", "ass5", "ass6", "ass7", 
"ass8"}
  for index=1,#pdffiles do 
local f = doc(pdffiles[index])
context.getfiguredimensions({f})
disppdf(pdffiles[index])
  end
\stopluacode
\stoptext

I didn’t know how to get an array (or indexed table or whatever you call it) in 
ConTeXt/Tex. My problem is now with context(context.noffigurepages). Am I 
calling it wrong? All I want to do is call \noffigurepages from the lua side. 
Is there something I am missing?

Jethro

> On 21 Aug 2022, at 4:41 PM, Pablo Rodriguez via ntg-context 
>  wrote:
> 
> On 8/18/22 02:13, jethro Reuel via ntg-context wrote:
>> Hello,
>> 
>> I am trying to put multiple PDF’s that were typeset differently into
>> one document without modifying the individual files themselves.
>> [...]
>> The problem is the original page numbers show and I’d prefer that it
>> did not. So I thought maybe I could clip all the page numbers from
>> every page (since they are all in the same position across all the
>> pages) but I don’t know how to do this with the \clip command. Any
>> ideas? I already tried using \input but it gives some weird output in
>> some places. It doesn’t have to use this method as long as it does
>> what I need it to do.
> 
> Hi Jethro,
> 
> it works using \clip with \externalfigure inside a loop (\dorecurse).
> 
> With \getfiguredimensions you get the number of pages of each PDF
> document (\noffigurepages).
> 
> The following source both generates the source PDF document and the
> imposed result with clipped pages (just to see a sample of the commands
> mentioned above):
> 
>  \startbuffer[newbuff]
>  \setuppapersize[A3]
>  \setupbodyfont[sans, 1200pt]
>  \starttext
>  \dorecurse{8}
>  {\startmakeup[page][pagestate=start, align=center, style=\bf]
>\recurselevel
>   \stopmakeup}
>  \stoptext
>  \stopbuffer
>  \startmode[*first]
>  \savebuffer[newbuff][source_page.tex, prefix=no]
>  \executesystemcommand{context --purgeall source_page.tex}
>  \stopmode
>  \setuplayout[page]
>  \setuppapersize[A6][A4]
>  \setuppaper[nx=2, ny=2]
>  \setuparranging [XY]
>  \starttext
>  \startnotmode[*first]
>  \def\Doc{source_page.pdf}
>  \getfiguredimensions[\Doc]
>  \dorecurse{\noffigurepages}
>{\clip[hoffset=96mm, voffset=136mm, width=105mm, height=148mm]
>{\externalfigure[\Doc][page=\recurselevel]}}
>  \stopnotmode
>  \stoptext
> 
> Just in case it might help,
> 
> Pablo
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://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
___


Re: [NTG-context] Clipping multiple PDFs

2022-08-22 Thread Jethro Djan via ntg-context
Thanks for the solution Pablo. It works well.

I wanted to add more pdfs (which also has many pages) and found it was
easier for me to reason in the lua side of things. This is what I have
at the moment:

\starttext
\startluacode
  local function doc(fil)
return fil..[[.pdf]]
  end

  local function disppdf(fname)
n = 1
repeat
  context.externalfigure({fname},{
page = n,
width = "200mm",
scale = "950"
  })
  n = n + 1
until n == context(context.noffigurepages)
  end

  local pdffiles = {"ass1", "ass2", "ass3", "ass4", "ass5", "ass6", "ass7",
"ass8"}
  for index=1,#pdffiles do
local f = doc(pdffiles[index])
context.getfiguredimensions({f})
disppdf(pdffiles[index])
  end
\stopluacode
\stoptext

I didn’t know how to get an array (or indexed table or whatever you call
it) in ConTeXt/Tex. My problem is now with context(context.noffigurepages).
Am I calling it wrong? All I want to do is call \noffigurepages from the
lua side. Is there something I am missing?

Jethro

On 21 Aug 2022, at 4:41 PM, Pablo Rodriguez via ntg-context <
ntg-context@ntg.nl> wrote:

On 8/18/22 02:13, jethro Reuel via ntg-context wrote:

Hello,

I am trying to put multiple PDF’s that were typeset differently into
one document without modifying the individual files themselves.
[...]
The problem is the original page numbers show and I’d prefer that it
did not. So I thought maybe I could clip all the page numbers from
every page (since they are all in the same position across all the
pages) but I don’t know how to do this with the \clip command. Any
ideas? I already tried using \input but it gives some weird output in
some places. It doesn’t have to use this method as long as it does
what I need it to do.


Hi Jethro,

it works using \clip with \externalfigure inside a loop (\dorecurse).

With \getfiguredimensions you get the number of pages of each PDF
document (\noffigurepages).

The following source both generates the source PDF document and the
imposed result with clipped pages (just to see a sample of the commands
mentioned above):

 \startbuffer[newbuff]
 \setuppapersize[A3]
 \setupbodyfont[sans, 1200pt]
 \starttext
 \dorecurse{8}
 {\startmakeup[page][pagestate=start, align=center, style=\bf]
   \recurselevel
  \stopmakeup}
 \stoptext
 \stopbuffer
 \startmode[*first]
 \savebuffer[newbuff][source_page.tex, prefix=no]
 \executesystemcommand{context --purgeall source_page.tex}
 \stopmode
 \setuplayout[page]
 \setuppapersize[A6][A4]
 \setuppaper[nx=2, ny=2]
 \setuparranging [XY]
 \starttext
 \startnotmode[*first]
 \def\Doc{source_page.pdf}
 \getfiguredimensions[\Doc]
 \dorecurse{\noffigurepages}
   {\clip[hoffset=96mm, voffset=136mm, width=105mm, height=148mm]
   {\externalfigure[\Doc][page=\recurselevel]}}
 \stopnotmode
 \stoptext

Just in case it might help,

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

maillist : ntg-context@ntg.nl /
https://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
___


Re: [NTG-context] Clipping multiple PDFs

2022-08-21 Thread Pablo Rodriguez via ntg-context
On 8/18/22 02:13, jethro Reuel via ntg-context wrote:
> Hello,
>
> I am trying to put multiple PDF’s that were typeset differently into
> one document without modifying the individual files themselves.
> [...]
> The problem is the original page numbers show and I’d prefer that it
> did not. So I thought maybe I could clip all the page numbers from
> every page (since they are all in the same position across all the
> pages) but I don’t know how to do this with the \clip command. Any
> ideas? I already tried using \input but it gives some weird output in
> some places. It doesn’t have to use this method as long as it does
> what I need it to do.

Hi Jethro,

it works using \clip with \externalfigure inside a loop (\dorecurse).

With \getfiguredimensions you get the number of pages of each PDF
document (\noffigurepages).

The following source both generates the source PDF document and the
imposed result with clipped pages (just to see a sample of the commands
mentioned above):

  \startbuffer[newbuff]
  \setuppapersize[A3]
  \setupbodyfont[sans, 1200pt]
  \starttext
  \dorecurse{8}
  {\startmakeup[page][pagestate=start, align=center, style=\bf]
\recurselevel
   \stopmakeup}
  \stoptext
  \stopbuffer
  \startmode[*first]
  \savebuffer[newbuff][source_page.tex, prefix=no]
  \executesystemcommand{context --purgeall source_page.tex}
  \stopmode
  \setuplayout[page]
  \setuppapersize[A6][A4]
  \setuppaper[nx=2, ny=2]
  \setuparranging [XY]
  \starttext
  \startnotmode[*first]
  \def\Doc{source_page.pdf}
  \getfiguredimensions[\Doc]
  \dorecurse{\noffigurepages}
{\clip[hoffset=96mm, voffset=136mm, width=105mm, height=148mm]
{\externalfigure[\Doc][page=\recurselevel]}}
  \stopnotmode
  \stoptext

Just in case it might help,

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

maillist : ntg-context@ntg.nl / https://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] Write a long chapter title in two lines

2022-08-18 Thread Jeong Dal via ntg-context
Dear all,

A few days ago, I sent an email as follows. But it is linked to another subject 
because I choose reply of another subject.
So, I send the same mail again.

Thank you for reading.

Best regards,
Dalyoung

**
I’d like to write a long chapter title in two lines if it is longer than the 
textwidth.
It is OK when I use just bigger fonts.

But it writes the long title in one line if I use outlined font for title as in 
MWE.

Is there a way to write it in two lines using the outlined font?

Thanks,

Best regards,

Dalyoung

\startuseMPgraphic{outlineT}
  draw outlinetext.b (\MPvar{tt})
  (withcolor .75white)
  (withcolor .725blue withpen pencircle scaled .75pt);%\MPvar{thick});
\stopuseMPgraphic
\definefont[BigFontOne][NotoSansCJKkr-Bold sa 4]
\define[1]\outlineTitle{\useMPgraphic{outlineT}{tt="#1"}}

\setuphead[chapter]
[textcommand=\outlineTitle,
 style=\BigFontOne,
 numbercommand=\outlineTitle,
% align = middle,
 number=yes]

\setupexternalfigures[location={default,local,global}]
%\definefont[fancy][Zapfino at 24pt]

\starttext
\startchapter[title={Very Long Long Long Title}]
\startcombination[3*1]
 {\externalfigure[cow]   [combination]}{cow}
 {\externalfigure[mill]  [combination]}{mill}
 {\externalfigure[hacker][combination]}{hacker}
\stopcombination
\stopchapter
\stoptext___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://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
___


Re: [NTG-context] Bug (?) with \placefigure[right]

2022-08-16 Thread Wolfgang Schuster via ntg-context

Bruce Horrocks via ntg-context schrieb am 16.08.2022 um 18:11:

Things start to go awry after about 5 or 6 iterations, 12 shows it up clearly 
with three or so nearly blank (except for the subject) pages produced.

\setuppapersize [A5] [A5]
\starttext
\dorecurse{12}{
\subject{Some heading}
\placefigure[right] {} {\externalfigure[cow.pdf] [width=3cm]}
\input lorem
}
\stoptext

I actually want \placefigure[right,none] in my real doc but that also goes awry.
LMTX current version: 2022.08.05 11:44

My actual requirement is to have a set of short biographies, including a small 
'passport' photo, for each contributor to a book. So any suggestions on how to 
wrap text around the photo that avoids this issue would be welcome.


\setuppapersize [A5] [A5]

\starttext

\dorecurse{12}
  {\subject{Some heading}
   \starthanging[right]{\externalfigure[cow.pdf][width=3cm]}
   \samplefile{lorem}
   \stophanging}

\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / https://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] Bug (?) with \placefigure[right]

2022-08-16 Thread Bruce Horrocks via ntg-context
Things start to go awry after about 5 or 6 iterations, 12 shows it up clearly 
with three or so nearly blank (except for the subject) pages produced.

\setuppapersize [A5] [A5]
\starttext
\dorecurse{12}{
\subject{Some heading}
\placefigure[right] {} {\externalfigure[cow.pdf] [width=3cm]}
\input lorem
}
\stoptext

I actually want \placefigure[right,none] in my real doc but that also goes awry.
LMTX current version: 2022.08.05 11:44

My actual requirement is to have a set of short biographies, including a small 
'passport' photo, for each contributor to a book. So any suggestions on how to 
wrap text around the photo that avoids this issue would be welcome.
—
Bruce Horrocks
Hampshire, UK

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

maillist : ntg-context@ntg.nl / https://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] Write a long chapter title in two lines

2022-08-15 Thread Jeong Dal via ntg-context
Dear all,

I’d like to write a long chapter title in two lines if it is longer than the 
textwidth.
It is OK when I use just bigger fonts.

But it writes the long title in one line if I use outlined font for title as in 
MWE.

Is there a way to write it in two lines using the outlined font?

Thanks,

Best regards,

Dalyoung

\startuseMPgraphic{outlineT}
  draw outlinetext.b (\MPvar{tt})
  (withcolor .75white)
  (withcolor .725blue withpen pencircle scaled .75pt);%\MPvar{thick});
\stopuseMPgraphic
\definefont[BigFontOne][NotoSansCJKkr-Bold sa 4]
\define[1]\outlineTitle{\useMPgraphic{outlineT}{tt="#1"}}

\setuphead[chapter]
[textcommand=\outlineTitle,
 style=\BigFontOne,
 numbercommand=\outlineTitle,
% align = middle,
 number=yes]

\setupexternalfigures[location={default,local,global}]
%\definefont[fancy][Zapfino at 24pt]

\starttext
\startchapter[title={Very Long Long Long Title}]
\startcombination[3*1]
 {\externalfigure[cow]   [combination]}{cow}
 {\externalfigure[mill]  [combination]}{mill}
 {\externalfigure[hacker][combination]}{hacker}
\stopcombination
\stopchapter
\stoptext


> On Aug 15, 2022, at 7:42 PM, Pablo Rodriguez via ntg-context 
>  wrote:
> 
> Dear list,
> 
> adapting a the sample from mkxl/page-str.mkxl (and code from the list),
> I came with the following sample:
> 
>  \setuppapersize[A6]
>  \showgrid
>  %\setuplayout[grid=yes]
>  \starttext
>  \input tufte
>  \startoutputstream[es]
>   \dorecurse{25}
>{\startlanguage[es]\input cervantes-es\stoplanguage%
>  \par\pushoutputstream}
>  \enableoutputstream[en]
>   \dorecurse{25}
>{\input zapf\par\pushoutputstream}
>  \disableoutputstream
>  \stopoutputstream
>  \synchronizestreams[es,en]
>  \page \flushoutputstream[es]
>  \page \flushoutputstream[en]
>  \stoptext
> 
> To reorder pages, I rename the output to "wg.pdf" and run the following
> code:
> 
>  \setuppapersize[A6]
>  \setuplayout[page]
>  \starttext
>  \dorecurse{26}
>  {\ifnum\recurselevel = 1
>\externalfigure[wg.pdf][page=\recurselevel]\else
>\externalfigure[wg.pdf][page=\recurselevel]
>\externalfigure[wg.pdf][page={\the\numexpr \recurselevel + 25}]\fi}
>  \stoptext
> 
> I’m afraid that the paragraph mistmatch is clear (the number of pages is
> way different for each versions).
> 
> Using the grid, the mismatch is not so evident (but there is still a
> different number of pages for each version).
> 
> Page reordering would be in this case:
> 
>  \setuppapersize[A6]
>  \setuplayout[page]
>  \starttext
>  \dorecurse{20}
>  {\ifnum\recurselevel = 1
>\externalfigure[wg.pdf][page=\recurselevel]\else
>\externalfigure[wg.pdf][page=\recurselevel]
>\externalfigure[wg.pdf][page={\the\numexpr \recurselevel + 19}]\fi}
>  \stoptext
> 
> I would need that for a bilingual edition. I don’t mind reodering the
> pages (if there is no other option).
> 
> But what am I doing wrong not to get synced text streams for facing pages?
> 
> Many thanks for your help,
> 
> Pablo
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://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] sync text streams in facing pages

2022-08-15 Thread Pablo Rodriguez via ntg-context
Dear list,

adapting a the sample from mkxl/page-str.mkxl (and code from the list),
I came with the following sample:

  \setuppapersize[A6]
  \showgrid
  %\setuplayout[grid=yes]
  \starttext
  \input tufte
  \startoutputstream[es]
   \dorecurse{25}
{\startlanguage[es]\input cervantes-es\stoplanguage%
  \par\pushoutputstream}
  \enableoutputstream[en]
   \dorecurse{25}
{\input zapf\par\pushoutputstream}
  \disableoutputstream
  \stopoutputstream
  \synchronizestreams[es,en]
  \page \flushoutputstream[es]
  \page \flushoutputstream[en]
  \stoptext

To reorder pages, I rename the output to "wg.pdf" and run the following
code:

  \setuppapersize[A6]
  \setuplayout[page]
  \starttext
  \dorecurse{26}
  {\ifnum\recurselevel = 1
\externalfigure[wg.pdf][page=\recurselevel]\else
\externalfigure[wg.pdf][page=\recurselevel]
\externalfigure[wg.pdf][page={\the\numexpr \recurselevel + 25}]\fi}
  \stoptext

I’m afraid that the paragraph mistmatch is clear (the number of pages is
way different for each versions).

Using the grid, the mismatch is not so evident (but there is still a
different number of pages for each version).

Page reordering would be in this case:

  \setuppapersize[A6]
  \setuplayout[page]
  \starttext
  \dorecurse{20}
  {\ifnum\recurselevel = 1
\externalfigure[wg.pdf][page=\recurselevel]\else
\externalfigure[wg.pdf][page=\recurselevel]
\externalfigure[wg.pdf][page={\the\numexpr \recurselevel + 19}]\fi}
  \stoptext

I would need that for a bilingual edition. I don’t mind reodering the
pages (if there is no other option).

But what am I doing wrong not to get synced text streams for facing pages?

Many thanks for your help,

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

maillist : ntg-context@ntg.nl / https://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
___


Re: [NTG-context] image with rounded corners

2022-08-12 Thread Henning Hraban Ramm via ntg-context

Am 12.08.22 um 13:10 schrieb Wolfgang Schuster via ntg-context:

Henning Hraban Ramm via ntg-context schrieb am 12.08.2022 um 10:57:

Hi, can ConTeXt make rounded image corners?



\setupexternalfigures[location=default]

\starttext

\startMPclip{rounded corner}
clip currentpicture to (roundedsquare(OverlayWidth,OverlayHeight,EmWidth));
\stopMPclip

\clip[nx=1,ny=1,mp=rounded corner]{\externalfigure[mill]}

\stoptext


Thank you!

Hraban

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


Re: [NTG-context] image with rounded corners

2022-08-12 Thread Wolfgang Schuster via ntg-context

Henning Hraban Ramm via ntg-context schrieb am 12.08.2022 um 10:57:

Hi, can ConTeXt make rounded image corners?
Both of my approaches don’t work:


\externalfigure[mill][
  width=3cm,
  frame=on,
  corner=round,radius=1cm,
  backgroundcorner=round,backgroundradius=1cm,
]

\defineoverlay[Mill][{%
  \externalfigure[mill][width=\overlaywidth]
}]
\framed[background=Mill,width=3cm,height=4cm,
corner=round,radius=1cm,
backgroundcorner=round,backgroundradius=1cm,
offset=overlay]{}


\setupexternalfigures[location=default]

\starttext

\startMPclip{rounded corner}
clip currentpicture to (roundedsquare(OverlayWidth,OverlayHeight,EmWidth));
\stopMPclip

\clip[nx=1,ny=1,mp=rounded corner]{\externalfigure[mill]}

\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / https://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
___


Re: [NTG-context] parameters of (setup)externalfigure, conversions etc.

2022-08-12 Thread Henning Hraban Ramm via ntg-context

Am 11.08.22 um 15:51 schrieb Henning Hraban Ramm via ntg-context:

Hi Hans,

yesterday you told me about the image conversions in grph-con.lua, and I 
tried to find out how to use them. Up to know I only knew "mp" for SVG 
images.


I found I can use "gray.pdf" or "cmyk.pdf" to convert an image (JPG or 
PNG) to grayscale/CMYK, but the resolution isn’t used for downsampling 
(of course, it’s not mentioned in the command template):


\externalfigure[hacker][conversion={gray.pdf},resolution=72]

I tried to write my own downsampling converter, but don’t understand how 
I can hook it into the list of converters:


"""

local downsample = sandbox.registerrunner {
   name = "downsample",
   program  = "gm",
template = [[convert -compress Zip -sampling-factor 1x1 -density 
%resolution%x%resolution% -resample %resolution%x%resolution% %oldname% 
%newname%]],

   checkers = checkers,
   defaults = defaults,
}

programs.downsample = { runner = downsample }


I found the solution in 
https://wiki.contextgarden.net/Using_Graphics#Image_Conversion, but 
that’s not as elegant as those in grph-inc.lua


(And I learned that ImageMagick’s convert works differently than 
GraphicsMagick’s WRT -density; i.e. you must use "gm convert".)


Peter Münster’s grph-downsample.lua was better, it calculated the actual 
pixel size necessary, but that doesn’t work any more.



"""

(I’m not sure if I must calculate the desired pixel size beforehand.)

-*-*-

Apart from converters, there are several parameters of \externalfigure 
that I don’t understand and thus can’t document in the Wiki; a few are 
even not yet documented in the interface files:


* equalwidth/equalheight
* s/sx/sy
* xmax/ymax
* prefix, label, comment
* bodyfont
* mask
* frames (≠ frame)
* interaction (PDF inclusion; found)crossreference
* resources
* display (alternative source? multimedia only?)
* order (of extensions; found)
* crop, transform
* controls, preview: only related to video and thus obsolete?
* hfactor/wfactor: When do these make sense? (I know factor)


Also, orientation seems to be missing in the interface (auto-syntax 
doesn’t pick it up).


Hraban
___
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] image with rounded corners

2022-08-12 Thread Henning Hraban Ramm via ntg-context

Hi, can ConTeXt make rounded image corners?
Both of my approaches don’t work:


\externalfigure[mill][
  width=3cm,
  frame=on,
  corner=round,radius=1cm,
  backgroundcorner=round,backgroundradius=1cm,
]

\defineoverlay[Mill][{%
  \externalfigure[mill][width=\overlaywidth]
}]
\framed[background=Mill,width=3cm,height=4cm,
corner=round,radius=1cm,
backgroundcorner=round,backgroundradius=1cm,
offset=overlay]{}

Hraban
___
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] TIL: figure combinations

2022-08-11 Thread Henning Hraban Ramm via ntg-context

You probably know about combinations to place images side by side:

\startcombination[3*1]
  {\externalfigure[cow]}{cow}
  {\externalfigure[mill]}{mill}
  {\externalfigure[hacker]}{hacker}
\stopcombination

Now, the widths aren’t calculated automatically.
You could define them on your own:

\startcombination[3*1]
  {\externalfigure[cow]   [width=.3\textwidth]}{cow}
  {\externalfigure[mill]  [width=.3\textwidth]}{mill}
  {\externalfigure[hacker][width=.3\textwidth]}{hacker}
\stopcombination

But that’s ugly and tedious. Hans did it for you:

\definemeasure[combination][
  (\textwidth
  -\effectiveleftskip
  -\effectiverightskip

-\numexpr\combinationparameter\nx-\plusone\relax\dimexpr\combinationparameter\distance\relax
  )/\combinationparameter]

So you can say:

\startcombination[3*1]
  {\externalfigure[cow]   [width=\measure{combination}]}{cow}
  {\externalfigure[mill]  [width=\measure{combination}]}{mill}
  {\externalfigure[hacker][width=\measure{combination}]}{hacker}
\stopcombination

But that’s still tedious.

With the power of \defineexternalfigure:

\defineexternalfigure[combination][width=\measure{combination}]
(That’s predefined, no need to copy!)

\startcombination[3*1]
  {\externalfigure[cow]   [combination]}{cow}
  {\externalfigure[mill]  [combination]}{mill}
  {\externalfigure[hacker][combination]}{hacker}
\stopcombination

Beautiful. ;)


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 / 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] parameters of (setup)externalfigure, conversions etc.

2022-08-11 Thread Henning Hraban Ramm via ntg-context

Hi Hans,

yesterday you told me about the image conversions in grph-con.lua, and I 
tried to find out how to use them. Up to know I only knew "mp" for SVG 
images.


I found I can use "gray.pdf" or "cmyk.pdf" to convert an image (JPG or 
PNG) to grayscale/CMYK, but the resolution isn’t used for downsampling 
(of course, it’s not mentioned in the command template):


\externalfigure[hacker][conversion={gray.pdf},resolution=72]

I tried to write my own downsampling converter, but don’t understand how 
I can hook it into the list of converters:


"""

local downsample = sandbox.registerrunner {
  name = "downsample",
  program  = "gm",
template = [[convert -compress Zip -sampling-factor 1x1 -density 
%resolution%x%resolution% -resample %resolution%x%resolution% %oldname% 
%newname%]],

  checkers = checkers,
  defaults = defaults,
}

programs.downsample = { runner = downsample }

"""

(I’m not sure if I must calculate the desired pixel size beforehand.)

-*-*-

Apart from converters, there are several parameters of \externalfigure 
that I don’t understand and thus can’t document in the Wiki; a few are 
even not yet documented in the interface files:


* equalwidth/equalheight
* s/sx/sy
* xmax/ymax
* prefix, label, comment
* bodyfont
* mask
* frames (≠ frame)
* interaction, crossreference
* resources
* display
* order
* crop, transform
* controls, preview: only related to video and thus obsolete?
* hfactor/wfactor: When do these make sense? (I know factor)

I accidentally learned that I can use parameters of \framed, but the 
inheritance from \setupframed is not explicit – some are mentioned, like 
backgroundcolor, others not, even if they work, like corner (but they 
don’t affect the image).



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


Re: [NTG-context] Set up external figure for particular image type

2022-08-01 Thread Hans Hagen via ntg-context

On 8/1/2022 2:29 AM, Thangalin via ntg-context wrote:

Got it working. Complete solution:

|\setupexternalfigures[ location={local,global,default}, 
width=\textwidth ] \defineexternalfigure[svg][width=1cm] 
\defineexternalfigure[jpg][width=2cm] 
\defineexternalfigure[png][width=4cm] % Won't be applied because there's 
no process action. % Default (\textwidth) is used, as defined above. 
\defineexternalfigure[pdf][width=6cm] \starttexdefinition 
includegraphics #1 \splitfilename{#1} \processaction[\splitofftype][ 
jpg=>{\externalfigure[#1][jpg]}, png=>{\externalfigure[#1][png]}, 
svg=>{\externalfigure[#1][svg][conversion=mp]}, 
default=>{\externalfigure[#1]}, unknown=>{\externalfigure[#1]} ] 
\stoptexdefinition \starttext \includegraphics{kitten.jpg} 
\includegraphics{mill.png} \includegraphics{cow.pdf} 
\includegraphics{tiger.svg} \stoptext |

I've added:

\setfigureconversion[svg][mp]

So that this works:

\starttext
  \externalfigure[kitten.jpg][width=2cm]
  \externalfigure[mill.png]  [width=4cm]
  \externalfigure[cow.pdf]   [width=6cm]
  \externalfigure[tiger.svg] [width=1cm]
\stoptext

But after we release you need to wikify it.

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
___


Re: [NTG-context] Set up external figure for particular image type

2022-08-01 Thread Thangalin via ntg-context
Got it working. Complete solution:

\setupexternalfigures[
  location={local,global,default},
  width=\textwidth
]\defineexternalfigure[svg][width=1cm]\defineexternalfigure[jpg][width=2cm]\defineexternalfigure[png][width=4cm]
% Won't be applied because there's no process action.% Default
(\textwidth) is used, as defined
above.\defineexternalfigure[pdf][width=6cm]
\starttexdefinition includegraphics #1
  \splitfilename{#1}

  \processaction[\splitofftype][
jpg=>{\externalfigure[#1][jpg]},
png=>{\externalfigure[#1][png]},
svg=>{\externalfigure[#1][svg][conversion=mp]},
default=>{\externalfigure[#1]},
    unknown=>{\externalfigure[#1]}
  ]\stoptexdefinition
\starttext
  \includegraphics{kitten.jpg}
  \includegraphics{mill.png}
  \includegraphics{cow.pdf}
  \includegraphics{tiger.svg}\stoptext

Image files attached.
Thanks again!
<>
___
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
___


Re: [NTG-context] Cron /var/www/aanhet.net/context/bin/cron/context-mirror

2022-07-29 Thread Jeong Dal via ntg-context
Dear Hans,

Thank you for the new way to align math formulas.
It is great to use “\alignhere”, “\breakhere”.

However, I got a problem today.
If I use it with figures side by side, then the alignment is broken.

Please try the following MWE.

Best regards,

Dalyoung


\setupexternalfigures[location={default,local,global}]

\starttext
\startplacefigure[location=right,]
\externalfigure[cow][width=.3\makeupwidth]
\stopplacefigure
\startformula
 U(f,P) \alignhere = f(2,2)\Delta A_{11}+f(2,3)\Delta A_{12}\breakhere
  \skiphere[1em] +f(3,2)\Delta A_{21}+f(3,3)\Delta A_{22} \breakhere
  = 4\times 2 + 6 \times 1+ 6 \times 2 +9 \times 1  \breakhere
  = 35.
\stopformula
\stoptext




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


Re: [NTG-context] How to switch off the numbering of a float in a CLDocument?

2022-07-21 Thread Taco Hoekwater via ntg-context


> On 21 Jul 2022, at 13:18, Willi Egger via ntg-context  
> wrote:
> 
> Hraban thank you for your answer.
> 
> I tried diffrent approaches in the meantime, however I am unable to get it 
> working.
> 
> What is wrong with this code? — The code woks a for the context.framedtext()
> 
> \setupexternalfigures[location={local,default}]
> 
> \startluacode
> 
>   function Foto_page() --thirddata
> 
>  context.startplacefigure({number="",textstyle="red",title="A Test"})
>context.externalfigure("{cow.pdf}",{width="0.5\\textwidth"}) 

It is subtle, but you need:

   context.externalfigure({“cow.pdf"},{width="0.5\\textwidth"}) 

A “lua table” becomes [] stuff, a “lua string” becomes {} stuff. Your original 
resulted in

  \externalfigure{{cow.pdf}}[width={0.5\textwidth}]

Best wishes,
Taco

PS \enabletrackers[context.*]


>  --context.framedtext(
>   --  {frame="on",style="\\bfd"},
>   --  "{This is a test}")
>  context.stopplacefigure()
>   end
>   
> \stopluacode
> 
> \define\Test{\ctxlua{Foto_page()}}
> 
> \starttext
>   \strut
>   \Test
> \stoptext
> 
> KR
> Willi
> 
>> On 18 Jul 2022, at 20:56, Henning Hraban Ramm via ntg-context 
>>  wrote:
>> 
>> Am 18.07.22 um 20:31 schrieb Willi Egger via ntg-context:
>>> Hi all,
>>> I wanted to place a figure in a cld. The example in the cld manual does not 
>>> reveal how to influence bahavior except for the caption.
>>> context.placefigure(
>>> “caption”,
>>>   function() context.externalfigure({i}, { width = "\\textwidth" } ) end )
>>> Can anybody enlighten me?
>> 
>> Just use
>> 
>> context.startplacefigure({ option = "some", otheroption = "thing" })
>> ...
>> context.stopplacefigure()
>> 
>> Hraban
>> 
>> ___
>> 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
> ___

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



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

maillist : ntg-context@ntg.nl / https://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
___


Re: [NTG-context] Set up external figure for particular image type

2022-07-18 Thread Wolfgang Schuster via ntg-context

Thangalin via ntg-context schrieb am 18.07.2022 um 19:10:

Thank you, Wolfgang.

That looks promising.

SVG files are converted using MetaPost. I thought the following would 
work:


svg=>{\externalfigure[#1][svg][conversion=mp]}


You can probably remove the second argument ([svg]) which was used in my 
example to pass the default values with \defineexternalfigure. Just 
using \externalfigure[#1][conversion=mp] where you pass the default 
values with the second argument is enough.


Wolfgang

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


Re: [NTG-context] Set up external figure for particular image type

2022-07-18 Thread Thangalin via ntg-context
Thank you, Wolfgang.

That looks promising.

SVG files are converted using MetaPost. I thought the following would work:

svg=>{\externalfigure[#1][svg][conversion=mp]}

Is there anything else that needs to happen to ensure SVG files are piped
through MetaPost?

Thanks again!



> \setupexternalfigures [location={local,global,default}]
>
> \defineexternalfigure [jpg] [width=4cm]
> \defineexternalfigure [png] [width=8cm]
>
> \starttexdefinition includegraphics #1
>
> \splitfilename{#1}
>
> \processaction
> [\splitofftype]
> [jpg=>{\externalfigure[#1][jpg]},
>  png=>{\externalfigure[#1][png]},
>  default=>{\externalfigure[#1]},
>  unknown=>{\externalfigure[#1]}]
>
> \stoptexdefinition
>
> \starttext
>
> \includegraphics{hacker.jpg}
>
> \includegraphics{mill.png}
>
> \includegraphics{cow.pdf}
>
> \stoptext
>
>
___
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
___


Re: [NTG-context] Set up external figure for particular image type

2022-07-18 Thread Thangalin via ntg-context
Thanks, Rik.

Not using Pandoc. I was using Pandoc up until 2020:

https://dave.autonoma.ca/blog/2019/05/22/typesetting-markdown-part-1/

I've since authored KeenWrite <https://github.com/DaveJarvis/keenwrite>,
which uses flexmark-java <https://github.com/vsch/flexmark-java> to
generate XHTML documents from Markdown. The only additions I've made to the
library is to add support for Pandoc's annotation syntax (:::).

That said, I'm also a firm believer in not duplicating information. The
information (file name extension) is already available in the documents, so
adding a classification on top of the extension feels redundant.

Thanks for the suggestion!

On Tue, Jul 12, 2022 at 12:18 PM Rik Kabel via ntg-context <
ntg-context@ntg.nl> wrote:

>
> On 2022-07-12 14:11, Thangalin via ntg-context wrote:
>
> Thank you for the suggestion Hraban.
>
> The source comes from Markdown, which is converted to XML, then typeset
> using ConTeXt. There's no Markdown-specific mechanism to relate images to a
> particular external figure definition, unfortunately. All images use the
> same syntax and are treated the same way. The only part that differs is the
> file name extension (and header within the file).
>
> One possibility would be something like:
>
> \setupexternalfigure[
> width=1em,
> height=1em,
> order={svg,pdf,png,jpg},
> location={local,default,global},
> ]
> \defineexternalfigure[png][
> width=\textwidth,
> height=\textheight,
> ]
> \unprotect
> \let\old_externalfigure=\externalfigure
> \tolerant\def\externalfigure[#1]#,[#2]#,[#3]{%
> \doifelseinstring{.png}{#1}{%
> \old_externalfigure[#1][png][#2]%
> }{%
> \doifelsefileexists{#1.png}{%
> \old_externalfigure[#1.png][png][#2]%
> }{%
> \old_externalfigure[#1][#2][#3]%
> }%
> }%
> }\protect
>
> See: https://tex.stackexchange.com/a/650221/2148
>
> I was wondering if there was a simpler or a solution that's more the
> ConTeXt-way?
>
> Thanks again!
>
>
> Assuming that Pandoc markdown is being used, you should be able to set
> class attributes on each image. You can then associate external figure
> definitions with specific classes, and process each individually. (Pandoc
> user guide, link_attributes
> <https://pandoc.org/MANUAL%202.html#extension-link_attributes>)
>
> --
> Rik
>
>
> ___
> 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
___


Re: [NTG-context] Set up external figure for particular image type

2022-07-12 Thread Rik Kabel via ntg-context


On 2022-07-12 14:11, Thangalin via ntg-context wrote:

Thank you for the suggestion Hraban.

The source comes from Markdown, which is converted to XML, then 
typeset using ConTeXt. There's no Markdown-specific mechanism to 
relate images to a particular external figure definition, 
unfortunately. All images use the same syntax and are treated the same 
way. The only part that differs is the file name extension (and header 
within the file).


One possibility would be something like:
|\setupexternalfigure[ width=1em, height=1em, order={svg,pdf,png,jpg}, 
location={local,default,global}, ] \defineexternalfigure[png][ 
width=\textwidth, height=\textheight, ] \unprotect 
\let\old_externalfigure=\externalfigure 
\tolerant\def\externalfigure[#1]#,[#2]#,[#3]{% 
\doifelseinstring{.png}{#1}{% \old_externalfigure[#1][png][#2]% }{% 
\doifelsefileexists{#1.png}{% \old_externalfigure[#1.png][png][#2]% 
}{% \old_externalfigure[#1][#2][#3]% }% }% } \protect |

See: https://tex.stackexchange.com/a/650221/2148

I was wondering if there was a simpler or a solution that's more the 
ConTeXt-way?


Thanks again!


Assuming that Pandoc markdown is being used, you should be able to set 
class attributes on each image. You can then associate external figure 
definitions with specific classes, and process each individually. 
(Pandoc user guide, link_attributes 
<https://pandoc.org/MANUAL%202.html#extension-link_attributes>)


--
Rik

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


Re: [NTG-context] Set up external figure for particular image type

2022-07-12 Thread Wolfgang Schuster via ntg-context

Thangalin via ntg-context schrieb am 12.07.2022 um 20:11:

Thank you for the suggestion Hraban.

The source comes from Markdown, which is converted to XML, then 
typeset using ConTeXt. There's no Markdown-specific mechanism to 
relate images to a particular external figure definition, 
unfortunately. All images use the same syntax and are treated the same 
way. The only part that differs is the file name extension (and header 
within the file).


One possibility would be something like:
|\setupexternalfigure[ width=1em, height=1em, order={svg,pdf,png,jpg}, 
location={local,default,global}, ] \defineexternalfigure[png][ 
width=\textwidth, height=\textheight, ] \unprotect 
\let\old_externalfigure=\externalfigure 
\tolerant\def\externalfigure[#1]#,[#2]#,[#3]{% 
\doifelseinstring{.png}{#1}{% \old_externalfigure[#1][png][#2]% }{% 
\doifelsefileexists{#1.png}{% \old_externalfigure[#1.png][png][#2]% 
}{% \old_externalfigure[#1][#2][#3]% }% }% } \protect |

See: https://tex.stackexchange.com/a/650221/2148

I was wondering if there was a simpler or a solution that's more the 
ConTeXt-way?


When you use XML as input you can add additional code to the setups block
which uses \externalfigure to load the image.


\setupexternalfigures [location={local,global,default}]

\defineexternalfigure [jpg] [width=4cm]
\defineexternalfigure [png] [width=8cm]

\starttexdefinition includegraphics #1

    \splitfilename{#1}

    \processaction
    [\splitofftype]
    [    jpg=>{\externalfigure[#1][jpg]},
 png=>{\externalfigure[#1][png]},
 default=>{\externalfigure[#1]},
 unknown=>{\externalfigure[#1]}]

\stoptexdefinition

%\starttexdefinition includegraphics #1
%
%    \getfiguredimensions[#1]
%
%    \processaction
%    [\figurefiletype]
%    [    jpg=>{\externalfigure[#1][jpg]},
%     png=>{\externalfigure[#1][png]},
%     default=>{\externalfigure[#1]},
% unknown=>{\externalfigure[#1]}]
%
%\stoptexdefinition

\starttext

\includegraphics{hacker.jpg}

\includegraphics{mill.png}

\includegraphics{cow.pdf}

\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / https://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
___


Re: [NTG-context] Set up external figure for particular image type

2022-07-12 Thread Thangalin via ntg-context
Thank you for the suggestion Hraban.

The source comes from Markdown, which is converted to XML, then typeset
using ConTeXt. There's no Markdown-specific mechanism to relate images to a
particular external figure definition, unfortunately. All images use the
same syntax and are treated the same way. The only part that differs is the
file name extension (and header within the file).

One possibility would be something like:

\setupexternalfigure[
width=1em,
height=1em,
order={svg,pdf,png,jpg},
location={local,default,global},
]
\defineexternalfigure[png][
width=\textwidth,
height=\textheight,
]
\unprotect
\let\old_externalfigure=\externalfigure
\tolerant\def\externalfigure[#1]#,[#2]#,[#3]{%
\doifelseinstring{.png}{#1}{%
\old_externalfigure[#1][png][#2]%
}{%
\doifelsefileexists{#1.png}{%
\old_externalfigure[#1.png][png][#2]%
}{%
\old_externalfigure[#1][#2][#3]%
}%
}%
}\protect

See: https://tex.stackexchange.com/a/650221/2148

I was wondering if there was a simpler or a solution that's more the
ConTeXt-way?

Thanks again!
___
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
___


Re: [NTG-context] Workshop at FrOSCon

2022-07-09 Thread Henning Hraban Ramm via ntg-context

Am 09.07.22 um 17:48 schrieb juh+ntg-context--- via ntg-context:
My workshop was accepted. What shall I cover? It's a workshop for 
beginners?

- Installation
- Hello word
What would you cover? Project structure? Style creation?


In my experience, most participants will know LaTeX, i.e. you must tell 
them to forget everything they believe to know about TeX ;P


– Layout, i.e. \setuppapersize, \setuplayout and \showlayout
– Structure, i.e. \startchapter, \startitemize
– Images & Floats, i.e. \externalfigure, \startplacefigure

Project structure makes sense if you have more than one hour.


I think one part will be: Where to find documentation?


Yes.

Tell them there will be a German book next year (I hope...); I’ll send 
you a link off-list.


I guess your Markdown workflow might interest some.


And if you want to join me in the workshop you're welcome!


Sorry.

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


Re: [NTG-context] dorecurse within combination

2022-07-07 Thread Wolfgang Schuster via ntg-context

Henning Hraban Ramm via ntg-context schrieb am 07.07.2022 um 21:25:

Am 07.07.22 um 20:52 schrieb Henning Hraban Ramm via ntg-context:

How can I do this?
Sorry for the noise, I solved it with Lua. The cld manual even 
contains a combinations example.


The Lua method is also simpler than a TeX based alternative.

\starttext

\startcollecting
%
\startcollect
\startcombination[3*1]
\stopcollect
%
\dorecurse{3}
  {\startcollect
   {\externalfigure[dummy]}{}
   \stopcollect}
%
\startcollect
\stopcombination
\stopcollect
%
\stopcollecting

\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] dorecurse within combination

2022-07-07 Thread Henning Hraban Ramm via ntg-context

Hi, I’d like to place pages from a multipage PDF in a combination:

\startcombination[3*1]
\dorecurse{3}{%
  {\externalfigure[multipage][width=\textwidth/3,page=\recurselevel]}{}
}
\stopcombination

That doesn’t work, because ConTeXt expects a { after \startcombination. 
(“A left brace was mandatory here, so I've put one in.”)

I guess I need some expansion, but \expanded doesn’t help.

How can I do this?

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] SVG text alignment issue

2022-06-28 Thread Thangalin via ntg-context
Thanks Aditya,

I tried your suggestion, but the result is the same. Here's the XML setup
for all images in the document:

\startxmlsetups xml:img
  \starttexcode
\placefloat[here,force]{}{%
  \hbox{\externalfigure[\xmlatt{#1}{src}][conversion=mp]}
}
  \stoptexcode
\stopxmlsetups

Here's the Markdown source document:

![](dna-02)

The source document is automatically exported as XHTML:


  


The XHTML is then passed to ConTeXt, whereupon the XML setup for images is
applied. The result is the same: the alignment for the text is off. Here's
an example where you can see the issue on the 16q24.3 text (far right):

https://i.ibb.co/WGh03Sr/genes.png

When the same SVG file is rendered using Apache Batik, the white text is
aligned to the middle of the black box.

Are there aAny other work-arounds?

Thank you!
___
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] Graphviz and ConTeXt

2022-06-24 Thread juh+ntg-context--- via ntg-context

Am 23.06.22 um 15:08 schrieb Taco Hoekwater:

Hi,

You could just convert these separately to pdf/svg/jpg/png and then load them 
as \externalfigure.


I thought about this solution.


You could also use the filter module to be able to take them inline into the 
ConTeXt code:



Thanks for the hint. This looks interesting. I'll try it out.

juh


___
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] Graphviz and ConTeXt

2022-06-23 Thread Taco Hoekwater via ntg-context
Hi,

You could just convert these separately to pdf/svg/jpg/png and then load them 
as \externalfigure. 

You could also use the filter module to be able to take them inline into the 
ConTeXt code:


\usemodule[filter]

\define[1]\ReadFigure{\externalfigure[#1]}

\defineexternalfilter[graphviz]
  [cache=yes,
   readcommand=\ReadFigure,
   output={\externalfilterbasefile.pdf},
   filtercommand={dot -Tpdf -o "\externalfilterbasefile.pdf" 
"\externalfilterinputfile"}]
  
\starttext
\startTEXpage
\startgraphviz
digraph G {
main -> parse -> execute;
main -> init;
main -> cleanup;
execute -> make_string;
execute -> printf
init -> make_string;
main -> printf;
execute -> compare;
}
\stopgraphviz
\stopTEXpage
\stoptext


See the filter module documentation for more details about that.

Best wishes,
Taco

> On 23 Jun 2022, at 14:08, juh via ntg-context  wrote:
> 
> Dear all,
> 
> I have a legacy project that I shall convert to a new ConTeXt project. 
> 
> There are a lot of Graphviz dot-files. What shall I do with these? 
> 
> Any hints?
> juh
> -- 
> Autoren-Homepage: . http://literatur.hasecke.com
> Satiren & Essays: . http://www.sudelbuch.de
> Privater Blog:  http://www.hasecke.eu
> Netzliteratur-Projekt:  http://www.generationenprojekt.de
> 
> 
> ___
> 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
> ___

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



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

maillist : ntg-context@ntg.nl / 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 to print a random whole number between x and y?

2022-06-17 Thread Wolfgang Schuster via ntg-context

Joel via ntg-context schrieb am 17.06.2022 um 16:10:
I was using this code for a long time in my document. I have a PDF 
with 10 pages, and this would randomly display one of those pages:


    \ctxlua{math.randomseed( os.time() )}

        \getrandomnumber \n {1} {10}

     \placefigure[force, 
none]{}{\framed[frame=off]{\externalfigure[comic.pdf][page=\n, 
width=\textwidth]}}


For reasons I cannot understand, after an update of ConTeXt, the code 
no longer works, though trying to reduce it to a minimum working 
example it works, so I cannot figure out what is wrong in my code.


Undefined control sequence

 ...domseed( os.time() )} \par \getrandomnumber \n
{1} {10} \par \placefigure...
\doifsomething #1->\edef \m_syst_string_one {#1
}\ifx \m_syst_string_one \emp...
\event ... {#6}{{\bf #6}} \par \doifsomething {#7}
{#7 } \par \doifsomething ...


Is there another solution for generating a random whole number between 
1 and 10?


Without a better example there is no way to tell what's wrong with your 
document. The most likely answer is that you try to expand part of your 
code which contains the \getrandomnumber line but since \n isn't defined 
yet you get the error message.


What you can try is to replace \getrandomnumber and "page=\n" with 
"page=\randomnumber{...}{...}".


\startbuffer[dummyfile]
\dorecurse{10}{\centerbox{\definedfont[Sans sa 10]Page \recurselevel}}
\stopbuffer

\setuplayout[page]

\starttext

%\getrandomnumber\n{1}{10}
%\typesetbuffer[dummyfile][page=\n]

\typesetbuffer[dummyfile][page=\randomnumber{1}{10}]

\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] How to print a random whole number between x and y?

2022-06-17 Thread Joel via ntg-context
I was using this code for a long time in my document. I have a PDF with 10 
pages, and this would randomly display one of those pages:
    \ctxlua{math.randomseed( os.time() )}
        
        \getrandomnumber \n {1} {10}
    
        \placefigure[force, 
none]{}{\framed[frame=off]{\externalfigure[comic.pdf][page=\n, 
width=\textwidth]}}
    
For reasons I cannot understand, after an update of ConTeXt, the code no longer 
works, though trying to reduce it to a minimum working example it works, so I 
cannot figure out what is wrong in my code.
Undefined control sequence

 ...domseed( os.time() )} \par \getrandomnumber \n 
  {1} {10} \par \placefigure...
\doifsomething #1->\edef \m_syst_string_one {#1
   }\ifx \m_syst_string_one \emp...
\event ... {#6}{{\bf #6}} \par \doifsomething {#7}
  {#7 } \par \doifsomething ...

Is there another solution for generating a random whole number between 1 and 10?
--Joel
___
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] Foonotes in Captions ... again

2022-06-16 Thread Denis Maier via ntg-context
Hmmm, I probably was to quick. Does not really work in my real document...

I'll try to solve the issue now by integrating the notes into the caption. 
Let's see if the authors accept it.

Anyway, maybe that would be a nice topic for the monthly context chat?

> -Ursprüngliche Nachricht-
> Von: ntg-context  Im Auftrag von Denis Maier
> via ntg-context
> Gesendet: Donnerstag, 16. Juni 2022 11:16
> An: mse...@telus.net; ntg-context@ntg.nl
> Cc: Maier, Denis Christian (UB) 
> Betreff: Re: [NTG-context] Foonotes in Captions ... again
> 
> Thanks, Max! That's very neat, and it indeed works in my use case.
> 
> Can anyone see any drawbacks here?
> 
> Best,
> Denis
> 
> > -Ursprüngliche Nachricht-
> > Von: Max Chernoff 
> > Gesendet: Donnerstag, 16. Juni 2022 01:32
> > An: ntg-context@ntg.nl
> > Cc: Maier, Denis Christian (UB) 
> > Betreff: Re: [NTG-context] Foonotes in Captions ... again
> >
> > > What's the current state of affairs regarding footnotes in floats?
> > > Both
> > version in the example below don't quite work...
> > > (Ideally, the note should be on the page with the float and the
> > > caption, but the numbering should also be adjusted.)
> >
> > We can completely abuse a bunch of different ConTeXt features to
> > ensure that the footnote numbers are always in the page order.
> >
> >  % New Code
> >  \unprotect
> >
> >  \startluacode
> >  userdata.visual_order = 0
> >  userdata.input_order = 0
> >  userdata.save_data = job.passes.define("saved_footnotes")
> >  userdata.previous_data =
> > job.passes.getcollected("saved_footnotes")
> >
> >  interfaces.implement {
> >  name = "set_footnote_number",
> >  actions = function ()
> >  userdata.input_order = userdata.input_order + 1
> >
> >  local input_index = userdata.input_order
> >  local page_index =
> > userdata.previous_data[input_index]
> >
> >  if page_index then
> >  structures.counters.set("footnote", 1, page_index - 1)
> >  end
> >  end
> >  }
> >  \stopluacode
> >
> >  \def\save_footnote_data#1{%
> >  \latelua{
> >  userdata.visual_order = userdata.visual_order + 1
> >  userdata.save_data[#1] = userdata.visual_order
> >  }%
> >  }
> >
> >  \let\old_footnote=\footnote
> >
> >  \starttexdefinition protected footnote #1
> >  \begingroup
> >  \clf_set_footnote_number
> >
> >  \def\insert##1\bgroup##2\egroup{
> >  \normalexpanded{
> >  \noexpand\save_footnote_data
> >  {\cldcontext{userdata.input_order}}
> >  }
> >  \normalinsert##1{##2}
> >  }
> >
> >  \old_footnote{#1}
> >  \endgroup
> >  \stoptexdefinition
> >
> >  \protect
> >
> >  % Original Example
> >
> >  \starttext
> >
> >  \footnote{asdf} \footnote{asdf} \footnote{asdf}
> >
> >  \input ward
> >
> >  \startplacefigure[title={asdfasdf\footnote{test 1}}]
> >  \externalfigure[cow.pdf]
> >  \stopplacefigure
> >
> >  \footnote{asdf} \footnote{asdf} \footnote{asdf}
> >
> >  \startplacefigure[title={asdfasdf\footnote{test 2}}]
> >  \externalfigure[cow.pdf][height=10cm]
> >  \stopplacefigure
> >
> >  \footnote{asdf} \footnote{asdf} \footnote{asdf}
> >
> >
> >  \page
> >  \footnote{asdf} \footnote{asdf} \footnote{asdf}
> >
> >  \input ward
> >
> >  \startplacefigure[title={asdfasdf\footnote{test 1}}]
> >  \externalfigure[cow.pdf]
> >  \stopplacefigure
> >
> >  \footnote{asdf} \footnote{asdf} \footnote{asdf}
> >
> >  % (Can't use postponingnotes)
> >  % \startpostponingnotes
> >  \startplacefigure[title={asdfasdf\footnote{test 2}}]
> >  \externalfigure[cow.pdf][height=10cm]
> >  \stopplacefigure
> >  % \stoppostponingnotes
> >
> >  \footnote{asdf} \footnote{asdf} \footnote{asdf}
> >  \stoptext
> >
> > Here, we save a mapping between each footnote's index in the input and
> > its index in the output to the .tu

Re: [NTG-context] Footnotes in captions -> "inherit" textwidth from floatntg

2022-06-16 Thread Denis Maier via ntg-context
Anyway, it’s possibly related to this question : 
https://www.mail-archive.com/ntg-context@ntg.nl/msg100815.html

Von: Maier, Denis Christian (UB)
Gesendet: Donnerstag, 16. Juni 2022 11:57
An: 'mailing list for ConTeXt users' 
Cc: jbf 
Betreff: AW: [NTG-context] Footnotes in captions -> "inherit" textwidth from 
floatntg

Yes, that works. But it’s still strange, isn’t it?

Denis

Von: ntg-context 
mailto:ntg-context-boun...@ntg.nl>> Im Auftrag von 
jbf via ntg-context
Gesendet: Donnerstag, 16. Juni 2022 11:49
An: Denis Maier via ntg-context mailto:ntg-context@ntg.nl>>
Cc: jbf mailto:roma83...@gmail.com>>; mailing list for 
ConTeXt users mailto:ntg-context@ntg.nl>>
Betreff: Re: [NTG-context] Footnotes in captions -> "inherit" textwidth from 
floatntg


Maybe \setupnote[footnote][width=\textwidth]?

Julian
On 16/6/22 18:56, Denis Maier via ntg-context wrote:
Hi,
I think I’ve ran into a somewhat strange behaviour. If you have a footnote in a 
float caption, the footnote won’t use the full textwidth, but only the width of 
the corresponding caption. Is that on purpose, a context bug or a user bug?

Best,
Denis


\starttext

asdf

\startplacefigure[title={My caption with a long footnote.\footnote{\input 
ward}}]
\externalfigure[cow.pdf]
\stopplacefigure

\stoptext


___

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



maillist : ntg-context@ntg.nl<mailto: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] Footnotes in captions -> "inherit" textwidth from floatntg

2022-06-16 Thread Denis Maier via ntg-context
Yes, that works. But it’s still strange, isn’t it?

Denis

Von: ntg-context  Im Auftrag von jbf via ntg-context
Gesendet: Donnerstag, 16. Juni 2022 11:49
An: Denis Maier via ntg-context 
Cc: jbf ; mailing list for ConTeXt users 

Betreff: Re: [NTG-context] Footnotes in captions -> "inherit" textwidth from 
floatntg


Maybe \setupnote[footnote][width=\textwidth]?

Julian

On 16/6/22 18:56, Denis Maier via ntg-context wrote:
Hi,
I think I’ve ran into a somewhat strange behaviour. If you have a footnote in a 
float caption, the footnote won’t use the full textwidth, but only the width of 
the corresponding caption. Is that on purpose, a context bug or a user bug?

Best,
Denis


\starttext

asdf

\startplacefigure[title={My caption with a long footnote.\footnote{\input 
ward}}]
\externalfigure[cow.pdf]
\stopplacefigure

\stoptext



___

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



maillist : ntg-context@ntg.nl<mailto: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] Footnotes in captions -> "inherit" textwidth from floatntg

2022-06-16 Thread jbf via ntg-context

Maybe \setupnote[footnote][width=\textwidth]?

Julian

On 16/6/22 18:56, Denis Maier via ntg-context wrote:


Hi,

I think I’ve ran into a somewhat strange behaviour. If you have a 
footnote in a float caption, the footnote won’t use the full 
textwidth, but only the width of the corresponding caption. Is that on 
purpose, a context bug or a user bug?


Best,

Denis

\starttext

asdf

\startplacefigure[title={My caption with a long 
footnote.\footnote{\input ward}}]


\externalfigure[cow.pdf]

\stopplacefigure

\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
__
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] Foonotes in Captions ... again

2022-06-16 Thread Denis Maier via ntg-context
Thanks, Max! That's very neat, and it indeed works in my use case.

Can anyone see any drawbacks here?

Best,
Denis

> -Ursprüngliche Nachricht-
> Von: Max Chernoff 
> Gesendet: Donnerstag, 16. Juni 2022 01:32
> An: ntg-context@ntg.nl
> Cc: Maier, Denis Christian (UB) 
> Betreff: Re: [NTG-context] Foonotes in Captions ... again
> 
> > What's the current state of affairs regarding footnotes in floats? Both
> version in the example below don't quite work...
> > (Ideally, the note should be on the page with the float and the
> > caption, but the numbering should also be adjusted.)
> 
> We can completely abuse a bunch of different ConTeXt features to ensure
> that the footnote numbers are always in the page order.
> 
>  % New Code
>  \unprotect
> 
>  \startluacode
>  userdata.visual_order = 0
>  userdata.input_order = 0
>  userdata.save_data = job.passes.define("saved_footnotes")
>  userdata.previous_data = job.passes.getcollected("saved_footnotes")
> 
>  interfaces.implement {
>  name = "set_footnote_number",
>  actions = function ()
>  userdata.input_order = userdata.input_order + 1
> 
>  local input_index = userdata.input_order
>  local page_index = userdata.previous_data[input_index]
> 
>  if page_index then
>  structures.counters.set("footnote", 1, page_index - 1)
>  end
>  end
>  }
>  \stopluacode
> 
>  \def\save_footnote_data#1{%
>  \latelua{
>  userdata.visual_order = userdata.visual_order + 1
>  userdata.save_data[#1] = userdata.visual_order
>  }%
>  }
> 
>  \let\old_footnote=\footnote
> 
>  \starttexdefinition protected footnote #1
>  \begingroup
>  \clf_set_footnote_number
> 
>  \def\insert##1\bgroup##2\egroup{
>  \normalexpanded{
>  \noexpand\save_footnote_data
>  {\cldcontext{userdata.input_order}}
>  }
>  \normalinsert##1{##2}
>  }
> 
>  \old_footnote{#1}
>  \endgroup
>  \stoptexdefinition
> 
>  \protect
> 
>  % Original Example
> 
>  \starttext
> 
>  \footnote{asdf} \footnote{asdf} \footnote{asdf}
> 
>  \input ward
> 
>  \startplacefigure[title={asdfasdf\footnote{test 1}}]
>  \externalfigure[cow.pdf]
>  \stopplacefigure
> 
>  \footnote{asdf} \footnote{asdf} \footnote{asdf}
> 
>  \startplacefigure[title={asdfasdf\footnote{test 2}}]
>  \externalfigure[cow.pdf][height=10cm]
>  \stopplacefigure
> 
>  \footnote{asdf} \footnote{asdf} \footnote{asdf}
> 
> 
>  \page
>  \footnote{asdf} \footnote{asdf} \footnote{asdf}
> 
>  \input ward
> 
>  \startplacefigure[title={asdfasdf\footnote{test 1}}]
>  \externalfigure[cow.pdf]
>  \stopplacefigure
> 
>  \footnote{asdf} \footnote{asdf} \footnote{asdf}
> 
>  % (Can't use postponingnotes)
>  % \startpostponingnotes
>  \startplacefigure[title={asdfasdf\footnote{test 2}}]
>  \externalfigure[cow.pdf][height=10cm]
>  \stopplacefigure
>  % \stoppostponingnotes
> 
>  \footnote{asdf} \footnote{asdf} \footnote{asdf}
>  \stoptext
> 
> Here, we save a mapping between each footnote's index in the input and its
> index in the output to the .tuc file. The code is definitely not pretty, but
> works well enough for the sample file provided.
> 
> -- Max
___
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] Footnotes in captions -> "inherit" textwidth from float

2022-06-16 Thread Denis Maier via ntg-context
Hi,
I think I've ran into a somewhat strange behaviour. If you have a footnote in a 
float caption, the footnote won't use the full textwidth, but only the width of 
the corresponding caption. Is that on purpose, a context bug or a user bug?

Best,
Denis


\starttext

asdf

\startplacefigure[title={My caption with a long footnote.\footnote{\input 
ward}}]
\externalfigure[cow.pdf]
\stopplacefigure

\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] Foonotes in Captions ... again

2022-06-15 Thread Max Chernoff via ntg-context

What's the current state of affairs regarding footnotes in floats? Both version 
in the example below don't quite work...
(Ideally, the note should be on the page with the float and the caption, but 
the numbering should also be adjusted.)


We can completely abuse a bunch of different ConTeXt features to ensure
that the footnote numbers are always in the page order.

% New Code
\unprotect

\startluacode
userdata.visual_order = 0
userdata.input_order = 0
userdata.save_data = job.passes.define("saved_footnotes")
userdata.previous_data = job.passes.getcollected("saved_footnotes")

interfaces.implement {
name = "set_footnote_number",
actions = function ()
userdata.input_order = userdata.input_order + 1

local input_index = userdata.input_order
local page_index = userdata.previous_data[input_index]

if page_index then
structures.counters.set("footnote", 1, page_index - 1)
end
end
}
\stopluacode

\def\save_footnote_data#1{%
\latelua{
userdata.visual_order = userdata.visual_order + 1
userdata.save_data[#1] = userdata.visual_order
}%
}

\let\old_footnote=\footnote

\starttexdefinition protected footnote #1
\begingroup
\clf_set_footnote_number

\def\insert##1\bgroup##2\egroup{
\normalexpanded{
\noexpand\save_footnote_data
{\cldcontext{userdata.input_order}}
}
\normalinsert##1{##2}
}

\old_footnote{#1}
\endgroup
\stoptexdefinition

\protect

% Original Example

\starttext

\footnote{asdf} \footnote{asdf} \footnote{asdf}

\input ward

\startplacefigure[title={asdfasdf\footnote{test 1}}]
\externalfigure[cow.pdf]
\stopplacefigure

\footnote{asdf} \footnote{asdf} \footnote{asdf}

\startplacefigure[title={asdfasdf\footnote{test 2}}]
\externalfigure[cow.pdf][height=10cm]
\stopplacefigure

\footnote{asdf} \footnote{asdf} \footnote{asdf}


\page
\footnote{asdf} \footnote{asdf} \footnote{asdf}

\input ward

\startplacefigure[title={asdfasdf\footnote{test 1}}]
\externalfigure[cow.pdf]
\stopplacefigure

\footnote{asdf} \footnote{asdf} \footnote{asdf}

% (Can't use postponingnotes)
% \startpostponingnotes
\startplacefigure[title={asdfasdf\footnote{test 2}}]
\externalfigure[cow.pdf][height=10cm]
\stopplacefigure
% \stoppostponingnotes

\footnote{asdf} \footnote{asdf} \footnote{asdf}
\stoptext

Here, we save a mapping between each footnote's index in the input and
its index in the output to the .tuc file. The code is definitely not
pretty, but works well enough for the sample file provided.

-- Max
___
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] Why are some images rendered very tiny?

2022-06-15 Thread Henning Hraban Ramm via ntg-context

Am 15.06.22 um 18:11 schrieb Joel via ntg-context:
I wrote this macro to display images in my book. It should place the 
image to the left, filling ~50% of \textwidth, then the caption is to 
the right.


\setupcaption[location=right, minwidth=.5\textwidth]
\define[4]\figureis{%
     \placefigure{#2, Courtesy #3, photo no. 
#1\nocite[#4]{}}{\externalfigure[#1][maxheight=.7\paperheight, 
maxwidth=.5\paperwidth, minwidth=.5\paperwidth]}

}

#1 = filename, other variables are used for reference/credit details.

The problem is, somehow some images are inexplicably displayed very tiny 
on the page. I check the image file and they are not small, but somehow 
is rendered small with the code above.


What is wrong in my code?


There are no parameters "minwidth" or "minheight", see 
https://wiki.contextgarden.net/Command/setupexternalfigure


It’s probable that your pictures have a high resolution (dpi) defined, 
so ConTeXt displays them according to that in their “natural” size.


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] Why are some images rendered very tiny?

2022-06-15 Thread Joel via ntg-context
I wrote this macro to display images in my book. It should place the image to 
the left, filling ~50% of \textwidth, then the caption is to the right.

\setupcaption[location=right, minwidth=.5\textwidth]
\define[4]\figureis{%
    \placefigure{#2, Courtesy #3, photo no. 
#1\nocite[#4]{}}{\externalfigure[#1][maxheight=.7\paperheight, 
maxwidth=.5\paperwidth, minwidth=.5\paperwidth]}
}
#1 = filename, other variables are used for reference/credit details.

The problem is, somehow some images are inexplicably displayed very tiny on the 
page. I check the image file and they are not small, but somehow is rendered 
small with the code above.

What is wrong in my code?
--Joel
___
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] Foonotes in Captions ... again

2022-06-15 Thread Denis Maier via ntg-context
Hi everyone

What's the current state of affairs regarding footnotes in floats? Both version 
in the example below don't quite work...
(Ideally, the note should be on the page with the float and the caption, but 
the numbering should also be adjusted.)

Best,
Denis

\starttext

\footnote{asdf} \footnote{asdf} \footnote{asdf}

\input ward

\startplacefigure[title={asdfasdf\footnote{test 1}}]
\externalfigure[cow.pdf]
\stopplacefigure

\footnote{asdf} \footnote{asdf} \footnote{asdf}

\startplacefigure[title={asdfasdf\footnote{test 2}}]
\externalfigure[cow.pdf][height=10cm]
\stopplacefigure

\footnote{asdf} \footnote{asdf} \footnote{asdf}


\page
\footnote{asdf} \footnote{asdf} \footnote{asdf}

\input ward

\startplacefigure[title={asdfasdf\footnote{test 1}}]
\externalfigure[cow.pdf]
\stopplacefigure

\footnote{asdf} \footnote{asdf} \footnote{asdf}

\startpostponingnotes
\startplacefigure[title={asdfasdf\footnote{test 2}}]
\externalfigure[cow.pdf][height=10cm]
\stopplacefigure
\stoppostponingnotes

\footnote{asdf} \footnote{asdf} \footnote{asdf}
\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] Rotating jpeg image gives weird output

2022-06-14 Thread Denis Maier via ntg-context
Thanks for your suggestions.

It probably is not EXIF-related. I've opened and saved the image with MS Paint, 
but that did not change anything (the increase in file size aside...).

Any other ideas? (I tend to think the image is corrupted in one way or the 
other, but I have no clue how to fix that.)

Best,
Denis

> -Ursprüngliche Nachricht-
> Von: Max Chernoff 
> Gesendet: Dienstag, 14. Juni 2022 11:45
> An: ntg-context@ntg.nl
> Cc: Maier, Denis Christian (UB) 
> Betreff: Re: [NTG-context] Rotating jpeg image gives weird output
> 
> > So, I've rotated the image, but now two things happen:
> >
> > 1. there's a weird offset (the image is moved to the right)
> >
> > This seems to be somehow related to the particular file. With a
> > different file that does not happen.
> 
> This can sometimes happen if the image has an embedded EXIF "Orientation"
> tag and you're using a buggy viewer. Really old versions of Firefox/pdf.js had
> this bug. If this is the case, you should be able to reproduce it with the
> following bash commands:
> 
>  convert -size 64x256 canvas:grey -fill black -draw "circle 32,128 16,112"
> demo1.jpg
>  exiftool -Orientation='Rotate 90 CW' demo1.jpg -o demo2.jpg
> 
> Then, include "demo1.jpg" and "demo2.jpg" in a ConTeXt file using
> \externalfigure. Both pictures should display as circles; if you get ovals, 
> then
> it's definitely EXIF-related.
> 
> > 2. The output contains this line
> > . location=local,global. location=local,global
> 
> Never seen this before, which makes me suspect that maybe this isn't EXIF-
> related. Maybe the image is just subtly corrupted?
> 
> Anyways, if the problem is EXIF-related, then opening and saving the image
> file with MS Paint (or any other non-EXIF-aware editor) should fix things.
> Otherwise, I have no suggestions.
> 
> -- Max
___
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] Rotating jpeg image gives weird output

2022-06-14 Thread Max Chernoff via ntg-context

So, I've rotated the image, but now two things happen:

1. there's a weird offset (the image is moved to the right)

This seems to be somehow related to the particular file. With a different
file that does not happen.


This can sometimes happen if the image has an embedded EXIF
"Orientation" tag and you're using a buggy viewer. Really old versions
of Firefox/pdf.js had this bug. If this is the case, you should be able
to reproduce it with the following bash commands:

convert -size 64x256 canvas:grey -fill black -draw "circle 32,128 16,112" 
demo1.jpg
exiftool -Orientation='Rotate 90 CW' demo1.jpg -o demo2.jpg

Then, include "demo1.jpg" and "demo2.jpg" in a ConTeXt file using
\externalfigure. Both pictures should display as circles; if you get
ovals, then it's definitely EXIF-related.


2. The output contains this line
. location=local,global. location=local,global


Never seen this before, which makes me suspect that maybe this isn't
EXIF-related. Maybe the image is just subtly corrupted?

Anyways, if the problem is EXIF-related, then opening and saving the image
file with MS Paint (or any other non-EXIF-aware editor) should fix things.
Otherwise, I have no suggestions.

-- Max
___
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] Importing pdf into MPpage

2022-06-11 Thread Stefan Nedeljkovic via ntg-context
That's perfect Fabrice, thank you very much!

On Sat, Jun 11, 2022 at 5:38 PM Fabrice L  wrote:

>
>
> Le 11 juin 2022 à 11:30, Stefan Nedeljkovic  a écrit :
>
> That's it, but how do I center it on (0, 0)?
>
>
> Sorry, I misunderstood the question. Here is a solution (perhaps there is
> a simpler solution !):
>
> \startMPpage
> picture TheImage ;
> TheImage := image(
> draw externalfigure "cow.pdf";
> );
> TheImage := TheImage shifted -center(TheImage);
> draw TheImage ;
> draw (0,0) withpen pencircle scaled .2in withcolor magenta ;
> \stopMPpage
>
> Fabrice.
>
>
> On Sat, Jun 11, 2022 at 4:46 PM Fabrice L  wrote:
>
>> Dear Stephan,
>>
>> Le 11 juin 2022 à 08:57, Stefan Nedeljkovic via ntg-context <
>> ntg-context@ntg.nl> a écrit :
>>
>> Dear list,
>>
>> I would like to place a pdf file at (0, 0), centered at original size
>> on a MPpage, and draw over it. But using the input command doesn't work.
>> How should I approach this?
>>
>>
>> Like this ?
>>
>> \startMPpage
>>draw externalfigure "thefile.pdf";
>>(… other commands…)
>> \stopMPpage
>>
>>
>>
>> Sincerely,
>> Stefan
>>
>>
>> Fabrice.
>>
>>
>> ___
>> 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] Importing pdf into MPpage

2022-06-11 Thread Fabrice L via ntg-context


> Le 11 juin 2022 à 11:30, Stefan Nedeljkovic  a écrit :
> 
> That's it, but how do I center it on (0, 0)?

Sorry, I misunderstood the question. Here is a solution (perhaps there is a 
simpler solution !):

\startMPpage
picture TheImage ; 
TheImage := image(
draw externalfigure "cow.pdf";
);
TheImage := TheImage shifted -center(TheImage);
draw TheImage ;
draw (0,0) withpen pencircle scaled .2in withcolor magenta ;
\stopMPpage

Fabrice.

> 
> On Sat, Jun 11, 2022 at 4:46 PM Fabrice L  <mailto:fabrice.al...@gmail.com>> wrote:
> Dear Stephan,
> 
>> Le 11 juin 2022 à 08:57, Stefan Nedeljkovic via ntg-context 
>> mailto:ntg-context@ntg.nl>> a écrit :
>> 
>> Dear list,
>> 
>> I would like to place a pdf file at (0, 0), centered at original size on a 
>> MPpage, and draw over it. But using the input command doesn't work. How 
>> should I approach this?
> 
> Like this ?
> 
> \startMPpage
>draw externalfigure "thefile.pdf";
>(… other commands…) 
> \stopMPpage
> 
> 
>> 
>> Sincerely,
>> Stefan
> 
> Fabrice.
> 
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> 
>> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / 
>> http://www.ntg.nl/mailman/listinfo/ntg-context 
>> <http://www.ntg.nl/mailman/listinfo/ntg-context>
>> webpage  : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / 
>> http://context.aanhet.net <http://context.aanhet.net/>
>> archive  : https://bitbucket.org/phg/context-mirror/commits/ 
>> <https://bitbucket.org/phg/context-mirror/commits/>
>> wiki : http://contextgarden.net <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] Importing pdf into MPpage

2022-06-11 Thread Stefan Nedeljkovic via ntg-context
That's it, but how do I center it on (0, 0)?

On Sat, Jun 11, 2022 at 4:46 PM Fabrice L  wrote:

> Dear Stephan,
>
> Le 11 juin 2022 à 08:57, Stefan Nedeljkovic via ntg-context <
> ntg-context@ntg.nl> a écrit :
>
> Dear list,
>
> I would like to place a pdf file at (0, 0), centered at original size on a
> MPpage, and draw over it. But using the input command doesn't work. How
> should I approach this?
>
>
> Like this ?
>
> \startMPpage
>draw externalfigure "thefile.pdf";
>(… other commands…)
> \stopMPpage
>
>
>
> Sincerely,
> Stefan
>
>
> Fabrice.
>
>
> ___
> 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] Importing pdf into MPpage

2022-06-11 Thread Fabrice L via ntg-context
Dear Stephan,

> Le 11 juin 2022 à 08:57, Stefan Nedeljkovic via ntg-context 
>  a écrit :
> 
> Dear list,
> 
> I would like to place a pdf file at (0, 0), centered at original size on a 
> MPpage, and draw over it. But using the input command doesn't work. How 
> should I approach this?

Like this ?

\startMPpage
   draw externalfigure "thefile.pdf";
   (… other commands…) 
\stopMPpage


> 
> Sincerely,
> Stefan

Fabrice.

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


[NTG-context] Problem with SVG an conversion mp (was: Improving pandoc's ConTeXt output)

2022-06-05 Thread Jan U. Hasecke via ntg-context
Am Sun, Jun 05, 2022 at 04:52:52PM -0700 schrieb Thangalin:
> This allows me to eliminate the dependency on both Pandoc and Inkscape.
> I've also encountered some problems with SVG to MP, but Hans is usually
> quick to fix the bugs given a minimal working example that pinpoints the
> problem. Either way, it's possible to retain the Inkscape step by telling
> ConTeXt not to use the MP conversion, as you alluded to, Juh.

So true. So here is a mwe, which works with inkscape and not with mp.

As some svg works with mp, I guess that mp cannot handle all svg
dialects. But this is only a guess.

juh


-- 
Autoren-Homepage: . http://literatur.hasecke.com
Satiren & Essays: . http://www.sudelbuch.de
Privater Blog:  http://www.hasecke.eu
Netzliteratur-Projekt:  http://www.generationenprojekt.de


\starttext
%\externalfigure[figure][width=10cm,conversion=mp]
\externalfigure[figure][width=10cm,conversion=mp]
\stoptext

signature.asc
Description: PGP signature
___
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] Compiling a large metapost document

2022-06-01 Thread Stefan Nedeljkovic via ntg-context
I figured it out. I was wrongly calculating the page size argument for gs.
Thank you very, very much again Max!

On Thu, Jun 2, 2022 at 4:41 AM Stefan Nedeljkovic 
wrote:

> There is one more problem: the pdf generated has incorrect margins. I
> tried to manually calculate the size in ps points and run gs directly, but
> the results are the same. How can I get an accurate rendering of the page?
>
> On Thu, Jun 2, 2022 at 4:22 AM Max Chernoff  wrote:
>
>> On 2022-06-01 8:00 p.m., Stefan Nedeljkovic wrote:
>> > Thank you very much Max! It works indeed! One more question. How would
>> I
>> > import the eps file back into MPpage, so I could do trickery with text.
>>
>> Convert the PostScript file into PDF with either "ps2pdf" or
>> GhostScript, then you can import the file with "externalfigure":
>>
>>  \startMPpage
>>  draw externalfigure "belgrade_gm.pdf";
>>  draw textext.top("One") shifted (264.352, 116.362);
>>  draw textext.top("Two") shifted (306.821, 186.907);
>>  \stopMPpage
>>
>> -- Max
>>
>
___
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] Compiling a large metapost document

2022-06-01 Thread Stefan Nedeljkovic via ntg-context
There is one more problem: the pdf generated has incorrect margins. I tried
to manually calculate the size in ps points and run gs directly, but the
results are the same. How can I get an accurate rendering of the page?

On Thu, Jun 2, 2022 at 4:22 AM Max Chernoff  wrote:

> On 2022-06-01 8:00 p.m., Stefan Nedeljkovic wrote:
> > Thank you very much Max! It works indeed! One more question. How would I
> > import the eps file back into MPpage, so I could do trickery with text.
>
> Convert the PostScript file into PDF with either "ps2pdf" or
> GhostScript, then you can import the file with "externalfigure":
>
>  \startMPpage
>  draw externalfigure "belgrade_gm.pdf";
>  draw textext.top("One") shifted (264.352, 116.362);
>  draw textext.top("Two") shifted (306.821, 186.907);
>  \stopMPpage
>
> -- Max
>
___
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] Compiling a large metapost document

2022-06-01 Thread Max Chernoff via ntg-context

On 2022-06-01 8:00 p.m., Stefan Nedeljkovic wrote:
Thank you very much Max! It works indeed! One more question. How would I 
import the eps file back into MPpage, so I could do trickery with text.


Convert the PostScript file into PDF with either "ps2pdf" or 
GhostScript, then you can import the file with "externalfigure":


\startMPpage
    draw externalfigure "belgrade_gm.pdf";
draw textext.top("One") shifted (264.352, 116.362);
draw textext.top("Two") shifted (306.821, 186.907);
\stopMPpage

-- Max
___
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] stacking of marginals

2022-05-31 Thread Henning Hraban Ramm via ntg-context

If you have many marginals, they tend to conflict.

The option stack=yes should enhance the situation.

I don’t expect wonders – if there’s not enough space, then ConTeXt can’t 
solve it. But it used to work better, as I can see in my magazines from 
the last years.


Now I can’t see a difference between stack=yes or no:

\usemodule[visual]
\useMPlibrary[dum]
\setupmargindata[inmargin][stack=yes]

\starttext

\dorecurse{20}{%
\fakewords{5}{30}
\inmargin{\externalfigure[dummy\recurselevel][width=15mm,height=15mm]}
\fakewords{5}{40}\par
}

\stoptext


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] Issue with interactive checkboxes[solved]

2022-05-24 Thread Jan-Erik Hägglöf via ntg-context
I’ve tested on my Mac OS Monterey 12.3.1 and the same phenomena as firefox it 
also is on google chrome.



> 24 maj 2022 kl. 10:18 skrev Jan-Erik Hägglöf :
> 
> HI Again!
> 
> I discovered what went wrong, such a silly syntax error, here comes a working 
> code:
> 
> \setupinteraction[state=start]
> 
> \definesymbol[yes][{\externalfigure[check-mark-svgrepo-com.svg][conversion=mp]}]
> \definesymbol[no][]
> 
> \newcount\chk
> \def\checkmark{%
> \global\advance\chk by 1
> \setupfield[setup1][width=0.5cm, height=0.5cm,rulethickness=1pt, 
> corner=round, framecolor=red]%
> \definefield[checkme\the\chk][check][setup1][yes,no][no]%
> \field[checkme\the\chk]%
> }
> 
> \starttext
> 
> \checkmark\
> 
> \checkmark\
> 
> \checkmark\
> 
> \stoptext
> 
> Sorry to bother the list but maybe it is helpful for someone.
> 
> Regards
> 
> /Jan-Erik
> 
>> 24 maj 2022 kl. 08:08 skrev Jan-Erik Hägglöf > <mailto:skrantajanne...@gmail.com>>:
>> 
>> I’ve tried this
>> 
>> \setupinteraction[state=start]
>> 
>> \definesymbol[yes][{\externalfigure[check-mark-svgrepo-com.svg][conversion=mp]}]
>> \definesymbol[no][]
>> 
>> \newcount\chk
>> \def\chk{%
>> \global \advance \chk by 1
>> \setupfield[setup1][width=0.5cm, height=0.5cm,rulethickness=1pt, 
>> corner=round, framecolor=red]%
>> \definefield[checkme\the\chk][check][setup1][yes,no][no]%
>> \field[checkme\the\chk]%
>> }
>> 
>> \starttext
>> 
>> \chk
>> 
>> \chk
>> 
>> \chk
>> 
>> \stoptext
>> 
>> But it gives the error ” You can’t use \global after \advance”
>> 
>> But this example works fine
>> 
>> \setupinteraction[state=start]
>> 
>> \newcount\clozecount
>> \def\mycloze{%
>>   \global \advance \clozecount by 1
>>   \definefield[uniqcloze\the\clozecount][line]%
>>   \field[uniqcloze\the\clozecount]%
>> }
>> 
>> \starttext
>> 
>> Frogs have four \mycloze\ and two eyes.
>> Frogs have four \mycloze\ and two eyes.
>> Frogs have four \mycloze\ and two eyes.
>> Frogs have four \mycloze\ and two eyes.
>> 
>> \stoptext
>> 
>> From 
>> 
>> https://tex.stackexchange.com/questions/560042/how-to-create-unique-clozes-in-context-in-a-pdf-that-users-can-type-in
>>  
>> <https://tex.stackexchange.com/questions/560042/how-to-create-unique-clozes-in-context-in-a-pdf-that-users-can-type-in>
>> 
>>> 24 maj 2022 kl. 07:44 skrev Jan-Erik Hägglöf >> <mailto:skrantajanne...@gmail.com>>:
>>> 
>>> Thank you, unfortunately it has no effect. Even if I make a macro, still it 
>>> is the same field.
>>> 
>>>> 23 maj 2022 kl. 21:59 skrev Pablo Rodriguez via ntg-context 
>>>> mailto:ntg-context@ntg.nl>>:
>>>> 
>>>> On 5/23/22 13:11, Jan-Erik Hägglöf via ntg-context wrote:
>>>>> HI!
>>>>> 
>>>>> Tried to make a checklist in an interactive document.
>>>>> 
>>>>> The problem seems to be that all checks/uncecks in same click, not each
>>>>> individually.
>>>>> 
>>>>> Is there something wrong with my code?
>>>> 
>>>> Hi Jan-Erik,
>>>> 
>>>> you basically put the same field twice.
>>>> 
>>>> Add something like:
>>>> 
>>>> \definefield [check-you] [check] [setup 3] [yes,no] [no]
>>>> 
>>>> \define\chka{\field[check-you]}
>>>> 
>>>> \chka
>>>> 
>>>> Checks will be different then.
>>>> 
>>>> I hope it helps,
>>>> 
>>>> Pablo
>>>> ___
>>>> If your question is of interest to others as well, please add an entry to 
>>>> the Wiki!
>>>> 
>>>> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / 
>>>> http://www.ntg.nl/mailman/listinfo/ntg-context 
>>>> <http://www.ntg.nl/mailman/listinfo/ntg-context>
>>>> webpage  : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / 
>>>> http://context.aanhet.net <http://context.aanhet.net/>
>>>> archive  : https://bitbucket.org/phg/context-mirror/commits/ 
>>>> <https://bitbucket.org/phg/context-mirror/commits/>
>>>> wiki : http://contextgarden.net <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] Issue with interactive checkboxes[solved]

2022-05-24 Thread Pablo Rodriguez via ntg-context
On 5/24/22 10:18, Jan-Erik Hägglöf via ntg-context wrote:
> HI Again!
>
> I discovered what went wrong, such a silly syntax error, here comes a
> working code:

Hi Jan-Erik,

this will also make it:

  \setupinteraction[state=start]
  \definesymbol [yes] [{\externalfigure[on.svg][conversion=mp]}]
  \definesymbol [no] [{\externalfigure[off.svg][conversion=mp]}]

  \setupfield[setup3][width=2ex, height=2ex]

  \dorecurse{3}
  {\definefield [check-\recurselevel] [check] [setup3] [yes,no] [no]}

  \setupbodyfont[sans, 30pt]

  \starttext
  \startTEXpage[offset=1em, foregroundstyle=\ssbf]

  \dorecurse{3}
{\field[check-\recurselevel]\
  option \recurselevel\blank[1ex]}
  \stopTEXpage
  \stoptext

But what I experienced in Acrobat Reader DC (on a borrowed computer) is
that you get the standard image (only when field is enabled) when you
click elsewhere in the document.

I guess that this may be related to a missing implementation, but first
I would like to confirm you are experiencing the same.

Best,

Pablo
___
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] Issue with interactive checkboxes[solved]

2022-05-24 Thread Jan-Erik Hägglöf via ntg-context
HI Again!

I discovered what went wrong, such a silly syntax error, here comes a working 
code:

\setupinteraction[state=start]

\definesymbol[yes][{\externalfigure[check-mark-svgrepo-com.svg][conversion=mp]}]
\definesymbol[no][]

\newcount\chk
\def\checkmark{%
\global\advance\chk by 1
\setupfield[setup1][width=0.5cm, height=0.5cm,rulethickness=1pt, corner=round, 
framecolor=red]%
\definefield[checkme\the\chk][check][setup1][yes,no][no]%
\field[checkme\the\chk]%
}

\starttext

\checkmark\

\checkmark\

\checkmark\

\stoptext

Sorry to bother the list but maybe it is helpful for someone.

Regards

/Jan-Erik

> 24 maj 2022 kl. 08:08 skrev Jan-Erik Hägglöf :
> 
> I’ve tried this
> 
> \setupinteraction[state=start]
> 
> \definesymbol[yes][{\externalfigure[check-mark-svgrepo-com.svg][conversion=mp]}]
> \definesymbol[no][]
> 
> \newcount\chk
> \def\chk{%
> \global \advance \chk by 1
> \setupfield[setup1][width=0.5cm, height=0.5cm,rulethickness=1pt, 
> corner=round, framecolor=red]%
> \definefield[checkme\the\chk][check][setup1][yes,no][no]%
> \field[checkme\the\chk]%
> }
> 
> \starttext
> 
> \chk
> 
> \chk
> 
> \chk
> 
> \stoptext
> 
> But it gives the error ” You can’t use \global after \advance”
> 
> But this example works fine
> 
> \setupinteraction[state=start]
> 
> \newcount\clozecount
> \def\mycloze{%
>   \global \advance \clozecount by 1
>   \definefield[uniqcloze\the\clozecount][line]%
>   \field[uniqcloze\the\clozecount]%
> }
> 
> \starttext
> 
> Frogs have four \mycloze\ and two eyes.
> Frogs have four \mycloze\ and two eyes.
> Frogs have four \mycloze\ and two eyes.
> Frogs have four \mycloze\ and two eyes.
> 
> \stoptext
> 
> From 
> 
> https://tex.stackexchange.com/questions/560042/how-to-create-unique-clozes-in-context-in-a-pdf-that-users-can-type-in
>  
> <https://tex.stackexchange.com/questions/560042/how-to-create-unique-clozes-in-context-in-a-pdf-that-users-can-type-in>
> 
>> 24 maj 2022 kl. 07:44 skrev Jan-Erik Hägglöf > <mailto:skrantajanne...@gmail.com>>:
>> 
>> Thank you, unfortunately it has no effect. Even if I make a macro, still it 
>> is the same field.
>> 
>>> 23 maj 2022 kl. 21:59 skrev Pablo Rodriguez via ntg-context 
>>> mailto:ntg-context@ntg.nl>>:
>>> 
>>> On 5/23/22 13:11, Jan-Erik Hägglöf via ntg-context wrote:
>>>> HI!
>>>> 
>>>> Tried to make a checklist in an interactive document.
>>>> 
>>>> The problem seems to be that all checks/uncecks in same click, not each
>>>> individually.
>>>> 
>>>> Is there something wrong with my code?
>>> 
>>> Hi Jan-Erik,
>>> 
>>> you basically put the same field twice.
>>> 
>>> Add something like:
>>> 
>>> \definefield [check-you] [check] [setup 3] [yes,no] [no]
>>> 
>>> \define\chka{\field[check-you]}
>>> 
>>> \chka
>>> 
>>> Checks will be different then.
>>> 
>>> I hope it helps,
>>> 
>>> Pablo
>>> ___
>>> If your question is of interest to others as well, please add an entry to 
>>> the Wiki!
>>> 
>>> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / 
>>> http://www.ntg.nl/mailman/listinfo/ntg-context 
>>> <http://www.ntg.nl/mailman/listinfo/ntg-context>
>>> webpage  : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / 
>>> http://context.aanhet.net <http://context.aanhet.net/>
>>> archive  : https://bitbucket.org/phg/context-mirror/commits/ 
>>> <https://bitbucket.org/phg/context-mirror/commits/>
>>> wiki : http://contextgarden.net <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] Issue with interactive checkboxes

2022-05-24 Thread Jan-Erik Hägglöf via ntg-context
I’ve tried this

\setupinteraction[state=start]

\definesymbol[yes][{\externalfigure[check-mark-svgrepo-com.svg][conversion=mp]}]
\definesymbol[no][]

\newcount\chk
\def\chk{%
\global \advance \chk by 1
\setupfield[setup1][width=0.5cm, height=0.5cm,rulethickness=1pt, corner=round, 
framecolor=red]%
\definefield[checkme\the\chk][check][setup1][yes,no][no]%
\field[checkme\the\chk]%
}

\starttext

\chk

\chk

\chk

\stoptext

But it gives the error ” You can’t use \global after \advance”

But this example works fine

\setupinteraction[state=start]

\newcount\clozecount
\def\mycloze{%
  \global \advance \clozecount by 1
  \definefield[uniqcloze\the\clozecount][line]%
  \field[uniqcloze\the\clozecount]%
}

\starttext

Frogs have four \mycloze\ and two eyes.
Frogs have four \mycloze\ and two eyes.
Frogs have four \mycloze\ and two eyes.
Frogs have four \mycloze\ and two eyes.

\stoptext

From 

https://tex.stackexchange.com/questions/560042/how-to-create-unique-clozes-in-context-in-a-pdf-that-users-can-type-in

> 24 maj 2022 kl. 07:44 skrev Jan-Erik Hägglöf :
> 
> Thank you, unfortunately it has no effect. Even if I make a macro, still it 
> is the same field.
> 
>> 23 maj 2022 kl. 21:59 skrev Pablo Rodriguez via ntg-context 
>> :
>> 
>> On 5/23/22 13:11, Jan-Erik Hägglöf via ntg-context wrote:
>>> HI!
>>> 
>>> Tried to make a checklist in an interactive document.
>>> 
>>> The problem seems to be that all checks/uncecks in same click, not each
>>> individually.
>>> 
>>> Is there something wrong with my code?
>> 
>> Hi Jan-Erik,
>> 
>> you basically put the same field twice.
>> 
>> Add something like:
>> 
>> \definefield [check-you] [check] [setup 3] [yes,no] [no]
>> 
>> \define\chka{\field[check-you]}
>> 
>> \chka
>> 
>> Checks will be different then.
>> 
>> I hope it helps,
>> 
>> Pablo
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> 
>> maillist : ntg-context@ntg.nl / 
>> 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
___


[NTG-context] Issue with interactive checkboxes

2022-05-23 Thread Jan-Erik Hägglöf via ntg-context
HI!Tried to make a checklist in an interactive document.The problem seems to be that all checks/uncecks in same click, not each individually.Is there something wrong with my code?See attached below\setupinteraction[state=start]\setupexternalfigures[location=global]\usemodule[fields]\definesymbol [yes] [{\externalfigure[check-mark-svgrepo-com.svg][conversion=mp]}]\definesymbol [no] []\setupfield[setup 3][width=0.5cm, height=0.5cm,rulethickness=1pt, corner=round, framecolor=red]\definefield [check-me] [check] [setup 3] [yes,no] [no]\define\chk{\field[check-me]}\starttext\chk\blank[3cm]\chk\stoptext

exempel1.pdf
Description: Adobe PDF document
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 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 \version[temporary] still alive?

2022-05-22 Thread Steffen Wolfrum via ntg-context
Hi,

testing this mwe I’d expect some indicators detecting overfull lines.

At least on my machine (ConTeXt  ver: 2022.01.21 20:13 LMTX) nothing happens:

\setuppapersize[A6]
% Tell ConTeXt where the windmill picture is
\setupexternalfigures[location={default}]
\version[temporary]

\section{Slithy toves}

% Top right of page will show successful reference '< fig2'
% Left margin will mention unsuccessful reference 'figNothing->'
See \in{Figure}[fig2] and \in{Figure}[figNothing].

% Top right of page will show new-created anchors '> fig1' and '> fig2'
% Top right of page will show successfully placed floats
\placefigure[here][fig1]{First windmill}{
   \externalfigure[mill][width=1cm]
}
\placefigure[here][fig2]{Second windmill}{
   \externalfigure[mill][width=1cm]
}

\startcolumns[n=3]
   % Overfull lines will have slugs in colum margins.
   \input linden 

   % Underfull hboxes get no warning
   x
\stopcolumns


Steffen
___
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] Interactive checkbox in ConTeXt

2022-05-22 Thread Jan-Erik Hägglöf via ntg-context
So far I accomplished this but problem is that when I check it checks all, not 
individually.

\setupinteraction[state=start]
\setupexternalfigures[location=global]

\definesymbol [yes] 
[{\externalfigure[check-mark-svgrepo-com.svg][conversion=mp]}]
\definesymbol [no] []


\setupfield
[setup 3]
[width=0.5cm, height=0.5cm,
rulethickness=1pt, corner=round, framecolor=red]


\definefield [check-me] [check] [setup 3] [yes,no] [no]

\define\chk{\field[check-me]}

\starttext

\chkgfgkfgfghjl

\chkdfdffdfff



\stoptext

> 22 maj 2022 kl. 10:47 skrev Jan-Erik Hägglöf :
> 
> Thank you for the useful tip.
> 
> I’ve tested the example given below but ran into missing figure, maybe I need 
> to reconstruct the MetaPost file as mentioned in setup. Se attached example:
> 
> Thanks in advance!
> 
> /Jan-Erik
> 
> \setupinteraction[state=start]
> \setupexternalfigures[location=global]
> 
> \definesymbol [yes] [{\externalfigure[mp-cont.502]}]
> \definesymbol [no] []
> 
> 
> \setupfield
> [setup 3]
> [width=2cm, height=2cm,
> rulethickness=3pt, corner=round, framecolor=red]
> 
> \definefield [check-me] [check] [setup 3] [yes,no] [no]
> 
> \starttext
> \field[check-me]
> \stoptext
> 
>> 20 maj 2022 kl. 12:28 skrev Henning Hraban Ramm via ntg-context 
>> :
>> 
>> Am 20.05.22 um 12:01 schrieb Jan-Erik Hägglöf via ntg-context:
>>> How do I accomplish a similar funktion like this, that is written in latex, 
>>> but in context instead?
>>> LATEXCODE
>>> |\documentclass{article} \usepackage{hyperref} \begin{document} 
>>> \begin{Form} \CheckBox[name=mycheckbox,checkboxsymbol=\ding{53}]{This is a 
>>> check box:} \end{Form} \end{document}|
>> 
>> Have a look at https://wiki.contextgarden.net/Widgets and the "mwidget" 
>> manual.
>> 
>> Custom symbols work unreliably, depending of the viewer.
>> 
>> 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] Interactive checkbox in ConTeXt

2022-05-22 Thread Jan-Erik Hägglöf via ntg-context
Thank you for the useful tip.

I’ve tested the example given below but ran into missing figure, maybe I need 
to reconstruct the MetaPost file as mentioned in setup. Se attached example:

Thanks in advance!

/Jan-Erik

\setupinteraction[state=start]
\setupexternalfigures[location=global]

\definesymbol [yes] [{\externalfigure[mp-cont.502]}]
\definesymbol [no] []


\setupfield
[setup 3]
[width=2cm, height=2cm,
rulethickness=3pt, corner=round, framecolor=red]

\definefield [check-me] [check] [setup 3] [yes,no] [no]

\starttext
\field[check-me]
\stoptext

> 20 maj 2022 kl. 12:28 skrev Henning Hraban Ramm via ntg-context 
> :
> 
> Am 20.05.22 um 12:01 schrieb Jan-Erik Hägglöf via ntg-context:
>> How do I accomplish a similar funktion like this, that is written in latex, 
>> but in context instead?
>> LATEXCODE
>> |\documentclass{article} \usepackage{hyperref} \begin{document} \begin{Form} 
>> \CheckBox[name=mycheckbox,checkboxsymbol=\ding{53}]{This is a check box:} 
>> \end{Form} \end{document}|
> 
> Have a look at https://wiki.contextgarden.net/Widgets and the "mwidget" 
> manual.
> 
> Custom symbols work unreliably, depending of the viewer.
> 
> 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
___


[NTG-context] overthinking overprinting

2022-05-19 Thread Henning Hraban Ramm via ntg-context


A question on TeX-D-L reminded me to look into this subject.

At the moment, there is \setupcolors[intent=overprint|knockout] with 
\startoverprint|knockout, as defined in colo-ext.mkxl|mkiv.


I’m not sure what that does as a general setting – usually you need 
overprinting for black text and lines in CMYK documents.


There are special cases where you want other (spot) colors to overprint, 
but that’s quite rare, and I can use transparency features to achieve 
the same (a=multiply) in an even more flexible way – as long as I don’t 
need a format like PDF/X-3 that doesn’t allow transparencies.
If I declare such a format, ConTeXt just switches off transparencies and 
doesn’t try to emulate (“flatten”) them as e.g. InDesign does.


So it would be nice if I could e.g.
\definecolor[OPred][m=1,y=1,intent=overprint]

OTOH there are cases where I want a black area or text to knockout the 
background, these might work with \startknockout etc.



When I try my example:

\useMPlibrary[dum]
\setupcolors[
   rgb=no,cmyk=yes,
   intent=overprint,% or knockout
]
\setupbodyfont[modern,ss,18pt]

\starttext

\definecollector[Test]
\setcollector [Test] {\externalfigure[none][width=8cm,height=6cm,frame=on]}
\setcollector [Test] [corner=middle,location=middle] {{\bf Toast}}
\setcollector [Test]
   [corner={left,top},location={right,bottom}]
   {\framed{LT}}
\setcollector [Test]
   [corner={left,bottom},location={right,top}]
   {\framed{LB}}

\composedcollector{Test}

\stoptext

... then the text is “knocked out” regardless how set the intent.
It also doesn’t help to use \startoverprint for the Text.
The attached screenshot shows the color separation preview from Acrobat 
Pro 9.


Is this broken or intended to be used differently?

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] Simple question

2022-05-10 Thread Denis Maier via ntg-context
Don't know how if there's an automatic way, perhaps look into ctx processing 
instructions.
Anyway you can use
--result=name
As you have to set quite a few options on the command line (modes, language) 
you'll perhaps want to use a makefile anyway.




Von: ntg-context  im Auftrag von Gerben Wierda via 
ntg-context 
Gesendet: Dienstag, 10. Mai 2022 18:47:32
An: mailing list for ConTeXt users
Cc: Gerben Wierda
Betreff: Re: [NTG-context] Simple question

Thank you.

Is it possible to change the name of the resulting PDF file based on the 
language and a mode?

So that with a command

context language=fr mode=simple file.tex

the result is in

file-simple-fr.pdf

and with

context language=ru mode=none file.tex (or no mode given)

the result is

file-ru.pdf

G

On 10 May 2022, at 17:21, Wolfgang Schuster 
mailto:wolfgang.schuster.li...@gmail.com>> 
wrote:

Gerben Wierda via ntg-context schrieb am 10.05.2022 um 00:15:
What is the easiest way to have a ‘database’ of translations for strings and 
maybe links?

I now have 4 languages and 2 versions so 8 documents, but I’d like to have all 
translatable strings together so I can maintain these in a single file. Ideally 
I can do a file where the key of the translation is one language (say English) 
and the translations are part of that.

Something I can call like this

\translatephrase[English phrase][nl]
\translatelocation[../LMTX-Output/without-ids/en/file.pdf][nl][simple]

and where I can maintain all the translations a bit like this:

\translationentry[English phrase]{
\definetranslatephrase[nl]Nederlandse frase]
\definetranslatephrase[fr][Phrase français]
}
}

\translatelocation[../LMTX-Output/without-ids/en/file.pdf][simple][nl][../LMTX-Output/without-ids/nl/file-simple.pdf]]
\translatelocation[../LMTX-Output/without-ids/en/file.pdf][none][nl][../LMTX-Output/without-ids/nl/file.pdf]]


Where the \translatelocation command can be used inside an \externalfigure 
command and \translatephrase can be used as as text.

In the end I’d like to compile with

context language=fr mode=simple mainfile.tex

Doable?

To set language dependent texts you can use the labeltext mechanism which is 
used by ConTeXt to change the captions for floats etc.

Besides the default \labeltext and \setuplabeltext commands you can create your 
own instance of the mechanism for your texts.

 begin example
\definelabelclass [gerben]

\setupgerbentext [en] [phrase=English phrase]
\setupgerbentext [nl] [phrase=Nederlandse frase]
\setupgerbentext [fr] [phrase=Phrase français]

%\mainlanguage[nl]
%\mainlanguage[fr]

\starttext
\gerbentext{phrase}
\stoptext
 end example

To change images you use multiple sub folders where each folder has images 
which the same name. In ConTeXt you can use a mode to choose which directory is 
used to load the image. Another method is to map the file names of the images 
to symbolic names and use only the symbolic names in your document.

 begin example
\setupexternalfigures [location={local,global,default}]

\useexternalfigure [simple] [cow.pdf]
%\useexternalfigure [simple] [hacker.png]

\starttext
\externalfigure[simple]
\stoptext
 end example

Wolfgang

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

maillist : ntg-context@ntg.nl / 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] Simple question

2022-05-10 Thread Gerben Wierda via ntg-context
Thank you.

Is it possible to change the name of the resulting PDF file based on the 
language and a mode?

So that with a command

context language=fr mode=simple file.tex

the result is in

file-simple-fr.pdf

and with 

context language=ru mode=none file.tex (or no mode given)

the result is

file-ru.pdf

G

> On 10 May 2022, at 17:21, Wolfgang Schuster 
>  wrote:
> 
> Gerben Wierda via ntg-context schrieb am 10.05.2022 um 00:15:
>> What is the easiest way to have a ‘database’ of translations for strings and 
>> maybe links?
>> 
>> I now have 4 languages and 2 versions so 8 documents, but I’d like to have 
>> all translatable strings together so I can maintain these in a single file. 
>> Ideally I can do a file where the key of the translation is one language 
>> (say English) and the translations are part of that. 
>> 
>> Something I can call like this
>> 
>> \translatephrase[English phrase][nl]
>> \translatelocation[../LMTX-Output/without-ids/en/file.pdf][nl][simple]
>> 
>> and where I can maintain all the translations a bit like this:
>> 
>> \translationentry[English phrase]{
>>  \definetranslatephrase[nl]Nederlandse frase]
>>  \definetranslatephrase[fr][Phrase français]
>>  }
>> }
>> 
>> \translatelocation[../LMTX-Output/without-ids/en/file.pdf][simple][nl][../LMTX-Output/without-ids/nl/file-simple.pdf]]
>> \translatelocation[../LMTX-Output/without-ids/en/file.pdf][none][nl][../LMTX-Output/without-ids/nl/file.pdf]]
>> 
>> 
>> Where the \translatelocation command can be used inside an \externalfigure 
>> command and \translatephrase can be used as as text.
>> 
>> In the end I’d like to compile with 
>> 
>> context language=fr mode=simple mainfile.tex
>> 
>> Doable?
> 
> To set language dependent texts you can use the labeltext mechanism which is 
> used by ConTeXt to change the captions for floats etc.
> 
> Besides the default \labeltext and \setuplabeltext commands you can create 
> your own instance of the mechanism for your texts.
> 
>  begin example
> \definelabelclass [gerben]
> 
> \setupgerbentext [en] [phrase=English phrase]
> \setupgerbentext [nl] [phrase=Nederlandse frase]
> \setupgerbentext [fr] [phrase=Phrase français]
> 
> %\mainlanguage[nl]
> %\mainlanguage[fr]
> 
> \starttext
> \gerbentext{phrase}
> \stoptext
>  end example
> 
> To change images you use multiple sub folders where each folder has images 
> which the same name. In ConTeXt you can use a mode to choose which directory 
> is used to load the image. Another method is to map the file names of the 
> images to symbolic names and use only the symbolic names in your document.
> 
>  begin example
> \setupexternalfigures [location={local,global,default}]
> 
> \useexternalfigure [simple] [cow.pdf]
> %\useexternalfigure [simple] [hacker.png]
> 
> \starttext
> \externalfigure[simple]
> \stoptext
>  end example
> 
> Wolfgang

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

maillist : ntg-context@ntg.nl / 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] Simple question

2022-05-10 Thread Wolfgang Schuster via ntg-context

Gerben Wierda via ntg-context schrieb am 10.05.2022 um 00:15:
What is the easiest way to have a ‘database’ of translations for 
strings and maybe links?


I now have 4 languages and 2 versions so 8 documents, but I’d like to 
have all translatable strings together so I can maintain these in a 
single file. Ideally I can do a file where the key of the translation 
is one language (say English) and the translations are part of that.


Something I can call like this

\translatephrase[English phrase][nl]
\translatelocation[../LMTX-Output/without-ids/en/file.pdf][nl][simple]

and where I can maintain all the translations a bit like this:

\translationentry[English phrase]{
\definetranslatephrase[nl]Nederlandse frase]
\definetranslatephrase[fr][Phrase français]
}
}

\translatelocation[../LMTX-Output/without-ids/en/file.pdf][simple][nl][../LMTX-Output/without-ids/nl/file-simple.pdf]]
\translatelocation[../LMTX-Output/without-ids/en/file.pdf][none][nl][../LMTX-Output/without-ids/nl/file.pdf]]


Where the \translatelocation command can be used inside an 
\externalfigure command and \translatephrase can be used as as text.


In the end I’d like to compile with

context language=fr mode=simple mainfile.tex

Doable?


To set language dependent texts you can use the labeltext mechanism 
which is used by ConTeXt to change the captions for floats etc.


Besides the default \labeltext and \setuplabeltext commands you can 
create your own instance of the mechanism for your texts.


 begin example
\definelabelclass [gerben]

\setupgerbentext [en] [phrase=English phrase]
\setupgerbentext [nl] [phrase=Nederlandse frase]
\setupgerbentext [fr] [phrase=Phrase français]

%\mainlanguage[nl]
%\mainlanguage[fr]

\starttext
\gerbentext{phrase}
\stoptext
 end example

To change images you use multiple sub folders where each folder has 
images which the same name. In ConTeXt you can use a mode to choose 
which directory is used to load the image. Another method is to map the 
file names of the images to symbolic names and use only the symbolic 
names in your document.


 begin example
\setupexternalfigures [location={local,global,default}]

\useexternalfigure [simple] [cow.pdf]
%\useexternalfigure [simple] [hacker.png]

\starttext
\externalfigure[simple]
\stoptext
 end example

Wolfgang

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

maillist : ntg-context@ntg.nl / 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] Simple question

2022-05-10 Thread Henning Hraban Ramm via ntg-context

Am 10.05.22 um 00:15 schrieb Gerben Wierda via ntg-context:
What is the easiest way to have a ‘database’ of translations for strings 
and maybe links?


I now have 4 languages and 2 versions so 8 documents, but I’d like to 
have all translatable strings together so I can maintain these in a 
single file. Ideally I can do a file where the key of the translation is 
one language (say English) and the translations are part of that.


Something I can call like this

\translatephrase[English phrase][nl]
\translatelocation[../LMTX-Output/without-ids/en/file.pdf][nl][simple]

and where I can maintain all the translations a bit like this:

\translationentry[English phrase]{
\definetranslatephrase[nl]Nederlandse frase]
\definetranslatephrase[fr][Phrase français]
}
}

\translatelocation[../LMTX-Output/without-ids/en/file.pdf][simple][nl][../LMTX-Output/without-ids/nl/file-simple.pdf]]
\translatelocation[../LMTX-Output/without-ids/en/file.pdf][none][nl][../LMTX-Output/without-ids/nl/file.pdf]]


Where the \translatelocation command can be used inside an 
\externalfigure command and \translatephrase can be used as as text.


In the end I’d like to compile with

context language=fr mode=simple mainfile.tex

Doable?

Gerben Wierda (LinkedIn <https://www.linkedin.com/in/gerbenwierda>)
R IT Strategy <https://ea.rna.nl/> (main site)
Book: Chess and the Art of Enterprise Architecture 
<https://ea.rna.nl/the-book/>

Book: Mastering ArchiMate <https://ea.rna.nl/the-book-edition-iii/>



Hi Gerben,

a lot is doable, it depends on by whom ;)
But this looks like a quite easy case.

Of course the answer is always “Lua tables”, but I guess the 
translations would be most easy to maintain in a CSV file (you can edit 
it in LibreOffice or Excel, while the latter often botches the encoding).


It could look like:

key;en;de;nl
yes;yes;ja;ja
LANG;English;Deutsch;Nederlands

i.e. the first column is the keyword and the other columns contain the 
translated term (so you can also change the “original” version).


(We’re using the same in a LaTeX3 project made by Marei.)

Without researching I assume there are already Lua functions to read a 
CSV file into a Lua table, and the lookup is easy – since I’m not fluent 
in Lua, I won’t provide the function(s) for you.


BTW there is already \translate 
(https://wiki.contextgarden.net/Command/translate) that changes text 
depending on the current language.


And there is the translate module that changes terms within the whole 
text: 
https://source.contextgarden.net/tex/context/modules/mkiv/m-translate.mkiv


Other options like .po files might be more versatile but also much more 
involved.


This covers \translatephrase; for your figures I’d just just a language 
variable in the path, like \externalfigure[images/\LANG/cow.pdf]

If this is always the current language, use \currentlanguage.
You can also setup the language dependent directory in 
\setupexternalfigures.


Regarding modes, the current language is set as a system mode (*en, 
*nl), and of course you can query modes with one of the many \doif 
macros. (https://wiki.contextgarden.net/Modes)
Since it doesn’t make sense to try 
\externalfigure[path/\currentmode/cow] (you never know how many modes 
are active), you can set a macro or variable depending on a mode:


\doifmode{simple}{\setvariable{gerben}{level}{simple}}
and then
\externalfigure[images/\getvariable{gerben}{level}/\currentlanguage/cow]

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] SVG style ignored after double semicolon

2022-05-09 Thread Heinrich Paeßens via ntg-context
ok, let’s get smarter.
how about sanitizing the svg-file from JFreeSVG with svgo or svgcleaner or nano 
or else?
And as a side effect you’d have the file optimized, ie. a smaller size 
(lossless I suppose) …
and are you sure that the ;;-issue is the only bug? After sanitizing you’ll 
never know but that should be ok.

I’ve checked this. For your example it’s ok.

> svgo in.svg
> in.svg:
> Done in 24 ms!
> 0.091 KiB - 26.9% = 0.066 KiB

> svgcleaner /Users/hp/in2.svg /Users/hp/out2.svg
> Your image is 9.36% smaller now.

 ,__,
 {o,o}
./)_)
 -»-»-

> On 9. May 2022, at 19:01, Heinrich Paeßens via ntg-context 
> mailto:ntg-context@ntg.nl>> wrote:
> 
> Yes, now I see, but isn’t there sth missing in the export from JFreeSVG, that 
> were supposed to fill in between the semicolons? If not, why don’t you just 
> post-process, if possible … 
> … sth like 
> 
> > gsed ’s/;;/;/g' in.svg > out.svg
> 
> ;-)
> 
> 
> 
>> On 9. May 2022, at 17:42, Thangalin > <mailto:thanga...@gmail.com>> wrote:
>> 
>> Hi Heinrich,
>> 
>> Use the SVG I provided. R and Renjin use two different SVG generators. 
>> Renjin uses JFreeSVG when exporting as SVG. As you pointed out, there are no 
>> issues with R because it will export an SVG file without any double 
>> semicolons.
>> 
>> In other words, try this:
>> 
>> \startbuffer[svg]
>> 
>>   > style="stroke:rgb(0,0,0);;fill:none" />
>> 
>> \stopbuffer
>> 
>> \starttext
>>   \placefigure{}{\includesvgbuffer[svg][conversion=mp]}
>> \stoptext
>> 
>> If you get a black square, that's the bug. If you get a white square, then 
>> there's something different about our environment setups.
>> 
>> Cheers!
>> 
>> 
>> On Mon, May 9, 2022 at 1:55 AM Heinrich Paeßens > <mailto:paess...@me.com>> wrote:
>> Hi there
>> 
>> I can compile your example without any tweaks, hence could not reproduce any 
>> error.
>> 
>> cheers
>> Heinrich
>> 
>> ———
>> 
>> R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
>> Copyright (C) 2022 The R Foundation for Statistical Computing
>> Platform: x86_64-apple-darwin17.0 (64-bit)
>> 
>> [R.app GUI 1.78 (8075) x86_64-apple-darwin17.0]
>> 
>> > svg("/Users/hp/filename.svg");
>> > plot(rnorm(200));
>> > dev.off()
>> null device 
>>   1 
>> > 
>> 
>> ———
>> 
>> % !TEX program = lmtx
>> 
>> \starttext
>>   \externalfigure[/Users/hp/filename.svg][conversion=mp]
>> \stoptext
>> 
>> ———
>> 
>> 
>> 
>> 
>>> On 9. May 2022, at 08:10, Thangalin via ntg-context >> <mailto:ntg-context@ntg.nl>> wrote:
>>> 
>>> Here's a screenshot comparing ConTeXt's PDF output (left) with KeenWrite's 
>>> preview for the same SVG document:
>>> 
>>> https://i.ibb.co/68nqwrg/render-r-plot.png 
>>> <https://i.ibb.co/68nqwrg/render-r-plot.png>
>>> 
>>> I've filed a bug against Renjin's SVG exporter.
>>> 
>>> Any guidance on how to fix this is greatly appreciated.
>>> 
>>> ___
>>> If your question is of interest to others as well, please add an entry to 
>>> the Wiki!
>>> 
>>> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / 
>>> http://www.ntg.nl/mailman/listinfo/ntg-context 
>>> <http://www.ntg.nl/mailman/listinfo/ntg-context>
>>> webpage  : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / 
>>> http://context.aanhet.net <http://context.aanhet.net/>
>>> archive  : https://bitbucket.org/phg/context-mirror/commits/ 
>>> <https://bitbucket.org/phg/context-mirror/commits/>
>>> wiki : http://contextgarden.net <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 <mailto:ntg-context@ntg.nl> / 
> http://www.ntg.nl/mailman/listinfo/ntg-context 
> <http://www.ntg.nl/mailman/listinfo/ntg-context>
> webpage  : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / 
> http://context.aanhet.net <http://context.aanhet.net/>
> archive  : https://bitbucket.org/phg/context-mirror/commits/ 
> <https://bitbucket.org/phg/context-mirror/commits/>
> wiki : http://contextgarden.net <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
___


[NTG-context] Simple question

2022-05-09 Thread Gerben Wierda via ntg-context
What is the easiest way to have a ‘database’ of translations for strings and 
maybe links?

I now have 4 languages and 2 versions so 8 documents, but I’d like to have all 
translatable strings together so I can maintain these in a single file. Ideally 
I can do a file where the key of the translation is one language (say English) 
and the translations are part of that. 

Something I can call like this

\translatephrase[English phrase][nl]
\translatelocation[../LMTX-Output/without-ids/en/file.pdf][nl][simple]

and where I can maintain all the translations a bit like this:

\translationentry[English phrase]{
\definetranslatephrase[nl]Nederlandse frase]
\definetranslatephrase[fr][Phrase français]
}
}

\translatelocation[../LMTX-Output/without-ids/en/file.pdf][simple][nl][../LMTX-Output/without-ids/nl/file-simple.pdf]]
\translatelocation[../LMTX-Output/without-ids/en/file.pdf][none][nl][../LMTX-Output/without-ids/nl/file.pdf]]


Where the \translatelocation command can be used inside an \externalfigure 
command and \translatephrase can be used as as text.

In the end I’d like to compile with 

context language=fr mode=simple mainfile.tex

Doable?

Gerben Wierda (LinkedIn <https://www.linkedin.com/in/gerbenwierda>)
R IT Strategy <https://ea.rna.nl/> (main site)
Book: Chess and the Art of Enterprise Architecture <https://ea.rna.nl/the-book/>
Book: Mastering ArchiMate <https://ea.rna.nl/the-book-edition-iii/>

___
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] SVG style ignored after double semicolon

2022-05-09 Thread Heinrich Paeßens via ntg-context
Yes, now I see, but isn’t there sth missing in the export from JFreeSVG, that 
were supposed to fill in between the semicolons? If not, why don’t you just 
post-process, if possible … 
… sth like 

> gsed ’s/;;/;/g' in.svg > out.svg

;-)



> On 9. May 2022, at 17:42, Thangalin  wrote:
> 
> Hi Heinrich,
> 
> Use the SVG I provided. R and Renjin use two different SVG generators. Renjin 
> uses JFreeSVG when exporting as SVG. As you pointed out, there are no issues 
> with R because it will export an SVG file without any double semicolons.
> 
> In other words, try this:
> 
> \startbuffer[svg]
> 
>style="stroke:rgb(0,0,0);;fill:none" />
> 
> \stopbuffer
> 
> \starttext
>   \placefigure{}{\includesvgbuffer[svg][conversion=mp]}
> \stoptext
> 
> If you get a black square, that's the bug. If you get a white square, then 
> there's something different about our environment setups.
> 
> Cheers!
> 
> 
> On Mon, May 9, 2022 at 1:55 AM Heinrich Paeßens  <mailto:paess...@me.com>> wrote:
> Hi there
> 
> I can compile your example without any tweaks, hence could not reproduce any 
> error.
> 
> cheers
> Heinrich
> 
> ———
> 
> R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
> Copyright (C) 2022 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin17.0 (64-bit)
> 
> [R.app GUI 1.78 (8075) x86_64-apple-darwin17.0]
> 
> > svg("/Users/hp/filename.svg");
> > plot(rnorm(200));
> > dev.off()
> null device 
>   1 
> > 
> 
> ———
> 
> % !TEX program = lmtx
> 
> \starttext
>   \externalfigure[/Users/hp/filename.svg][conversion=mp]
> \stoptext
> 
> ———
> 
> 
> 
> 
>> On 9. May 2022, at 08:10, Thangalin via ntg-context > <mailto:ntg-context@ntg.nl>> wrote:
>> 
>> Here's a screenshot comparing ConTeXt's PDF output (left) with KeenWrite's 
>> preview for the same SVG document:
>> 
>> https://i.ibb.co/68nqwrg/render-r-plot.png 
>> <https://i.ibb.co/68nqwrg/render-r-plot.png>
>> 
>> I've filed a bug against Renjin's SVG exporter.
>> 
>> Any guidance on how to fix this is greatly appreciated.
>> 
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> 
>> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / 
>> http://www.ntg.nl/mailman/listinfo/ntg-context 
>> <http://www.ntg.nl/mailman/listinfo/ntg-context>
>> webpage  : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / 
>> http://context.aanhet.net <http://context.aanhet.net/>
>> archive  : https://bitbucket.org/phg/context-mirror/commits/ 
>> <https://bitbucket.org/phg/context-mirror/commits/>
>> wiki : http://contextgarden.net <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] SVG style ignored after double semicolon

2022-05-09 Thread Thangalin via ntg-context
Hi Heinrich,

Use the SVG I provided. R and Renjin use two different SVG generators.
Renjin uses JFreeSVG when exporting as SVG. As you pointed out, there are
no issues with R because it will export an SVG file without any double
semicolons.

In other words, try this:

\startbuffer[svg]

  

\stopbuffer

\starttext
  \placefigure{}{\includesvgbuffer[svg][conversion=mp]}
\stoptext

If you get a black square, that's the bug. If you get a white square, then
there's something different about our environment setups.

Cheers!


On Mon, May 9, 2022 at 1:55 AM Heinrich Paeßens  wrote:

> Hi there
>
> I can compile your example without any tweaks, hence could not reproduce
> any error.
>
> cheers
> Heinrich
>
> ———
>
> R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
> Copyright (C) 2022 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin17.0 (64-bit)
>
> [R.app GUI 1.78 (8075) x86_64-apple-darwin17.0]
>
> > svg("/Users/hp/filename.svg");
> > plot(rnorm(200));
> > dev.off()
> null device
>   1
> >
>
> ———
>
> % !TEX program = lmtx
>
> \starttext
>   \externalfigure[/Users/hp/filename.svg][conversion=mp]
> \stoptext
>
> ———
>
>
>
>
> On 9. May 2022, at 08:10, Thangalin via ntg-context 
> wrote:
>
> Here's a screenshot comparing ConTeXt's PDF output (left) with KeenWrite's
> preview for the same SVG document:
>
> https://i.ibb.co/68nqwrg/render-r-plot.png
>
> I've filed a bug against Renjin's SVG exporter.
>
> Any guidance on how to fix this is greatly appreciated.
>
>
> ___
> 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] SVG style ignored after double semicolon

2022-05-09 Thread Heinrich Paeßens via ntg-context
Hi thereI can compile your example without any tweaks, hence could not reproduce any error.cheersHeinrich———R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"Copyright (C) 2022 The R Foundation for Statistical ComputingPlatform: x86_64-apple-darwin17.0 (64-bit)[R.app GUI 1.78 (8075) x86_64-apple-darwin17.0]> svg("/Users/hp/filename.svg");> plot(rnorm(200));> dev.off()null device           1 > ———% !TEX program = lmtx\starttext  \externalfigure[/Users/hp/filename.svg][conversion=mp]\stoptext———

tst-svg-mp.pdf
Description: Adobe PDF document
On 9. May 2022, at 08:10, Thangalin via ntg-context <ntg-context@ntg.nl> wrote:Here's a screenshot comparing ConTeXt's PDF output (left) with KeenWrite's preview for the same SVG document:https://i.ibb.co/68nqwrg/render-r-plot.pngI've filed a bug against Renjin's SVG exporter.Any guidance on how to fix this is greatly appreciated.
___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-contextwebpage  : http://www.pragma-ade.nl / http://context.aanhet.netarchive  : 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] Crediting copyright on photographs

2022-05-05 Thread Bruce Horrocks via ntg-context
Thank-you Adam, Hraban and Richard for your suggestions.

In the end it was remarkably simple:

\starttext
\definecollector[example]
\setcollector [example] {\externalfigure[cow][width=6cm,frame=off]}
\setcollector [example] [corner={right,bottom},location={right,top}]
{\rotate[rotation=90]{\copyright A great artist}}
\placefigure [ ] [fig:cow] {A fine figure of a cow} 
{\composedcollector{example}}
\stoptext

In the above the cow is drawn with the figure caption below as normal and with 
the copyright text running upwards along the edge of the right-hand edge of the 
image. And if you want to fine tune the space between the image and the text 
then it's easy to \framed the text and play around with the size and offsets.

—
Bruce Horrocks
Hampshire, UK

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

maillist : ntg-context@ntg.nl / 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] Crediting copyright on photographs

2022-05-05 Thread Richard Mahoney via ntg-context
Bruce,

I tend to do something such as the following:

\startplacefigure[reference={fig:0007},location={here},title={{\it
Vīkṣya}, 5b},list={Ch.\ {\sc ix}\TI {\it Vīkṣya}, 5b}]

\externalfigure[plates/01-09/01-09-07-
c.jpg][scale=1000,frame=off,equalwidth=325pt]

{{\NI}{\tfx \copyright\ 2012 Sylvain {\sc Brocquet}.}}

\stopplacefigure


You can find the result in v. 1, p. 257:

Murugaiyan, Appasamy & Parlier-Renault, Édith (2021) (Eds) Whispering
of Inscriptions:
South Indian Epigraphy and Art History: Papers from an International
Symposium in memory
of Professor Noboru Karashima (Paris, 12–13 October 2017). Oxford:
Indica et Buddhica.

OA PDF here:

https://indica-et-buddhica.org/publications/murugaiyan-appasamy-parlier-renault-edith/whispering-of-inscriptions-south-indian-epigraphy-and-art-history



Best, Richard



-- 
T +6433121699  M +64210640216
rmaho...@indica-et-buddhica.org
https://indica-et-buddhica.org/

Indica et Buddhica
Littledene  Bay Road  Oxford  NZ
NZBN: 9429041761809


-Original Message-
From: Henning Hraban Ramm via ntg-context 
Reply-To: mailing list for ConTeXt users 
To: ntg-context@ntg.nl
Cc: Henning Hraban Ramm 
Subject: Re: [NTG-context] Crediting copyright on photographs
Date: Thu, 5 May 2022 08:54:52 +0200
Mailer: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:91.0)
Gecko/20100101 Thunderbird/91.8.1
X-Spam-Score: 0.0

Am 04.05.22 um 23:59 schrieb Bruce Horrocks via ntg-context:
> I need to include the copyright acknowledgement / photographer
> credit on an image but I'm not sure what's the best way to do it.
> 
> Option 1: I can add the acknowledgement to the end of the
> \placefigure caption text:
> 
> e.g.   \placefigure{A picture of a cow. Image of a cow that may or
> may not be under copyright
> anymore.}{\externalfigure[cow][height=6cm]}
> 
> then the copyright bit will appear in the Table of Figures which I
> don't really want to happen. Is there a way to truncate this?

Using

\startplacefigure[title={complete caption}, list={description in the 
table of figures}]...\stopplacefigure

you can have different caption texts, like for titles.


> Option 2: some magazines print the copyright credit running up the
> side of the image, independently of the caption. I'd quite like to
> do this and wondered if anyone had already written something they
> could share?

I often use \ininner{\rotate[location=fit]{Copyright notice}}, but
it’s 
a hassle to get the placement right, don’t use it within the caption. 
Using \setlayer is most reliable.


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] Crediting copyright on photographs

2022-05-05 Thread Henning Hraban Ramm via ntg-context

Am 04.05.22 um 23:59 schrieb Bruce Horrocks via ntg-context:

I need to include the copyright acknowledgement / photographer credit on an 
image but I'm not sure what's the best way to do it.

Option 1: I can add the acknowledgement to the end of the \placefigure caption 
text:

e.g.   \placefigure{A picture of a cow. Image of a cow that may or may not be 
under copyright anymore.}{\externalfigure[cow][height=6cm]}

then the copyright bit will appear in the Table of Figures which I don't really 
want to happen. Is there a way to truncate this?


Using

\startplacefigure[title={complete caption}, list={description in the 
table of figures}]...\stopplacefigure


you can have different caption texts, like for titles.



Option 2: some magazines print the copyright credit running up the side of the 
image, independently of the caption. I'd quite like to do this and wondered if 
anyone had already written something they could share?


I often use \ininner{\rotate[location=fit]{Copyright notice}}, but it’s 
a hassle to get the placement right, don’t use it within the caption. 
Using \setlayer is most reliable.



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] Crediting copyright on photographs

2022-05-04 Thread Adam Reviczky via ntg-context
Hi Bruce,

The Layers page has some examples (
https://wiki.contextgarden.net/Layers#Place_labels_on_pictures) and the
Collectors page as well (https://wiki.contextgarden.net/Collectors).

Some MWE:

\starttext
\definelayer  [figure][width=\overlaywidth,height=\overlayheight]
\defineoverlay[figure][{\directsetup{figure}\tightlayer[figure]}]
\startsetups figure
\setlayerframed[figure][frame=off,preset=rightbottom]{\copyright\ 2022}
\stopsetups
\externalfigure[cow][background={foreground,figure}]
\stoptext

\starttext
\definecollector[example]
\setcollector [example] {\externalfigure[cow][width=4cm,frame=off]}
\setcollector [example]
[corner={right,bottom},location={left,top}]{\copyright\ 2022}
\composedcollector{example}
\stoptext

Adam

On Wed, May 4, 2022 at 11:01 PM Bruce Horrocks via ntg-context <
ntg-context@ntg.nl> wrote:

> I need to include the copyright acknowledgement / photographer credit on
> an image but I'm not sure what's the best way to do it.
>
> Option 1: I can add the acknowledgement to the end of the \placefigure
> caption text:
>
> e.g.   \placefigure{A picture of a cow. Image of a cow that may or may not
> be under copyright anymore.}{\externalfigure[cow][height=6cm]}
>
> then the copyright bit will appear in the Table of Figures which I don't
> really want to happen. Is there a way to truncate this?
>
>
> Option 2: some magazines print the copyright credit running up the side of
> the image, independently of the caption. I'd quite like to do this and
> wondered if anyone had already written something they could share?
>
> —
> Bruce Horrocks
> Hampshire, UK
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> 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
___


[NTG-context] Crediting copyright on photographs

2022-05-04 Thread Bruce Horrocks via ntg-context
I need to include the copyright acknowledgement / photographer credit on an 
image but I'm not sure what's the best way to do it.

Option 1: I can add the acknowledgement to the end of the \placefigure caption 
text:

e.g.   \placefigure{A picture of a cow. Image of a cow that may or may not be 
under copyright anymore.}{\externalfigure[cow][height=6cm]}

then the copyright bit will appear in the Table of Figures which I don't really 
want to happen. Is there a way to truncate this?


Option 2: some magazines print the copyright credit running up the side of the 
image, independently of the caption. I'd quite like to do this and wondered if 
anyone had already written something they could share?

—
Bruce Horrocks
Hampshire, UK

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

maillist : ntg-context@ntg.nl / 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] recursion in a table

2022-05-01 Thread Aditya Mahajan via ntg-context
On Sun, 1 May 2022, Henning Hraban Ramm via ntg-context wrote:

> Hi,
> I was playing with the example from 
> https://wiki.contextgarden.net/Scaling_Rotating_Mirroring_Clipping#Location_parameter
>  
> and tried to put it in a tabulate:
> 
> 
> \useMPlibrary[dum]
> \setupexternalfigures[width=3em,height=2em,frame=on,]
> 
> %\def\TXT{\ruledhbox{\bf(XyX)}}
> \def\TXT{\externalfigure[pic]}
> 
> \starttabulate[|l|l|l|l|l|l|]
>  \NC\NC normal\NC depth\NC fit\NC broad\NC high\NC\NR
>  \HL
> \dostepwiserecurse{0}{359}{45}{%
> %\expanded{\setuprotate[rotation=\recurselevel]}
>  \NC{\expanded{\recurselevel}˚}%

Untested, but I think that you might need:

\expanded{\NC \recurselevel \noexpand\NC ... }

> This works, but \recurselevel is always 0. I know I must expand it (like 
> in the original example), but I can’t make it work within the tabulation.
> In the first column, \expanded{\recurselevel} stays 0, and 
> rotation=\expanded{\recurselevel} gives an error, while the \setuprotate 
> line has no effect (if I remove "rotation=\recurselevel", of course).
> 
> How would that work?

Remind me of a more-than-a-decade-old discussion on the mailing list, 
summarized here:

https://adityam.github.io/context-blog/post/tex-programming/

> Also, \HL doesn’t work at the end, and the second line of the error 
> message makes no sense:

I find that in such cases, using Lua (CLD) is the simplest solution

Aditya___
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] recursion in a table

2022-05-01 Thread Henning Hraban Ramm via ntg-context

Hi,
I was playing with the example from 
https://wiki.contextgarden.net/Scaling_Rotating_Mirroring_Clipping#Location_parameter 
and tried to put it in a tabulate:



\useMPlibrary[dum]
\setupexternalfigures[width=3em,height=2em,frame=on,]

%\def\TXT{\ruledhbox{\bf(XyX)}}
\def\TXT{\externalfigure[pic]}

\starttabulate[|l|l|l|l|l|l|]
\NC\NC normal\NC depth\NC fit\NC broad\NC high\NC\NR
\HL
\dostepwiserecurse{0}{359}{45}{%
%\expanded{\setuprotate[rotation=\recurselevel]}
\NC{\expanded{\recurselevel}˚}%

\NC{\ruledhbox{X\rotate[location=normal,rotation=\recurselevel]{\TXT}X}}%
\NC{\ruledhbox{X\rotate[location=depth,rotation=\recurselevel] 
{\TXT}X}}%
\NC{\ruledhbox{X\rotate[location=fit,rotation=\recurselevel] 
{\TXT}X}}%
\NC{\ruledhbox{X\rotate[location=broad,rotation=\recurselevel] 
{\TXT}X}}%
\NC{\ruledhbox{X\rotate[location=high,rotation=\recurselevel] 
{\TXT}X}}%

  \NC\NR}
%\HL % error
\stoptabulate


This works, but \recurselevel is always 0. I know I must expand it (like 
in the original example), but I can’t make it work within the tabulation.
In the first column, \expanded{\recurselevel} stays 0, and 
rotation=\expanded{\recurselevel} gives an error, while the \setuprotate 
line has no effect (if I remove "rotation=\recurselevel", of course).


How would that work?

Also, \HL doesn’t work at the end, and the second line of the error 
message makes no sense:

"""
I expect to see \noalign only after the \cr of an alignment.
Proceed, and I'll ignore this case.
mtx-context | fatal error: return code: 1
"""

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] Centering figures that extend into the margin

2022-04-20 Thread Willi Egger via ntg-context
Hi Yann,

I have not a solution for you  but I would like to point you to the “details” 
manual, where many of special placements of floats are discussed.

Kind regards

Willi

> On 20 Apr 2022, at 11:39, yann--- via ntg-context  wrote:
> 
> Hi,
> 
> I've been playing around with 'marginnote' layout similar to tufte's books.  
> The
> main thing that I can't figure out is how to centre figures that extend into 
> the
> margin.  These should take over the whole page, but the content of the figure
> should be centred, which is normally the case in normal figures.
> 
> Below is my try of defining a marginnote that does this, by calculating the
> textarea size and setting the width to that.  However, I can't seem to then
> figure out how to center the externalfigure inside of the figure.
> 
> Thanks in advance!
> Yann
> 
> \useMPlibrary[dum]
> 
> \setuplayout[
> edgedistance=1cm,
> backspace=2cm,
> rightmargin=4.5cm,
> leftmargin=0cm,
> topspace=1cm,
> header=1cm,
> footer=1cm,
> headerdistance=0.5cm,
> width=fit,
> height=fit,
> ]
> 
> \newdimen\LeftMarginSize
> \LeftMarginSize=\dimexpr \backspace + \rightmarginwidth + 
> \rightmargindistance \relax
> \newdimen\TextAreaSize
> \TextAreaSize=\dimexpr \textwidth + \rightmarginwidth + \rightmargindistance 
> \relax
> \definefloat[marginfigure][marginfigures][figure]
> \setupfloat[marginfigure][location=inner,default=top,width=\TextAreaSize]
> \setupcaptions[marginfigure][
> leftmargin=\dimexpr \LeftMarginSize / 2 \relax,
> location=bottom,
> width=\textwidth,
> ]
> \setuplabeltext[marginfigure=Figure~]
> \showframe
> 
> \starttext
> 
> \startplacemarginfigure
> \externalfigure[][width=13cm]
> \stopplacemarginfigure
> 
> \stoptext
> 
> -- 
> Yann Herklotz
> https://yannherklotz.com
> ___
> 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
___


[NTG-context] Centering figures that extend into the margin

2022-04-20 Thread yann--- via ntg-context
Hi,

I've been playing around with 'marginnote' layout similar to tufte's books.  The
main thing that I can't figure out is how to centre figures that extend into the
margin.  These should take over the whole page, but the content of the figure
should be centred, which is normally the case in normal figures.

Below is my try of defining a marginnote that does this, by calculating the
textarea size and setting the width to that.  However, I can't seem to then
figure out how to center the externalfigure inside of the figure.

Thanks in advance!
Yann

\useMPlibrary[dum]

\setuplayout[
  edgedistance=1cm,
  backspace=2cm,
  rightmargin=4.5cm,
  leftmargin=0cm,
  topspace=1cm,
  header=1cm,
  footer=1cm,
  headerdistance=0.5cm,
  width=fit,
  height=fit,
]

\newdimen\LeftMarginSize
\LeftMarginSize=\dimexpr \backspace + \rightmarginwidth + \rightmargindistance 
\relax
\newdimen\TextAreaSize
\TextAreaSize=\dimexpr \textwidth + \rightmarginwidth + \rightmargindistance 
\relax
\definefloat[marginfigure][marginfigures][figure]
\setupfloat[marginfigure][location=inner,default=top,width=\TextAreaSize]
\setupcaptions[marginfigure][
  leftmargin=\dimexpr \LeftMarginSize / 2 \relax,
  location=bottom,
  width=\textwidth,
]
\setuplabeltext[marginfigure=Figure~]
\showframe

\starttext

\startplacemarginfigure
\externalfigure[][width=13cm]
\stopplacemarginfigure

\stoptext

-- 
Yann Herklotz
https://yannherklotz.com
___
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] new upload

2022-04-19 Thread Hans Hagen via ntg-context

Hi,

I uploaded a new lmtx. Some more adaptive magic ... I'm not sure how 
usefull it is but users always find ways to apply such things. I 
attached a test file.


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
-\starttext

\setupexternalfigures
  [location={default,global}]

\startMPdefinitions
def TickTock =
interim linecap := squared;
save p ; path p ; p := fullsquare 
xysized(AdaptiveWidth,.9(AdaptiveHeight+AdaptiveDepth)) ;
fill p withcolor AdaptiveColor ;
draw bottomboundary (p enlarged (-AdaptiveThickness) )
withdashes (3*AdaptiveThickness)
withpen pencircle scaled AdaptiveThickness
withcolor white ;
enddef ;
\stopMPdefinitions

\startsetups adaptive:test
\setbox\usedadaptivebox\hbox to \usedadaptivewidth yoffset 
-.9\usedadaptivedepth \bgroup
\hss
\startMPcode
TickTock ;
\stopMPcode
\hss
   \egroup
\stopsetups

\definecolor[adaptive:tick][.25(blue,green)]
\definecolor[adaptive:tock][.75(blue,green)]

\defineadaptive
  [tick]
  [setups=adaptive:test,
   color=adaptive:tick,
   foregroundcolor=white,
   foregroundstyle=\infofont,
   strut=yes]

\defineadaptive
  [tock]
  [tick]
  [color=adaptive:tock]

\dorecurse{5}{
\dostepwiserecurse{1}{150}{1}{%
this~#1.##1 is~#1.##1 test~#1.##1
\ifodd##1\relax
\adaptivebox[tick]{\hss tick #1.##1\hss}
\else
\adaptivebox[tock]{\hss tock #1.##1\hss}
\fi
}
\blank
}

\startsetups adaptive:test
\setbox\usedadaptivebox\hbox to \usedadaptivewidth yoffset 
-\usedadaptivedepth \bgroup
\externalfigure
  [cow.pdf]
  [width=\usedadaptivewidth,
   height=\dimexpr\usedadaptiveheight+\usedadaptivedepth\relax]%
   \egroup
\stopsetups

\dorecurse{5}{
\dostepwiserecurse{1}{150}{1}{%
this~#1.##1 is~#1.##1 test~#1.##1
{\adaptivebox[strut=yes,setups=adaptive:test]{}}
}
\blank
}

\page

\startsetups adaptive:test
\setbox\usedadaptivebox\vbox to \usedadaptivetotal \bgroup
\externalfigure
  [cow.pdf]
  [width=\usedadaptivewidth,
   height=\usedadaptivetotal]%
   \egroup
\stopsetups

\ruledvbox to \textheight {
\par \begstrut \samplefile{tufte} \endstrut \par
\adaptivevbox[strut=yes,setups=adaptive:test]{\hsize\textwidth\hss}
\par \begstrut \samplefile{tufte} \endstrut
}

\page

\startsetups adaptive:test:a
\setbox\usedadaptivebox\vbox to \usedadaptivetotal \bgroup
\externalfigure
  [cow.pdf]
  [width=\framedmaxwidth,
   frame=on,
   height=\usedadaptivetotal]%
   \egroup
\stopsetups

\startsetups adaptive:test:b
\setbox\usedadaptivebox\vbox to \usedadaptivetotal \bgroup
\externalfigure
  [cow.pdf]
  [width=\usedadaptivewidth,
   frame=on,
   height=\usedadaptivetotal]%
   \egroup
\stopsetups

\showframe

\framed[height=18cm,align=middle,adaptive=yes,top=,bottom=] {%
\begstrut \samplefile{tufte} \endstrut
\par
\adaptivevbox
  [strut=yes,setups=adaptive:test:a]
  {\showstruts\strut\hsize5cm\hss}%
\par
\adaptivevbox
  [strut=yes,setups=adaptive:test:b]
  {\showstruts\strut\hsize5cm\hss}%
\par
\begstrut \samplefile{tufte} \endstrut
}

\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] placing (on) layers

2022-04-16 Thread Pablo Rodriguez via ntg-context
On 4/15/22 21:51, Henning Hraban Ramm via ntg-context wrote:
> Hi again,
>
> I’m always struggling with putting stuff on layers, since these just
> never start where I’d expect them to, and the offsets changed a few
> times within the last years.
>
> Please explain how I should define a layer that covers the whole page,
> since the following MWE is wrong (the layer always starts below the
> first line):

Hi Hraban,

slightly modifying your MWE, I think I get what might fit your needs
(see below).

I never used \flushlayer and your sample shows that it doesn’t fit here.

The layer is relative to the page, not to the paper in this case.

And the state is an option for the layer (in \definelayer), not for the
background, being "start" its default value.

Just in case it might help,

Pablo

  \setupexternalfigures
 [location={default,global}]

  \setuppapersize[A5][A4]
  \setuplayout[
 marking=on,
 location=middle,
  ]
  \definemeasure[Bleed][3mm]
  \definemeasure[MaxHeight]
  [{\dimexpr\paperheight + 2\measure{Bleed}\relax}]
  \definemeasure[MaxWidth]
  [{\dimexpr\paperwidth + 2\measure{Bleed}\relax}]

  \definelayer[papier][
 preset=lefttop,
 %x=0mm,y=0mm,
 width=\paperwidth,
 height=\paperheight,
  ]
  \setupbackgrounds[page][background=papier]

  \starttext
  \showframe
  TEST

  \setlayerframed[papier][
 preset=lefttop,
 %x=-\measure{Bleed},
 %y=-\measure{Bleed},
 offset=overlay,
 %frame=off,
 width=\measure{MaxWidth},
 height=\measure{MaxHeight},
  ]{\externalfigure[cow][
 width=\measure{MaxWidth},height=\measure{MaxHeight}
  ]}

  \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] placing (on) layers

2022-04-16 Thread Henning Hraban Ramm via ntg-context

Hi Willi,

thank you, I wasn’t aware that \flushlayer works this way. This was also 
the problem in my real project.


And I had the wrong layer mentioned in \setupbackgrounds from another test.
Also, cropoffset was interfering in the real project, see my other mail.

Hraban

Am 16.04.22 um 22:27 schrieb Willi Egger via ntg-context:

Hi Hraban,

if you flush a layer like in your example, then the layer is attached to the 
left top of the text area. If you want to place it in another place, you will 
have to move it by x and y dimensions to the right place in the first brackets 
of the \setlayerframed command . — What would be possible is to attach the 
layer as a background to one of the different areas of the  paper.

I hope this gives you a hint how to proceed..

Willi


On 15 Apr 2022, at 21:51, Henning Hraban Ramm via ntg-context 
 wrote:

Hi again,

I’m always struggling with putting stuff on layers, since these just never 
start where I’d expect them to, and the offsets changed a few times within the 
last years.

Please explain how I should define a layer that covers the whole page, since 
the following MWE is wrong (the layer always starts below the first line):


\useMPlibrary[dum]

\setuppapersize[A5][A4]
\setuplayout[
  marking=on,
  location=middle,
]
\definemeasure[Bleed][3mm]
\definemeasure[MaxHeight][{\dimexpr\paperheight + 2\measure{Bleed}\relax}]
\definemeasure[MaxWidth][{\dimexpr\paperwidth + 2\measure{Bleed}\relax}]

\definelayer[papier][
  preset=lefttop,
  %x=0mm,y=0mm,
  width=\paperwidth,
  height=\paperheight,
]
\setupbackgrounds[paper][background=cover,state=start]


\starttext
\showframe
TEST

\setlayerframed[papier][
  preset=lefttop,
  %x=-\measure{Bleed},
  %y=-\measure{Bleed},
  offset=overlay,
  %frame=off,
  width=\measure{MaxWidth},
  height=\measure{MaxHeight},
]{\externalfigure[dummy][
  width=\measure{MaxWidth},height=\measure{MaxHeight}
]}

\flushlayer[papier]

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


___
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] placing (on) layers

2022-04-16 Thread Willi Egger via ntg-context
Hi Hraban,

if you flush a layer like in your example, then the layer is attached to the 
left top of the text area. If you want to place it in another place, you will 
have to move it by x and y dimensions to the right place in the first brackets 
of the \setlayerframed command . — What would be possible is to attach the 
layer as a background to one of the different areas of the  paper.

I hope this gives you a hint how to proceed..

Willi

> On 15 Apr 2022, at 21:51, Henning Hraban Ramm via ntg-context 
>  wrote:
> 
> Hi again,
> 
> I’m always struggling with putting stuff on layers, since these just never 
> start where I’d expect them to, and the offsets changed a few times within 
> the last years.
> 
> Please explain how I should define a layer that covers the whole page, since 
> the following MWE is wrong (the layer always starts below the first line):
> 
> 
> \useMPlibrary[dum]
> 
> \setuppapersize[A5][A4]
> \setuplayout[
>  marking=on,
>  location=middle,
> ]
> \definemeasure[Bleed][3mm]
> \definemeasure[MaxHeight][{\dimexpr\paperheight + 2\measure{Bleed}\relax}]
> \definemeasure[MaxWidth][{\dimexpr\paperwidth + 2\measure{Bleed}\relax}]
> 
> \definelayer[papier][
>  preset=lefttop,
>  %x=0mm,y=0mm,
>  width=\paperwidth,
>  height=\paperheight,
> ]
> \setupbackgrounds[paper][background=cover,state=start]
> 
> 
> \starttext
> \showframe
> TEST
> 
> \setlayerframed[papier][
>  preset=lefttop,
>  %x=-\measure{Bleed},
>  %y=-\measure{Bleed},
>  offset=overlay,
>  %frame=off,
>  width=\measure{MaxWidth},
>  height=\measure{MaxHeight},
> ]{\externalfigure[dummy][
>  width=\measure{MaxWidth},height=\measure{MaxHeight}
> ]}
> 
> \flushlayer[papier]
> 
> \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
> ___

___
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] placing (on) layers

2022-04-15 Thread Henning Hraban Ramm via ntg-context

Hi again,

I’m always struggling with putting stuff on layers, since these just 
never start where I’d expect them to, and the offsets changed a few 
times within the last years.


Please explain how I should define a layer that covers the whole page, 
since the following MWE is wrong (the layer always starts below the 
first line):



\useMPlibrary[dum]

\setuppapersize[A5][A4]
\setuplayout[
  marking=on,
  location=middle,
]
\definemeasure[Bleed][3mm]
\definemeasure[MaxHeight][{\dimexpr\paperheight + 2\measure{Bleed}\relax}]
\definemeasure[MaxWidth][{\dimexpr\paperwidth + 2\measure{Bleed}\relax}]

\definelayer[papier][
  preset=lefttop,
  %x=0mm,y=0mm,
  width=\paperwidth,
  height=\paperheight,
]
\setupbackgrounds[paper][background=cover,state=start]


\starttext
\showframe
TEST

\setlayerframed[papier][
  preset=lefttop,
  %x=-\measure{Bleed},
  %y=-\measure{Bleed},
  offset=overlay,
  %frame=off,
  width=\measure{MaxWidth},
  height=\measure{MaxHeight},
]{\externalfigure[dummy][
  width=\measure{MaxWidth},height=\measure{MaxHeight}
]}

\flushlayer[papier]

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


[NTG-context] new upload

2022-04-15 Thread Hans Hagen via ntg-context

Hi,

I uploaded a new lmtx. Apart from a experimental intersection feature in 
the mp library (and metafun, more will be revealed when MS an I are okay 
with it) there is not that much news.


I decided to turn some test code into a mechanism which is illustrated 
below. Adaptive boxes are hboxes that act a bit like glue which means 
that when we hook in e.g. a graphic it can be made to adapt.


We can add some more methods if needed so maybe you see other usage. The 
interface is rather lightweight and the overhead is quite resonable.


Hans


===

\starttext

\startMPdefinitions
def TickTock =
interim linecap := squared;
save p ; path p ; p := fullsquare 
xysized(AdaptiveWidth,.9(AdaptiveHeight+AdaptiveDepth)) ;

fill p withcolor AdaptiveColor ;
draw bottomboundary (p enlarged (-AdaptiveThickness) )
withdashes (3*AdaptiveThickness)
withpen pencircle scaled AdaptiveThickness
withcolor white ;
enddef ;
\stopMPdefinitions

\startsetups adaptive:test
\setbox\usedadaptivebox\hbox to \usedadaptivewidth yoffset 
-.9\usedadaptivedepth \bgroup

\hss
\startMPcode
TickTock ;
\stopMPcode
\hss
   \egroup
\stopsetups

\definecolor[adaptive:tick][.25(blue,green)]
\definecolor[adaptive:tock][.75(blue,green)]

\defineadaptive
  [tick]
  [setups=adaptive:test,
   color=adaptive:tick,
   foregroundcolor=white,
   foregroundstyle=\infofont,
   strut=yes]

\defineadaptive
  [tock]
  [tick]
  [color=adaptive:tock]

% with postprocessing

\dorecurse{5}{
\dostepwiserecurse{1}{150}{1}{%
this~#1.##1 is~#1.##1 test~#1.##1
\ifodd##1\relax
\adaptivebox[tick]{\hss tick #1.##1\hss}
\else
\adaptivebox[tock]{\hss tock #1.##1\hss}
\fi
}
\blank
}

\page

% without postprocessing

\dorecurse{5}{
\dostepwiserecurse{1}{150}{1}{%
this~#1.##1 is~#1.##1 test~#1.##1
{\showboxes\adaptivebox[strut=yes,foregroundcolor=darkred]{\hss 
test #1.##1\hss}}

}
\blank
}

\page

% with images

% a weird one

\setupexternalfigures
  [location={default,global}]

\startsetups adaptive:test
\setbox\usedadaptivebox\hbox to \usedadaptivewidth yoffset 
-\usedadaptivedepth \bgroup

\externalfigure
  [cow.pdf]
  [width=\usedadaptivewidth,
   height=\dimexpr\usedadaptiveheight+\usedadaptivedepth\relax]%
   \egroup
\stopsetups

\dorecurse{5}{
\dostepwiserecurse{1}{150}{1}{%
this~#1.##1 is~#1.##1 test~#1.##1
{\adaptivebox[strut=yes,setups=adaptive:test]{}}
}
\blank
}

\stoptext

It actually uses an already present for a while low level engine feature 
that we introduced as part of the math processing update:


\dorecurse
  {1000}
  {test \uleaders\ruledhbox{\hss#1\hss}\hskip2em minus 1em\ }


Next on the todo is to move some experimental graphic trickery related 
to math (matrices) into the core but the interfacing needs some thought.


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] Full-page Figure?

2022-03-30 Thread śrīrāma via ntg-context
On Tuesday, March 29, 2022 4:18 AM Michael Urban via ntg-context wrote:
> Is there a simple way to accomplish this?

Aside from the other solution using makeup, a simpler way might be to just use 
the 'page' option for positioning the float. The following MWE achieves the 
same result as that with the makeup:

  \setuppagenumbering[alternative=doublesided]
  \setupexternalfigures[location=default]

  \setupheadertexts[]
  \setupheadertexts[chapter][\date]
  \setupfootertexts[pagenumber]

  \starttext
  \startchapter [title={Chapter title}]
  \dorecurse{2}{\samplefile{knuth}}
  \placefigure[page]{a floating cow}{\externalfigure[cow]} 
  \dorecurse{4}{\samplefile{knuth}}
  \blank

  \dorecurse{2}{\samplefile{tufte}}
  \stopchapter
  \stoptext

  Sreeram


___
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] Full-page Figure?

2022-03-30 Thread Michael Urban via ntg-context
Almost there.  But if I add \setuppagenumbering  [alternative=doublesided]
to the example, there is a blank page before the makeup page, and an unnumbered 
blank page after.  If I add doublesided=no to the
\setupmakeup options, the unnumbered blank page is not there, but there is 
still a blank page before.  It is seemingly forcing
a right-hand page for some reason I do not understand.

Mike


> On Mar 28, 2022, at 6:37 PM, śrīrāma via ntg-context  
> wrote:
> 
> On Tuesday, March 29, 2022 4:18 AM Michael Urban via ntg-context wrote:
>> Is there a simple way to accomplish this?
> 
> I suppose you need 'postponing'. See
>  https://wiki.contextgarden.net/Command/startpostponing
> [One can specify a page explicitly, or, more conveniently, an offset]
> 
> First, we define a makeup and enable header, footer and page for it. Then we 
> can put the float inside the makeup and wrap it with 
> \start...\stoppostponing. Here is a MWE:
> 
> %%% start example
>  \setupexternalfigures[location=default]
>  \definemakeup
>[FloatPage]
>  \setupmakeup
>[FloatPage]
>[headerstate=normal,
>   pagestate=start,
>   align=middle,
> footerstate=normal]
> 
>  \setupheadertexts[]
>  \setupheadertexts[chapter][\date]
>  \setupfootertexts[pagenumber]
> 
>  \starttext
>  \startchapter [title={Chapter title}]
>\startpostponing[+1]
>  \startFloatPagemakeup
>  \placefigure{a floating cow}{\externalfigure[cow]}
>  \stopFloatPagemakeup
>\stoppostponing
>  \dorecurse{6}{\samplefile{knuth}}
>  \blank
> 
>  \dorecurse{2}{\samplefile{tufte}}
>  \stopchapter
>  \stoptext
> %%% stop example
> 
> Of course, I think some manual hand-tuning is required (in the final stages 
> of the document) in deciding the right place to put the postponing block and 
> in deciding what offset is best.
> 
> Sreeram
> 
> 
> ___
> 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] Full-page Figure?

2022-03-28 Thread śrīrāma via ntg-context
On Tuesday, March 29, 2022 4:18 AM Michael Urban via ntg-context wrote:
> Is there a simple way to accomplish this?

I suppose you need 'postponing'. See
  https://wiki.contextgarden.net/Command/startpostponing
[One can specify a page explicitly, or, more conveniently, an offset]

First, we define a makeup and enable header, footer and page for it. Then we 
can put the float inside the makeup and wrap it with \start...\stoppostponing. 
Here is a MWE:

%%% start example
  \setupexternalfigures[location=default]
  \definemakeup
[FloatPage]
  \setupmakeup
[FloatPage]
[headerstate=normal,
   pagestate=start,
   align=middle,
 footerstate=normal]

  \setupheadertexts[]
  \setupheadertexts[chapter][\date]
  \setupfootertexts[pagenumber]

  \starttext
  \startchapter [title={Chapter title}]
\startpostponing[+1]
  \startFloatPagemakeup
  \placefigure{a floating cow}{\externalfigure[cow]}
  \stopFloatPagemakeup
\stoppostponing
  \dorecurse{6}{\samplefile{knuth}}
  \blank

  \dorecurse{2}{\samplefile{tufte}}
  \stopchapter
  \stoptext
%%% stop example

Of course, I think some manual hand-tuning is required (in the final stages of 
the document) in deciding the right place to put the postponing block and in 
deciding what offset is best.

Sreeram


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


<    1   2   3   4   5   6   7   8   9   10   >