Re: [NTG-context] lmtx

2019-12-11 Thread Richard Mahoney | Indica et Buddhica
Thank you Hans. I've just generated a monograph I'm setting with your
new linux-64 zip. Everything seems just fine, great.


Best, Richard




-- 
Richard Mahoney | Indica et Buddhica
 
Littledene  Bay Road  Oxford  NZ 
T: +6433121699  M: +64210640216 
r.maho...@indica-et-buddhica.org 

https://indica-et-buddhica.org/ 

-Original Message-
From: Hans Hagen 
Reply-To: mailing list for ConTeXt users 
To: mailing list for ConTeXt users 
Subject: [NTG-context] lmtx
Date: Thu, 12 Dec 2019 01:37:00 +0100
Mailer: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) 
Gecko/20100101
 Thunderbird/68.3.0

Hi,

The last few days there have been reports about garbled files in the 
lmtx installation so I did some test oinon a linux machine and indeed 
there was some issue (I'm not sure what causes it). Anyway, I made
new 
zips so maybe one needs to reinstall (using the installer zip). It 
installs okay on wsl so probably also on other linuxes.

This version (luametatex 2.03.3) has (again) a little smaller mem 
footprint as I still want it all to perforem ok on relative small 
devices or vm's and as side effect a bit smaller format file, not
that 
that matters much (compared to general mem usage). There is not much
to 
gain anyway, in terms of memory usage and performance so it's more an 
occasional challenge than a neccessity I guess.

Anyway, hopefully nothing got broken. Peter Rolf and I are updating
some 
of the pdf validation related stuff (additional formats), so that can
be 
in flux.

Hans

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

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

2019-12-11 Thread Otared Kavian
Actually I did the update with a new install.sh downloaded from Pragma's site, 
but in fact I got again the older version 2019.12.06 21:40…
So the issues I was reporting concern 2019.12.06 21:40 version.

> On 12 Dec 2019, at 06:28, Otared Kavian  wrote:
> 
> Hi Hans,
> 
> Thank you for the new beta. I tested a few things and they work nicely as 
> expected. 
> 
> However I would like to ask you to put back into lmtx the nice error messages 
> handling we had in early November: now when there is an error it is 
> impossible to locate it and the file filename-status.html contains nothing 
> (though the colored « error » pdf produced is nice looking…).
> In early November the error messages were very precise and the file 
> filename-status.html was very helpful.
> 
> There is also an issue in lmtx (since the version 2019.12.06, including the 
> latest) where in some situations using \startitemize... \stopitemize produces 
> some garbled items and some numbered items completely disappear. I could not 
> make a minimal example, but I can send you the PDF which shows the issue.
> 
> Many thanks, and best regards: OK
> 
> 
>> On 12 Dec 2019, at 01:37, Hans Hagen  wrote:
>> 
>> Hi,
>> 
>> The last few days there have been reports about garbled files in the lmtx 
>> installation so I did some test oinon a linux machine and indeed there was 
>> some issue (I'm not sure what causes it). Anyway, I made new zips so maybe 
>> one needs to reinstall (using the installer zip). It installs okay on wsl so 
>> probably also on other linuxes.
>> 
>> This version (luametatex 2.03.3) has (again) a little smaller mem footprint 
>> as I still want it all to perforem ok on relative small devices or vm's and 
>> as side effect a bit smaller format file, not that that matters much 
>> (compared to general mem usage). There is not much to gain anyway, in terms 
>> of memory usage and performance so it's more an occasional challenge than a 
>> neccessity I guess.
>> 
>> Anyway, hopefully nothing got broken. Peter Rolf and I are updating some of 
>> the pdf validation related stuff (additional formats), so that can be in 
>> flux.
>> 
>> Hans
>> 
>> -
>> Hans Hagen | PRAGMA ADE
>> Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>>  tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
>> -
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> 
>> maillist : ntg-context@ntg.nl / 
>> http://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>> ___
> 

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

2019-12-11 Thread Otared Kavian
Hi Hans,

Thank you for the new beta. I tested a few things and they work nicely as 
expected. 

However I would like to ask you to put back into lmtx the nice error messages 
handling we had in early November: now when there is an error it is impossible 
to locate it and the file filename-status.html contains nothing (though the 
colored « error » pdf produced is nice looking…).
In early November the error messages were very precise and the file 
filename-status.html was very helpful.

There is also an issue in lmtx (since the version 2019.12.06, including the 
latest) where in some situations using \startitemize... \stopitemize produces 
some garbled items and some numbered items completely disappear. I could not 
make a minimal example, but I can send you the PDF which shows the issue.

Many thanks, and best regards: OK


> On 12 Dec 2019, at 01:37, Hans Hagen  wrote:
> 
> Hi,
> 
> The last few days there have been reports about garbled files in the lmtx 
> installation so I did some test oinon a linux machine and indeed there was 
> some issue (I'm not sure what causes it). Anyway, I made new zips so maybe 
> one needs to reinstall (using the installer zip). It installs okay on wsl so 
> probably also on other linuxes.
> 
> This version (luametatex 2.03.3) has (again) a little smaller mem footprint 
> as I still want it all to perforem ok on relative small devices or vm's and 
> as side effect a bit smaller format file, not that that matters much 
> (compared to general mem usage). There is not much to gain anyway, in terms 
> of memory usage and performance so it's more an occasional challenge than a 
> neccessity I guess.
> 
> Anyway, hopefully nothing got broken. Peter Rolf and I are updating some of 
> the pdf validation related stuff (additional formats), so that can be in flux.
> 
> Hans
> 
> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

2019-12-11 Thread Hans Hagen

Hi,

The last few days there have been reports about garbled files in the 
lmtx installation so I did some test oinon a linux machine and indeed 
there was some issue (I'm not sure what causes it). Anyway, I made new 
zips so maybe one needs to reinstall (using the installer zip). It 
installs okay on wsl so probably also on other linuxes.


This version (luametatex 2.03.3) has (again) a little smaller mem 
footprint as I still want it all to perforem ok on relative small 
devices or vm's and as side effect a bit smaller format file, not that 
that matters much (compared to general mem usage). There is not much to 
gain anyway, in terms of memory usage and performance so it's more an 
occasional challenge than a neccessity I guess.


Anyway, hopefully nothing got broken. Peter Rolf and I are updating some 
of the pdf validation related stuff (additional formats), so that can be 
in flux.


Hans

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

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


Re: [NTG-context] changing alignment inside a paragraph

2019-12-11 Thread Wolfgang Schuster



mf schrieb am 11.12.2019 um 15:31:

This is a good-enough solution to my problem:

\setupalign[stretch]

\starttext

\def\Text{This is the text of an index term, that is normally justified,
but I'd like the page numbers to be flushed to the right from
their second line}

\def\Pages{34, 57, 101-104, 276, 345, 401, 403, 512.}

\type{\PlaceIndexTerm} has 6 parameters:
\startitemize[n]
\item the main text
\item the pages' numbers
\item the text width
\item the left margin of the lines made only of page numbers
\item the width of the separator (an hbox) before the first page 
number, when there's room

  in the last line of the text
\item the minimum accepted space left at the end of the last line of 
text, to put a page number

\stopitemize

\def\PlaceIndexTerm#1#2#3#4#5#6{%
\newdimen\TextWidth \TextWidth=#3
\newdimen\SBPN \SBPN=#5 % space before page numbers
\newdimen\PagesIndentation \PagesIndentation=#4
\newdimen\MSLLL \MSLLL=#6 % minimum space left on last line
\parshape 1 0pt \TextWidth #1\par
\newdimen\LLW \LLW=\lastlinewidth
\page[no]
\ifdim \dimexpr\TextWidth-\LLW-\SBPN > \MSLLL 
\blank[-\the\lineheight,fixed]\fi

\startalignment[flushright,stretch]
\ifdim \dimexpr\TextWidth-\LLW-\SBPN > \MSLLL
\parshape 2
\LLW \dimexpr \TextWidth - \LLW
\PagesIndentation \dimexpr \TextWidth - \PagesIndentation \red
\else
\parshape 1 \PagesIndentation \dimexpr \TextWidth - \PagesIndentation 
\darkgreen

\fi
\noindent\ifdim \dimexpr\TextWidth-\LLW-\SBPN > \MSLLL\hbox to 
\SBPN{}\fi #2\par

\stopalignment}


\starttext

\startbuffer
This is the text of an index term, that is normally justified,
but I'd like the page numbers to be flushed to the right from
their second line\par
\startalignment[flushright]
\ifdim\dimexpr\hsize-\lastlinewidth\relax>2\emwidth
    \blank[overlay]
%   simple solution but doesn't indent the numbers on the following lines
%   \hskip\dimexpr\lastlinewidth+\emwidth\relax
    \parshape 2
    \dimexpr\lastlinewidth+\emwidth\relax 
\dimexpr\hsize-\lastlinewidth-\emwidth\relax

    \emwidth \dimexpr\hsize-\emwidth\relax
\else
    \parshape 1 \emwidth \dimexpr\hsize-\emwidth\relax
\fi
34, 57, 101-104, 276, 345, 401, 403, 512.
\stopalignment
\stopbuffer

\dorecurse
  {10}
  {\hsize\dimexpr.75\textwidth-#1\emwidth\relax
   \getbuffer
   \page}

\stoptext

Wolfgang

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

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


Re: [NTG-context] Ebooks with ConTeXt?

2019-12-11 Thread Rik Kabel


On 12/11/2019 10:45, Henning Hraban Ramm wrote:

Am 2019-12-11 um 16:17 schrieb Rik Kabel :

On 12/11/2019 01:10, Jan U. Hasecke wrote:

Ebooks are xhtml so styles are limited to the capabilities of css. I
fear that initials has to be left flowing images.


Sorry, but if I understand what you mean by initials, that is not the case. 
Consider

.lettrine>p::first-letter {
 font-size: 3rem ;
 line-height  : 0 ;
}

This might be the right CSS instruction, but when I tried that last year, only 
one reader interpreted it correctly.

and ::* are badly supported.

Best, Hraban

Works fine with Calibre, I have not used any other readers. Is this an 
epub 2/3 issue?


--
Rik

___
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] Ebooks with ConTeXt?

2019-12-11 Thread Henning Hraban Ramm

> Am 2019-12-11 um 16:17 schrieb Rik Kabel :
> 
> On 12/11/2019 01:10, Jan U. Hasecke wrote:
>> Ebooks are xhtml so styles are limited to the capabilities of css. I
>> fear that initials has to be left flowing images.
>> 
> Sorry, but if I understand what you mean by initials, that is not the case. 
> Consider
> 
> .lettrine>p::first-letter {
> font-size: 3rem ;
> line-height  : 0 ;
> }

This might be the right CSS instruction, but when I tried that last year, only 
one reader interpreted it correctly.
> and ::* are badly supported.

Best, Hraban

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

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


Re: [NTG-context] Ebooks with ConTeXt?

2019-12-11 Thread Rik Kabel


On 12/11/2019 01:10, Jan U. Hasecke wrote:

Ebooks are xhtml so styles are limited to the capabilities of css. I
fear that initials has to be left flowing images.


Sorry, but if I understand what you mean by initials, that is not the case. 
Consider

   .lettrine>p::first-letter {
    font-size    : 3rem ;
    line-height  : 0 ;
   }

This produces a raised large character at the beginning of a paragraph. It does 
not automatically accommodate leading quotation marks and such, so some tuning 
may be needed, and of course you have to tag the paragraph with the appropriate 
class.

Similarly, you can set the first line of a paragraph to smallcap.

--
Rik

___
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] changing alignment inside a paragraph

2019-12-11 Thread mf

This is a good-enough solution to my problem:

\setupalign[stretch]

\starttext

\def\Text{This is the text of an index term, that is normally justified,
but I'd like the page numbers to be flushed to the right from
their second line}

\def\Pages{34, 57, 101-104, 276, 345, 401, 403, 512.}

\type{\PlaceIndexTerm} has 6 parameters:
\startitemize[n]
\item the main text
\item the pages' numbers
\item the text width
\item the left margin of the lines made only of page numbers
\item the width of the separator (an hbox) before the first page number, 
when there's room

  in the last line of the text
\item the minimum accepted space left at the end of the last line of 
text, to put a page number

\stopitemize

\def\PlaceIndexTerm#1#2#3#4#5#6{%
\newdimen\TextWidth \TextWidth=#3
\newdimen\SBPN \SBPN=#5 % space before page numbers
\newdimen\PagesIndentation \PagesIndentation=#4
\newdimen\MSLLL \MSLLL=#6 % minimum space left on last line
\parshape 1 0pt \TextWidth #1\par
\newdimen\LLW \LLW=\lastlinewidth
\page[no]
\ifdim \dimexpr\TextWidth-\LLW-\SBPN > \MSLLL 
\blank[-\the\lineheight,fixed]\fi

\startalignment[flushright,stretch]
\ifdim \dimexpr\TextWidth-\LLW-\SBPN > \MSLLL
\parshape 2
\LLW \dimexpr \TextWidth - \LLW
\PagesIndentation \dimexpr \TextWidth - \PagesIndentation \red
\else
\parshape 1 \PagesIndentation \dimexpr \TextWidth - \PagesIndentation 
\darkgreen

\fi
\noindent\ifdim \dimexpr\TextWidth-\LLW-\SBPN > \MSLLL\hbox to 
\SBPN{}\fi #2\par

\stopalignment}

\def\PlaceIndexTermDescribed#1#2#3#4#5#6{%
\newdimen\TW\TW=#3
\noindent{\tfx width={\bf \PtToCm{\the\TW}},
pages' left margin (2nd line)={\bf #4},
hbox before pages={\bf #5},\\%
min space left on last line of text={\bf #6}}\par
\blank[halfline]
\PlaceIndexTerm{#1}{#2}{#3}{#4}{#5}{#6}
\blank}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{3cm}{12pt}{1em}{12pt}
In this case there's no space left on the last line of text,
so the page numbers are flushed to the right, starting from
a new line.

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{3.5cm}{12pt}{1em}{12pt}
Now the last line of text is short and there's room to start the page
numbers on the same line. The remainder of page numbers is flushed right,
with a (min) left margin of 12pt.\par
Actually, the page numbers are started in a new paragraph with a 
\type{\parshape}

that depends on the last line of the text; then the new paragraph is moved
upwards with a \type{\blank[-\the\lineheight,fixed]}.
A \type{\page[no]} before the \type{\blank} guarantees that
no page break occurs between text and numbers.

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{4cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{4.5cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{5cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{5.5cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{6cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{6.5cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{7cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{7.5cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{8cm}{12pt}{1em}{12pt}
That \type{512} left on the last line is ugly, and we can trim the 
separator hbox
from \type{1em} to \type{.1em} to let all the page numbers fit in the 
last line:\par

\blank
\PlaceIndexTermDescribed{\Text}{\Pages}{8cm}{12pt}{.1em}{12pt}
or we could increase the left margin of the lines made only of page numbers
(to \type{3cm} in this case), to distribute the numbers better across 
the two lines:\par

\blank
\PlaceIndexTermDescribed{\Text}{\Pages}{8cm}{3cm}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{8.5cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{9cm}{12pt}{1em}{12pt}

\page
\PlaceIndexTermDescribed{\Text}{\Pages}{9.5cm}{12pt}{1em}{12pt}
Increasing the left margin of the lines of page numbers gives a better 
result:\par

\blank
\PlaceIndexTermDescribed{\Text}{\Pages}{9.5cm}{4cm}{1em}{12pt}

\page
Full text width (third parameter set to \type{\textwidth}):\par
\blank
\PlaceIndexTermDescribed{\Text}{\Pages}{\textwidth}{12pt}{1em}{12pt}

\stoptext

(Thanks again to Wolfgang for answering my question)

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

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


Re: [NTG-context] Bug: Segmentation fault

2019-12-11 Thread luigi scarso
On Wed, Dec 11, 2019 at 12:10 AM Hans Hagen  wrote:

> On 12/11/2019 12:03 AM, luigi scarso wrote:
> > I guess that we have to check if catcodetable -1 is already defined...
> i already sent you a patch, probbaly also ok for trunk
>

Committed revision 7235.
-- 
luigi
___
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: Segmentation fault

2019-12-11 Thread Hans Hagen

On 12/11/2019 1:28 AM, Henri Menke wrote:


$ luatex <(echo '\relax\directlua{print("\string\\,")}\bye')
This is LuaTeX, Version 1.11.2 (TeX Live 2020/dev)
  restricted system commands enabled.
(/dev/fd/63\,
)


I don't even want to think about what piping adds to this (some command 
line processing).


Hans

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

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


Re: [NTG-context] Ebooks with ConTeXt?

2019-12-11 Thread Hans Hagen

On 12/11/2019 7:10 AM, Jan U. Hasecke wrote:


What I can say about epub generally is: It's better to avoid fancy
styling at all and use the default fonts and styles of the ebook devices.
indeed, and when you come from context export, just process the file in 
1pt bodyfont on a very large page .. no page breaks, margin mess, floats 
moving then ...


(btw, it's a pitty that pdf viewers can't handle very high pages well 
because having a book with every chapter one page would be nice ... no 
float issue then; i tried that but the problem is that viewers don't 
remember the vertical positions when you go backward)


Hans

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

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


Re: [NTG-context] Bug: Segmentation fault

2019-12-11 Thread luigi scarso
On Wed, Dec 11, 2019 at 1:28 AM Henri Menke  wrote:

> In this case I wanted to generate the thin space (\,).  My expectation
> (which worked elsewhere) was that full expansion will turn "\string\\,"
> into "\\," where the two backslashes have catcode 12 and will not be
> expanded further.  Then the Lua string will turn the escape sequence \\
> into a single backslash, therefore ending up with \, in the Lua string.
>
>


\directlua{token.set_macro("foo","\relax")}
(gdb) x/7c str
0x59376c18: 13 '\r' 101 'e' 108 'l' 97 'a'  120 'x' 32 ' '  0 '\000'
(gdb) p lstr
$24 = 6
where \foo is
 \foo=macro:
->#!.

vs
\directlua{token.set_macro("foo",[==[\relax]==])}
(gdb) x/8c str
0x59376ea8: 92 '\\' 114 'r' 101 'e' 108 'l' 97 'a'  120 'x' 32 ' '  0
'\000'
(gdb) p lstr
$25 = 7
\foo=macro:
->\relax .

Another example is
\directlua{token.set_macro("foo","\medskip")}\show\foo
which gives the error:   invalid escape sequence near '"^^Kskip \m'.
vs
\directlua{token.set_macro("foo",[==[\medskip]==])}\show\foo
 which gives
\foo=macro:
->\vskip \medskipamount .

Your example:
\directlua{token.set_macro("foo","\string\\,")}\show\foo
gives
(gdb) x/3c str
0x593765a8: 92 '\\' 44 ','  0 '\000'
(gdb) p lstr
$29 = 2
 \foo=macro:
->BAD,.

vs
\directlua{token.set_macro("foo",[==[\,]==])}\show\foo
(gdb) x/20c str
0x59376908: 92 '\\' 109 'm' 115 's' 107 'k' 105 'i' 112 'p' 32 ' '  92
'\\'
0x59376910: 116 't' 104 'h' 105 'i' 110 'n' 109 'm' 117 'u' 115 's' 107
'k'
0x59376918: 105 'i' 112 'p' 32 ' '  0 '\000'
(gdb) p lstr
$31 = 19
 \foo=macro:
->\mskip \thinmuskip .


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