Re: [NTG-context] Axis macro in MetaFun

2021-09-11 Thread kauśika cittūr via ntg-context
On Saturday, September 11, 2021 10:30:25 PM IST Hans Hagen wrote:
> On 9/11/2021 4:27 PM, kauśika cittūr via ntg-context wrote:
> > Dear All,
> > 
> > I am truly grateful for the new additions to MetaFun. It has greatly
> > helped me in producing neat drawings for my academic work. In this
> > connection, I have a few queries.
> > 
> > Currently I am using PGFPlots (with ConTeXt) to draw simple plots from CSV
> > data. I was wondering if there is any way to do the same in MetaFuns. That
> > is, is it possible to do something like the following in order to obtain
> > a line plot of the values in the 'data.csv' file? Also is it possible to
> > have the 'labels' be the identical for all points in a given list?
> > 
> > \startMPcode
> > 
> >draw lmt_axis [
> >
> >sx = 2mm, sy = 2mm,
> >nx = 80, ny = 40,
> >tx = 15, ty = 15,
> >
> >list = {
> >
> >  [
> >  
> >connect = true,
> >color = "darkblue",
> >close = true,
> >points = {data.csv},
> >labels = {"•"},
> >  
> >  ]
> >
> >},
> >
> >] withpen pencircle scaled 0.5mm;
> > 
> > \stopMPcode
> 
> It depends on how one has data in the csv, You can patch mlib-scn.lmt
> (line 659)
> 
>  if type(v) == "table" then
>  return injectpath(v,connector,close)
>  elseif type(v) == "string" then
>  local code = load("return " .. v)
>  if code then
>  return code()
>  end
>  else
>  return injectpair(0,0)
>  end
> 
> then a string represents a function:
> 
> \starttext
> 
> \startluacode
>  io.savedata("temp.csv", "x,y\n10,10\n20,40\n30,30\n")
> 
>  local mycsvsplitter = utilities.parsers.rfc4180splitter()
> 
>  function MP.MyPoints(name)
>  local data = io.loaddata(name)
>  local list = mycsvsplitter(data)
>  table.remove(list,1)
>  for i=1,#list do
>  list[i][1] = tonumber(list[i][1])
>  list[i][2] = tonumber(list[i][2])
>  end
>  mp.inject.path(list)
>  end
> 
> \stopluacode
> 
> \startMPcode
>draw lmt_axis [
>sx = 2mm, sy = 2mm,
>nx = 80, ny = 40,
>tx = 15, ty = 15,
> 
>list = {
>  [
>connect = true,
>color = "darkblue",
>close = true,
>points = "MP.MyPoints('temp.csv')",
>labels = {"•"},
>  ]
>},
>] withpen pencircle scaled 0.5mm;
> \stopMPcode
> 
> \stoptext
> 
> we can of course have some predefined and when we can agree on how these
> files loo, adding a "csv" is no big deal ... it's all about consistent
> interfacing
> 
> 
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -

Dear Hans,

Many thanks for your detailed guidance. I think for now this patch should 
suffice for my simple needs.

Best,
kauśika


___
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] Weird error when using \startformula inside lua

2021-09-11 Thread Aditya Mahajan via ntg-context
On Sat, 11 Sep 2021, Hans Hagen wrote:

> On 9/11/2021 5:11 AM, Aditya Mahajan via ntg-context wrote:
> > I sometimes define lua functions for showing out worked out calculations.
> > The following minimal example shows that
> > 
> >context([[\startformula ... \stopformula]])
> > 
> > fails in LMTX with an error message:
> > 
> > tex error   > tex error on line 3 in file ./test.tex: Undefined control
> > sequence \undefined
> > 
> > MWE:
> > 
> > \startluacode
> >thirddata = thirddata or {}
> > 
> >local comment = [[
> >  This is a famous formula
> >  \startformula
> >a^2 + b^2 = c^2
> >  \stopformula
> >]]
> > 
> >function thirddata.explanation()
> >context(comment)
> >end
> > 
> > \stopluacode
> > 
> > \starttext
> > \ctxlua{thirddata.explanation()}
> > \stoptext
> > 
> > The actual use case is more complicated (where I use templates, so I don't
> > want to convert everything to context.startformula() etc.). The example
> > compiles with MkIV but not LMTX.
> > 
> > Any idea what is going on?
> \enabletrackers[context*]
> 
> shows that we have an unprotected \startformula so we need this in
> strc-mat.mkxl:
> 
> \permanent\protected\defcsname\e!start\v!formula\endcsname{\strc_formulas_start_formula{}}
> \permanent\protected\defcsname\e!stop
> \v!formula\endcsname{\strc_formulas_stop_formula}
> 
> \permanent\tolerant\protected\def\defineformulaalternative[#1]#*[#2]#*[#3]%
>   {\frozen\instance\protected\defcsname\e!start#1\v!formula\endcsname{#2}%
>\frozen\instance\protected\defcsname\e!stop #1\v!formula\endcsname{#3}}
> 
> (the \protected probably got lost when i added overload protection etc)

Thanks! This fixes the error in my main document as well.

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
___


Re: [NTG-context] ConTeXt inserts additional dots for Iosevka font

2021-09-11 Thread Marcel Fabian Krüger via ntg-context
Hi,

On Sun, Sep 12, 2021 at 12:01:08AM +0200, Hans Hagen wrote:
> >  \definefontfeature
> >[default:test]
> >[default]
> >[cv36=2,cv26=6]
> 
> What is the number supposed to indicate ? It is not an alternate, right?

Actually it is an alternate, but only partially.

> 
> >  \definefont
> >[SomeFont]
> >[name:iosevka*default:test]
> >  \starttext
> >  \SomeFont
> >  I live in a dot-heavy world.
> >  \stoptext
> > 
> > has six dots instead of one dot over each "i". Tests with multiple other
> > font shapers and inspection of the font file confirmed that this is not
> > intentional behavior.
> > 
> > Could you take a look at that?
> > (Based on a luotfload bug report at
> > https://github.com/latex3/luaotfload/issues/202)
> when a number is specified for a multiple and the is > 1 we repeat the last
> glyph ... this is a 'secret' feature that (already a while ago) we added
> when discussing / testing a experimental arabic font in combination with a
> paragraph optimizer ... normally users will say 'yes' and not give a number

Thanks, this explains a lot. In this font it's problematic though
because the cv.. features have multiple loopup tables, one of which is a
"multiple" lookup (used to decompose characters before applying the
replacements, especially decomposing i into the stem and the dot)
and another one is an "alternate" lookup providing multiple character
variants.
So selecting one of the other alternates requires that a number is
passed, but passing the number enables the repetition in the multiple
lookup...

> 
> i can make that a 'context only' feature if needed

That would certainly solve the issue for me, but it might be nice to
provide a solution for context users too. Maybe the feature could be
adapted to only interpret the argument as a replication factor if the
"multiple" is the only lookup for the feature or if no other lookup
for the feature is an alternate lookup?

Best,
Marcel
___
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] ConTeXt inserts additional dots for Iosevka font

2021-09-11 Thread Hans Hagen via ntg-context

On 9/11/2021 10:36 PM, Marcel Fabian Krüger via ntg-context wrote:

Hi,

ConTeXt has some issues with the character variant features of the
Iosevka font available at
https://github.com/be5invis/Iosevka/releases/download/v10.1.1/super-ttc-iosevka-10.1.1.zip

E.g. the following document

 \definefontfeature
   [default:test]
   [default]
   [cv36=2,cv26=6]


What is the number supposed to indicate ? It is not an alternate, right?


 \definefont
   [SomeFont]
   [name:iosevka*default:test]
 \starttext
 \SomeFont
 I live in a dot-heavy world.
 \stoptext

has six dots instead of one dot over each "i". Tests with multiple other
font shapers and inspection of the font file confirmed that this is not
intentional behavior.

Could you take a look at that?
(Based on a luotfload bug report at
https://github.com/latex3/luaotfload/issues/202)
when a number is specified for a multiple and the is > 1 we repeat the 
last glyph ... this is a 'secret' feature that (already a while ago) we 
added when discussing / testing a experimental arabic font in 
combination with a paragraph optimizer ... normally users will say 'yes' 
and not give a number


i can make that a 'context only' feature if needed

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
___


[NTG-context] ConTeXt inserts additional dots for Iosevka font

2021-09-11 Thread Marcel Fabian Krüger via ntg-context
Hi,

ConTeXt has some issues with the character variant features of the
Iosevka font available at
https://github.com/be5invis/Iosevka/releases/download/v10.1.1/super-ttc-iosevka-10.1.1.zip

E.g. the following document

\definefontfeature
  [default:test]
  [default]
  [cv36=2,cv26=6]
\definefont
  [SomeFont]
  [name:iosevka*default:test]
\starttext
\SomeFont
I live in a dot-heavy world.
\stoptext

has six dots instead of one dot over each "i". Tests with multiple other
font shapers and inspection of the font file confirmed that this is not
intentional behavior.

Could you take a look at that?
(Based on a luotfload bug report at
https://github.com/latex3/luaotfload/issues/202)

Best regards,
Marcel
___
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] read PDF metadata from other file

2021-09-11 Thread Pablo Rodriguez via ntg-context
On 9/11/21 6:16 PM, Hans Hagen via ntg-context wrote:
> On 9/11/2021 2:35 PM, Pablo Rodriguez via ntg-context wrote:
>> [...]
>> How can I get the pure text value, so I can transfer metadata from one
>> PDF document into another PDF document?
> just use the better interface
> [...]
> after which you enter wiki mode

Mamy thanks for your reply, Hans.

I think this might be simpler for me:

  \starttext
  \startluacode
  function document.transfer_metadata(name)
  local main_doc = lpdf.epdf.load(name)
  lpdf.addtocatalog("Lang", lpdf.string(main_doc.Catalog.Lang))
  lpdf.addtoinfo("Title", lpdf.unicode(main_doc.Info.Title))
  lpdf.addtoinfo("Subject", lpdf.unicode(main_doc.Info.Subject))
  lpdf.addtoinfo("Author", lpdf.unicode(main_doc.Info.Author))
  lpdf.epdf.unload(name)
  end
  \stopluacode
  \unexpanded\def\TransferMetadata#1%
{\ctxlua{document.transfer_metadata("#1")}}
  \null
  \TransferMetadata{name.pdf}
  \stoptext

Added to
https://wiki.contextgarden.net/Interaction#Import_PDF_metadata_fields_from_other_PDF_documents.

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Image cropped

2021-09-11 Thread Wolfgang Schuster via ntg-context

Fabrice Couvreur via ntg-context schrieb am 11.09.2021 um 17:52:

Hi Wolfgang,
The red frame is the print area ?


The *green* frame are the margins of the A4 paper which is positioned in 
the middle of the A3 paper.


The larger paper allows you to the see the part of the margins which are 
outside of the printable area.


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] Axis macro in MetaFun

2021-09-11 Thread Hans Hagen via ntg-context

On 9/11/2021 4:27 PM, kauśika cittūr via ntg-context wrote:

Dear All,

I am truly grateful for the new additions to MetaFun. It has greatly helped me
in producing neat drawings for my academic work. In this connection, I have a
few queries.

Currently I am using PGFPlots (with ConTeXt) to draw simple plots from CSV
data. I was wondering if there is any way to do the same in MetaFuns. That is,
is it possible to do something like the following in order to obtain a line
plot of the values in the 'data.csv' file? Also is it possible to have the
'labels' be the identical for all points in a given list?

\startMPcode
   draw lmt_axis [
   sx = 2mm, sy = 2mm,
   nx = 80, ny = 40,
   tx = 15, ty = 15,
   
   list = {

 [
   connect = true,
   color = "darkblue",
   close = true,
   points = {data.csv},
   labels = {"•"},
 ]
   },
   ] withpen pencircle scaled 0.5mm;
\stopMPcode



It depends on how one has data in the csv, You can patch mlib-scn.lmt 
(line 659)


if type(v) == "table" then
return injectpath(v,connector,close)
elseif type(v) == "string" then
local code = load("return " .. v)
if code then
return code()
end
else
return injectpair(0,0)
end

then a string represents a function:

\starttext

\startluacode
io.savedata("temp.csv", "x,y\n10,10\n20,40\n30,30\n")

local mycsvsplitter = utilities.parsers.rfc4180splitter()

function MP.MyPoints(name)
local data = io.loaddata(name)
local list = mycsvsplitter(data)
table.remove(list,1)
for i=1,#list do
list[i][1] = tonumber(list[i][1])
list[i][2] = tonumber(list[i][2])
end
mp.inject.path(list)
end

\stopluacode

\startMPcode
  draw lmt_axis [
  sx = 2mm, sy = 2mm,
  nx = 80, ny = 40,
  tx = 15, ty = 15,

  list = {
[
  connect = true,
  color = "darkblue",
  close = true,
  points = "MP.MyPoints('temp.csv')",
  labels = {"•"},
]
  },
  ] withpen pencircle scaled 0.5mm;
\stopMPcode

\stoptext

we can of course have some predefined and when we can agree on how these 
files loo, adding a "csv" is no big deal ... it's all about consistent 
interfacing



-
  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] Axis macro in MetaFun

2021-09-11 Thread Hans Hagen via ntg-context

On 9/11/2021 4:27 PM, kauśika cittūr via ntg-context wrote:


My final query: is it possible to specify a co-ordinate transform for any/all
of the axes? For instance in my work, I would like to plot the y-axis in the
log-scale.
Alan is working on that when he is in distraction mode ... we have done 
some preparations already.


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] read PDF metadata from other file

2021-09-11 Thread Hans Hagen via ntg-context

On 9/11/2021 2:35 PM, Pablo Rodriguez via ntg-context wrote:

Dear list,

I have the following sample:

   \starttext
   \setupinteraction
 [state=start,
  title={\cldcontext{pdfe.open("b.pdf").Info.Title}}]
   \null
   \stoptext

 From a document composed with \insertpages, I need to transfer medatada.

But I get the raw value "feff0061" (which I guess it may be introduced
by lpdf.pdfunicode).

How can I get the pure text value, so I can transfer metadata from one
PDF document into another PDF document?

just use the better interface

\starttext

\startluacode
function document.whatever(name)
local p = lpdf.epdf.load(name)
context(p.Info.Title)
lpdf.epdf.unload(p)
end
\stopluacode

and/or use the converter (but still you need to close the file)

\setupinteraction
  [state=start,
 % title=\cldcontext{lpdf.fromsixteen(pdfe.open("b.pdf").Info.Title)},
   title={\ctxlua{document.whatever("b.pdf")}}]

 %\cldcontext{lpdf.fromsixteen(pdfe.open("b.pdf").Info.Title)}
  \ctxlua{document.whatever("b.pdf")}

\stoptext

after which you enter wiki mode

Hans

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

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


Re: [NTG-context] Image cropped

2021-09-11 Thread Fabrice Couvreur via ntg-context
Hi Wolfgang,
The red frame is the print area ?

Le sam. 11 sept. 2021 à 16:43, Wolfgang Schuster via ntg-context <
ntg-context@ntg.nl> a écrit :

> Fabrice Couvreur via ntg-context schrieb am 11.09.2021 um 16:32:
>
> Hello,
> I like to put a logo on my statements but I noticed that the image is
> cropped on the edge.
> I tried to change the printer's print settings but was unsuccessful.
>
>
> Add these settings to your example and you see the problem.
>
> \setuppapersize[A4][A3]
>
> \setuplayout[location=middle]
>
> \setuplayout[width=middle,height=middle]
>
> \setupfootertexts
>[margin]
>[]
>[{\offset[y=\strutdp]{\externalfigure[logo.pdf][factor=max]}}]
>[]
>[{\offset[y=\strutdp]{\externalfigure[logo.pdf][factor=max]}}]
>
> \showframe
>
> \starttext
> \dorecurse{8}{\input knuth}
> \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
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Image cropped

2021-09-11 Thread Wolfgang Schuster via ntg-context

Fabrice Couvreur via ntg-context schrieb am 11.09.2021 um 16:32:

Hello,
I like to put a logo on my statements but I noticed that the image is 
cropped on the edge.

I tried to change the printer's print settings but was unsuccessful.


Add these settings to your example and you see the problem.

\setuppapersize[A4][A3]

\setuplayout[location=middle]


\setuplayout[width=middle,height=middle]

\setupfootertexts
   [margin]
   []
 [{\offset[y=\strutdp]{\externalfigure[logo.pdf][factor=max]}}]
   []
 [{\offset[y=\strutdp]{\externalfigure[logo.pdf][factor=max]}}]

\showframe

\starttext
\dorecurse{8}{\input knuth}
\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] Image cropped

2021-09-11 Thread Fabrice Couvreur via ntg-context
Hello,
I like to put a logo on my statements but I noticed that the image is
cropped on the edge.
I tried to change the printer's print settings but was unsuccessful.
Thanks
Fabrice

\setuplayout[width=middle,height=middle]

\setupfootertexts
   [margin]
   []
   [{\offset[y=\strutdp]{\externalfigure[logo.pdf][factor=max]}}]
   []
   [{\offset[y=\strutdp]{\externalfigure[logo.pdf][factor=max]}}]

\showframe

\starttext
\dorecurse{8}{\input knuth}
\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] Axis macro in MetaFun

2021-09-11 Thread kauśika cittūr via ntg-context
Dear All,

I am truly grateful for the new additions to MetaFun. It has greatly helped me 
in producing neat drawings for my academic work. In this connection, I have a 
few queries.

Currently I am using PGFPlots (with ConTeXt) to draw simple plots from CSV 
data. I was wondering if there is any way to do the same in MetaFuns. That is, 
is it possible to do something like the following in order to obtain a line 
plot of the values in the 'data.csv' file? Also is it possible to have the 
'labels' be the identical for all points in a given list? 

\startMPcode
  draw lmt_axis [
  sx = 2mm, sy = 2mm,
  nx = 80, ny = 40,
  tx = 15, ty = 15, 
  
  list = {
[
  connect = true,
  color = "darkblue",
  close = true,
  points = {data.csv},
  labels = {"•"},
]
  },
  ] withpen pencircle scaled 0.5mm;
\stopMPcode

My final query: is it possible to specify a co-ordinate transform for any/all 
of the axes? For instance in my work, I would like to plot the y-axis in the 
log-scale.

Thanks,
kauśika


___
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] read PDF metadata from other file

2021-09-11 Thread Pablo Rodriguez via ntg-context
Dear list,

I have the following sample:

  \starttext
  \setupinteraction
[state=start,
 title={\cldcontext{pdfe.open("b.pdf").Info.Title}}]
  \null
  \stoptext

From a document composed with \insertpages, I need to transfer medatada.

But I get the raw value "feff0061" (which I guess it may be introduced
by lpdf.pdfunicode).

How can I get the pure text value, so I can transfer metadata from one
PDF document into another PDF document?

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___
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] LuaMetaTEX as LaTeX to XHTML/ePub transpiler?

2021-09-11 Thread Hans Hagen via ntg-context

On 9/11/2021 1:49 PM, Hugh Fisher via ntg-context wrote:


It may be unfair, but my impression is that TeX and typesetting / layout systems
based on TeX can do more interesting things than say XML or Sphinx. Moving
to a more "universal" markup format might broaden my options, but I don't
want a lowest common denominator solution.
As soon as documents become more complex and one wants control over th 
elayout all these alternative-to-tex formats in the end are not better 
than structured tex input. The simpler the input tagging, the more 
complex the escaping from that.  So in the end it all depends on what 
kind of documents one has to deal with. And it's all about abstraction 
and structure: the more, the easier.


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] LuaMetaTEX as LaTeX to XHTML/ePub transpiler?

2021-09-11 Thread Hans Hagen via ntg-context

On 9/11/2021 1:19 PM, Hugh Fisher wrote:

On Fri, 10 Sept 2021 at 21:47, Hans Hagen  wrote:



[ munch ]



in this area there is nothing in luametatex that luatex can't do


As in my earlier reply, I'm thinking about replacing Adobe Illustrator with
Metapost, and LuaMetaTEX seems to have better integration?


indeed the interfaces in lmtx/luametatex are better than in mkiv/luatex 
and new things will only be done in lmtx


anyway, context users most likely will move to lmtx (mkiv is not really 
frozen as it is also the test case for luatex, but there will be no 
fundamental new things added)



so, if your source uses a limited set of commands you can write a parser
(in any language)


This parser would need to understand TeX source files and conventions
such as % for comments, recognise commands starting with \ and with
arguments/parameters bracketed by [] and {}, and look up command names
that might be written in Lua, then call them.

Isn't that what LuaMetaTEX does? No, I haven't looked at the actual source
code yet, but starting with something that already does most of what you
want is always quicker than writing from scratch.

sure, any tex engine is better at parsing tex input

the main differences between luatex and luametatex (much is disucussed 
in articles and manuals) is that luametatex has no backend built in and 
has some better interfaces in the front end; there are extension to the 
subsystems of the tex engine (fonts, language, math, inserts, marks, 
alignments, conditionals, macro definition, par handling) that are not 
in luatex (which is basically frozen in order to permit other macro 
packages to support it); lua helpers have been cleaned up and there are 
some more; luametatex has a smaller binary, is more efficient wrt memory 
and has better performance (if used well) than luatex


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] LuaMetaTEX as LaTeX to XHTML/ePub transpiler?

2021-09-11 Thread Hugh Fisher via ntg-context
Collating several suggestions into one:

On Fri, 10 Sept 2021 at 21:26, Henning Hraban Ramm  wrote:
> Did you try pandoc?

On Fri, 10 Sept 2021 at 21:47, Hans Hagen  wrote:
> you can consider coding your documents in xml and convert them to latex
> and html .. neutral input so to say

On Sat, 11 Sept 2021 at 01:07, T. Kurt Bond  wrote:
> You might also consider hevea (a LaTeX to HTML translator) and pandoc (which 
> bills itself as a universal document converter) and can convert into and out 
> of LaTeX.  I use pandoc a lot, although not for LaTeX to HTML translation.  
> Pandoc can output EPUB, BTW.

On Sat, 11 Sept 2021 at 01:34,  wrote:
> You may want to have a look at the lwarp package as an alternative to tex4ht.

Thanks T. Kurt Bond and Denis Maier for the suggestions. A better alternative
to tex4ht / tex4ebook would certainly be much easier for me, even if I'm still
somewhat offended by the intermediate steps.

As for xml or pandoc, I'd rather not because I want to keep print (PDF) as the
primary output, and I don't want to lose what TeX/LaTeX can do that most
markup languages can't.

From what I know of pandoc, it is like Sphinx in that the way it generates PDF
output is by translating pandoc into LaTeX/TeX, then running TeX! So instead
of my current toolchain where I write the LaTeX I want directly, I'd
be examining
the pandoc output and if it isn't what I want, poking at pandoc in the hope of
making things better.

It may be unfair, but my impression is that TeX and typesetting / layout systems
based on TeX can do more interesting things than say XML or Sphinx. Moving
to a more "universal" markup format might broaden my options, but I don't
want a lowest common denominator solution.

--

cheers,
Hugh Fisher
___
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] Setting up the double pages of part beginnings

2021-09-11 Thread Wolfgang Schuster via ntg-context

Christian Dekant via ntg-context schrieb am 10.09.2021 um 19:25:

Dear List,

I am trying to set up double pages at the beginning of a new part in 
such a way that:
- on an odd/right-hand page there will be number and the title typeset 
in some fashion, and
- on the even/left-hand page there should be a full (printpaper)size 
image.


https://www.mail-archive.com/ntg-context@ntg.nl/msg94581.html

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] LuaMetaTEX as LaTeX to XHTML/ePub transpiler?

2021-09-11 Thread Hugh Fisher via ntg-context
On Fri, 10 Sept 2021 at 21:47, Hans Hagen  wrote:
>
[ munch ]

>
> in this area there is nothing in luametatex that luatex can't do

As in my earlier reply, I'm thinking about replacing Adobe Illustrator with
Metapost, and LuaMetaTEX seems to have better integration?

>
> so, if your source uses a limited set of commands you can write a parser
> (in any language)

This parser would need to understand TeX source files and conventions
such as % for comments, recognise commands starting with \ and with
arguments/parameters bracketed by [] and {}, and look up command names
that might be written in Lua, then call them.

Isn't that what LuaMetaTEX does? No, I haven't looked at the actual source
code yet, but starting with something that already does most of what you
want is always quicker than writing from scratch.


-- 

cheers,
Hugh Fisher
___
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] LuaMetaTEX as LaTeX to XHTML/ePub transpiler?

2021-09-11 Thread Hugh Fisher via ntg-context
On Fri, 10 Sept 2021 at 21:26, Henning Hraban Ramm  wrote:
>
> No.
>
> LuaMetaTeX is ConTeXt-only.
> You would need a LaTeX -> ConTeXt conversion, and there is none.
>

Well I am thinking about switching to ConTeX/LuaMetaTEX anyway, because at the
moment I draw vector art in the last non-subscription version of Adobe
Illustrator, now
approaching ten years old. I'll be trying out Metapost as a replacement.

My markup isn't that complicated, so at worst I could translate by
hand. But it occurs
to me that if I get this markup to markup text translation going, I'd
be able to write a
LaTeX -> ConTeXt converter as a set of LaTeX named Lua functions.

-- 

cheers,
Hugh Fisher
___
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] Changing the style of author’s surname in a custom bibliographical style

2021-09-11 Thread Tomáš V via ntg-context

Greetings,

I am trying to make a bibliographical style that would comply to the ISO 
690 standard and I have a few questions:


1) The name of the author need to be written in the inverted format 
(e.g. Knuth, Donald). It is also customary to write the surname either 
in uppercase or in small caps (e.g. KNUTH, Donald). If I wanted to 
change the whole name to small caps I’d do something like this:


\btxdoif {author} {
    {\sc \btxflush{author}}
    \btxperiod
}

How do I change the “font” of the surname only? Can this be done by 
redefining a TeX macro (like in BibLaTeX’s \mkbibnamefamily) or is this 
done by changing some Lua code?


2) As I have said, the name has to be inverted. This is done by setting 
authorconversion to inverted. I’ve tried doing this like this:


\setupbtx[iso690:list][authorconversion=inverted,]

and this:

\setupbtxlist[iso690][authorconversion=inverted,]

Neither of these options work, but this works:

\setupbtx[default:list][authorconversion=inverted,]

I’m confused—why does changing the default option work and changing the 
option for my style doesn’t?


Here's a MWE for both of my problems:

% publ-imp-iso690.mkiv
\startbtxrenderingdefinitions[iso690]
\definebtx
    [iso690]
    [
    default=default,
    specification=iso690,
    ]
\definebtxrendering
    [iso690]
    [
    specification=iso690,
    numbering=yes,
    ]
\setupbtx[default:list]
    [
    authorconversion=inverted,
    ]
% field definitions
\starttexdefinition btx:iso690:author
    \btxdoif {author} {
    \btxflush{author}
    \btxperiod
    }
\stoptexdefinition
% book definition
\startsetups btx:iso690:list:book
    \texdefinition{btx:iso690:author}
    \removeunwantedspaces
\stopsetups

% publ-imp-iso690.lua
local specification = {
    name  = "iso690",
    categories = { },
}
local categories = specification.categories
categories.book = {
    required = { "title" },
    optional = {"author"},
}
return specification

Thanks for your help,
Tomáš
___
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] Default page layout

2021-09-11 Thread kauśika cittūr via ntg-context
On Friday, September 10, 2021 2:09:29 PM IST Hans Hagen wrote:
> On 9/10/2021 7:26 AM, kauśika cittūr via ntg-context wrote:
> > Dear List,
> > 
> > I am using LMTX 2021.08.30 19:56.
> > 
> > I have the following example –
> > \starttext
> > \showlayout
> > 
> > \input knuth
> > \stoptext
> > 
> > which yields an output (attached here) with a "asymmetric" layout.
> > 
> > Am I doing something wrong? Or have I missed something? Please advise.
> 
> this is indeed the default, originating in initial usage decades ago:
> singlesided stapled prints and a wide outer margin for making notes
> 
> you can do
> 
>\setuplayout[width=middle,height=middle]
> 
> as well as
> 
>\setuppagenumbering[alternative=doublesided]
> 
> and more like that
> 
> 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
> -

Dear Hans,

Thanks for the explanation.

Best,
kauśika


___
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] Weird error when using \startformula inside lua

2021-09-11 Thread Hans Hagen via ntg-context

On 9/11/2021 5:11 AM, Aditya Mahajan via ntg-context wrote:

I sometimes define lua functions for showing out worked out calculations. The 
following minimal example shows that

   context([[\startformula ... \stopformula]])

fails in LMTX with an error message:

tex error   > tex error on line 3 in file ./test.tex: Undefined control 
sequence \undefined

MWE:

\startluacode
   thirddata = thirddata or {}

   local comment = [[
 This is a famous formula
 \startformula
   a^2 + b^2 = c^2
 \stopformula
   ]]

   function thirddata.explanation()
   context(comment)
   end

\stopluacode

\starttext
\ctxlua{thirddata.explanation()}
\stoptext

The actual use case is more complicated (where I use templates, so I don't want 
to convert everything to context.startformula() etc.). The example compiles 
with MkIV but not LMTX.

Any idea what is going on?

\enabletrackers[context*]

shows that we have an unprotected \startformula so we need this in 
strc-mat.mkxl:


\permanent\protected\defcsname\e!start\v!formula\endcsname{\strc_formulas_start_formula{}}
\permanent\protected\defcsname\e!stop 
\v!formula\endcsname{\strc_formulas_stop_formula}


\permanent\tolerant\protected\def\defineformulaalternative[#1]#*[#2]#*[#3]%
  {\frozen\instance\protected\defcsname\e!start#1\v!formula\endcsname{#2}%
   \frozen\instance\protected\defcsname\e!stop #1\v!formula\endcsname{#3}}

(the \protected probably got lost when i added overload protection etc)

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] Setting up the double pages of part beginnings

2021-09-11 Thread Pablo Rodriguez via ntg-context
On 9/10/21 7:25 PM, Christian Dekant via ntg-context wrote:
> [...]
> % startTEXpage does not increase page number => incrementpagenumber

Sorry, Christian, I’m afraid I don’t understand what you want to achieve

\startTEXpage[pagestate=start] uses page numbers as any other page.

I hope it helps,

Pablo
--
http://www.ousia.tk
___
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
___