[NTG-context] Re: PDF, runner, and TikZ patches

2024-03-15 Thread Max Chernoff
Hi Aditya, Jim,

On Fri, 2024-03-15 at 01:53 +0100, Aditya Mahajan wrote:
> On Thu, 14 Mar 2024, Jim wrote:
> > were you hoping the ConTeXt distribution would ship its own
> > pgfutil-context.def, or were you hoping that someone could convince Henri
> > to put the RGB change in?
>
> We can patch some of the definitions of pgfutil-context.def in m-tikz
> if really needed, but it would be preferable to first check if tikz
> maintainers are willing to merge them upstream.

Ah, okay. I was under the impression that the LMTX standalone
distribution carried a ton of TikZ patches and that ConTeXt patches
weren't really merged upstream, but it sounds like there are only a
couple small patches and upstream does merge ConTeXt patches. I'll
rebase my PR and check with upstream again. Thanks!

On Thu, 2024-03-14 at 20:53 -0300, Jim wrote:
> were you hoping the ConTeXt distribution would ship its own
> pgfutil-context.def, or were you hoping that someone could convince Henri
> to put the RGB change in?

I've seen a few TikZ bugs/patches resolved on this list, and I know that
the LMTX standalone distribution carries patches for TikZ (although
fewer than I thought?), so this seemed like the right place to start.

> And, if anyone has the will to push this (or add it in to a ConTeXt
> distribution version), I'd still like the cmyk support, even if there is no
> ability to specify colour profiles:
>
> \def\pgfutil(a)emu@cmyk#1#2,#3,#4,#5\@nil
> {
> \pgfmathsetmacro{\@red@}{(1 - #2) * (1 - #5)}%
> \pgfmathsetmacro{\@green@}{(1 - #3) * (1 - #5)}%
> \pgfmathsetmacro{\@blue@}{(1 - #4) * (1 - #5)}%
> \expandafter\edef\csname\string\color@#1\endcsname
> {\noexpand\xcolor@ {}{}{rgb}{\@red@,\@green@,\@blue@}}
> }
>
> I don't see that it would hurt anything, even if it doesn't give complete
> cmyk support.

I need to rebase my current PGF PR anyways, so I'll add this in with it.

Thanks,
-- Max

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] PDF, runner, and TikZ patches

2024-03-14 Thread Max Chernoff
Hi all,

I've had a few patches applied to my installation for a little while
now, so I figured that I should send them in. There's a diff at the end
of the email, and the modified files are attached [but rejected by the
mailing list, so sent separately to Hans]

 * In the definition of "featurecreep()" in "lpdf-mis.lmt",
   "structures.pages.tobesaved[i].status" should be "[...].state" to
   match the definition of "pages.save" in "strc-pag.lua". 
   
 * For the "resultof" runner in "util-sbx.lmt", the current io.popen
   mode only works with Windows. See the definition of "l_checkmodep" in
   "liolib.c".
   
 * Some of the pgfplots 3D shaders appear to be broken,
   see https://tex.stackexchange.com/a/708121 .
   
 * The TikZ "RGB" colour model does not currently work properly. This is
   internally used by "\usepgfplotslibrary[colorbrewer]" among others.
   See https://github.com/pgf-tikz/pgf/pull/1130 .
   
Thanks,
-- Max


diff --git a/tex/generic/pgf/utilities/pgfutil-context.def 
b/tex/generic/pgf/utilities/pgfutil-context.def
index eddab09ab..66edb0980 100644
--- a/tex/generic/pgf/utilities/pgfutil-context.def
+++ b/tex/generic/pgf/utilities/pgfutil-context.def
@@ -26,8 +26,17 @@
 \def\pgfutil@definecolor#1#2#3{\csname pgfutil@emu@#2\endcsname{#1}#3\@nil}

 
\def\pgfutil@emu@rgb#1#2,#3,#4\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#3,#4}}}
-\def\pgfutil@emu@gray#1#2\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#2,#2}}}
+\def\pgfutil@emu@gray#1#2\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{gray}{#2}}}
 
\def\pgfutil@emu@cmyk#1#2,#3,#4,#5\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{cmyk}{#2,#3,#4,#5}}}
+\def\pgfutil@emu@RGB#1#2,#3,#4\@nil{%
+\begingroup
+\pgfmathdivide@{#2}{255}\let\pgfutil@emu@RGB@r\pgfmathresult
+\pgfmathdivide@{#3}{255}\let\pgfutil@emu@RGB@g\pgfmathresult
+\pgfmathdivide@{#4}{255}\let\pgfutil@emu@RGB@b\pgfmathresult
+
\edef\pgf@marshal{\def\expandafter\noexpand\csname\string\color@#1\endcsname{%
+
\noexpand\xcolor@{}{}{rgb}{\pgfutil@emu@RGB@r,\pgfutil@emu@RGB@g,\pgfutil@emu@RGB@b}}}%
+\expandafter\endgroup\pgf@marshal
+}


 % no need for x colors (users can load it if needed)
diff --git a/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex 
b/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex
index 60d6274..106c490 100644
--- a/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex
+++ b/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex
@@ -2804,6 +2804,9 @@
 \def\pgfplotsretval{4}%
 \fi
 \fi
+ \if0\pgfplotsretval
+ \def\pgfplotsretval{5}
+ \fi
 \pgfkeyslet{/pgfplots/surf shading/shading type}\pgfplotsretval%
 %
 \pgfplotsplothandlermesh@set@shader@colormap
diff --git 
a/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-luatex.def 
b/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-luatex.def
index 0046daa..b563732 100644
--- a/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-luatex.def
+++ b/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-luatex.def
@@ -61,7 +61,7 @@
 \pgfplotslibrarysurfusepath
 \endpgfpicture
 }%
- \immediate\saveboxresource resources{
+ \saveboxresource resources{
 /Pattern << \pgfplots@glob@TMPa >> % write the pattern resource dictionary
 }\pgfutil@tempboxa
 \leavevmode
diff --git a/tex/context/base/mkxl/util-sbx.lmt 
b/tex/context/base/mkxl/util-sbx.lmt
index b48d4a9..0ee8a16 100644
--- a/tex/context/base/mkxl/util-sbx.lmt
+++ b/tex/context/base/mkxl/util-sbx.lmt
@@ -393,7 +393,7 @@ local runners = {
 if trace then
 report("resultof: %s",command)
 end
-local handle = iopopen(command,"rb") -- already has flush
+local handle = iopopen(command,"r") -- already has flush
 if handle then
 local result = handle:read("*all") or ""
 handle:close()
diff --git a/tex/context/base/mkxl/lpdf-mis.lmt 
b/tex/context/base/mkxl/lpdf-mis.lmt
index 0f21cf9..a9cfe02 100644
--- a/tex/context/base/mkxl/lpdf-mis.lmt
+++ b/tex/context/base/mkxl/lpdf-mis.lmt
@@ -510,7 +510,7 @@ local function featurecreep()
 return -- fatal error
 end
 local label = p.viewerprefix or ""
-if p.status == v_stop then
+if p.state == v_stop then
 if not stopped then
 list[#list+1] = i - 1 -- pdf starts numbering at 0
 list[#list+1] = pdfdictionary {


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net

[NTG-context] Re: \intertext and highlighting with \alignhere/\breakhere

2024-03-13 Thread Max Chernoff
Hi Hans, Mikael,

On Wed, 2024-03-13 at 13:06 +0100, Hans Hagen wrote:
> On 3/13/2024 12:26 PM, Mikael Sundqvist wrote:
> > I can confirm that it works over \alignhere. Hans is doing some black
> > magic, but I guess he did not want to show off by including the whole
> > line.
> Indeed, no need to show of the obvious
> 
> \definebar
>[mybar]
>[backgroundbar]
>[height=\strutht,depth=\strutdp,offset=.250ex,color=red]
> 
> [...]

That looks perfect, thanks!
-- Max
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \intertext and highlighting with \alignhere/\breakhere

2024-03-13 Thread Max Chernoff
Hi Hans,

On Tue, 2024-03-12 at 15:21 +0100, Hans Hagen wrote:
> the next upload will support the attached ... so no ugly hacky code needed

"\texthere[inbetween]" looks perfect, thanks!

The "\definebar[...][inlined]" doesn't look quite right though -- the
issue that I'm having is that I can't figure out how to highlight across
both sides of an \alignhere without any questionable hacks. Unless the
new "inlined" does work across an \alignhere and I'm just not seeing it
in the example.

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] \intertext and highlighting with \alignhere/\breakhere

2024-03-12 Thread Max Chernoff
Hi all,

Often I want to include a sentence/paragraph in the middle of a long
multipart formula. With the old \startalign/\stopalign formulas, I could
use \intertext{...} to do this, but this doesn't work with the new
\alignhere/\breakhere formulas. I've managed to find a "solution" for
this, although I'd prefer something a bit less hacky. Any ideas?

Also, is there a way to highlight an equation across an \alignhere? Once
again, I've found a "solution", but like before, it's pretty hacky.

Example files are attached.

Thanks,
-- Max
\setupindenting[yes, 3em]
\setuphead[section][page=yes]

\unprotect
\newbox\intertext_tmp_box
\newdimen\intertext_tmp_dimen

\starttexdefinition protected newintertext #1
\texthere[left]{
\setbox\intertext_tmp_box=\hbox{
\startframedtext[
offset=none,
width=\hsize,
frame=off,
]
\parindent = \v_spac_indentation_normal
\noindent
#1
\stopframedtext
}
\global\intertext_tmp_dimen = \ht\intertext_tmp_box
\vbox to 0pt{
\vskip\dimexpr 1ex - \baselineskip \relax
\box\intertext_tmp_box
\vss
}
\aftergrouped{
\aftergrouped{
\vadjust{
\penalty 1
\vskip\dimexpr \intertext_tmp_dimen - \baselineskip \relax
}
}
}
}
\breakhere
\stoptexdefinition
\protect

\starttext
\section{Old alignment}
\samplefile{knuth}
\placeformula\startformula\startalign
\NC \text{something} + \text{really} + \text{really} + \text{long} \NC= \sqrt{x} \NR[+]
\intertext{\samplefile{knuth}}
\NC d \NC= e + f \NR[+]
\NC g \NC= h + i
\stopalign\stopformula
\samplefile{knuth}


\section{“I expect to see \tex{noalign} only after the \tex{cr} of an alignment.”}
\starttyping
\samplefile{knuth}
\startformula
\text{something} + \text{really} + \text{really} + \text{long} \alignhere= \sqrt{x} \numberhere \breakhere
\intertext{\samplefile{knuth}}
d \alignhere= e + f \numberhere \breakhere
g \alignhere= h + i
\stopformula
\samplefile{knuth}
\stoptyping


\section{Alignment not kept}
\samplefile{knuth}
\startformula
\text{something} + \text{really} + \text{really} + \text{long} \alignhere= \sqrt{x} \numberhere
\stopformula
\samplefile{knuth}
\startformula
d \alignhere= e + f \numberhere \breakhere
g \alignhere= h + i
\stopformula
\samplefile{knuth}


\section{My hack}
\samplefile{knuth}
\startformula
\text{something} + \text{really} + \text{really} + \text{long} \alignhere= \sqrt{x} \numberhere \breakhere
\newintertext{\samplefile{knuth}}
d \alignhere= e + f \numberhere \breakhere
g \alignhere= h + i
\stopformula
\samplefile{knuth}
\stoptext
\unprotect
\newbox\hightlight_tmp_box

\definemathframed[_highlight][
location=mathematics,
frame=off,
background=color,
backgroundcolor=lightred,
backgroundoffset=0.25ex,
]

\tolerant\def\highlighthere#1\alignhere#2#3\breakhere{%
\setbox\hightlight_tmp_box=\hbox{%
\m{%
\forcedisplaymath%
#1#2\null%
}%
}%
\alignhere%
\phantom{%
\null#2\null%
}%
\mskip -8mu%
\hskip -\wd\hightlight_tmp_box%
\lower 1ex \hbox{%
\_highlight[
loffset=\wd\hightlight_tmp_box,
location=keep
]{%
\hskip -\wd\hightlight_tmp_box%
\forcedisplaymath%
#1#2#3%
}%
}%
\breakhere%
}
\protect

\starttext
\startformula
a \alignhere= b + c \breakhere
\highlighthere d + e \alignhere= f \breakhere
g \alignhere= h + i
\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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Different behavior of \clf_lastypos vs \clf_lastxpos

2023-09-17 Thread Max Chernoff
Hi Aditya,

> For some reason, there is an extra \relax written to file after
> `\the\numexp\clf_lastypos\relax` (there is no such relax after
> `\the\numexpr\clf_lastxpos\relax`). The test.pgf file is:
> 
> \macro {A}{23930350}{43358454.0\relax } \macro {B}{39564274.0\relax
>   }{14083538}
> 
> Any ideas on why is the extra \relax written after lastypos and how to
> fix that?

\numexpr stops at the first non-expandable or non-digit token. If
\clf_last[xy]pos expands to an integer, then that's the \relax, but if
it expands to a float, then that's the decimal point. 

With Lua, adding, subtracting, or multiplying two integers will give you
an integer, but dividing gives you a float. So somewhere in the backend,
the vertical position is probably divided but the horizontal position is
only added or subtracted.

To fix this, change lines 2344--2345 of anch-pos.lmt from

   implement { name = "lastxpos", actions = function() 
context(jobpositions.lastx) end }
   implement { name = "lastypos", actions = function() 
context(jobpositions.lasty) end }

to

   implement { name = "lastxpos", actions = function() context("%.0f", 
jobpositions.lastx) end }
   implement { name = "lastypos", actions = function() context("%.0f", 
jobpositions.lasty) end }

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

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


[NTG-context] Re: TOC with sections titles and page numbers like a paragraph beneath chapter

2023-09-04 Thread Max Chernoff


Hi Julian,

> I am attempting to get a TOC that looks like the following (in other 
> words with section titles and their relative page numbers in a block 
> below the chapter):

> Has 
> anyone put together a TOC of this kind and might be able to give me a 
> hint to follow?

This is fairly close to what you're looking for I think (the manual, not
the package itself):

   
http://mirrors.ctan.org/macros/luatex/generic/lua-widow-control/lua-widow-control.pdf

The source is a little messy, but I've used it in a bunch of other
documents and it seems fairly robust:

   
https://github.com/gucci-on-fleek/lua-widow-control/blob/7c4544/docs/manual/lwc-manual.mkxl#L167-L234

There aren't any page numbers for the subsections in that, but you
should be able to add those inside the definition of
\SubsectionTOCcommand with either #3 or \currentlistentrypagenumber.

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

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


[NTG-context] Re: combining \definetyping and \definebuffer

2023-07-29 Thread Max Chernoff
I'm on mobile now so I can't type out a complete solution, but I think that 
what you're looking for is in this file:


https://github.com/gucci-on-fleek/unnamed-emoji/blob/master/documentation/unemoji-manual.mkxl

It doesn't exactly do what you specifically asked for, but I think that it's 
pretty similar to your end goal. There's a .tex file with example usage in the 
same folder and a link to the compiled PDF from the main repo page. 

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

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


[NTG-context] Re: context-on-web broken

2023-07-08 Thread Max Chernoff
On Sat, 2023-07-08 at 08:38 +0200, Mikael Sundqvist wrote:
> David kindly made available
> 
> https://texlive.net/run?context
> 
> to start with a minimal context file.

There's also 

   https://live.contextgarden.net/
   
which is pretty much the exact same thing. Not very up to date though:

   system  > ConTeXt  ver: 2021.10.28 10:19 LMTX  fmt: 2021.10.28  int: 
english/english

-- Max


___
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] lpdf.registerfontmethod

2023-07-06 Thread Max Chernoff
Hi Hans,

In lpdf-emb.lmt, there's a commented-out definition of
lpdf.registerfontmethod that I'd like to use. I've uncommented this in
my installation and it's worked pretty well for me, so can you please
uncomment/enable this by default in the distribution?

If you want further background, this is how I'm using it:

   lpdf.registerfontmethod("rawpdf", function(filename, details)
   return
   details.properties.indexdata[1],
   0.001,
   function(char)
   return char.code, char.width / t3_to_sp
   end,
   function() end,
   function() end
   end)
   
   local function make_glyph(codepoint, unicode, width, height, code)
   local spec  = {
   width   = width * t3_to_sp,
   height  = height * t3_to_sp,
   depth   = 0,
   unicode = { utf8.codepoint(unicode or "", 1, -1, true) },
   code = width .. " 0 d0 " .. code,
   }
   local tfmdata  = fonts.hashes.identifiers[font.current()]
   tfmdata.characters[codepoint] = spec
   
   fonts.dropins.swapone(
   "rawpdf",
   tfmdata,
   { code = spec },
   codepoint
   )
   
   fonts.constructors.addcharacters(
   font.current(),
   { characters = { [codepoint] = spec } }
   )
   end

I specifically need something that writes out a raw PDF stream. I'm
using this to write a 4000+ page PDF file to be included by pdfTeX, so I
can't have any XObject indirection or similar, otherwise the number of
objects skyrockets and pdfTeX (+qpdf) gets really slow.

If you're curious, the actual code where I'm using this is here:

   
https://github.com/gucci-on-fleek/unnamed-emoji/blob/master/source/svg-to-pdf.cld
   
https://github.com/gucci-on-fleek/unnamed-emoji/blob/master/source/unnamed-emoji.lua

I know that what I'm doing in the .cld file is wildly unsupported, but
I'm the only one who will ever need to run that. I am planning on
distributing the .lua file though, so I'd like to get this change in the
distribution.

I'm also open to using a different interface instead if you don't want
to publicly-expose lpdf.registerfontmethod.

Thanks,
-- Max
___
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] SVG converter bugs

2023-07-06 Thread Max Chernoff
Hi Hans,

I've been using the SVG->MP converter and I've found a few bugs. Most of
the bugs are with "weird" SVG input, but I have no control over the
input, and the metadata on most of the files shows that it was exported
from Adobe Illustrator which is (unfortunately) quite popular. I've
tested all of the below with the latest ConTeXt.



If you give Metapost an out-of-order gradient, it produces an invalid
PDF. Both pages in this example:

   \startbuffer[gradient]
   http://www.w3.org/2000/svg;>
   
   
   
   
   
   
   
   
   
   
   
   \stopbuffer
   
   \starttext
   
   \startTEXpage
   \includesvgbuffer[gradient]
   \stopTEXpage
   
   \startMPpage
   fill unitsquare xyscaled (200,100)
   withshademethod "linear"
   withshadecenteronefraction (0,1)
   withshadecentertwofraction (0,0)
   withshadestep (
   withshadefraction 0
   withshadecolors (green, green)
   )
   withshadestep (
   withshadefraction 0.75
   withshadecolors (blue, green)
   )
   withshadestep (
   withshadefraction 0.25
   withshadecolors (green, blue)
   )
   withshadestep (
   withshadefraction 1
   withshadecolors (green, blue)
   )
   ;
   \stopMPpage
   
   \stoptext

write this to the PDF

   /Bounds [
 0
 0.75
 0.25
   ]

which is invalid and renders incorrectly in every PDF reader that I've
tested. This is what the SVG 1.1 spec has to say:

   Each gradient offset value is required to be equal to or greater than
   the previous gradient stop's offset value. If a given gradient stop's
   offset value is not equal to or greater than all previous offset values,
   then the offset value is adjusted to be equal to the largest of all
   previous offset values.



The following SVG renders incorrectly, but replacing the 0% stop with
the commented one fixes it:

   http://www.w3.org/2000/svg;>
   
   
   
   
   
   
   
   
   
   



Using a gradient as the stroke colour outputs an invalid colour to
MetaPost. This example:

   \startbuffer[gradient]
   http://www.w3.org/2000/svg;>
   
   
   
   
   
   
   
   
   
   \stopbuffer
   
   \startluacode
   print(metapost.svgtomp{data = buffers.getcontent("gradient")})
   \stopluacode

gives this output:

   [...]
   withcolor "url(#gradient)"
   [...]



"stop-opacity" seems to be ignored:

   \startbuffer[gradient]
   http://www.w3.org/2000/svg;>
   
   
   
   
   
   
   
   
   
   \stopbuffer
   
   \startTEXpage
   \includesvgbuffer[gradient]
   \stopTEXpage



Finally, "display:none;" doesn't work:

   \startbuffer[gradient]
   http://www.w3.org/2000/svg;>
   
   
   \stopbuffer
   
   \startTEXpage
   \includesvgbuffer[gradient]
   \stopTEXpage


Thanks,
-- Max
___
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] Protect the lettrine

2023-06-15 Thread Max Chernoff via ntg-context
Hi Dave,

> How would you instruct ConTeXt to "protect" the lettrine such that
> regardless of whether the first paragraph spans multiple lines, a short
> first paragraph will still prevent the second paragraph from overlapping
> the lettrine?

> Here's the output I'm looking to achieve:
> 
> https://i.stack.imgur.com/XeZQS.png
> 
> Note how the second line honours the lettrine's width and padding, in the
> same way that the second line of the first paragraph in Knuth's quote
> respects the width and padding.

Here's a questionable Lua-based solution:

   \startluacode
   userdata.hangindent = 0
   function userdata.post_lettrine(head)
   nodes.tasks.disableaction("finalizers", "userdata.post_lettrine")
   
   if tex.prevgraf < math.abs(tex.hangafter) then
   userdata.hangindent = tex.hangindent
   nodes.tasks.enableaction("processors", "userdata.next_par")
   end
   
   return head
   end
   nodes.tasks.appendaction("finalizers", "before", "userdata.post_lettrine")
   nodes.tasks.disableaction("finalizers", "userdata.post_lettrine")
   
   
   function userdata.next_par(head)
   nodes.tasks.disableaction("processors", "userdata.next_par")
   
   if head.next.id == node.id("glue") and
  head.next.subtype == 20
   then
   head.next.width = userdata.hangindent
   end
   
   return head
   end
   nodes.tasks.appendaction("processors", "before", "userdata.next_par")
   nodes.tasks.disableaction("processors", "userdata.next_par")
   
   
   local default = typesetters.initials.actions.default
   function typesetters.initials.actions.default(...)
   nodes.tasks.enableaction("finalizers", "userdata.post_lettrine")
   return default(...)
   end
   \stopluacode
   
   \setupinitial[n=2]
   
   [...]

Normally manipulating nodes inside the callbacks is the wrong way to do
something, but in this case, that's exactly how the standard initial
code works. 

We need to modify the "default" alternative since "\setupinitial"
provides no way for us to set a different alternative. A better solution
would be to provide a new alternative so we wouldn't need to make
questionable overrides to the base code.

-- Max
___
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] Super slow installation

2023-05-30 Thread Max Chernoff via ntg-context
Hi all,

I think that this is all resolved now, but if not, maybe this extra info
will help?

I'm using this script to test:

   #!/bin/sh
   
   for x in \
   "https://speed.cloudflare.com/__down?bytes=$(echo '50*1024^2' | bc)" \
   "https://speedtest1.mnd.bulk.iss.as9143.net:8080/random5000x5000.jpg; \
   "http://lmtx.pragma-ade.com/install-lmtx/texmf.zip; \
   ;do
   echo "$x"
   curl -w 'scale=2;%{speed_download}*8/1024^2\n' -sSo /dev/null "$x" | bc
   echo
   done
   
Cloudflare should have a fast data centre near anywhere, and
...as9143.net is hosted directly by the ISP that lmtx.pragma-ade.com
uses. I'll also run 

   traceroute -I lmtx.pragma-ade.com

This is what I get from home (Red Deer, Alberta; with Telus):

   https://speed.cloudflare.com/__down?bytes=52428800
   41.27
   
   https://speedtest1.mnd.bulk.iss.as9143.net:8080/random5000x5000.jpg
   12.49
   
   http://lmtx.pragma-ade.com/install-lmtx/texmf.zip
   13.92
   
   traceroute to lmtx.pragma-ade.com (213.125.29.165), 30 hops max, 60 byte 
packets
1  _gateway (10.XX.XX.XX)  1.422 ms  1.634 ms  1.888 ms
2  10.XX.XX.XX (10.XX.XX.XX)  7.211 ms  7.429 ms *
3  154.11.15.111 (154.11.15.111)  28.474 ms * *
4  ae57.edge6.Seattle1.Level3.net (4.14.240.209)  31.370 ms * *
5  * * *
6  us-sjo01a-ri3-ae-6-0.aorta.net (213.46.190.57)  43.847 ms *  42.311 ms
7  us-nyc01b-rd2-ae-18-0.aorta.net (84.116.146.34)  201.019 ms * *
8  us-was03a-rd1-ae-5-0.aorta.net (84.116.146.142)  172.439 ms *  174.154 ms
9  * * *
   10  asd-rc0001-cr101-be60-2.core.as33915.net (213.51.64.5)  173.222 ms * *
   11  213.51.7.227 (213.51.7.227)  174.405 ms * *
   12  D57D1DA5.static.ziggozakelijk.nl (213.125.29.165)  202.408 ms * *

And this is what I get from a server in Germany (Hetzner):

   https://speed.cloudflare.com/__down?bytes=52428800 
   714.28 

 
   https://speedtest1.mnd.bulk.iss.as9143.net:8080/random5000x5000.jpg
   478.20 

 
   http://lmtx.pragma-ade.com/install-lmtx/texmf.zip  
   38.13
   
   traceroute to lmtx.pragma-ade.com (213.125.29.165), 30 hops max, 60 byte 
packets
1  static.161.94.4.46.clients.your-server.de (46.4.94.161)  0.439 ms  0.433 
ms  0.433 ms
2  core24.fsn1.hetzner.com (213.239.229.117)  0.424 ms  0.427 ms  0.432 ms
3  juniper6.dc2.nbg1.hetzner.com (213.239.245.53)  2.864 ms  2.867 ms  
2.867 ms
4  ae12-500.nbg40.core-backbone.com (80.255.9.21)  2.867 ms  2.867 ms  
2.867 ms
5  ae5-2074.ams10.core-backbone.com (81.95.2.138)  11.049 ms  11.052 ms  
11.052 ms
6  nl-ams04a-ri3-ae-29-0.aorta.net (213.46.182.185)  11.465 ms  11.293 ms  
11.310 ms
7  asd-rc0001-cr101-be64.core.as9143.net (213.51.64.65)  17.658 ms  17.785 
ms  17.789 ms
8  asd-tr0021-dr141-lag2-2.core.as33915.net (213.51.7.227)  17.386 ms  
17.402 ms  17.397 ms
9  D57D1DA5.static.ziggozakelijk.nl (213.125.29.165)  25.103 ms  27.319 ms  
27.323 ms
   
Thanks,
-- Max
___
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] Can ConTeXt write its pdf to a different directory?

2023-05-26 Thread Max Chernoff via ntg-context
Hi Peter,

> My .tex file is in a directory within my working directory. I would like 
> ConTeXt to write its output in the same directory as my .tex file. But it 
> writes to the working directory.
> 
> This was asked 10 years ago:
> `tex.stackexchange.com/questions/67928/how-to-set-output-directory-in-context-command`
> 
> The answer given then was to use:
> `context filename --result=output-directory/filename`
> 
> But this doesn't work now. When I compile my .tex file, I get a message:
> `results are to be on the running path, not on 'output-directory', ignoring 
> --result`

This seems to work, although I'm not sure that I would call it a "good"
solution:

   \startluacode
   local function absolute(path)
   return file.collapsepath(dir.expandname(path))
   end
   
   local texfile = absolute(environment.filename)
   local pdffile = file.addsuffix(
   absolute(environment.inputfilebarename),
   "pdf"
   )
   
   luatex.wrapup(function()
   os.rename(pdffile, file.replacesuffix(texfile, "pdf"))
   end)
   \stopluacode
   
   \starttext
   Hello!
   \stoptext

-- Max
___
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] Noto Emoji COLRv1

2023-05-23 Thread Max Chernoff via ntg-context
Hi Hans,

I tried using the code from [1] for Noto Emoji in COLRv1 format [2]:

   \startTEXpage
   \definefontfeature[colored][default][colr=9]
   \definedfont[Noto-COLRv1.ttf*colored] 閭 % U+1F986
   \stopTEXpage

but ConTeXt gives the following error:

   fonts   > otf loading > loading 'Noto-COLRv1.ttf', hash 'noto-colrv1'
   otf reader  > table version 1 of 'colr' is partially supported for font 
Noto-COLRv1.ttf
   otf reader  > unsupported colr type 2 paint format 0
   otf reader  > unsupported colr type 2 paint format %i
   otf reader  > fatal error in file 'Noto-COLRv1.ttf': 
...ext/tex/texmf-context/tex/context/base/mkxl/font-dsp.lmt:3575: table index 
is nil
   stack traceback:
...ext/tex/texmf-context/tex/context/base/mkiv/font-otr.lua:2344: in 
metamethod 'newindex'
...ext/tex/texmf-context/tex/context/base/mkxl/font-dsp.lmt:3575: in 
metamethod 'index'
...ext/tex/texmf-context/tex/context/base/mkxl/font-dsp.lmt:3677: in 
metamethod 'index'
...ext/tex/texmf-context/tex/context/base/mkxl/font-dsp.lmt:3150: in 
upvalue 'getpaintoffset'
...ext/tex/texmf-context/tex/context/base/mkxl/font-dsp.lmt:3564: in 
field '?'
...ext/tex/texmf-context/tex/context/base/mkxl/font-dsp.lmt:3677: in 
metamethod 'index'
...ext/tex/texmf-context/tex/context/base/mkxl/font-dsp.lmt:3685: in 
local 'reader'
...ext/tex/texmf-context/tex/context/base/mkiv/font-otr.lua:2089: in 
upvalue 'readtable'
...ext/tex/texmf-context/tex/context/base/mkiv/font-otr.lua:2204: in 
upvalue 'readdata'
...ext/tex/texmf-context/tex/context/base/mkiv/font-otr.lua:2257: in 
function <...ext/tex/texmf-context/tex/context/base/mkiv/font-otr.lua:2240>
[C]: in function 'xpcall'
...ext/tex/texmf-context/tex/context/base/mkiv/font-otr.lua:2346: in 
upvalue 'loadfont'
...ext/tex/texmf-context/tex/context/base/mkiv/font-otr.lua:2401: in 
field 'loadfont'
...ext/tex/texmf-context/tex/context/base/mkxl/font-otl.lmt:160: in 
field 'load'
...ext/tex/texmf-context/tex/context/base/mkxl/font-otl.lmt:624: in 
upvalue 'otftotfm'
...ext/tex/texmf-context/tex/context/base/mkxl/font-otl.lmt:652: in 
function <...ext/tex/texmf-context/tex/context/base/mkxl/font-otl.lmt:651>
(...tail calls...)
...ext/tex/texmf-context/tex/context/base/mkxl/font-def.lmt:362: in 
function <...ext/tex/texmf-context/tex/context/base/mkxl/font-def.lmt:350>
(...tail calls...)
...ext/tex/texmf-context/tex/context/base/mkxl/font-def.lmt:465: in 
field 'read'
...ext/tex/texmf-context/tex/context/base/mkxl/font-ctx.lmt:1371: in 
function <...ext/tex/texmf-context/tex/context/base/mkxl/font-ctx.lmt:1228>
(...tail calls...)
   fonts   > otf loading > loading failed due to read error
   fonts   > defining > forced type 'ttf' of 'Noto-COLRv1' not found
   fonts   > defining > unable to define 'Noto-COLRv1.ttf' as 
'thedefinedfont--0'
   system  > print height forced to paper height
   system  > print width forced to paper width
   fonts   > checking > char 閭 (U+1F986) in font 'LMRoman10-Regular' 
with id 1: missing

From what I can tell, the Lua code is trying to read past the end of
font file. I tried debugging the error further, but this is well beyond
my understanding.

(Also, paintreaders[6--11] in font-dsp.lmt are missing "offset" in the
function signature, and paintreaders itself is glboal. Maybe related?)

I'm using the current latest (2023.05.08 17:39).

Thanks,
-- Max

[1]: https://mailman.ntg.nl/pipermail/ntg-context/2022/107279.html
[2]: https://github.com/googlefonts/noto-emoji/raw/main/fonts/Noto-COLRv1.ttf
___
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] SVG ViewBox figure battle

2023-05-20 Thread Max Chernoff via ntg-context
Hi,
> Any ideas on how to force that setting without modifying grph-con.lua?

This seems to work:

   \startluacode
   function figures.converters.svg.pdf(oldname, newname)
   figures.programs.inkscape.runner {
   format = "filename",
   resolution = "600",
   crop   = "--export-area-page",
   newname= dir.expandname(newname),
   oldname= dir.expandname(oldname),
   }
   end
   \stopluacode
   
I mostly just copied that from grph-con.lua, but the CLD manual has a
few more details:

   
https://www.pragma-ade.com/general/manuals/cld-mkiv.pdf#%5B%7B%22num%22%3A89%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22Fit%22%7D%5D

-- Max
___
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] LuaMetaTeX doesn't find files when symlinked

2023-04-28 Thread Max Chernoff via ntg-context


Hi Lynx,

> Today, I created a separate "user command" within TeXstudio, and it
> points to "/usr/local/ConTeXt_Standalone/context-linux-64/bin/mtxrun" 
> This command generates the same log output as the example at
> https://gitlab.com/islandoftex/images/texlive/-/issues/30.

This is probably not the same issue, since the path "context-linux-
64/bin/mtxrun" suggests that that isn't a symlink. (Well, it is a
symlink mtxrun => ./luametatex, but that email is about multi-level
symlinks like /usr/bin/context => /usr/local/texlive/2023/bin/x86_64-
linux/context => ./luametatex)

To compile a document, you almost certainly want to use "context"
instead of "mtxrun". So try changing the user command to
"/usr/local/ConTeXt_Standalone/context-linux-64/bin/context".

If that doesn't fix anything, run

   $ /usr/local/ConTeXt_Standalone/context-linux-64/bin/mtxrun --generate
   $ /usr/local/ConTeXt_Standalone/context-linux-64/bin/context --make
   
and try again.

If it still doesn't work, then what do you get when you run

   $ /usr/local/ConTeXt_Standalone/context-linux-64/bin/context --nofile

-- Max

___
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] LuaMetaTeX doesn't find files when symlinked

2023-04-27 Thread Max Chernoff via ntg-context
Hi Hans,

With the LuaMetaTeX-based ConTeXt wrapper, it's not generally possible
to run ConTeXt from a symlinked binary in another directory. This shows
up if someone makes symlinks in "/usr/bin" so that they can avoid adding
anything to their $PATH.

If you make run a symlink to the LuaMetaTeX-based ConTeXt wrapper, it
looks for texmfcnf.lua relative to the symlink location, not the symlink
target. With the old LuaTeX/kpse-based wrapper, the script would look
for texmfcnf.lua relative to the symlink target.

I know that my description above is terrible, so here's a demo:

   $ bin=$(mtxrun --expand-var TEXMFOS | head -1)/*
   $ cd $(mktemp -d)
   $ ln -s $bin/luatex $bin/luametatex $bin/context $bin/context.lua 
$bin/mtxrun $bin/mtxrun.lua .
   $ ./context --nofile
   $ ./context --luatex --nofile
   
Running the above commands used to work with the old LuaTeX/kpse-based
wrapper, but it doesn't work any more. I was able to ""fix"" this by
adding the lines

   if os.selfpath then
   environment.ownbin = lfs.symlinktarget(os.selfpath .. io.fileseparator 
.. os.selfname)
   environment.ownpath = environment.ownbin:match("^.*" .. io.fileseparator)
   else
   environment.ownpath = kpse.new("luatex"):var_value("SELFAUTOLOC")
   environment.ownbin = environment.ownpath .. io.fileseparator .. (arg[-2] 
or arg[-1] or arg[0] or "luatex"):match("[^" .. io.fileseparator .. "]*$")
   end
   
to mtxrun.lua, right below the line

   package.loaded["data-ini"] = package.loaded["data-ini"] or true
   
but this is obviously not a very good fix.

There are some threads with more details at:

   https://tug.org/pipermail/tex-live/2023-March/049028.html
   https://gitlab.com/islandoftex/images/texlive/-/issues/30
   
Those links only discuss TL, but I get the same issue if I make a symlink
to the standalone ConTeXt files. 

Thanks,
-- Max
___
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] update

2023-04-27 Thread Max Chernoff via ntg-context
Hi Lynx,

> * How can I be sure that the standalone version is the one being
> implemented?

It depends on what your $PATH is set to. On Linux/macOS, you can run

   $ type -ap context

to list all the ConTeXts in your $PTAH. The first one in that list is
the one that will be ran by default.

If you want to always run the standalone version, then you'll need to
make sure that your ConTeXt directory comes before your TL directory in
your PATH. On Linux/macOS, you'd add something like

   export PATH="/path/to/context/bin/:$PATH"
   
to your ~/.profile; on Windows, you can use the "setx" command. Googling
something like "add location to path" will get you more specific
instructions for your OS/shell.

> * How do I update the standalone version

Just run the installer again. On my system, I run

   $ cd /opt/context
   $ sudo sh ./install.sh

> (I assume that, as of today,
> it is already the most up-to-date version

Correct.

> if and when it is
> required or desired to do so?

You only need to update ConTeXt if a new update fixes a bug that affects
you or adds a new feature that you want. Most updates are announced on
the list, so you could just update whenever you see a new update. Or you
could just try updating once per week. You could also just never update.
Up to you.

The general recommendation is to save an old copy of the ConTeXt folder
before you update in case something breaks. I've never done this before
though since I can usually patch the bugs myself, and I can always fall
back on the version in TL if something is really broken.

-- Max
___
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] update

2023-04-27 Thread Max Chernoff via ntg-context

Hi Hans,

> I actually dont' know the rules for updating texlive but there are
> definitely updates.

The rules are:

 - Packages and formats are updated about 24 hours after a new version
   is uploaded to CTAN.
   
 - Binaries are only updated once-per-year.

But there are also some special cases:

 - The luatex binary will be updated shortly for "reasons" (details to 
   be made public later).
   
 - The luametatex binary is allowed to be updated whenever.

  https://tug.org/pipermail/tex-live/2023-March/049058.html

 - I have no idea how ConTeXt is added to TL, but it doesn't appear to 
   be through the usual automatic CTAN sync. 
   
> Basically tex live is the yearly snapshot.

Because you're allowed to update luametatex at will and luatex hardly
changes, you could update the ConTeXt in TL more than once per year.
There's no need for it to get as many updates as the standalone
distribution, but it would be nice to get an update every 3 months or
so. (I have no idea how much work this is for you+Mojca, so it's maybe
not worth the effort).

> But you can just install the lmtx installation alongside (it's small
> compared to tex live) and have the best of both worlds. The lmtx
> installation also has mkiv. It also comes with the fonts that match
> what we expect in context (as fonts get updated or changed). 

Lynx, I'll second this recommendation. The standalone lmtx distribution
is updated weekly-ish, uses less than 400MB disk space when installed,
and coexists happily with TL. The only downside is that it doesn't have
a friendly installation GUI like TL does. Even then, I personally find
it easier to install than TL.

Installation instructions:

   https://wiki.contextgarden.net/Installation
   
Thanks,
-- Max
___
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] update

2023-04-26 Thread Max Chernoff via ntg-context
Hi Lynx, Aditya,


> > New to conTeXt, have not performed a specific update prior to this. 
> > 
> > My conTeXt installation is part of TeXlive-2023 (under Linux OS). Will
> > the updates to ConTeXt be handled by tlmgr ? 
> 
> No. Usually, texlive updates context once a year. 

This is correct in general, but this specific update *will* end up in
TL2023 due to the engine changes that Hans mentioned. It's not in TL
yet, but we're actively working on it, so it should show up within a
week or so (hopefully).

Thanks,
-- Max
___
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] /usr/bin/env texlua no such file or directory; ~/context/tex is not a valid TEXROOT path; no file plain.tex

2023-04-10 Thread Max Chernoff via ntg-context
Hi Carlos,

I think that you may be installing the old ConTeXt MkIV distribution
instead of the new ConTeXt LMTX. ConTeXt LMTX doesn't distribute
"texlua" at all, and running 
"./install --modules=all" doesn't make sense with LMTX (since the
installer can't install modules).

From what link did you download your ConTeXt? If it started with
"minimals.contextgarden.net", then that's the old ConTeXt; if it started
with "lmtx.pragma-ade.com" then it's the new LMTX. The wiki page that
you want is

   https://wiki.contextgarden.net/Installation#Unix
   
All the other wiki pages are outdated. 

This is just a wild guess, so I may be very wrong here.

If this doesn't work, then what do you get when you run

   type -ap context
   type -ap luatex
   type -ap texlua
   type -ap luametatex
   /full/path/to/texlive/2023/context --version
   /full/path/to/context/standalone/context --version
   ls -la /full/path/to/texlive/2023/context
   ls -la /full/path/to/context/standalone/context

(I'll also add that I have both the ConTeXt and TeX Live versions of
"context" installed on Linux, so it's definitely possible.)

Thanks,
-- Max
___
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] attempt to index nil value with bidi math in hbox

2023-04-02 Thread Max Chernoff via ntg-context
Hi Hans,

This test file:

   \setupdirections[bidi=global,method=one]
   \starttext
   \hbox{$\varepsilon$-TeX}
   \stoptext

gives the following error:

   callback error: 
...ext/tex/texmf-context/tex/context/base/mkxl/typo-duc.lmt:618: attempt to 
index a nil value (local 'before')
   stack traceback:
   ...ext/tex/texmf-context/tex/context/base/mkxl/typo-duc.lmt:618: in 
upvalue 'resolve_weak'
   ...ext/tex/texmf-context/tex/context/base/mkxl/typo-duc.lmt:781: in 
upvalue 'resolve_levels'
   ...ext/tex/texmf-context/tex/context/base/mkxl/typo-duc.lmt:1053: in 
local 'handler'
   ...ext/tex/texmf-context/tex/context/base/mkxl/typo-dir.lmt:182: in 
upvalue 'typesetters_directions_handler'
   [string "local tonut  = nodes.tonut..."]:20: in function <[string 
"local tonut  = nodes.tonut..."]:13>
   (...tail calls...)
   
Running either this:

   \starttext
   \hbox{$\varepsilon$-TeX}
   \stoptext

or this:

   \setupdirections[bidi=global,method=one]
   \starttext
   \hbox{$\varepsilon$TeX}
   \stoptext
   
works as expected, without any errors.

Thanks,
-- Max
___
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] tikz error upgrading to texlive version (artix)

2023-04-02 Thread Max Chernoff via ntg-context
Hi Xavier,

On Sun, 2023-04-02 at 11:00 +, Xavier B. wrote:
> Max, when I use context minimals, I get:
> 
> modules > 'pgfrcs' is not found
> modules > 'pgfmat' is not found
> modules > 'tikz' is loaded
> open source > level 3, order 4, name 
> '/home/xan/bin/context-minimal/tex/texmf-context/tex/context/modules/mkxl/m-tikz.mkxl'
> runtime error : input file 'pgfutil-common.tex' is not found, quitting
> mtx-context | fatal error: return code: 1
> make: *** [Makefile:10: ng-exercicis.conTeXt.pdf] Error 1
> [xan@coronari apunts-espa]$
> 
> 
> but when I run texlive, no errors shown:
> 
> $ pacman -Qs texlive
> local/texlive-bin 2023.66539-1
> TeX Live binaries
> local/texlive-core 2023.66587-1 (texlive-most)
> TeX Live core distribution
> local/texlive-pictures 2023.66549-1 (texlive-most)
> TeX Live - Packages for drawings graphics
> local/texlive-science 2023.66461-1 (texlive-most)
> TeX Live - Typesetting for mathematics, natural and computer sciences
> 
> 
> Any hints?

The ConTeXt distribution doesn't contain any packages/modules by
default, so you'll need to install TikZ manually. I usually use the
script listed here:

   https://wiki.contextgarden.net/Modules#ConTeXt_LMTX
   
But you could also install manually using the .zip file here:

   https://mirrors.ctan.org/install/graphics/pgf/base/pgf.tds.zip
   
-- Max

___
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] characters.tex.toutf bug

2023-03-30 Thread Max Chernoff via ntg-context
Hi Hans,

> it is more side effect of removing the (declared obsolete some years 
> ago) `` '' input which catched it later
> 
> i tend to remove
> 
>  for k, v in next, ligaturemapping do
>  hash[k] = v
>  end
>
> in favor of an explicit 'tquo' feature that one can enable if wanted
> 
> \definefontfeature[default][default][tlig=yes,tquo=yes,trep=yes]

That does make the output more consistent, but not in the way that I'm
wanting. My real code looks more like this:

   \definefontfeature[default][default][tlig=yes, tquo=yes, trep=yes]
   
   \startbuffer[test-bib]
   @article{one,
   author = {``Auth\v{o}r---One''},
   }
   @article{two,
   author = {``Authǒr---Two''},
   }
   \stopbuffer
   
   \usebtxdataset[test-bib.buffer]
   
   \startluacode
   for key, value in 
table.sortedpairs(publications.datasets.default.luadata) do
   print(key, publications.prerollcmdstring(value.author))
   end
   \stopluacode

publications.prerollcmdstring seems to run before any of the
replacements/ligatures, so with your fix I get this as the output:

   one ``Authǒr---One''
   two ``Authǒr---Two''
   
while with my suggested fix I get:

   one “Authǒr—One”
   two “Authǒr—Two”
   
I'm using a CLD document to convert a bunch of old .bib and .tex files into
Lua tables (which I'll then convert into XML). I can't modify any of the
input files, so I'll need to somehow deal with all the LaTeX-style input.
Using publications.prerollcmdstring + characters.tex.toutf seems like the
best way to do this, but I'm open to a different solution if you have any
suggestions.

Thanks,
-- Max
___
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] tikz error upgrading to texlive version (artix)

2023-03-30 Thread Max Chernoff via ntg-context
Hi Xavier,
> During the texlive package, I get this error:

> I simply run context to this file:
> 
> \usemodule[tikz]
> 
> \starttext
> {\bf a} \tikz (0,0) -- (1,0);
> \stoptext

> So, the problem is not the package or the distro, it's something more
> basic which causes the error.

Someone else reported this issue to the TikZ GitHub:

   https://github.com/pgf-tikz/pgf/issues/1248
   
so it's definitely not just you. There's also a suggested (temporary)
solution there. For a more permanent solution, someone will need to patch
the m-tikz.mkXX files distributed with ConTeXt.

-- Max
___
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] characters.tex.toutf bug

2023-03-29 Thread Max Chernoff via ntg-context
Hi Hans,

"characters.tex.toutf" only works if there is a backslash somewhere in
its input string. This leads to some really surprising behaviour in the
following example:

   \definefontfeature[default][tlig=no, trep=no]
   
   \startbuffer[test-bib]
   @article{one,
   author = {``Author---\v{O}ne''},
   }
   @article{two,
   author = {``Author---Two''},
   }
   \stopbuffer
   
   \usebtxdataset[test-bib.buffer]
   
   \starttext
   \placelistofpublications[method=dataset]
   \stoptext

Removing the following lines

   elseif not find(str,"\\",1,true) then
   return str
   
from the definition of "characters.tex.toutf" in "char-tex.{lmt,lua}"
fixes this issue for me.

Thanks,
-- Max
___
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] Float control

2023-03-01 Thread Max Chernoff via ntg-context

Hi Denis,

> The floats where jumping around, appearing in a different order than
> in the source file

Tables and figures can appear in different orders than each other, and a
top float could appear at the top of the page that it is mentioned, but
if you ever see Figure 2 before Figure 1 or a float appearing before it
is placed in the source (with the exception of the top issue), then
you've probably found a bug.

> some positioning keys had not the intended effect (e.g. top)

I've had mixed results with some of the positioning keys too, but "top"
should generally work okay. If you're using columns, weird stuff can
sometimes happen with top/bottom floats, but you should still be able to
make them work. You can also try adding

   \setupfloat[ntop=100]
   
at the start of you're document. I've had that fix an otherwise-
unexplainable bug once.

> I know, TeX's float positioning algorithm should be rather reliable
> and stable

Not as much as you would expect. The TeX page breaking algorithm is
greedy, single-pass, and dependant on every page prior, so you can get
some pretty chaotic results in pathological situations. "Typical"
documents don't usually have any issues, but you can (even accidentally)
make a document that gives some really weird results.

> Anyway, I'd like to learn more about the whole float issue. Is there anything 
> particular I could read to learn more about the whole thing?

The only float documentation for ConTeXt that I'm aware of is a short
section in It's in the Details

   
https://www.pragma-ade.nl/general/manuals/details.pdf#%5B%7B%22num%22%3A39%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22Fit%22%7D%5D
   
and another short section in the old Reference Manual

   http://pmrb.free.fr/contextref.pdf#aut%3A957
   
There's also the Wiki page

   https://wiki.contextgarden.net/Floating_Objects
   
and the source code

   https://source.contextgarden.net/tex/context/base/mkxl/strc-flt.mklx
   
I haven't been able to find anything that really goes into the details
though. (If there's something that I'm missing here, please let me know!
I've been looking for awhile now)

> Maybe I'm missing out on something fundamental...

At the TeX level, floats are known as \insert's/insertions. The end of
Chapter 15 in The TeXbook goes into detail here. TeX By Topic also has a
good description in Chapter 29

   https://texdoc.org/serve/texbytopic/0#chapter.29
   
Then there's also Low Level TeX which documents the changes in LMTX

   https://www.pragma-ade.com/general/manuals/lowlevel-inserts.pdf
   
Inserts are (in my opinion) the most complicated part of TeX. Even at an
engine level, they aren't that well documented. When writing the
footnote code for lua-widow-control, I had to read through "TeX the
program" since some of the details weren't documented anywhere else.

And as Peter mentioned, if you post a specific example someone will
probably come along and help.

-- Max
___
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] [m-database] How to properly add module arguments?

2023-02-26 Thread Max Chernoff via ntg-context
Hi Paul,

> I added a stanza to the appropriate interface file:
> 
> --- begin stanza added to i-database.xml ---
> 
> I modeled that after the stanza for the argument `strip`. I think
> that's the only thing I need to do in the interface file.

I'd recommend completely ignoring the interface i-*.xml files. They
don't do anything particularly useful for a third-party module.

>\c!skipheader=\v!no, % <- Added, following the pattern with strip

This line is your issue. Inside \unprotect...\protect, "!" is treated as
a letter, so you're trying to expand the value of the macro
"\c!skipheader". The problem is that that macro isn't defined anywhere. 

Backing up a little further, the \c!... commands are all string
*C*onstants. If you see a command with a name like \c!blah, it almost
certain expands to exactly the string "blah". Why is this useful? Well,
if you run ConTeXt in another language, then the \c!... commands will
instead contain that string but in the other language. So something like
\c!left would be "left" in English, "gauche" in French, "links" in
German, "vlevo" in Czech, etc. 

You could define \c!skipheader to just be "skipheader", or you could
give it a translated value for 10 or so languages. But the easier
solution is to just use the string "skipheader" directly:

   \setupdatabase
 [\c!separator={,},
  \c!quotechar=,
  \c!commentchar=,
  \c!strip=\v!no,
  skipheader=\v!no, % <-- HERE
  \c!before=,
  \c!after=,
  \c!first=,
  \c!last=,
  \c!left=,
  \c!right=]
   
As a more general suggestion, it is usually a really bad idea to modify the
standard ConTeXt files since any changes will be overwritten on updates.
Probably the best solution is to make a new file called "t-xdatabase.mkiv"
stored in your texmf-local/, start the file with "\usemodule[database]"
then add any changes after that. Or, just copy and paste the original file
into your new file. (Maybe you were doing this already though)
   
Hope this helps,
-- Max
___
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] Unwanted space with \startframedtext

2022-12-21 Thread Max Chernoff via ntg-context
Hi Hans,

There's an uncommented linebreak in the definition of
\pack_framed_text_start that's introducing an unwanted space just before
\startframedtext. 

Minimal example:

   \showmakeup[space]
   \starttext
   \hbox{.\startframedtext.\stopframedtext}
   \stoptext
   
Patch:

   --- texmf-context/tex/context/base/mkxl/pack-rul.old 2022-12-21 
19:12:14.790830416 -0700
   +++ texmf-context/tex/context/base/mkxl/pack-rul.mkxl2022-12-21 
19:12:26.193652551 -0700
   @@ -2693,7 +2693,7 @@

\tolerant\protected\def\pack_framed_text_start[#1]#*[#2]#*[#3]% or 
#1#*[#2]#*[#3]% and pass {#1}
  {\bgroup
   -   \edef\currentframedtext{#1}
   +   \edef\currentframedtext{#1}%
   \doifelseassignment{#2}
 {\pack_framed_text_start_indeed\empty{#2}}
 {\pack_framed_text_start_indeed{#2}{#3}}}

(originally reported at https://tex.stackexchange.com/q/669296/270600)

Thanks,
-- Max
___
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] Achieving different \cite styles

2022-12-09 Thread Max Chernoff via ntg-context

Hi Jethro,

> I am interested in being able to cite in different ways. By analogy, I
> refer to the \texcite{}, \parencite{} and other options available with
> biblatex in LaTeX. How do I achieve something like \textcite{} in
> ConTeXt?

Page 34 of the publications manual lists the various styles:

   https://www.pragma-ade.nl/general/manuals/mkiv-publications.pdf#page=35
   
\parencite is like \cite[authoryear][article] and \textcite is like
\cite[authoryears][article]. The names are admittedly a little confusing,
but you can define your own wrappers with something like

   \define\parencite[1]{\cite[authoryear][#1]}
   \define\textcite[1]{\cite[authoryears][#1]}

-- Max
___
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] Font expansion enabled by default with the latest upload

2022-11-21 Thread Max Chernoff via ntg-context

Hi Hans,

> what you observe is likely a side effect of an increase in accuracy 
> which gives a bit less drift in the pdf; expansion is turned off (it 
> would increase runtime if turned on)

It's not just in the PDF though, I can also see the change from Lua.

Using this document:

   \showframe
   
   % \definefontfeature[default][default][expansion=quality]
   % \usetypescript[modern-base]
   % \setupbodyfont[reset,modern]
   % \setupalign[hz]
   
   \startluacode
   function userdata.test(head)
   local last_line = node.tail(head)
   local i = 1
   for n in node.traverse(node.tail(last_line.list), true) do
   print(n)
   if n.id == node.id("glue") then
   print(node.effectiveglue(n, last_line) / 65536)
   elseif n.width then
   print(n.width / 65536)
   end
   
   if i >= 6 then
   break
   else
   i = i + 1
   end
   end
   
   return head
   end
   
   nodes.tasks.appendaction("finalizers", "after", "userdata.test")
   nodes.tasks.enableaction("finalizers", "userdata.test")
   \stopluacode
   
   \starttext
   Hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello.%
   \ctxlua{nodes.tasks.enableaction("finalizers", "userdata.test")}
   
   \ctxlua{nodes.tasks.disableaction("finalizers", "userdata.test")}
   \stoptext

(A) With the expansion lines commented/default on ConTeXt "2022.11.18
13:22" I get:

   nil : glue righthangskip>
   0.0
 13299 : glue rightskip>
   0.0
 13263 : glue parfillskip>
   0.0
 12877 : penalty linepenalty>
  1687 : glyph unset>
   3.3341674804688
 12850 : glyph unset>
   5.9967041015625
   
(B) With the expansion lines uncommented/enabled on ConTeXt "2022.11.18
13:22" I get:

   nil : glue righthangskip>
   0.0
 13992 : glue rightskip>
   0.0
 13956 : glue parfillskip>
   0.046096801757812
 12877 : penalty linepenalty>
  1687 : glyph unset>
   3.3341674804688
 12850 : glyph unset>
   5.9967041015625
   
(C) With the expansion lines commented/default live.contextgarden.net I
get:

   nil : glue righthangskip>
   0.0
 10943 : glue rightskip>
   0.0
 10909 : glue parfillskip>
   6.6463470458984
 10138 : penalty linepenalty>
   524 : glyph 32768>
   3.26220703125
 10119 : glyph 32768>
   5.8767700195312

(D) And with the expansion lines uncommented/enabled on
live.contextgarden.net I get:

   nil : glue righthangskip>
   0.0
 11195 : glue rightskip>
   0.0
 11161 : glue parfillskip>
   0.046096801757812
 10138 : penalty linepenalty>
   524 : glyph 32768>
   3.3341674804688
 10119 : glyph 32768>
   5.9967041015625

A, B, and D all have almost the same \parfillskip widths, and the exact
same "." and "o" widths. But comparing A/B/D to C, there's a 6.6pt
difference in the \parfillskip values and a 0.12pt difference between
the "o" widths.

Maybe it's just a coincidence, but it seems odd that enabling expansion
makes no difference with the latest version (A/B) and that latest with
no expansion (A) gives identical results to the old version with
expansion (D). Plus, a 6.6pt difference in glue lengths seems like a lot
for an accuracy change.

I could very easily be wrong here, but something seems off to me.

Thanks,
-- Max
___
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] thousand separator space

2022-11-21 Thread Max Chernoff via ntg-context

Hi Jan,


> Why is there an additional space after the thousand separator in math mode?

Because something like

   ${\mathbb N} = \{1,2,3,4,\dots\}$
   
would look quite bad without any space between the numbers.

(The technical reason is that commas have the math class \mathpunct,
meaning that TeX automatically adds a space after them. Adding the
braces converts it to \mathord, which doesn't add any spaces.)

> And what can I do to get rid of the additional space?

The TeXbook recommends that you wrap the comma in curly braces

   $x = 1{,}000$
   
but there's probably a ConTeXt \setupxxx command that would have the same
effect. 

Many European languages use the comma as a decimal separator, so I'd
generally recommend using a thinspace (\,) instead of a comma as a
thousands separator to avoid confusion. 

Thanks,
-- Max
___
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] Horizontal spacing

2022-11-21 Thread Max Chernoff via ntg-context

Hi Steffen,

> But how can I adjust in general the horizontal distance between glyphs
> (I don't mean \kern, I am looking for a general setup)?

You probably want \definecharacterkerning. See

   https://www.pragma-ade.nl/general/manuals/fonts-mkiv.pdf#page=171

for details on how to use it.

-- Max
___
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] Font expansion enabled by default with the latest upload

2022-11-21 Thread Max Chernoff via ntg-context
Hi Hans,

Font expansion (hz) seems to be enabled by default with the latest
upload. 

If I compile this document locally with ConTeXt "2022.11.18 13:22":

   \showframe
   
   % \definefontfeature[default][default][expansion=quality]
   % \usetypescript[modern-base]
   % \setupbodyfont[reset,modern]
   % \setupalign[hz]
   
   \starttext
   Hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello hello hello hello hello hello hello hello hello hello
   hello hello hello.
   \stoptext

I get slightly different spacing than I do when I compile the same
document on live.contextgarden.net. If I compile the document with the
lines uncommitted on live.contextgarden.net, I get the same results as I
do on my local installation with the lines commented.

Personally, I think that enabling hz expansion by default is probably a
good thing, but this change will affect a very large number of documents
and you never mentioned it in the announcement email, so I suspect that
it was accidentally added when you added the math hz.

Thanks,
-- Max
___
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 simulate \hss in luametatex?

2022-11-11 Thread Max Chernoff via ntg-context
Hi,

> I want to  simulate \hss  in lua end in ConTeXt/luametatex environment.
> For example,
> 
> ```ConTeXt
> a{\raise 1.5ex\hbox to 0pt{\hss b}}c
> ```

> And in lua, I do as follows(part of my app seen in attachment):

Your code doesn't compile as is. I think that this is the same thing
though:

   \starttext
   \startluacode
   local a = node.new"glyph"
   a.char = string.byte("a")
   a.font = font.current()
   
   local b = node.new"glyph"
   b.char = string.byte("b")
   b.font = font.current()
   
   local c = node.new"glyph"
   c.char = string.byte("c")
   c.font = font.current()
   
   local hss = node.new("glue")
   hss.stretch = 65536
   hss.stretchorder = 2
   hss.shrink = 65536
   hss.shrinkorder = 2
   hss.width = 0
   b = node.insertbefore(b, b, hss)
   
   local box = node.new("hlist", "box")
   box.head = b
   box.width = 0
   box.shift = -tex.sp("1ex")
   
   tex.forcehmode()
   node.write(a + box + c)
   \stopluacode
   \stoptext

> And got 'b' on top of 'c' in pdf as follows:
> 
> ```pdf
>   b
> ac
> ```

The \hss isn't the problem here. The problem is actually with the box.
When you manually make the \hbox like that, I think (although I could be
wrong) that you're bypassing all of TeX's glue calculations. You should
probably use "node.hpack" instead:

   \starttext
   \startluacode
   local a = node.new"glyph"
   a.char = string.byte("a")
   a.font = font.current()
   
   local b = node.new"glyph"
   b.char = string.byte("b")
   b.font = font.current()
   
   local c = node.new"glyph"
   c.char = string.byte("c")
   c.font = font.current()
   
   local hss = node.new("glue")
   hss.stretch = 65536
   hss.stretchorder = 2
   hss.shrink = 65536
   hss.shrinkorder = 2
   hss.width = 0
   
   local box = node.hpack(hss + b, "exactly", 0)
   box.shift = -tex.sp("1ex")
   
   tex.forcehmode()
   a.next = box
   box.next = c
   node.write(a)
   \stopluacode
   \stoptext

-- Max

___
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] node.setglue broken in LuaMetaTeX

2022-11-07 Thread Max Chernoff via ntg-context
Hi Hans,

Using node.setglue in LuaMetaTeX sets all of the glue components to
zero.

This example:

   \startluacode
   local stretch_order = "stretch_order"
   local shrink_order = "shrink_order"
   if status.luatex_engine == "luametatex" then
   stretch_order = "stretchorder"
   shrink_order  ="shrinkorder"
   end
   
   local glue = node.new "glue"
   print(node.getglue(glue))
   node.setglue(glue, 1, 2, 3, 4, 5)
   print(node.getglue(glue))
   glue.width = 1
   glue.stretch = 2
   glue.shrink = 3
   glue[stretch_order] = 4
   glue[shrink_order] = 5
   print(node.getglue(glue))
   node.setglue(glue, 1, 2, 3, 4, 5)
   print(node.getglue(glue))
   \stopluacode

produces this output in MkIV:

   0   0   0   0   0
   1   2   3   4   5
   1   2   3   4   5
   1   2   3   4   5
   
but this output in MkXL:

   0   0   0   0   0
   0   0   0   0   0
   1   2   3   4   5
   0   0   0   0   0
   
Thanks,
-- Max
___
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] "true" units in LuaMetaTeX

2022-10-27 Thread Max Chernoff via ntg-context

Hi Hans,

> Anyway, I'll check it. Is anyone still using this "true" actually?

I've been playing around with LuaMetaLaTeX/LuaMetaPlain recently

   https://github.com/zauguin/luametalatex
   
and plain.tex uses truein for typesetting the footnote rule. It's trivial
to fix that specific case, but I'm finding 140 other files in TeX Live that
use the "true" dimensions, 69 of which that have been updated in the past 3
years. I doubt that anyone in ConTeXt uses the "true" dimensions though.

> I don't check github, it's mostly there for the compile farm and 
> intermediate testing (e.g. math stuff) so sending me a mail is ok. When 
> there is some serious issue a mwe to the list is good enough.

K, will do.

Thanks,
-- Max
___
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] "true" units in LuaMetaTeX

2022-10-27 Thread Max Chernoff via ntg-context
Hi Hans,

The unit scanner in LuaMetaTeX fails for any of the "true" dimensions. 

With this test file:

   \starttext
   \vrule width 1truein height 1pt depth 0pt\relax
   
   \vrule width 1in height 1pt depth 0pt\relax
   \stoptext

I get this output:

   tex error   > tex error on line 2 in file ./lmtx-true.tex: Valid keyword 
expected, likely 'true'
   

   \vrule width 1truei
   n height 1pt depth 0pt\relax
   
   1 \starttext
   2 >>  \vrule width 1truein height 1pt depth 0pt\relax
   3 
   4 \vrule width 1in height 1pt depth 0pt\relax
   5 \stoptext
   6 

I was able to fix this with the patch at the end of the email.

(Also, how do you want patches sent? Via email to the mailing list,
emailed directly to you, as a pull request on GitHub, or something
else?)

Thanks,
-- Max

-- >8 --
From 69f186daa9b3bf53697e6edf1bd9b066d64b35fe Mon Sep 17 00:00:00 2001
From: Max Chernoff <49086429+gucci-on-fl...@users.noreply.github.com>
Date: Wed, 26 Oct 2022 23:45:19 -0600
Subject: [PATCH] Fix scanning of "true" units

---
 source/tex/texscanning.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source/tex/texscanning.c b/source/tex/texscanning.c
index 7f78d80..98a9c41 100644
--- a/source/tex/texscanning.c
+++ b/source/tex/texscanning.c
@@ -2304,6 +2304,7 @@ typedef enum scanned_unit {
 
 static int tex_aux_scan_unit(halfword *num, halfword *denom, halfword *value, 
halfword *order)
 {
+  AGAIN:
 do {
 tex_get_x_token();
 } while (cur_cmd == spacer_cmd);
@@ -2327,7 +2328,6 @@ static int tex_aux_scan_unit(halfword *num, halfword 
*denom, halfword *value, ha
 goto BACK_TWO;
 }
 cur_cs = save_cur_cs;
-  AGAIN:
 switch (chrone) {
 case 'p': case 'P':
 switch (chrtwo) {
-- 
2.37.3


___
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] Missing parinitskips in \normalizelinemode=0

2022-10-26 Thread Max Chernoff via ntg-context

Hi Hans,

> i'll bypass that warnign when the mode is zero

I saw that you made that change in the latest upload, thanks.
Unfortunately, I'm still getting the same output:

   luatex warning  > linebreak: list seems already prepared
   luatex warning  > linebreak: [ leftinit | rightinit | leftfill | rigthfill ] 
expected
   nil
   
Also, what's causing me issues isn't the warning but rather that
tex.linebreak is returning nil instead of an info table as the second
return value.

> btw, you need to work with a copy of the list

Now that you point that out, I'm actually surprised that that example
worked at all. The real code does use a copy of the list though (and
also uses the proper callback interfaces instead of "system.callbacks.
permitoverloads")

Thanks,
-- Max

___
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] Missing parinitskips in \normalizelinemode=0

2022-10-18 Thread Max Chernoff via ntg-context
Hi Hans,

When running in \normalizelinemode=0, the \parinitleftskip and 
\parinitrightskip nodes are either nonexistant or invisible from Lua,
causing tex.linebreak to not work correctly.

This sample file:

   \enabledirectives[system.callbacks.permitoverloads]
   
   \normalizelinemode=0
   
   \directlua{
   callback.register("pre_linebreak_filter", function(head)
   tex.preparelinebreak(head)
   local list, info = tex.linebreak(head)
   print(info)
   
   return head
   end)
   }
   
   \starttext
  \input knuth
   \stoptext

Produces this output:

   luatex warning  > linebreak: list seems already prepared
   luatex warning  > linebreak: [ leftinit | rightinit | leftfill | rigthfill ] 
expected
   nil
   
Thanks,
-- Max
___
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] issues with current latest

2022-10-14 Thread Max Chernoff via ntg-context
On Fri, 2022-10-14 at 16:38 -0600, Alan Braslau wrote:
> On Fri, 14 Oct 2022 16:33:12 -0600
> Max Chernoff  wrote:
> 
> > Do you know how to rebuild the format? I've tried the following to no
> > avail:
> > 
> > --script mtx-context
> 
> I believe that you have to give the full script path here to mtxrun

Thanks! Running:

   luatex --luaonly "/opt/context/tex/texmf-linux-64/bin/mtxrun.lua" --script 
/opt/context/tex/texmf-context/scripts/context/lua/mtx-context.lua --luatex 
--make --redirected

has fixed the format issue. 

I now unfortunately have a new issue (probably for Hans or Mikael).
Running:

   context --luatex empty.tex
   
where "empty.tex" is:

   \starttext
   \null
   \stoptext

gives me this output:

   mtx-context | redirect luametatex -> luatex: luatex --luaonly 
"/opt/context/tex/texmf-linux-64/bin/mtxrun.lua" --script mtx-context --luatex 
empty.tex --redirected
   
   resolvers   | formats | executing runner 'run luatex format': 
/opt/context/tex/texmf-linux-64/bin/luatex --jobname="empty" 
--fmt=/home/max/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en.fmt
 
--lua=/home/max/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en.lui
 cont-yes.mkiv --c:currentrun=1 --c:engine="luatex" 
--c:fulljobname="./empty.tex" --c:input="./empty.tex" --c:kindofrun=1 
--c:luatex --c:maxnofruns=9 --c:redirected 
--c:texmfbinpath="/opt/context/tex/texmf-linux-64/bin"
   This is LuaTeX, Version 1.15.1 (TeX Live 2023/dev) 
system commands enabled.
   open source > level 1, order 1, name 
'/opt/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'
   job > passes > version mismatch: 1.33 <> 1.32
   system  > 
   system  > ConTeXt  ver: 2022.10.14 10:16 MKIV  fmt: 2022.10.14  int: 
english/english
   system  > 
   system  > 'cont-new.mkiv' loaded
   open source > level 2, order 2, name 
'/opt/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
   system  > beware: some patches loaded from cont-new.mkiv
   close source> level 2, order 2, name 
'/opt/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
   system  > files > jobname 'empty', input './empty', result 'empty'
   fonts   > latin modern fonts are not preloaded
   languages   > language 'en' is active
   open source > level 2, order 3, name 
'/home/max/Projects/lua-widow-control/nogit-testing/empty.tex'
   fonts   > preloading latin modern fonts (second stage)
   
   lua error   > lua error on line 1 in file 
/home/max/Projects/lua-widow-control/nogit-testing/empty.tex:
   
   ...tex/texmf-context/tex/context/fonts/mkiv/common-math.lfg:100: attempt to 
index a nil value (field 'subsets')
   stack traceback:
...tex/texmf-context/tex/context/fonts/mkiv/common-math.lfg:100: in 
field 'moveitalics'
.../context/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg:103: in 
main chunk
[C]: in function 'dofile'
...ext/tex/texmf-context/tex/context/base/mkiv/good-ini.lua:78: in 
function <...ext/tex/texmf-context/tex/context/base/mkiv/good-ini.lua:68>
(...tail calls...)
   
   1 >>  \starttext
   2 \null
   3 \stoptext
   4 
   
   mtx-context | fatal error: return code: 256

The same file compiles just fine with LMTX.

Thanks,
-- Max
___
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] issues with current latest

2022-10-14 Thread Max Chernoff via ntg-context
Hi Alan,

On Fri, 2022-10-14 at 16:20 -0600, Alan Braslau wrote:
> On Fri, 14 Oct 2022 15:38:52 -0600
> Max Chernoff via ntg-context  wrote:
> 
> 
>$ context --luatex test.tex
>mtx-context | redirect luametatex -> luatex: luatex --luaonly 
> "/opt/context/tex/texmf-linux-64/bin/mtxrun.lua" --script mtx-context 
> --luatex test.tex --redirected
>mtxrun  | unknown script 'mtx-context.lua' or
> 'mtx-mtx-context.lua'
> 
> This happens when the luatex cache is cleared and the context format is not 
> rebuilt properly.

Do you know how to rebuild the format? I've tried the following to no
avail:

   $ mtxrun --generate
   [snip]
   
   $ context --make
   [snip]
   
   $ context --luatex --make
   mtx-context | redirect luametatex -> luatex: luatex --luaonly 
"/opt/context/tex/texmf-linux-64/bin/mtxrun.lua" --script mtx-context --luatex 
--make --redirected
   mtxrun  | unknown script 'mtx-context.lua' or 'mtx-mtx-context.lua'
   
   $ TEXINPUTS="$(dirname $(mtxrun --findfile 'cont-en.mkiv' | head -1))" 
luatex -ini cont-en.mkiv
   warning: /opt/context/tex/texmf/web2c/texmf.cnf:49: (kpathsea) No cnf value 
on line: OSFONTDIR =.
   This is LuaTeX, Version 1.15.1 (TeX Live 2023/dev)  (INITEX)
system commands enabled.
   (/opt/context/tex/texmf-context/tex/context/base/mkiv/cont-en.mkiv
   (/opt/context/tex/texmf-context/tex/context/base/mkiv/context.mkiv
   (/opt/context/tex/texmf-context/tex/context/base/mkiv/syst-ini.mkiv)
   (/opt/context/tex/texmf-context/tex/context/base/mkiv/norm-ctx.mkiv)
   (/opt/context/tex/texmf-context/tex/context/base/mkiv/syst-pln.mkiv)
   (/opt/context/tex/texmf-context/tex/context/base/mkiv/syst-mes.mkiv)
   
(/opt/context/tex/texmf-context/tex/context/base/mkiv/luat-cod.mkiv[\directlua]
   :1: attempt to call a nil value (field 'registercode')
   stack traceback:
[\directlua]:1: in main chunk.
   \registerctxluafile ...ua.registercode("#1","#2")}
 
   l.73 \registerctxluafile{luat-cod}{}
 
   ? x
181 words of node memory still in use:
  1 dir, 22 glue_spec nodes
  avail lists: 2:3
   No pages of output.
   Transcript written on cont-en.log.

   $ fmtutil --all
   bash: fmtutil: command not found...
   
   $ context --make cont-en.mkiv
   [snip]
   
Not sure what else to try.

Thanks,
-- Max
___
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] issues with current latest

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

Hi Pablo,

> I’m afraid that I cannot make latest from 2022.10.14 10:16 with LuaTeX.
> 
> I’m on Linux64.

I've got the same configuration and I'm getting the same results:

   $ context --luatex test.tex
   mtx-context | redirect luametatex -> luatex: luatex --luaonly 
"/opt/context/tex/texmf-linux-64/bin/mtxrun.lua" --script mtx-context --luatex 
test.tex --redirected
   mtxrun  | unknown script 'mtx-context.lua' or 'mtx-mtx-context.lua'
   
   $ luatex '\relax'
   warning: /opt/context/tex/texmf/web2c/texmf.cnf:49: (kpathsea) No cnf value 
on line: OSFONTDIR =.
   This is LuaTeX, Version 1.15.1 (TeX Live 2023/dev) 
system commands enabled.
   
   kpathsea: Running mktexfmt luatex.fmt
   mktexfmt: No such file or directory
   I can't find the format file `luatex.fmt'!
   
   $ luatex -ini '\end'
   warning: /opt/context/tex/texmf/web2c/texmf.cnf:49: (kpathsea) No cnf value 
on line: OSFONTDIR =.
   This is LuaTeX, Version 1.15.1 (TeX Live 2023/dev)  (INITEX)
system commands enabled.
   No pages of output.
   Transcript written on texput.log.
   
LuaMetaTeX works fine though.

Thanks,
-- Max
___
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 make something appear to the right of every paragraph?

2022-10-13 Thread Max Chernoff via ntg-context
Hi Joel,
> When I use the code given, it compiles and displays fine. But when I
> try replacing \everypar with \EveryPar, it halts during compiling

It looks like \EveryPar is a macro and not a token list.

> These both work great, but do that for the whole document? Is there a
> way to restrict it to only apply the lines to some parts of the file,
> not every single paragraph?

Option 1:

   \newif\ifprintlines
   
   \EveryPar{%
   \ifprintlines%
   \vbox to 0pt{%
   \dorecurse{3}{%
   \rlap{%
   \hskip\dimexpr\hsize+1em%
   \vrule height 0.4pt width 3cm%
   \relax%
   }%
   }%
   }%
   \fi%
   }
   
   \parskip=\baselineskip
   
   \starttext
   \printlinestrue
   One line paragraph
   
   Two line paragraph \\
   Two line paragraph
   
   Three line paragraph \\
   Three line paragraph \\
   Three line paragraph
   \printlinesfalse
   
   Four line paragraph \\
   Four line paragraph \\
   Four line paragraph \\
   Four line paragraph
   
   \samplefile{bryson}
   
   \printlinestrue
   \samplefile{knuth}
   \stoptext

Option 2:

   \startluacode
   -- Constants
   local RULE_OFFSET= tex.sp "1em"
   local RULE_THICKNESS = tex.sp "0.4pt"
   local RULE_LENGTH= tex.sp "3cm"
   
   local show_lines = true
   
   -- Callback
   function userdata.lines(head)
   if status.output_active or
  tex.nest.ptr > 1 or
  not show_lines
   then
   return head
   end
   
   local i = 0
   for n in node.traverseid(node.id "hlist", head) do
   i = i + 1
   if i > 3 then
   break
   end
   
   local offset = node.new "glue"
   offset.width = RULE_OFFSET
   node.slide(n.list).next = offset
   
   local rule = node.new "rule"
   rule.width = RULE_LENGTH
   rule.height = RULE_THICKNESS
   rule.depth = 0
   offset.next = rule
   end
   
   return head
   end
   
   nodes.tasks.appendaction(
   "finalizers",
   "after",
   "userdata.lines"
   )
   
   interfaces.implement {
   name  = "showlines",
   public= true,
   arguments = { "boolean" },
   actions   = function(x)
   show_lines = x
   end,
   }
   \stopluacode
   
   \parskip=\baselineskip
   
   \starttext
   \showlines true
   One line paragraph
   
   Two line paragraph \\
   Two line paragraph
   
   Three line paragraph \\
   Three line paragraph \\
   Three line paragraph
   
   \showlines false
   Four line paragraph \\
   Four line paragraph \\
   Four line paragraph \\
   Four line paragraph
   
   \samplefile{bryson}
   
   \showlines true
   \samplefile{knuth}
   \stoptext

These are both kind of hacky though. I'd recommend that you use Hans's
solution instead:

   \starttext
   
   \def\StartHack
 {\margintext
   [location=right,style=]
   {\thinrules[n=3]}}
   
   \def\StopHack
 {\par \ifnum\prevgraf<3
\blank[\the\numexpr4-\prevgraf\relax*line]
  \fi}
   
   \StartHack \input tufte \StopHack
   
   \StartHack test test \StopHack
   
   \StartHack test test \StopHack
   
   \stoptext

Thanks,
-- Max
___
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] atan2 function

2022-10-13 Thread Max Chernoff via ntg-context

Hi,

> The angle function doesn't appear to provide the same calculation as
> my atantwo in all cases.

They both give the same results, but "angle" gives a result in degrees
while "atantwo" gives a result in radians. This demo:

   \startMPpage
   vardef atantwo( expr dy, dx ) =
   save theta;
   
   numeric theta;
   
   theta := 0;
   
   if (dx > 0):
   theta := atan( dy / dx );
   elseif (dx < 0) and (dy >= 0):
   theta := atan( dy / dx ) + pi;
   elseif (dx < 0) and (dy < 0):
   theta := atan( dy / dx ) - pi;
   elseif (dx == 0) and (dy > 0):
   theta := pi / 2;
   elseif (dx == 0) and (dy < 0):
   theta := -pi / 2;
   fi;
   
   theta
   enddef;
   
   def showangles(expr dx, dy) =
   message "---"
   message "atantwo " & decimal atantwo(dy, dx)
   message "angle " & decimal (angle(dx, dy) * pi / 180)
   message "angle " & decimal angle(dx, dy)
   message "(" & decimal dx & ", " & decimal dy & ")"
   enddef;
   
   showangles(1, 0);
   showangles(1, 1);
   showangles(0, 1);
   showangles(-1, 1);
   showangles(-1, 0);
   showangles(-1, -1);
   showangles(0, -1);
   showangles(1, -1);
   \stopMPpage

gives:

   (1, 0)
   angle 0
   angle 0
   atantwo 0
   ---
   (1, 1)
   angle 45
   angle 0.78539816339744828
   atantwo 0.78539816339744828
   ---
   (0, 1)
   angle 90
   angle 1.5707963267948966
   atantwo 1.5707963267948966
   ---
   (-1, 1)
   angle 135
   angle 2.3561944901923448
   atantwo 2.3561944901923448
   ---
   (-1, 0)
   angle 180
   angle 3.1415926535897931
   atantwo 3.1415926535897931
   ---
   (-1, -1)
   angle -135
   angle -2.3561944901923448
   atantwo -2.3561944901923448
   ---
   (0, -1)
   angle -90
   angle -1.5707963267948966
   atantwo -1.5707963267948966
   ---
   (1, -1)
   angle -45
   angle -0.78539816339744828
   atantwo -0.78539816339744828
   ---
   
Thanks,
-- Max
___
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] atan2 function

2022-10-13 Thread Max Chernoff via ntg-context
Hi,

> How is atan2 called? I rolled my own as follows:

> Is atan with two parameters supposed to behave like atan2?

At mp-math.mpxl:167 there is:

   vardef atan   primary x = angle(1,x)   enddef ;
   
The MetaPost manual says:

   The angle operator takes a pair and computes the two-argument
   arctangent; i.e., angle is the inverse of the dir operator
   
So it looks like "angle" is the function that you want for "atan2". 

Thanks,
-- Max
___
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] LMTX generates PDFs with non-working fonts on real printers

2022-10-12 Thread Max Chernoff via ntg-context
On Wed, 2022-10-12 at 13:14 +0200, Leah Neukirchen wrote:
> > Seeing that you're modifying the font encoding, could you perhaps
> > reconsider supporting hinting in LMTX? 
> > 
> >https://mailman.ntg.nl/pipermail/ntg-context/2022/106311.html
> > 
> > Even with a high resolution screen, I can still see a difference, and
> > the issue can show up in print too:
> > 
> >
> >https://graphicdesign.stackexchange.com/q/5874
> >
> > I'm fairly confident that these issues are all hinting-related:
> > 
> >https://mailman.ntg.nl/pipermail/ntg-context/2022/106874.html
> >https://mailman.ntg.nl/pipermail/ntg-context/2022/105212.html
> >
> > Considering that all of the fonts included with ConTeXt are hinted, it
> > seems like a shame to not include any of that data in the generated
> > PDFs.
> 
> The last version of font-cff.lua should also copy the hinting-related
> values of the CFF properly (/BlueScale, /StemSnap[HV] etc).
> We fixed that on the side. ;)

Yay!

Thanks,
-- Max
___
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] Spacing in \unit - SOLVED

2022-10-12 Thread Max Chernoff via ntg-context
Hi Gavin,

On Wed, 2022-10-12 at 15:54 -0600, Gavin wrote:
> Hi Max, Alan, Bruce, Hans, et.al
> 
> I solved my four issues with \unit spacing. In the process, I
> prevented unwanted line breaks and removed an overzealous backspace
> before division symbols. Below is a MWE that shows all of these
> issues, as well as pictures of the result with the unmodified phys-
> dim.mkxl and with my modified phys-dim.mkxl. The final result is
> exactly what I wanted.

This new output looks *much* better than the old one, thanks! 

My only comment is that the spacing around the multiplication sign looks
a little too tight to me. The original spacing was probably too large,
but I think that a little more space than you currently have would be
better.

> If anyone wants my changes, either for their own use or to improve the
> distributed phys-dim.mkxl, I’m happy to share.

Yes, can you please share that to the list?

Hi Rik,

> It does look like you have introduced additional space before the 
> solidus. Was that intentional?

I believe that that is intentional. From the earlier email:

> removed an overzealous backspace before division symbols.

This new spacing looks much more even to me, especially around the
exponents.

Thanks,
-- Max
___
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] LMTX generates PDFs with non-working fonts on real printers

2022-10-11 Thread Max Chernoff via ntg-context
Hi Leah,


> > Leah and I are zooming in on the issue. It might relate to wrong font
> > matrix default behavior in the pdf printer driver, and GS got a fix
> > for that long ago, so maybe old printers with not-updated drivers can
> > be affected.
> >
> > Once we're confident that we can catch it Leah (who does the low level
> > introspective testing with viewers, printers and tools) likely will
> > report on it and there will be a test file for users to test if what
> > we do is okay before we apply the safeguard.
> 
> There's a write up now on the issue:
> https://leahneukirchen.org/blog/archive/2022/10/50-blank-pages-or-black-box-debugging-of-pdf-rendering-in-printers.html

Great write up! I was expecting the issue to be something quite simple,
but it's actually fairly complicated. Especially considering that the
issue only happens with a few printer models, I'm pretty impressed that
you managed to find the problem. At least the fix appears quite easy.

Seeing that you're modifying the font encoding, could you perhaps
reconsider supporting hinting in LMTX? 

   https://mailman.ntg.nl/pipermail/ntg-context/2022/106311.html

Even with a high resolution screen, I can still see a difference, and
the issue can show up in print too:

   
   https://graphicdesign.stackexchange.com/q/5874
   
I'm fairly confident that these issues are all hinting-related:

   https://mailman.ntg.nl/pipermail/ntg-context/2022/106874.html
   https://mailman.ntg.nl/pipermail/ntg-context/2022/105212.html
   
Considering that all of the fonts included with ConTeXt are hinted, it
seems like a shame to not include any of that data in the generated
PDFs.

Thanks,
-- Max
___
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 make something appear to the right of every paragraph?

2022-10-10 Thread Max Chernoff via ntg-context
Hi Joel,

On Mon, 2022-10-10 at 12:46 +, Joel wrote:
>  Hello Max,
> It is preferred if the solution is just three lines per paragraph,
> rather than some content parallel to the text

A Lua callback solution:

   \startluacode
   -- Constants
   RULE_OFFSET= tex.sp "1em"
   RULE_THICKNESS = tex.sp "0.4pt"
   RULE_LENGTH= tex.sp "3cm"
   
   -- Callback
   function userdata.lines(head)
   if status.output_active or
  tex.nest.ptr > 1
   then
   return head
   end
   
   local i = 0
   for n in node.traverseid(node.id "hlist", head) do
   i = i + 1
   if i > 3 then
   break
   end
   
   local offset = node.new "glue"
   offset.width = RULE_OFFSET
   node.slide(n.list).next = offset
   
   local rule = node.new "rule"
   rule.width = RULE_LENGTH
   rule.height = RULE_THICKNESS
   rule.depth = 0
   offset.next = rule
   end
   
   return head
   end
   
   nodes.tasks.appendaction(
   "finalizers",
   "after",
   "userdata.lines"
   )
   \stopluacode
   
   \parskip=\baselineskip
   
   \starttext
   One line paragraph
   
   Two line paragraph \\
   Two line paragraph
   
   Three line paragraph \\
   Three line paragraph \\
   Three line paragraph
   
   Four line paragraph \\
   Four line paragraph \\
   Four line paragraph \\
   Four line paragraph
   
   \samplefile{bryson}
   
   \samplefile{knuth}
   \stoptext

An \everypar solution:

   \appendtoks%
   \vbox to 0pt{%
   \dorecurse{3}{%
   \rlap{%
   \hskip\dimexpr\hsize+1em%
   \vrule height 0.4pt width 3cm%
   \relax%
   }%
   }%
   }%
   \to\everypar
   
   \parskip=\baselineskip
   
   \starttext
   One line paragraph
   
   Two line paragraph \\
   Two line paragraph
   
   Three line paragraph \\
   Three line paragraph \\
   Three line paragraph
   
   Four line paragraph \\
   Four line paragraph \\
   Four line paragraph \\
   Four line paragraph
   
   \samplefile{bryson}
   
   \samplefile{knuth}
   \stoptext

Neither of these solutions are great though. Both of these solutions are
pretty low-level, so there's presumably a more ConTeXt-y way of doing
this.

Thanks,
-- Max
___
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] ConTeXt Standalone does not works on macOS Monterey with Apple M2 chip

2022-10-10 Thread Max Chernoff via ntg-context

Hi Tommaso,

> I'm trying to install ConTeXt Standalone on my Mac (macOS 12.6 Monterey and
> Apple M2 chip) but at the end of the installation the ConTeXt-MkIV folder
> (where I install Standalone) on the disk weighs only 7MB (the tex tree is
> created, but its folders are empty).
> I've never had a problem installing it on my old computer (Intel processor).
> 
> Do you know if it is a known problem?
> 
> These are the commands I used (taken from the wiki):
> 
> rsync -av rsync: //contextgarden.net/minimals/setup/first-setup.sh .
> sh ./first-setup.sh --modules = all --fonts = all --goodies = all --context
> = latest --engine = luatex
> 
> Where am I wrong?

I think that MkIV has been frozen since before macOS ARM was released,
so I wouldn't be surprised if an ARM version just doesn't exist.

I've never used macOS, but if this worked on your Intel Mac, then you
can try running the installer via Rosetta instead of running it
directly. TeX is so fast that the Rosetta emulation will have fairly
little overhead.


> LMTX installation, on the other hand, should be successful (the folder
> weighs 297.8 MB, as much as the Standalone one should weigh).

You can still use MkIV with the LMTX installation. Just run 

   context --luatex document.tex
   
instead of the usual

   context document.tex
   
TeX Live also supports macOS ARM and includes MkIV if you want another
installation option.

Thanks,
-- Max
___
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 make something appear to the right of every paragraph?

2022-10-10 Thread Max Chernoff via ntg-context
Hi Joel,

> I'd like to add some area for readers to write in the margins of some
> text. This would leave three lines, like this to the right of the
> text.

Is it okay if there are rules continuously down the right column? If so,
this is fairly simple to do with layers/backgrounds + MetaFun. 

If you want for there to be exactly three rules per paragraph, then that
is more complicated. I can think of some bad solutions (\everypar, Lua
callbacks), but I'll leave it to someone else to think of a good
solution.

Thanks,
-- Max
___
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] Spacing in \unit

2022-10-10 Thread Max Chernoff via ntg-context
Hi Alan,

> I would very strongly argue that the space between the number and the
> following units be UNBREAKABLE. Perhaps a thin space (preference), but
> most certainly non-breakable.
> 
> Similarly around the times in scientific notation.
> 
> I further cannot imagine that a line break be acceptable around a \cdot
> in composite units.
> 
> This can possibly lead to overfill and underfill, something that I find
> *infinitely* more acceptable then breaking numbers and units.

Yes, I agree completely here.

> I do not know or use the \units command. Maybe it uses unbreakable
> spaces, maybe not. I would never use it unless it could be configured
> to only use nonbreakable spaces. 

The current behaviour doesn't break the unit from the number, but it
does split the scientific notation.

This test file:

   \starttext
   \hsize=0pt Math: $G = \unit{6.6743e-11 m3 kg-1 s-2}$
   
   \hsize=0pt Text: \unit{6.6743e-11 m3 kg-1 s-2}
   \stoptext
   
gives:

   Math:
   퐺=
   6.6743×
   10–11m3⋅kg–1⋅s–2
   Text:
   6.6743
   ×
   10−11 m3⋅kg−1⋅s−2
   
which isn't great. In my opinion, the \unit command should be typeset in an
\hbox (or similar) since I can't think of any circumstances where breaking
it would be reasonable.

Thanks,
-- Max
___
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] LMTX generates PDFs with non-working fonts on real printers

2022-10-09 Thread Max Chernoff via ntg-context

Hi all,

> I use LuaMetaTeX 2.10 20220918 + ConTeXt LMTX 2022.09.11.
> 
> Here's a tiny test document, I disabled PDF compression but it also
> doesn't work with the default settings.
> 
> \setupbackend[level=0,compresslevel=0]
> \starttext
> Just a line of text.
> \stoptext
> 
> When I print this "directly" (i.e. sending the raw PDF to the printer)
> on a Ricoh MP3053 or on a Samsung CLP-680DW, I just get an empty page.

Just to add some more data points, I tested the attached MkXL file on
two printers, and the file printed perfectly on both.

Printer 1:
   Brother HL-3170CDW
   Printed via running "cat test.mkxl.pdf | nc Colour-Printer.local 9100"
   
Printer 2:
   HP M227f LaserJet
   Printed from the PDF file on a USB stick
   
Neither printer is anything fancy; they're both fairly inexpensive home
laser printers. I've got a much older Brother laser printer that I may be
able to test with next week.

Sorry I can't be of more help.
-- Max
___
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] \setuparranging values for perfect bound A5 on A3?

2022-10-08 Thread Max Chernoff via ntg-context

Hi Bruce,

> I have a book to be perfect bound[1] and I'm trying to work out what
> imposition to use.
> 
> The printer would like 4 A5 pages laid out on A3 e.g.
> 
> +---+---+
> |   |   |
> | a | b |
> |   |   |
> +---+---+
> |   |   |
> | c | d |
> |   |   |
> +---+---+
> 
> so that he can cut the paper and simply stack a, b, c, & d on top of
> each other and then put them in the binding machine[2].
> 
> If the book is 40 pages long, say, then stack 'a' has page 1 on the
> top, page 2 on the reverse, then the next sheet has page 3 and 4, and
> so on down to the last sheet which has page 9 on the front and page 10
> on the back. Stack 'b' would have page 11 on the front, 12 on the back
> and so on, so that each stack has a quarter of the book.
> 
> Is this something LMTX can do and if so what combination of
> \setuplayout and \setuppaper do I need to use? If they can be printed
> in reverse order then great but I assume the printer can do that
> fairly easily.

I don't think that there's any way to do this from within a document
run, so I think that you'll need to use an external program.

> If not, is there a recommended external program that can do it?

But, you can use ConTeXt as the external program here. 

Save as "imposition.cld":

   local filename = document.getargument("filename")
   local pdf = lpdf.epdf.image.open(filename)
   local pages = pdf.nofpages
   local max = math.ceil(pages / 4)
   
   context.setuppapersize({ "A5" }, { "A3" })
   context.setuppaper { nx = 2, ny = 2 }
   context.setuparranging { "XY" }
   
   local function insert_page(n)
   context.startpagemakeup()
   context.filterpages({ filename }, { n })
   context.stoppagemakeup()
   end
   
   context.starttext()
   for i = 1, max do
   if i % 2 == 1 then
   insert_page(i + 0 * max)
   insert_page(i + 1 * max)
   insert_page(i + 2 * max)
   insert_page(i + 3 * max)
   else
   insert_page(i + 1 * max)
   insert_page(i + 0 * max)
   insert_page(i + 3 * max)
   insert_page(i + 2 * max)
   end
   end
   context.stoptext()
   
Then run:

   context imposition.cld --filename=document.pdf
   
where "document.pdf" is replaced by your document name.

I'm not sure if I got your desired output quite right here, but
hopefully you can easily modify the script if something isn't quite
right.

Thanks,
-- Max
___
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] Apostrophe entity using \xmltexentity is ignored

2022-10-08 Thread Max Chernoff via ntg-context
Hi,

> Has the handling for the apostrophe character entity changed recently?
> 
> In the following example, the \xmltexentity for apostrophe is ignored,
> resulting in a straight apostrophe instead of a curled one:

> Any ideas on how to fix it?

(see also https://tex.stackexchange.com/a/661002/270600)

There are two different problems here.

1. Typing "'" now gives a straight apostrophe instead of a curly one by 
   default.

   The solution to this is to add 
   
  \definefontfeature[default][default][trep=yes]
  
   somewhere near the start of your document. See this thread
   
  https://mailman.ntg.nl/pipermail/ntg-context/2021/104286.html
  
   from last year.
   
2. ConTeXt ignores the redefinition of predefined entities. 

   If you run this code:
   
  \enabletrackers[xml.entities]
  
  \xmltexentity{apos}{XXX}
  \xmltexentity{lsquo}{YYY}
  \xmltexentity{rsquo}{ZZZ}
  \xmltexentity{laquo}{«}
  \xmltexentity{raquo}{»}
  
   then you get this output:
   
  xml > tex > registering tex entity 'apos' as 'XXX'
  xml > tex > registering tex entity 'lsquo' as 'YYY'
  xml > tex > registering tex entity 'rsquo' as 'ZZZ'
  xml > tex > registering tex entity 'laquo' as '«'
  xml > tex > registering tex entity 'raquo' as '»'
  xml > core > resolving entity  to internal ''
  xml > core > resolving entity  to internal ''
  xml > core > resolving entity  to predefined '''
  xml > core > resolving entity  to internal ''
  xml > core > resolving entity  to internal ''
  xml > core > resolving entity  to internal ''
  xml > core > resolving entity  to internal ''
  xml > core > resolving entity  to internal ''
  xml > core > resolving entity  to internal ''
  xml > tex > passing entity 'lsquo' as 'YYY' using 
'ctxcatcodes'
  xml > tex > passing entity 'U+27' as ''' using 'ctxcatcodes'
  xml > tex > passing entity 'laquo' as '«' using 'ctxcatcodes'
  xml > tex > passing entity 'raquo' as '»' using 'ctxcatcodes'
  xml > tex > passing entity 'rsquo' as 'ZZZ' using 
'ctxcatcodes'

   I know of a bad way to fix this (see the linked SE question), but
   hopefully someone here knows of a proper solution.
   
Thanks,
-- Max
___
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] floats disturb grid setting

2022-10-03 Thread Max Chernoff via ntg-context

Hi Hraban,

> > As soon as I use floats, text isn’t typeset on the grid any more:
> > 
> > 
> > \setuppaper[A5]
> > \setuplayout[grid=yes]
> > \showframe\showgrid
> 
> Oops, my bad: It must be "grid=on".
> But didn’t work "yes" in earlier versions?

I just tested:

 MkIV  MkXL
[grid=yes]   BrokenBroken
 [grid=on]   BrokenWorks

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

2022-10-03 Thread Max Chernoff via ntg-context
Hi Hraban,

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

Neither of those links are valid images themselves, they are both
redirects. The following works though:

   \starttext
   \externalfigure[https://tug.org/images/logobw.jpg]
   \stoptext
   
I can't seem to get the second one to work since its redirected URL is a
bit odd.

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

I have no idea if ConTeXt would ever follow redirects before, but I
agree that it would be a useful feature.

Thanks,
-- Max
___
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] Fwd: [CG Wiki] ConTeXt with VS Code (https://wiki.contextgarden.net/VSCode)

2022-10-03 Thread Max Chernoff via ntg-context
Hi Taco, Michal,
> > 

> > > /home/qasar/Stažené/cont/tex/texmf-context/context/data/vscode/extensions/context/node_modules/vsce/out/package.js:136
> > > return (translations ?? [])
> > >   ^

That's the "Nullish coalescing operator", which MDN says is only
available in Node.js >= v14. 

   
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator
   
What does running: 

   nodejs --version
   
give you? 

If it's less than v14, then you should probably upgrade your Node.js
installation. If that's not possible, then you'll need to downgrade
"vsce" to v1.103.1. 

If it's greater than v14, then you probably have two Node installations
and you installed "vsce" with the wrong one.

Thanks,
-- Max
___
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] Suboptimal German hyphenation

2022-09-28 Thread Max Chernoff via ntg-context
Hi Leah,

> I was typesetting some German text on a narrow page when I discovered
> the justification wasn't as good as expected.  I think I tracked this
> down to differences in hyphenation points, namely, ConTeXt has fewer:
> 
> \starttext
> \language[de]
> \showhyphens{Zusammenhang}
> \showhyphens{anderswo}
> \showhyphens{anderswoher}
> \stoptext
> 
> This shows
> languages   > hyphenation > show: Zusam[-||]men[-||]hang
> languages   > hyphenation > show: anderswo
> languages   > hyphenation > show: anders[-||]wo[-||]her

Babel/ngerman sets left/righthyphenmin to 2/2, but ConTeXt sets those to
3/3 for German. (The English default is 2/3). I don't speak German so I
have no idea which is correct, but you can get the same behaviour in
ConTeXt with:

   \mainlanguage[de]
   \lefthyphenmin=2
   \righthyphenmin=2
   
   \starttext
   \showhyphens{Zusammenhang}
   \showhyphens{anderswo}
   \showhyphens{anderswoher}
   \stoptext

which gives:

   languages   > hyphenation > show: Zu[-||]sam[-||]men[-||]hang
   languages   > hyphenation > show: an[-||]ders[-||]wo
   languages   > hyphenation > show: an[-||]ders[-||]wo[-||]her
   
-- Max
___
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] new hash for buffer (as file)

2022-09-26 Thread Max Chernoff via ntg-context
Hi Hans, Pablo,


> > But I do agree that the line ending handling seems a little odd. I find it
> > surprising that the buffers internally use CR line endings since no systems
> > in the past 20 years use that.
> 
> how about tex ...
> 
> \number\endlinechar
> \number\numexpr`M-`A+1\relax % plain sets up `^^M

Argh, how could I have forgotten about that. Yes, that makes complete
sense.

> > First, run "chcp 65001" before running "context" and record the size of the
> > file written. Then, run "chcp 1251" and run "context" again. Hopefully the
> > file size doesn't change; but if it does, then that means that the binary
> > content of any file written will depend on the system's default code page,
> > which would complicate making reproducible hashes.
>
> if that were the case nothing would work .. so it's bytes in - bytes out

Ok good, that's what I was expecting. I've unfortunately used some
programs that even fairly recently depended on the system code page, so
I'm always a little cautious.

> Hi Max,
> 
> I realized later that I was doing something wrong. My fault here.

Glad that you've figured it out.

> I thought that ConTeXt would output the same character encoding as in
> the source file when saving a buffer.

Yes, Hans confirmed that that is correct. 

Thanks,
-- Max


___
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] new hash for buffer (as file)

2022-09-25 Thread Max Chernoff via ntg-context

Hi Pablo,

> But now I don’t understand is the following issue: if the saved file
> contains "\r\n", why does basic Notepad the new lines?
> 
> "\r\n" are the chars to get new lines in Windows. Or what am I missing here?

I'm not too sure what you're asking here, but Notepad was somewhat-
recently updated to handle both CRLF and LF line endings:

   https://devblogs.microsoft.com/commandline/extended-eol-in-notepad/
   
But I do agree that the line ending handling seems a little odd. I find it
surprising that the buffers internally use CR line endings since no systems
in the past 20 years use that. 

Also, you should probably check to make sure that the results of the
file don't depend on the current code page on Windows. Try writing out a
buffer from ConTeXt with the following contents:

   АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя
   
First, run "chcp 65001" before running "context" and record the size of the
file written. Then, run "chcp 1251" and run "context" again. Hopefully the
file size doesn't change; but if it does, then that means that the binary
content of any file written will depend on the system's default code page,
which would complicate making reproducible hashes.
   
-- Max
___
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] PDF viewer

2022-09-23 Thread Max Chernoff via ntg-context

Hi Hraban,

> Unfortunately, Firefox doesn’t register itself as a PDF viewer (at least 
> on MacOS), that means I can’t use it easily to open a PDF from the 
> command line (e.g. in scripts).

That's odd. You can set it as the default PDF viewer on Windows and
Linux at least.

> >> for forms:
> >>   - fill in
> > Yes.
> 
> Just checked again with current Firefox: It doesn’t work with all of my 
> test files.

I tested it with the eforms manual:

   http://mirrors.ctan.org/macros/latex/contrib/acrotex/doc/eformman.pdf
   
and it seems to work fine for me. I've also used it to fill out a few
government forms in the past and it's worked too. Unfortunately, I think
that there are like 12 incompatible ways of making a form in PDF, so
support probably heavily depends on how the document was made.

> >>   - print documents with/without form contents
> > Yes.
> 
> I couldn’t find an option to print without form contents. (But usually
> you would want filled forms, so “with” is ok.)

Well if you refresh the page, you can delete everything that you've
filled in :)

> >>   - custom checkmarks/radiobuttons should work & display correctly
> > 
> > Usually it works, sometimes it doesn't.
> > 
> >>   - JS for calculations
> > 
> > Usually it works, sometimes it doesn't.
> 
> Need to check further...

I checked with the eforms manual linked above. Check marks and radio
buttons seem to work, but calculations don't.

> >> for annotations (correction workflow; generally just nice to have):
> >>   - similar to Adobe/Foxit Reader
> > 
> > Reading annotations works, but you can't modify anything.
> 
> Ok. There’s still no PDF viewer on Linux that can handle annotations 
> well. (But even Acrobat Reader on MacOS frequently crashes on them; I’m 
> using Foxit Reader for annotations, but the one for Linux is too old.)

Microsoft Edge has decent PDF annotation support. I've never tested it
on Linux, but a Linux version does exist. Okular also lets you add some
annotations.


> > I've been using pdf.js almost exclusively for the past few years either
> > via Firefox or VS Code, and I've never really had any problems. The only
> > real issue that I've had is that it gets fairly slow with documents over
> > a few thousand pages long. Otherwise, it seems pretty fast and stable,
> > and it supports nearly every feature that I tend to need.
> 
> Well, documents with thousands of pages are probably unreliable/slow in 
> most viewers.

I've got a 1.1GB document with 16000 pages, and Okular handles it just
as fast as a 10 page document. Firefox at least manages to not crash
when opening the document, which is better than most viewers.

Okular is actually a pretty nice viewer in general. It's really fast,
and it also seems to support most of these features. The tricky thing
with it though is that I think that it would be much harder to modify
compared to pdf.js.

-- Max

___
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] new hash for buffer (as file)

2022-09-22 Thread Max Chernoff via ntg-context
Hi Pablo,

> I mean, to get hash of the file attached to the document, I need to save
> the buffer for "context(utilities.sha2.hash256(io.loaddata(buffer)))".
> 
> But I don’t need to save the buffer to attach it to the PDF document.
> 
> My question is how to define \shabufferfile to avoid \savebuffer (only
> required to get the hash).

The SHA calculation isn't working properly because of a weird newline
issue. Try this:

   \setupinteraction[state=start]
   \setupinteractionscreen[option={attachment}]
   
   \startbuffer[test]
   just a test
   and another one
   \stopbuffer
   
   \starttext
   \startluacode
   require("util-sha")
   
   function sha256(str)
   return utilities.sha2.hash256(
   str:gsub(string.char(0x0D), string.char(0x0A))
   )
   end
   \stopluacode
   
   \def\shabuffer#1%
   {\cldcontext{sha256(buffers.raw("#1"))}}
   
   \def\shafile#1%
   {\cldcontext{sha256(io.loaddata("#1"))}}
   
   \shabuffer{test}
   
   \savebuffer[test][temporary-αβγ, prefix=no]
   
   \shafile{temporary-αβγ}
   
   \attachment[buffer=test, name=\shabuffer{test}, method=hidden]
   \stoptext
   
You can remove the "\savebuffer" and the "\shafile"; I just kept that in to
show that the two hashes are now the same.

-- Max
> 
___
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] PDF viewer

2022-09-22 Thread Max Chernoff via ntg-context

Hi Hraban,

> I compiled a kind of wishlist what we need or look for in a new or 
> enhanced open source PDF viewer, as discussed e.g. at the 2021 meeting.
> 
> https://wiki.contextgarden.net/PDF_viewer
> 
> Feel free to enhance the wiki page or discuss here.

I think that pdf.js (the Firefox PDF viewer) meets most of these
requirements. There are a few requirements that it doesn't meet, but
it's open source and written in JavaScript, so we should be able to add
anything that's missing.

Going down the list on the Wiki:

> in general:
>  - PDF 2.0 compatible

It can open PDF 2.0 files, but I doubt that it supports every single
feature.

>  - proper color and transparency display (respect color profiles)

It supports all of the PDF colour models/profiles for vectors, although
it ignores embedded colour profiles in images.

   https://github.com/mozilla/pdf.js/issues/2856

Regular RGB and CMYK stuff works fine though.

>  - limited JavaScript support (no modification, no file operations)

Yes, although it is quite limited:

   
https://blog.mozilla.org/attack-and-defense/2021/10/14/implementing-form-filling-and-accessibility-in-the-firefox-pdf-viewer/

>  - search

Yes.

>  - update on file change (configurable)

Not by default in Firefox. It works fine in this extension though:

   https://github.com/tomoki1207/vscode-pdfviewer

>  - keyboard control for as much as possible (but also menus/menubars)

Yes

>  - sidebar for bookmarks/ToC

Yes

>  - SyncTeX support

Not in Firefox, although there are patches to enable it:

   
https://github.com/James-Yu/LaTeX-Workshop/blob/cff1a372/viewer/components/synctex.ts
   
https://github.com/tomoki1207/vscode-pdfviewer/blob/92fecdb8/src/pdfPreview.ts

>  - accessibility (e.g. alternative text must work)

I've never used it, but it looks like there's good support:

   
https://blog.mozilla.org/attack-and-defense/2021/10/14/implementing-form-filling-and-accessibility-in-the-firefox-pdf-viewer/

>  - access to file attachments (lower priority)

Surprisingly, yes.

> for presentations:
>  - presentation mode (full screen, no visible controls, on one 
>monitor/beamer of choice)

Yes.

>  - JS for controlling optional content groups (OCGs, Viewer Layers)

You can toggle all the layers in the side panel. I don't think that you
can toggle via buttons or JS though.

>  - inner- and inter-document links must work

Yes; however, inter-document links are sometimes limited depending for
security reasons. I'm sure that this can be configured though.

>  - multimedia support at least via links (suggestion: use “plain Rich
>Media” approach with OS’ default player)

I don't think so, although I guess you could include a video file as an
attachment.

>  - transition effects not necessary (but if the developer has fun
>including them, go on)

No transition effects.

> for forms:
>  - fill in

Yes.

>  - print documents with/without form contents

Yes.

>  - same-ID fields on different pages must be synchronized

No idea.

>  - custom checkmarks/radiobuttons should work & display correctly

Usually it works, sometimes it doesn't. 

>  - JS for calculations

Usually it works, sometimes it doesn't. 

> for annotations (correction workflow; generally just nice to have):
>  - similar to Adobe/Foxit Reader

Reading annotations works, but you can't modify anything.

> for development/debugging:
>  - show metadata (incl. XMP), e.g. in a sidebar or dialog

You can see all the "regular" metadata, but XMP doesn't work.

>  - show fonts metadata (inclusion etc.)

No.

>  - show PDF Boxes (MediaBox, CropBox, TrimBox, BleedBox, ArtBox) as
>colored frames, switchable via preferences and menu (bar) item

No.

>  - check for PDF/A and PDF/X compliance would be nice (integrate
>VeraPDF?)

>  - FOSS license

Yes. (Apache 2.0)

>  - should at least work on Windows, MacOS (preferably 10.14+), Linux
>and *BSD; iOS & Android versions would be nice

It's built in to Firefox, so it works on Windows, macOS, Linux, and the
BSDs. It should also work on mobile, although support is a little
spottier there.

>  - how about (long term) support?

It should be supported as long as Firefox exists.

>  - Funding

Overleaf uses pdf.js as its default PDF viewer, so they may perhaps be
willing to help.

~~

I've been using pdf.js almost exclusively for the past few years either
via Firefox or VS Code, and I've never really had any problems. The only
real issue that I've had is that it gets fairly slow with documents over
a few thousand pages long. Otherwise, it seems pretty fast and stable,
and it supports nearly every feature that I tend to need.

Since it's written in JavaScript, it should be fairly easy to modify,
and it should run on nearly everything.

-- Max


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

maillist : ntg-context@ntg.nl / 

Re: [NTG-context] hash for buffer contents

2022-09-21 Thread Max Chernoff via ntg-context
Hi Pablo,

> Is there any way to get "utilities.sha2.hash512" with the contents of
> the "abc" buffer?

You can use "buffers.getcontent" or "buffers.raw":

   \startbuffer[test]
   One
   Two
   Three
   \stopbuffer[test]
   
   \starttext
   \startluacode
   require("util-sha")
   
   local content = buffers.getcontent("test")
   -- local content = buffers.raw("test") -- same result
   local sha512 = utilities.sha2.hash512(content)
   context(sha512)
   \stopluacode
   \stoptext

Depending on what you're trying to do, the "filter" module may be
helpful here.

-- Max
___
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] cannot update ConTeXt to 2022.09.16

2022-09-20 Thread Max Chernoff via ntg-context

Hi Pablo, Otared,

> On 9/19/22 18:23, Otared Kavian via ntg-context wrote:
> > Hi Pablo,
> >
> > I had the same issue and, as this was discussed a few years or months
> > ago, after removing the three files with extension « .tma » the
> > update goes through normally.> On my machine, running MacOS X, I had to 
> > remove the following files:>
> texmf.tma
> > texmf-osx-64.tma
> > texmf-context.tma
> 
> Hi Otared,
> 
> what is really weird, installing both brand-new versions for Win64 and
> Linux64 is that I cannot get current latest from 2022.09.16 14:39 (but
> only from 2022.09.11 20:44).

The exact same thing is happening on my end (Linux x86-64). I tried
upgrading using the regular method, then I tried deleting *.tma and
updating again. I still have version "2022.09.11 20:44". Not sure how to
fix it, but I guess at least you're not alone :)

-- Max
___
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] LuaMetaTeX insert nodes patch

2022-09-16 Thread Max Chernoff via ntg-context
Hi Hans,

I see that you've released the LuaMetaTeX source code, yay! I'm really
impressed with how easy it is to build, and with how quickly it builds.

Can you please apply this patch to the LuaMetaTeX source code:


diff --git source/lua/lmtnodelib.c source/lua/lmtnodelib.c
index ff98a70..1aade86 100644
--- source/lua/lmtnodelib.c
+++ source/lua/lmtnodelib.c
@@ -6557,10 +6557,7 @@ static int nodelib_common_getfield(lua_State *L, int 
direct, halfword n)
 break;
 case insert_node:
 if (lua_key_eq(s, index)) {
-halfword index = lmt_tohalfword(L, 3);
-if (tex_valid_insert_id(index)) {
-insert_index(n) = index;
-}
+lua_pushinteger(L, insert_index(n));
 } else if (lua_key_eq(s, cost)) {
 lua_pushinteger(L, insert_float_cost(n));
 } else if (lua_key_eq(s, depth)) {


This should fix the following minimal example:

   \startluacode
   local insert = node.new "insert"
   insert.index = 4
   print(insert.index)
   \stopluacode
   
Thanks,
-- Max
___
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] Latest ConTeXt won't "--make"

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

Hi Mikael,

> I don't see this problem with the latest. Moreover, I think the
> version of luametatex was pushed to 2.10, so there might be a
> mis-match in your case. I hope it helps.

I just tried updating again, and it says that I'm up to date, but:

   $ luametatex --version
   This is LuaMetaTeX, Version 2.09.62
   
   Execute 'luametatex --credits' for credits and version details.
   
   There is NO warranty. Redistribution of this software is covered by the terms
   of the GNU General Public License, version 2 or (at your option) any later
   version. For more information about these matters, see the file named COPYING
   and the LuaMetaTeX source.
   
   Functionality : level 20220825
   Support   : cont...@ntg.nl
   Copyright : The Lua(Meta)TeX Team(s) (2005-2022+)
   
   The LuaMetaTeX project is related to ConTeXt development. This macro package
   tightly integrates TeX and MetaPost in close cooperation with Lua. Updates 
will
   happen in sync with ConTeXt and when needed. Don't be fooled by unchanged 
dates:
   long term stability is the objective.
   
   $ context --version
   mtx-context | ConTeXt Process Management 1.04
   mtx-context |
   mtx-context | main context file: 
/opt/context/tex/texmf-context/tex/context/base/mkiv/context.mkiv
   mtx-context | current version: 2022.09.11 20:44
   mtx-context | main context file: 
/opt/context/tex/texmf-context/tex/context/base/mkxl/context.mkxl
   mtx-context | current version: 2022.09.11 20:44
   
the engine/format appear to be mismatched. Manually updating the engine
with:

   $ sudo wget 
http://lmtx.pragma-ade.nl/install-lmtx/tex/texmf-linux-64/bin/luametatex
   
   $ luametatex --version
   This is LuaMetaTeX, Version 2.10.00
   
   Execute 'luametatex --credits' for credits and version details.
   
   There is NO warranty. Redistribution of this software is covered by the terms
   of the GNU General Public License, version 2 or (at your option) any later
   version. For more information about these matters, see the file named COPYING
   and the LuaMetaTeX source.
   
   Functionality : level 20220918
   Support   : cont...@ntg.nl
   Copyright : The Lua(Meta)TeX Team(s) (2005-2022+)
   
   The LuaMetaTeX project is related to ConTeXt development. This macro package
   tightly integrates TeX and MetaPost in close cooperation with Lua. Updates 
will
   happen in sync with ConTeXt and when needed. Don't be fooled by unchanged 
dates:
   long term stability is the objective.
   
has solved the issue. I'm not sure why the the engine wasn't updating,
but it appears to be fixed now. 

Thanks,
-- Max

___
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] Hyphenation in multi-language projects

2022-09-14 Thread Max Chernoff via ntg-context
Hi Steffen,

> … \replaceword should be the correct way for proper hyphenation??

Well I'm not sure if it's "correct", but it seems to work. Based on my
testing, having three subsequent sets of groups ({A}{B}{C}) is converted
to a discretionary. The discretionary hyphen "\-" is equivalent to the
Plain TeX command "\discretionary{-}{}{}", so 

   \replaceword[hyphenations][steffen][steff{-}{}{}en]
   
acts just like "steff\-en". TeX won't otherwise hyphenate a word with
discretionaries, so this means that "steff-en" will be the only allowable
hyphenation.

-- Max
___
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] Latest ConTeXt won't "--make"

2022-09-14 Thread Max Chernoff via ntg-context
Hi all,

I've just updated to the latest ConTeXt, but I'm unable to make the
format:

   $ context --make
   resolvers   | resolving | configuration files already identified
   resolvers   | resolving | loading configuration file 
'selfautoparent:/texmf/web2c/texmfcnf.lua'
   [...]
   resolvers   | formats | using tex source file 
'/opt/context/tex/texmf-context/tex/context/base/mkxl/cont-en.mkxl'
   resolvers   | formats | using lua stub file 
'/opt/context/tex/texmf-context/tex/context/base/mkxl/luat-cod.lmt'
   resolvers   | formats | changing to format path 
'/home/max/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex'
   resolvers   | formats | executing runner 'make luametatex format': 
/opt/context/tex/texmf-linux-64/bin/luametatex --ini  
--lua=/opt/context/tex/texmf-context/tex/context/base/mkxl/luat-cod.lmt 
/opt/context/tex/texmf-context/tex/context/base/mkxl/cont-en.mkxl  
   This is LuaMetaTeX, Version 2.09.62  (INITEX)
   [...]
   resolvers   > lua > loading file 
'/opt/context/tex/texmf-context/tex/context/base/mkxl/math-spa.lmt' succeeded
   resolvers   > lua > loading file 
'/opt/context/tex/texmf-context/tex/context/base/mkxl/math-fnt.lmt' succeeded
   resolvers   > lua > loading file 
'/opt/context/tex/texmf-context/tex/context/base/mkxl/math-pre.lmt' succeeded
   tex error   > tex error on line 559 in file math-ini.mkxl: Undefined 
control sequence \undefined 
   

  +\removeitaliccorrectionclassoptioncode
   
   
   The control sequence at the end of the top line of your error message was 
never
   \def'ed. You can just continue as I'll forget about whatever was undefined.
   resolvers   | formats |
   resolvers   | formats | binary path  : 
/opt/context/tex/texmf-linux-64/bin
   resolvers   | formats | format path  : 
/home/max/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex
   resolvers   | formats | luatex engine: luametatex
   resolvers   | formats | lua startup file : 
/opt/context/tex/texmf-context/tex/context/base/mkxl/luat-cod.lmt
   resolvers   | formats | context file : 
/opt/context/tex/texmf-context/tex/context/base/mkxl/cont-en.mkxl
   resolvers   | formats | run time : 0.573 seconds
   resolvers   | formats | return value : error
   resolvers   | formats |
   system  | total runtime: 0.610 seconds of 0.647 seconds
   
Commenting out line 559 of math-ini.mkxl fixes the issue.

Thanks,
-- Max
___
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] Hyphenation in multi-language projects

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

Hi Steffen,

> The idea is to set the hyphenation for certain words regardless of the
> language that is used in the surrounding paragraphs.
> 
> In this example it should stay: «steff-en»
> 
> How do i set this to all non-english paragraphs (without using
> \hyphenation on each language-switch)?

You can use \replaceword:

   \starttext
   
   \setuppapersize[A6][A6]
   
   \mainlanguage[en]
   
   \replaceword[hyphenations][steffen][steff{-}{}{}en]
   \setreplacements[hyphenations]
   
   english text english text english teste: steffen steffen
   
   \start\language[it]
   italian text italian text italian teste: steffen steffen
   \stop
   
   \stoptext
   
-- Max
___
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] searching in the source browser

2022-09-05 Thread Max Chernoff via ntg-context

Hi Hraban,

> Am 05.09.22 um 21:07 schrieb Pablo Rodriguez via ntg-context:
> > has it to be the source browser?
> > 
> > I mean, I use grep in Linux (MSYS2 in Windows [and brew.sh is available
> > for macOS]) and it works perfectly fine with ConTeXt.
> > 
> >$ grep -irl fi[eë][eë] context
> >context/tex/texmf-context/tex/context/base/mkiv/char-def.lua
> >context/tex/texmf-modules/tex/context/third/lilypond/t-lilypond.tex
> > 
> > Althought regular expressions are fine, I don’t know why "fi[eë]+"
> > doesn’t work in this case.
> > 
> > Just in case it might help,
> 
> Thank you – I found
> 
> grep -R "regex" ~/context
> 
> to be most easy.
> 
> But I like the source browser with its syntax highlighting, and it’s a
> pity that the search is so limited.

I usually use the new GitHub "Code Search". This works pretty well,
although you need a (free) account to use it:

   https://cs.github.com/contextgarden/context-mirror?q=%5Cstarttext
   
Sourcegraph should work pretty much the same way. I don't usually use
it, but it has the advantage of not requiring an account:

   
https://sourcegraph.com/search?q=context:global+repo:%5Egithub%5C.com/contextgarden/context-mirror%24+%5Cstarttext=standard
   
Both of these have syntax highlighting and work with literal strings or
regexes.

-- Max
___
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] No error when loading a non-existent module

2022-08-26 Thread Max Chernoff via ntg-context
On Fri, 2022-08-26 at 07:40 +0200, Hans Hagen wrote:
> On 8/26/2022 3:00 AM, Max Chernoff wrote:
> > Is there a way to make this produce a nice little "error" PDF as soon as
> > the error occurs just like using "\undefined" does?
> 
> Only If I add it as option (directive driven, must find some good name 
> for it).

You already have errors and warnings as an option, so a good name might
be "fatal"?

> Most modules add commands and that shows immediately. Modules that kick 
> in without some command that needs to enable something are sort of 
> not-done or rare and experimental only and comparable to when some 
> module patches or overloads core functionality withoutr mentioning it.

Here I'm mainly thinking about my lua-widow-control module, which
produces a visual effect, although it can be quite subtle if you're not
paying very close attention.

> > > and if needed can add that line to a local cont-loc.mkxl file so that it
> > > always kicks in.
> > 
> > Didn't know about that either.
> 
> Ah, that's one of the oldest features: cont-new (for patched before 
> updates), cont-loc (for local preferences) and cont-exp (for wolfgang 
> and me)

Not seeing anything on the Wiki about either of those. I guess that
means I'm volunteering myself :)

Similarly to "cont-loc.mkxl", is there some local file that is only read
during format generation? Some of my documents use pgf/TikZ and expl3,
and loading these during format generation can save quite a bit of time
when compiling. I know that I can just modify "cont-en.mkxl" or
"context.mkxl", but those can be overwritten by updates.

> > But wouldn't it make sense for this to be an error by default? Nothing
> > good can happen if a user loads a non-existent (or misspelled) module.
> > Loading a non-existent file is a fatal error even in Plain TeX
> > \nonstopmode. I think that making this an error by default would break
> > very few working documents. In exchange, most users would get much more
> > helpful error messages.
> It would never be default because it is quite possible to have cases 
> where a module became redundant or is optional. There arte very few 
> cases where we are not downward 'command and file' compatible (the most 
> noticeable exceptions are when font, language and encoding subsystems 
> fundamentally change).

Fair enough. 

Thanks,
-- Max


___
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] No error when loading a non-existent module

2022-08-25 Thread Max Chernoff via ntg-context
Hi Hans,

On Thu, 2022-08-25 at 08:57 +0200, Hans Hagen wrote:
> On 8/25/2022 2:19 AM, Max Chernoff via ntg-context wrote:
> But ... you can already do
> 
> \enabledirectives[logs.errors=*]
> 
> or
> 
> \enabledirectives[logs.errors=missing modules]

Didn't know about that, thanks.

However, this still continues processing the document and produces a PDF
at the end. All that that seems to do is make ConTeXt exit with a non-
zero status code, which is fairly easy to ignore if you're not paying
attention. 

Is there a way to make this produce a nice little "error" PDF as soon as
the error occurs just like using "\undefined" does?

> and if needed can add that line to a local cont-loc.mkxl file so that it 
> always kicks in.

Didn't know about that either.

But wouldn't it make sense for this to be an error by default? Nothing
good can happen if a user loads a non-existent (or misspelled) module.
Loading a non-existent file is a fatal error even in Plain TeX
\nonstopmode. I think that making this an error by default would break
very few working documents. In exchange, most users would get much more
helpful error messages.

Thanks,
-- Max


___
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] No error when loading a non-existent module

2022-08-24 Thread Max Chernoff via ntg-context
Hi all,

If you load a non-existent module, ConTeXt issues a minor warning, but
otherwise proceeds as normal:

MWE:

   \usemodule[doesnt-exist]
   
   \starttext
   Hello world!
   \stoptext
   
I think that this behaviour should be changed so that a fatal error is
issued when a loaded module cannot be found. Plain TeX, LaTeX, and OpTeX
all throw an error whenever their versions of modules cannot be found, so
ConTeXt is the odd one out here.

There are 3 scenarios that I can think of for when you attempt to load a
module, but it cannot be found:

1. A module provides some new command "\somecommand"

   In this case, loading the module will quietly fail, but an undefined
   control sequence error will be issued whenever you use
   "\somecommand". This disguises the root problem, which is that the
   module was never loaded, potentially confusing users.
   
2. A module changes the layout of a document

   In this case, the layout of the document would be unchanged by the
   module. If you're looking at every document, then this would be
   obvious; however, if you're using some batch processing system, you
   could unknowingly send out incorrectly-styled documents quite easily.
   
3. You load a module that provides some command, then never use it

   This is the only case where the new error would break any documents.
   However, this case should hopefully be pretty rare since it's
   pointless to load a module then never use any of its features.
   
Making this change could potentially break some documents that currently
work, but I think that this change is worth it, since I'd rather have
something break loudly (throwing an error) rather than silently (producing
a semi-corrupt document).

Thanks,
-- Max
   
___
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 can I make a Gentoo Linux package for ConTeXt LMTX?

2022-08-22 Thread Max Chernoff via ntg-context
Hi Amano,


> Wuh. That's a bit complex.

Not really. From a user perspective, all that you need to run is

   make install
   
From a developer perspective, this is essentially just the base ConTeXt
files, a modified texmfcnf.lua, and a fairly basic makefile.

> For distribution packages that depend on context for generation of PDF
> documents, having context as a system package is essential.

I'd say that ConTeXt *is* available in nearly every package manager, via
TeX Live. Very very few package managers would have no TeX Live. TeX
Live only includes MkIV, the "stable" version, but most users won't
notice many differences from MkXL/LMTX, the "experimental" version. 

By policy, TeX Live only updates its binaries once per year. This would
be pretty much unworkable with LuaMetaTeX due to its frequent upgrades.
At some point when LuaMetaTeX is stable, the source will be released and
almost certainly be incorporated in TeX Live. 

> And, distribution maintainers can make things work if they understand
> TeX directory structure and texmfcnf.lua.

Packaging/installing ConTeXt is actually much easier than doing so for
other TeX systems. With other systems, you need to fiddle around with
fonts and packages, but with ConTeXt, you can pretty much just unpack a
few files.

Here's a short paper that should give you an overview of how hard
packaging TeX can be:

   https://tug.org/TUGboat/tb34-3/tb108preining-distro.pdf

> It comes down to care. If they care and they have installation guide,
> they will make it work.

I'm not sure who you're talking about here. If you're talking about end-
users, then yes, it's pretty simple to install ConTeXt. I personally
find ConTeXt much easier to install than TeX Live.

If you're talking about packagers, then packaging ConTeXt is no more
complex than packaging TeX Live (which of course includes ConTeXt MkIV).
The installer documentation for ConTeXt LMTX certainly isn't as detailed
as it is for TeX Live, but LMTX is still beta software.

If you're trying to say that the ConTeXt developers don't care, then you
may be "right" in a sense, but missing the point entirely. There is no
one who is paid to work on ConTeXt: all of the developers work on it
either as volunteers or to support their own business needs. The current
installer works for them and for many other users. This isn't to say
that they don't care about the users, but rather that they are unlikely
to spend much time making a package for a fairly unpopular distro where
the official installer already works.

> On Sunday, August 21st, 2022 at 7:13 PM, Michal Vlasák  
> wrote:

Hi Michal,

> > I prepared a proof of concept, that I am ready to take down immediately
> > at Hans' request, since I don't handle license information properly, and
> > texmf-context is stripped down (just so that the downloads are not too
> > big for proof of concept).
> > 
> > https://github.com/vlasakm/context

That's quite impressive!

> > There is documentation about how it can be used. I hope its obvious how
> > I got "texmf" (texmf-context.zip, unzip, delete some files I didn't want
> > to take up space), 

One suggestion: instead of unpacking and committing "texmf-context.zip",
I'd recommend adding 

   https://github.com/contextgarden/context-mirror/
   
as a git submodule. That way, it's easy to keep the files up-to-date, your
repo will use less space, and there's a clearer separation between your
package files and ConTeXt itself.

> > A bit of a disclaimer: I don't really recommend pursuing this further.
> > Some time ago I was also that foolish to try to package TeX for Linux
> > distributions. Unfortunately I think that the result will never by
> > optimal - as demonstrated by the previous discussions, the usual
> > purposes of packages (to integrate software into the system) don't apply
> > much to TeX / ConTeXt - there one wants something more or less self
> > contained (so that updates are under control, no random non-essential
> > libraries brake things, etc.).

Well packaging the files into .rpm/.deb isn't really a bad idea; what's
bad is the weird modifications that distros make, plus the fact that
nearly every distro delays updates by quite some time. I generally agree
that installing TeX straight from the source is better, although I can
see why some users prefer to install from their distro repos.

Thanks,
-- Max

___
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] Color property of \setupurl

2022-08-20 Thread Max Chernoff via ntg-context
Hi,

> Could someone clarify me in what kind of context the color of a 
> hyperlink is controlled by the "color" property of \setupurl?

This code:

   \show\setupurl
   \showthe\everysetupurl
   
produces:

   > \setupurl=frozen protected macro: [#1]->\ifarguments \or 
\mult_interfaces_get_parameters \??url [#1]\fi \the \everysetupurl 
   > 
   
so \setupurl doesn't appear to do anything at all. I suspect that it is an
old MkII relic, and can be safely ignored.

-- Max
___
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 can I make a Gentoo Linux package for ConTeXt LMTX?

2022-08-17 Thread Max Chernoff via ntg-context
> 
Hi Amano(?), Hans

> > Can you make it easier to make an OS package for ConTeXt LMTX by
> > releasing versioned (source) archives, including BUILD/INSTALL
> > instructions in the versioned archives, and so on? I wish I could just
> > extract a versioned binary archive into certain locations or use GNU
> > autotools or use meson build system which is far better than GNU
> > autotools.
> 
> there is a github repository for the tex stuff 

For reference, the GitHub repository is at:

   https://github.com/contextgarden/context-mirror/
   
It's semi-official mirror, but the authoritative source is the zips hosted
by Pragma. 

> and have no experience 
> with all that versioning / release / os packaging stuff (couldn't test
> it anyway and continuously adapt to teh subtle differences in 
> distributions and os's) ... we just post zips (already for decades) but 
> anyone is free to come up with such instructions (e.g. aditya did some
> for arch)
> 
> anyway, lmtx is still kind of experimental and at some point 
> installation will move to the garden (not much is needed, just a web 
> server) and the packaging scripts are / will be in the distribution  .. 
> there are no dependencies (and we keep it that way: self contained bins)
> 
> sorry, i just can't spent time on all the possible variant ways of 
> installation .. that is up to volunteers

I think all that Amano is asking for is for older versions of the
zips/binaries to be kept available. Right now, the only files available
for download that I'm aware of are the latest versions.

This is problematic from a reproducibility standpoint, since if you have
multiple people, say, writing a large textbook, it would make sense that
they wouldn't want to upgrade their systems constantly in case something
breaks. These people can easily just avoid upgrades, but if someone new
joins the team, they can only download the newest version. However, that
won't necessarily match the older version that everyone else has, which
can lead to problems.

Having older versions available would also help in the case of major
short-term regressions, since users would be able to (manually)
downgrade to an older version if necessary. 

An easy solution to this would be the following: instead of overwriting
the whole "/install-lmtx/" tree on every update, you would install all
the new files to something like "/install-lmtx-2022-08-07/", then have
"/install-lmtx/" be a symlink to the latest "/install-lmtx--MM-DD/".
I don't think that this would be very hard to implement from a technical
perspective, and the only downside that I can think of would be extra
disk space used. This is a fairly common implementation among other
software.

One other solution would be to have "dl.contextgarden.net" mirror a
zip/binary combo once every few months or so. These would often be out
of date, but they would provide a stable archive that would be useful in
cases like this.

This is just a suggestion though; it's not something that I personally
need, although I see how it could be potentially valuable for others.

Thanks,
-- Max
___
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] Accessing inserts from Lua in LuaMetaTeX

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

Hi Hans,

> > First, how do I get an insert's class/type from the "insert" nodes on
> > the page? With LuaTeX, the insert's class/type is the same as the
> > subtype of the "ins" nodes, but the subtype of the "insert" nodes is
> > always zero in LuaMetaTeX, so I'm not sure how to get the class/type.

After playing around, I found that this is stored in ".index". I'm able to write to this value just fine, but whenever I
read it I get an error.

This minimal example:

   \starttext
   \setbox999=\vbox{\hrule width 10pt height 10pt}
   
   \startluacode
   local insert = node.new("insert")
   local rule = tex.box[999].list
   insert.list = rule
   insert.index = 4
   
   node.write(insert)
   \stopluacode
   \stoptext
   
works perfectly, but this example:

   \startluacode
   local insert = node.new "insert"
   insert.index = 4
   print(insert.index)
   \stopluacode
   
gives this error message:

   In \insertmode 2 you can't use zero as index.
   
I suspect that this is a bug, but I may just be doing something wrong.

> Indeed, we don't use these boxes and registers because we run in 
> \insertmode=2. This gives us more state info (i kept the old method 
> around for now).

Inserts always felt a little hacky in TeX, so I think that the new
methods are a huge improvement.

> > Second, how do I get the head of the insert box from Lua? With LuaTeX,
> > from TeX you would use "\box" and from Lua you can use
> > "tex.box[]". With LuaMetaTeX, you use "\insertbox" from
> > TeX, but I'm not sure how to get at the insert box from Lua.
> 
> tex.getinsertdistance
> tex.getinsertmultiplier
> tex.getinsertlimit
> tex.getinsertheight
> tex.getinsertdepth
> tex.getinsertwidth
> tex.getinsertcontent
> tex.setinsertdistance
> tex.setinsertmultiplier
> tex.setinsertlimit
> tex.setinsertcontent

Perfect! "tex.getinsertcontent" does exactly what I need.

Really minor, but I would expect that

   tex.insertcontent[4] = 
= tex.insertcontent[4]
   
would be exist and be equivalent to

= tex.getinsertcontent(4)
   tex.setinsertcontent(4, )

> The insert (etc) handler is more clever and flexible. So, for instance
> we can bubble up inserts. I think you do a preroll so in that case you
> can set the migrations related parameter to not bubble up.
> 
> \starttext
> 
> \holdingmigrations\numexpr1+2+4\relax
> 
> \setbox0\hbox{test \footnote{test} test}
> 
> \setbox2\vbox{\unhcopy0}
> 
> \holdingmigrations0
> 
> \setbox4\vbox{\unhcopy0}
> 
> \unhbox0
> 
> \unvbox2
> 
> \unvbox4
> 
> \stoptext
> 
> But I have no clue how all that will work out with (lua) code that 
> manipulates these things. In list nodes you can consult the pre and post 
> fields to what got migrated.

I don't think that that will work in this case. I'm doing most of the
work in "pre_output_filter", which is after all of the insert nodes have
been removed from the page and put into their respective boxes. And I
can't postpone setting any inserts until then because TeX needs to know
their height for when it breaks the page. I don't really like how I have
to move the footnotes, but I can't find any better way of doing things.

If you're curious, most of the insert code is in these two functions:

   
   
https://github.com/gucci-on-fleek/lua-widow-control/blob/2bca90/source/lua-widow-control.lua#L612-L669
   
https://github.com/gucci-on-fleek/lua-widow-control/blob/2bca90/source/lua-widow-control.lua#L843-L924

Thanks,
-- Max

___
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 can I make a Gentoo Linux package for ConTeXt LMTX?

2022-08-15 Thread Max Chernoff via ntg-context
Okay, I'm seeing a few separate issues here.

1. Gentoo expects to compile everything from source.

   This isn't an option here since LuaMetaTeX doesn't have any source
   available (yet). So for the time being, you'll need to use the provided
   binaries. These support pretty much every architecture, so this
   shouldn't really be a problem.

2. You want to install ConTeXt LMTX system-wide.

   This is doable with the standard Linux installer script. Just make sure
   to run the script as root and install the files in /opt/context. This is
   what I've done on my system, and it works quite well. 
   
  $ ls -l $(type -p context)
  lrwxrwxrwx. 1 root root 10 Jul 28 00:33 
/opt/context/tex/texmf-linux-64/bin/context -> luametatex*
  
3. You want to install ConTeXt without any network access.

   The easiest way to do this would be to install on a system with
   internet, then just copy over the files. 
   
   If you want to use the "original" installer files, it shouldn't be
   impossible, but probably not too easy either. (All steps below are
   untested)
   
   The platform-independent stuff is all in one big zip, located at:
   
  http://lmtx.pragma-ade.nl/install-lmtx/texmf-context.zip
  
   Unzip this file as "/tex/texmf-context/".
  
   Then you also need to download all of the binaries. You will need to
   download all of the paths listed in this file:
   
  http://lmtx.pragma-ade.nl/install-lmtx/tex/texmf-linux-64.tma
  
   All of those files need to be placed in "/tex/texmf-linux-
   64/bin".
   
   Then to finish installing you'll need to run "mtxrun --generate" and
   "context --make". There are probably a bunch of other steps that I'm
   missing, but this should get you close.
   
   Again, probably easier to just use the regular installer.

4. ConTeXt is really picky about texmfcnf stuff.

   This is an issue that I've had too:
   
  https://github.com/latex3/l3build/issues/232
   
   Pretty much any modification of anything texmfcnf-related with ConTeXt
   will completely prevent it from running. There's a thread discussing the
   problem (but with no real solutions) here:
   
  https://tug.org/pipermail/tex-live/2020-September/046099.html
  
   And a Wiki page here:
   
  https://wiki.contextgarden.net/Custom_Configuration
  
   I agree that this texmfcnf stuff makes it really difficult to install or
   use ConTeXt with any kind of custom paths. Does anyone know how to
   properly configure a texmfcnf with custom paths?
   
Hopefully this is of some help.
-- Max
___
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] Accessing inserts from Lua in LuaMetaTeX

2022-08-15 Thread Max Chernoff via ntg-context
Hi all,

I'm trying to manipulate some inserts from Lua in LuaMetaTeX, and I'm
having some problems that I'm not having with LuaTeX. 

First, how do I get an insert's class/type from the "insert" nodes on
the page? With LuaTeX, the insert's class/type is the same as the
subtype of the "ins" nodes, but the subtype of the "insert" nodes is
always zero in LuaMetaTeX, so I'm not sure how to get the class/type.

Second, how do I get the head of the insert box from Lua? With LuaTeX,
from TeX you would use "\box" and from Lua you can use
"tex.box[]". With LuaMetaTeX, you use "\insertbox" from
TeX, but I'm not sure how to get at the insert box from Lua.

The context for both of these is that my module lua-widow-control
sometimes moves a line containing footnotes to the next page, so I need
to do some surgery to make sure that the "footnote marks" stay with the
"footnote text". This is tricky but doable with LuaTeX, but I can't seem
to get it to work with the new inserts in LuaMetaTeX, hence the above
questions.

Thanks,
-- Max
___
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 do code listings & sections from XML (AsciiDoc)

2022-08-12 Thread Max Chernoff via ntg-context
> Hi,
> 
> Hans helped me out with some asciidoc processing a while ago.
> 
> I played a bit further, but I'm currently facing two minor issues:
> 
> (a) I don't know how to turn program listing (verbatim code) from xml
> to (perhaps, vim-based) syntax highlighting (but most importantly, to
> make sure that line breaks work properly)


> Ad (a). The source that looks similar to this:
> 
> 
> int main()
> {
> return 0;
> }
> 
> 
> should be converted into some kind of equivalent of
> 
> % on top
> \usemodule[vim]
> \definevimtyping [CPP] [syntax=cpp]
> 
> \startCPP
> int main()
> {
> return 0;
> }
> \stopCPP

> Any hints would be greatly appreciated.

This should get you pretty close:

   https://tex.stackexchange.com/a/652116/
   
You can look through the revision history for a few different versions if
the newest one doesn't quite work.
   
-- Max
___
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] ConTeXt meeting 2022 – please register!

2022-08-04 Thread Max Chernoff via ntg-context

Hi Hraban,

> but I’d like to know why you (esp. if you attended 
> previous meetings) decided not to come:

A not-useful answer:

* The flight would take 14 hours each way (biggest reason)
 
* The flight would cost more than 2 months of rent

* It would be a bad idea for me to miss a full week of classes

-- Max
___
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] Can't manipulate glue added by tex.preparelinebreak

2022-07-28 Thread Max Chernoff via ntg-context
> looks like i don't update something, i'll fix it (probably bin later
> today)

> new upload (see earlier mail for rest)

Works great! Thanks!

> btw, you can do this:
> 
>  local h, t, pil, pir, pfl, pfr = tex.preparelinebreak(new_head)
>  inspect(pfr)
>  pfr.stretchorder = 0
>  pfr.stretch = 0
> 

Ah, that's quite convenient. I'm still supporting LuaTeX, so
unfortunately I'm somewhat limited with which helpers I can take
advantage of.

> as well as use
> 
>   tex.show(broken)
> 
> to see the result

That will be really nice for debugging. I've either been storing boxes
and typesetting them later (like shown earlier) or using node.traverse +
inspect. This will be much nicer to use.

Thanks,
-- Max
___
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] Can't manipulate glue added by tex.preparelinebreak

2022-07-26 Thread Max Chernoff via ntg-context
Hi Hans,

The new tex.preparelinebreak is great (thanks again), but I can't seem
to figure out how to manipulate the parfillskip nodes that it adds.

MWE:

\newbox\testbox

   \startluacode
   function test(head)
   if head.id ~= node.id "par" then
   return head
   end
   
   new_head = node.copylist(head)
   tex.preparelinebreak(new_head)
   
   local parfillskip = node.tail(new_head)
   inspect(parfillskip) -- Confirm that this really is a parfillskip
   parfillskip.stretchorder = 0
   parfillskip.stretch = 0
   
   local broken = tex.linebreak(new_head)
   tex.setbox("global", "testbox", broken)
   
   return head
   end
   \stopluacode
   
   \starttext
   {\dorecurse{209}{Hello }\par}\page
   
   {\parfillskip=0pt\dorecurse{209}{Hello }\par}\page
   
   {\ctxlua{nodes.tasks.appendaction("processors", "after", "test")}
\dorecurse{209}{Hello }\par}\page
   
   \box\testbox
   \stoptext

I would expect that pages 1 and 3 would be identical, and that pages 2
and 4 would be identical. However, page 4 is the same as pages 1 and 3,
which isn't what I'd expect. I can do a similar idea in LuaTeX/MkIV and
get the expected results, so I'm not too sure what I'm doing wrong here.
I'm probably just missing something obvious, but I'm not too sure what.
Any ideas?

Thanks,
-- Max
___
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] debugging lmtx and firefox (was: TeXGyre Heros on Firefox)

2022-07-22 Thread Max Chernoff via ntg-context


> the firefox pdf viewer has problems with at least two sans serif
> fonts.
> 
> Using this mwe I get a bad display in ff with Gyre font and Alegreya
> Font.
> 

What do you mean by "bad display"? Are the fonts blurry, or are the
shapes all slightly distorted? Your test file displays fine on my
system.

> But there are many Firefox users out there who never use a real 
> pdf-viewer. I would like to show them a good result.

I've been using Firefox (and pdf.js) as my PDF viewer almost exclusively
for the past ~2 years, and I've been using ConTeXt LMTX for about the
same amount of time. I haven't noticed any font issues, so I suspect
that this issue is system-dependant. I've mostly been on Windows for the
past few years, but I'm now on Linux, and I haven't noticed any issues
with either.

> I have no idea if the difference is the cause of the bad display.
> 
> Luckily chrome based browsers shows the fonts without any flaws.

Ok, random guess time (so I may be waay off here):

I think that this is a hinting problem. The TeX Gyre fonts are all
professionally hinted, so what might be happening be that when ConTeXt
is subsetting the fonts, it is removing all of the hinting information,
while LibreOffice is keeping all of the hints. I've opened PDFs from
ConTeXt and LibreOffice in FontForge and the hints are still there, so I
don't think that this is the case, but maybe? The hinting format is also
wildly different between Type 1 and CFF/OTF, so maybe there is just a
bug in one of the font renderers. 

Chrome uses an internal backend to render all of its text, but Firefox
uses system-dependant backends (I think). Most renderers these days will
autohint unhinted fonts using an embedded FreeType so that they still
display somewhat-well. You can adjust the "hinting strength" in
FreeType, which I would guess would usually be set to the maximum. So
LibreOffice includes the font hints and things display fine, and Chrome
uses a bundled FreeType with maximum hinting so things display fine.

Firefox on Windows would need to bundle its own FreeType since there
isn't a system one, and it renders fine in my experience. But Firefox on
Linux would just use the system FreeType. I think that you are on Linux
(?) and the default in Linux is for minimal/no hinting. Now, I've
specifically enabled maximum hinting on my system, and I'm not seeing
any problems with rendering. If you're using Gnome, can you try enabling
"full" hinting in Gnome Tweaks, reboot, then test again? No idea how to
configure this with other DEs, but I'm sure that it's possible. 

Another related guess is that older versions of FreeType maybe had a bug
with parsing/displaying hints. I think that Chrome bundles its own
FreeType which would be recent, but if you're using Firefox on Linux, it
is probably using the system FreeType library. If you're on an older LTS
distro, then the system FreeType may be really old and buggy.

If you're using macOS, I can't really help you too much except for to
say that text rendering on macOS is usually pretty bad unless you have a
really high resolution screen.

So those are my random guesses. Maybe one of them is helpful somehow.

-- Max
___
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] Metafun hexagons aren't hexagons

2022-07-20 Thread Max Chernoff via ntg-context
Hi,

The recently added Metafun hexagons seem to be producing octagons
instead:

   \startMPpage
   fill fullhexagon scaled 100;
   draw unithexagon scaled 50 withcolor white;
   \stopMPpage
   
-- Max
___
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] upload

2022-07-08 Thread Max Chernoff via ntg-context
This is because you need to pass a list that conforms to what the 
builder expects and the callback that you use doesn't do that for you 
(after all, it also gets hbox content).


Isn't "processors/after" the same as "pre_linebreak_filter"? I thought 
that only "hpack_filter" gets \hbox content? Anyways, my actual function 
has this guard at the very start:


if (head.id ~= par_id and context) or -- Ensure that we were 
actually given a par

status.output_active or -- Don't run during the output routine
tex.nest.ptr > 1 -- Don't run inside boxes
then
return head
end

so I think that I'm only processing actual top-level paragraphs here.

There is no 'callback sequence handler' for the par builder (currently i 
see no need for it, also given the extra overhead involved) but this 
what what you can do:


\startluacode
 function builders.paragraphs.constructors.methods.preroll_a(head)
 local result, info = tex.linebreak(head)
 tex.prevdepth = info.prevdepth
 tex.prevgraf = info.prevgraf
 return result
 end
 function builders.paragraphs.constructors.methods.preroll_b(head)
 local result, info = tex.linebreak(nodes.nuts.copylist(head))
 inspect(info)
 return true
 end
\stopluacode

\defineparbuilder[preroll_a]
\defineparbuilder[preroll_b]

\starttext
 \setmainparbuilder[default]   \input tufte \par \input tufte \page
 \setmainparbuilder[preroll_a] \input tufte \par \input tufte \page
 \setmainparbuilder[preroll_b] \input tufte \par \input tufte \page
\stoptext


I think that that code is for replacing the linebreaker entirely, like 
with using "linebreak_filter"? My goal isn't to replace the linebreaker; 
I just want to be able to inspect the paragraph before it is broken, 
without modifying anything.


What I'm trying to do *very* roughly looks like the following:

paragraphs = {}
attribute = 1234

function pre_linebreak_filter(head)
if head.id ~= node.id"par" then
return head
end

local nat_node, nat_info = tex.linebreak(node.copylist(head))
node.freelist(nat_node)

local long_node, long_info = tex.linebreak(
node.copylist(head), {looseness = 1}
)

if long_info.prevgraf == nat_info.prevgraf + 1 then
table.insert(paragraphs, long_node)
end

return head
end

function post_linebreak_filter(head)
node.setattribute(head, attribute, #paragraphs)
node.setattribute(node.slide(head), attribute, #paragraphs)

return head
end

function pre_output_filter(head)
if tex.outputpenalty ~= tex.widowpenalty then
return head
end

-- Pick a paragraph from `paragraphs` somehow

-- Replace that paragraph on the page with the one
-- from `paragraphs`

-- Move the last line of the page onto the top of
-- tex.lists.contributehead

return head
end

(The full implementation is in the module "lua-widow-control" on CTAN, 
TeX Live, and modules.contextgarden.net, or directly at 
"https://github.com/gucci-on-fleek/lua-widow-control/blob/master/source/lua-widow-control.lua;. 
It's pretty long though, so I'm just trying to summarize here.)


This works pretty well with Plain LuaTeX, LuaLaTeX, OpTeX, MkIV, and 
MkXL before the latest upload, but something broke with the latest 
upload in MkXL. I understand that I'm mucking around with volatile 
interfaces, and I have no problem making a bunch of changes whenever the 
engine/format changes; the problem is that I'm not too sure what changed 
in the engine, so I don't know what I need to change in my code.


On the to do is a to add a 'prepare' helper that adds 
the mandate nodes (par fillers etc) 


Maybe that's all that I need? If that's the case, I have no problem 
coding my own "prepare helper" if you think that it'll be awhile before 
you get around to it; the problem is that I'm not entirely sure what 
nodes I would need to add. These new nodes aren't added until after 
"pre_linebreak_filter", and they're gone after the linebreaker runs, so 
I can't inspect a "regular" paragraph to see where these nodes belong.


but even then one has to be careful 
where linebreak hackery is applied.


Oh yes, I'm well aware :) Earlier versions of my module would silently 
eat entire paragraphs, which was very not good. Luckily that problem is 
fixed now.


And finally, thanks for all your work with LuaMetaTeX. This new engine 
is quite nice to work with and has some pretty cool new features.


Thanks,
-- Max
___
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  : 

Re: [NTG-context] Malfunctioning of syllabic partitioning of words in Spanish

2022-07-06 Thread Max Chernoff via ntg-context
I am writing a document in Spanish and I notice that the syllable 
partitioning of words does not conform to the rules of the language. And 
so, for example, the word "limitarse" is partitioned as "lim-itarse" 
(the correct one is "li-mi-tar-se"), "colores" as "col-ores" (instead of 
"co-lo-res"), "abstenerse" as "absten-erse" (and it should be 
"abs-te-ner-se"), etc.


Make sure that you set up the language correctly. Using this test file 
(on today's new upload):


\language[es] % Needed for Spanish hyphenation

\starttext
\hsize=0pt % Hack to force hyphenation

limitarse

colores

abstenerse
\stoptext

I get:

li­-mi­-tar­-se // co­-lo­-res // abs­-te­-ner­-se

I don't know any Spanish, but using your test words, I think that these 
are the expected results.


Using the "pattern" script, I get slightly different results, but it 
still seems correct to me:


$ mtxrun --script pattern --hyphenate --language=es limitarse
[...]
mtx-patterns| es 3 3 : limitarse : limi-tarse

$ mtxrun --script pattern --hyphenate --language=es colores
[...]
mtx-patterns| es 3 3 : colores : colo-res

$ mtxrun --script pattern --hyphenate --language=es abstenerse
[...]
mtx-patterns| es 3 3 : abstenerse : abs-te-nerse

If adding "\language[es]" to your document doesn't help, I believe that 
there are a few Spanish speakers on the list who will know much more 
than I do about setting up the hyphenation.


-- 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] upload

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

Hi,

With the latest upload, "tex.linebreak" doesn't return an "info" table.

When running this code:

\startluacode
function test(head)
local new_head, info = tex.linebreak(node.copylist(head))

print(head, type(head), info, type(info))

if info == nil then
print "!!! info is nil !!!"
end

return head
end

nodes.tasks.appendaction("processors", "after", "test")
\stopluacode

\starttext
Hello!
\stoptext

with the latest upload I get (also note the small typo in "rigthfill"):

luatex warning  > linebreak: no [ leftinit | rightinit | leftfill | 
rigthfill] expected
   2353 : par vmodepar>  userdatanil 
nil
!!! info is nil !!!
   2299 : glue userskip> userdatanil 
nil
!!! info is nil !!!

but with live.contextgarden.net I get:

luatex warning  > tex: left parfill skip is gone
Underfull \hbox (badness 1) in paragraph at lines 20--1
929 : par vmode_par> userdata
table: 0x39a050f7000table
   1561 : glue userskip> userdatanil 
nil
!!! info is nil !!!

Thanks,
-- 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] "pragma-ade.com" is now a domain parking page

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

Well, we must change a lot of dead links on the wiki now.

Taco, can you automate it? Otherwise I’ll start...


I do not know of a clean way to automate that. It may be possible, but then it 
is outside of my knowledge set. So yeah, by hand.


This might work

https://wiki.contextgarden.net/Special:ReplaceText

but I don't have the permissions to use it. I have no idea if it will 
work, but it looks like both of you (Hraban and Taco) are administrators 
and thus have requisite permissions to test it.


-- 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] "pragma-ade.com" is now a domain parking page

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

Hans had been complaining about networksolutions not allowing him to move the 
domain away from them, so I guess this was to be expected.
indeed, and transfer is pending for ages now ... looks liek they don't 
like to transfer


They only have 5 days to respond to a transfer request. If it's been
longer -- which it presumably has been -- you can file a complaint with
ICANN, which should hopefully push them to complete the transfer.


https://www.icann.org/en/system/files/files/transfer-complaint-24aug16-en.pdf

Even if it's expired, you should still be able to transfer it:

https://www.icann.org/resources/pages/name-holder-faqs-2017-10-10-en (#11)

The WHOIS info says that the domain doesn't expire until 2023-06-28, so
I'm not too sure what's going on here.

make me wonder if we should just ditch that domain and stick to the nl 
one only, saves money too


There are lots of links around the web to "pragma-ade.com". It might be a
good idea to phase out the .com and have all of the pages redirect to the
.nl, but I'd say that it's probably worth the ~$15/year to make sure that
pragma-ade.com isn't used to host spam/porn/malware.

-- 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] "pragma-ade.com" is now a domain parking page

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

When I go to:

https://www.pragma-ade.com/

I get a page that says:

pragma-ade.com expired on 06/28/2016 and is pending renewal or deletion.

followed by some advertisements. Both a link archiver

https://archive.today/jUOox

and an SSL/TLS certificate checker

https://www.ssllabs.com/ssltest/analyze.html?d=www.pragma-ade.com

show the same results, so I'm pretty sure that this isn't just an issue
with my connection.

Both "https://www.pragma-ade.nl/; and "https://www.pragma-pod.nl/; still
work as expected.

Here's the output of a few debugging commands:

$ whois pragma-ade.com
   Domain Name: PRAGMA-ADE.COM
   Registry Domain ID: 30119007_DOMAIN_COM-VRSN
   Registrar WHOIS Server: whois.networksolutions.com
   Registrar URL: http://networksolutions.com
   Updated Date: 2022-06-30T10:41:12Z
   Creation Date: 2000-06-28T10:41:39Z
   Registry Expiry Date: 2023-06-28T10:41:39Z
   Registrar: Network Solutions, LLC
   Registrar IANA ID: 2
   Registrar Abuse Contact Email: ab...@web.com
   Registrar Abuse Contact Phone: +1.8003337680
   Domain Status: clientTransferProhibited 
https://icann.org/epp#clientTransferProhibited
   Name Server: NS1.PENDINGRENEWALDELETION.COM
   Name Server: NS2.PENDINGRENEWALDELETION.COM
   DNSSEC: unsigned
   URL of the ICANN Whois Inaccuracy Complaint Form: 
https://www.icann.org/wicf/
>>> Last update of whois database: 2022-07-01T05:34:25Z <<<


$ dig www.pragma-ade.com @1.1.1.1
; <<>> DiG 9.16.1-Ubuntu <<>> www.pragma-ade.com @1.1.1.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33675
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;www.pragma-ade.com.IN  A

;; ANSWER SECTION:
www.pragma-ade.com. 7200IN  A   208.91.197.132

;; Query time: 90 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Thu Jun 30 23:34:00 MDT 2022
;; MSG SIZE  rcvd: 63


$ whois 208.91.197.132
NetRange:   208.91.196.0 - 208.91.197.255
CIDR:   208.91.196.0/23
NetName:CONFLUENCE-NETWORK-INC
NetHandle:  NET-208-91-196-0-1
Parent: NET208 (NET-208-0-0-0-0)
NetType:Direct Allocation
OriginAS:   AS40034
Organization:   Confluence Networks Inc (CN)
RegDate:2011-04-15
Updated:2015-11-23
Ref:https://rdap.arin.net/registry/ip/208.91.196.0

OrgName:Confluence Networks Inc
OrgId:  CN
Address:3rd Floor, J & C Building, P.O. Box 362
City:   Road Town
StateProv:  Tortola
PostalCode: VG1110
Country:VG
RegDate:2011-04-07
Updated:2017-03-29
Ref:https://rdap.arin.net/registry/entity/CN


$ whois pragma-ade.nl
Domain name: pragma-ade.nl
Status:  active

Reseller:
   Soverin BV
   Vijzelstraat 68
   1017HL Amsterdam
   Netherlands

Registrar:
   Metaregistrar B.V.
   Zuidelijk Halfrond 1
   2801DD Gouda
   Netherlands

Abuse Contact:
   +31.858885692
   ab...@metaregistrar.com

Creation Date: 1999-02-10

Updated Date: 2021-11-23

DNSSEC:  yes

Domain nameservers:
   ns0.soverin.net
   ns1.soverin.net
   ns2.soverin.net
   ns3.soverin.net

Record maintained by: NL Domain Registry


$ dig www.pragma-ade.nl @1.1.1.1

; <<>> DiG 9.16.1-Ubuntu <<>> www.pragma-ade.nl @1.1.1.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7089
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;www.pragma-ade.nl. IN  A

;; ANSWER SECTION:
www.pragma-ade.nl.  300 IN  A   213.125.29.165

;; Query time: 730 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Thu Jun 30 23:55:28 MDT 2022
;; MSG SIZE  rcvd: 62


$ whois 213.125.29.165
inetnum:213.125.29.160 - 213.125.29.167
netname:PRAGMA
descr:  Pragma
descr:  Hasselt
descr:  This space is statically assigned.
country:NL
admin-c:HH6275-RIPE
tech-c: ZBTB1-RIPE
status: ASSIGNED PA
mnt-by: ZIGGO-AUTOREG1
created:2015-11-18T13:16:01Z
last-modified:  2015-11-18T13:16:01Z
source: RIPE

role:   VODAFONEZIGGO IP AUTHORITY
address:Kabelweg 51
address:1014BA Amsterdam
address:The Netherlands
phone:  +3188717
admin-c:ZIPA1-RIPE
tech-c: MB5261-RIPE
tech-c: BH4773-RIPE

[NTG-context] Tagging corrupts URLs in bibliographies

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

Enabling PDF tagging corrupts the URLs displayed in bibliographies.

MWE:

\setuptagging[state=start]

\usebtxdataset[mkiv-publications.bib]
\usebtxdefinitions[apa]
% \usebtxdefinitions[chicago]

\starttext
\nocite[article, advancedonline]
\placelistofpublications
\stoptext

I think that APA and Chicago are the only styles that display URLs in
the bibliography, but there may be others that I'm missing. There's a
patch at the end that seems to fix things for me, although there's
likely a better solution.

-- Max

--- texmf-context/tex/context/base/mkiv/publ-ini.old2022-06-30 
14:54:35.422262400 -0600
+++ texmf-context/tex/context/base/mkiv/publ-ini.mkiv   2022-06-30 
15:06:28.975132000 -0600
@@ -399,6 +399,7 @@
 % This fails when we check field values:
 
 \let\btxrawfield\btxfield

+\let\btxrawflush\btxflush
 
 \def\btxfield  #1{\dostarttagged\t!pubfld{#1}\clf_btxfield {\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged}

 \def\btxdetail 
#1{\dostarttagged\t!pubfld{#1}\clf_btxdetail{\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged}


--- texmf-context/tex/context/base/mkxl/publ-ini.old2022-06-30 
15:05:36.018821900 -0600
+++ texmf-context/tex/context/base/mkxl/publ-ini.mkxl   2022-06-30 
15:06:22.220074900 -0600
@@ -399,6 +399,7 @@
 \aliased\let\btxsetup\fastsetup
 
 \permanent\def\btxrawfield   #1{\clf_btxfield {\currentbtxdataset}{\currentbtxtag}{#1}}

+\permanent\def\btxrawflush   #1{\clf_btxflush 
{\currentbtxdataset}{\currentbtxtag}{#1}}
 
 \permanent\def\btxfield  #1{\dostarttagged\t!pubfld{#1}\clf_btxfield {\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged}

 \permanent\def\btxdetail 
#1{\dostarttagged\t!pubfld{#1}\clf_btxdetail{\currentbtxdataset}{\currentbtxtag}{#1}\dostoptagged}


--- texmf-context/tex/context/base/mkiv/publ-imp-apa.old2022-06-30 
14:56:18.210565000 -0600
+++ texmf-context/tex/context/base/mkiv/publ-imp-apa.mkvi   2022-06-30 
14:56:40.611212000 -0600
@@ -1263,12 +1263,12 @@
 \setbreakpoints[doi]
 \ifconditional\btxinteractive
 \goto {
-\hyphenatedurl{\btxflush{url}}
+\hyphenatedurl{\btxrawflush{url}}
 } [
-url(\btxflush{url})
+url(\btxrawflush{url})
 ]
 \else
-\hyphenatedurl{\btxflush{url}}
+\hyphenatedurl{\btxrawflush{url}}
 \fi
 \endgroup
 \stoptexdefinition
@@ -1280,12 +1280,12 @@
 \setbreakpoints[doi]
 \ifconditional\btxinteractive
 \goto {
-\hyphenatedurl{doi:\btxflush{doi}}
+\hyphenatedurl{doi:\btxrawflush{doi}}
 } [
-url(http://dx.doi.org/\btxflush{doi})
+url(http://dx.doi.org/\btxrawflush{doi})
 ]
 \else
-\hyphenatedurl{doi:\btxflush{doi}}
+\hyphenatedurl{doi:\btxrawflush{doi}}
 \fi
 \endgroup
 \stoptexdefinition


--- texmf-context/tex/context/base/mkiv/publ-imp-chicago.old2022-06-30 
14:59:53.31010 -0600
+++ texmf-context/tex/context/base/mkiv/publ-imp-chicago.mkvi   2022-06-30 
15:00:39.497438200 -0600
@@ -1258,12 +1258,12 @@
 \setbreakpoints[doi]
 \ifconditional\btxinteractive
 \goto {
-\hyphenatedurl{\btxflush{url}}
+\hyphenatedurl{\btxrawflush{url}}
 } [
-url(\btxflush{url})
+url(\btxrawflush{url})
 ]
 \else
-\hyphenatedurl{\btxflush{url}}
+\hyphenatedurl{\btxrawflush{url}}
 \fi
 \endgroup
 \stoptexdefinition
@@ -1275,12 +1275,12 @@
 \setbreakpoints[doi]
 \ifconditional\btxinteractive
 \goto {
-\hyphenatedurl{doi:\btxflush{doi}}
+\hyphenatedurl{doi:\btxrawflush{doi}}
 } [
-url(http://dx.doi.org/\btxflush{doi})
+url(http://dx.doi.org/\btxrawflush{doi})
 ]
 \else
-\hyphenatedurl{doi:\btxflush{doi}}
+\hyphenatedurl{doi:\btxrawflush{doi}}
 \fi
 \endgroup
 \stoptexdefinition
___
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] Odd behaviour with Plex typescript

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

just preload it, as in:

\usebodyfont[modern]

\setupbodyfont[plex]

\setuphead
   [section]
   [style={\switchtobodyfont[modern]}]

\starttext
 \section{A}
 A
\stoptext


That seems to have fixed it. Thanks!

-- 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] \setextrafontkerns can cause an infinite loop

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

Sometimes using \setextrafontkerns can cause an infinite loop.

Example 1:

\setextrafontkerns[max]

\starttext
l\it l
\stoptext

Example 2:

\setupbodyfont[libertinus]

\setextrafontkerns[max]

\starttext
x\ss x
\stoptext

Both of these examples cause ConTeXt to get stuck until it runs out of
memory. This happens in both MkIV and MkXL.

This patch seems to fix the issue (although it may break other things...):

--- texmf-context/tex/context/base/mkiv/typo-fkr.old2022-06-30 
03:05:17.702804200 -0600
+++ texmf-context/tex/context/base/mkiv/typo-fkr.lua2022-06-30 
03:05:22.286858200 -0600
@@ -57,6 +57,7 @@
 end
 if kern ~= 0 then
 head, current = 
insertbefore(head,current,new_kern(kern))
+current = getnext(current)
 end
 lastdata = data
 else
@@ -69,6 +70,7 @@
 local kern = getkernpair(lastdata,lastchar,char)
 if kern ~= 0 then
 head, current = 
insertbefore(head,current,new_kern(kern))
+current = getnext(current)
 end
 end
 lastchar = char

-- 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] Odd behaviour with Plex typescript

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

If you load the Plex typescript, a spurious space is added on the first
switch to another font, messing up any alignment. This doesn't happen
with any other fonts; only with Plex.

MWE:

\setuphead[section][style={\switchtobodyfont[modern]}]
\setupbodyfont[plex]

\starttext
\section{A}
A
\stoptext

I was able to fix this by removing the space immediately before the "%"
on line 136 of "type-imp-plex.mkiv", changing it from this (original):


\definefontfeature[plexwideneddefault][default][extend=\luaexpr{1/0.85}] % An 
odd floating point number to correct monospace.

to this (fixed):


\definefontfeature[plexwideneddefault][default][extend=\luaexpr{1/0.85}]% An 
odd floating point number to correct monospace.

I'm pretty sure that TeX is ignoring spaces at this point, so I have no
idea why this issue exists or why the fix works.

-- 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] [Bug] Two-column text: Larger top spacing in inline images

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

Not a bug, although it may be unexpected. It's a grid snapping thing. Try:

\def\example{%
Lorem ipsum. Lorem ipsum. Lorem ipsum.
Lorem ipsum. Lorem ipsum. Lorem ipsum.
Lorem ipsum. Lorem ipsum. Lorem ipsum.
Lorem ipsum. Lorem ipsum. Lorem ipsum.
Lorem ipsum. Lorem ipsum. Lorem ipsum.
Lorem ipsum. Lorem ipsum. Lorem ipsum.
\startMPcode draw fullcircle scaled 1cm; \stopMPcode\
Lorem ipsum. Lorem ipsum. Lorem ipsum.}

\starttext
\example
\startcolumns[grid=off]
\example
\stopcolumns
\stoptext

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


  1   2   >