Re: [NTG-context] Nuclear reactions

2023-04-15 Thread Hans Åberg via ntg-context

> On 15 Apr 2023, at 19:19, Gavin via ntg-context  wrote:
> 
> I’m writing nuclear reactions. When add prescripts to atomic symbols with two 
> letters, (Be, Sr, Xe, etc.) the prescripts split the atoms!

One can use Unicode superscript and subscript numbers, as in ²³⁵₉₂U, which is 
easier to read. For input, an editor supporting text substitutions might be 
used.


___
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] Unicode superscript and subscript parentheses as operators

2021-12-30 Thread Hans Åberg via ntg-context

> On 28 Dec 2021, at 23:05, Hans Hagen  wrote:
> 
> On 12/28/2021 10:53 PM, Hans Åberg wrote:
> 
>> This is great, though there is a typo in the second line. I attach a 
>> corrected example, illustrating what I might use it for: A logic program, 
>> where I found it readable in plain text to use the Unicode superscript and 
>> subscript parentheses. But when typeset, they should be superscripts and 
>> subscripts.
> i still want to come up with domain specific math features ... sp fpr 
> instance we could have a module for logic but it's users who have to come up 
> with demands ...

With direct bindings in LuaTeX it might be easier. —TeX syntax is good for 
writing by hand only.


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

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


Re: [NTG-context] Unicode superscript and subscript parentheses as operators

2021-12-28 Thread Hans Åberg via ntg-context

> On 28 Dec 2021, at 23:05, Hans Hagen  wrote:
> 
> On 12/28/2021 10:53 PM, Hans Åberg wrote:
> 
>> This is great, though there is a typo in the second line. I attach a 
>> corrected example, illustrating what I might use it for: A logic program, 
>> where I found it readable in plain text to use the Unicode superscript and 
>> subscript parentheses. But when typeset, they should be superscripts and 
>> subscripts.
> i still want to come up with domain specific math features ... sp fpr 
> instance we could have a module for logic but it's users who have to come up 
> with demands ...

I found using Unicode superscript and subscript parentheses more readable in 
general than the TeX convention in plain text. Otherwise, the program has logic 
as a basis, but is not intended to be restricted to that. FYI, the program is 
posted here, but has some dependencies to get running. The directory 'tests' 
has examples that are precompiled (checked agains with 'make check').

https://savannah.gnu.org/git/?group=metalogic-inference


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

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


Re: [NTG-context] Unicode superscript and subscript parentheses as operators

2021-12-28 Thread Hans Åberg via ntg-context

> On 28 Dec 2021, at 23:03, Hans Hagen  wrote:
> 
> On 12/28/2021 10:53 PM, Hans Åberg wrote:
>> \starttext
>> Course-of-values induction:
>>   $$휞 ⊢ 푷(0); 휞, 풚 ≤ 풙 ⇒ 푷(풚) ⊢⁽풚⁾₍풙₎ 푷(s(풙)) ⊩ 휞 ⊢ 푷(풕)$$
>> \stoptext
> 
> stay away from $$ but use
> 
>  \startformula
>  휞 ⊢ 푷(0); 휞, 풚 ≤ 풙 ⇒ 푷(풚) ⊢⁽풚⁾₍풙₎ 푷(s(풙)) ⊩ 휞 ⊢ 푷(풕)
>  \stopformula

Thanks, I am aware if that, but wrote it in a hurry. :-)


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

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


Re: [NTG-context] Unicode superscript and subscript parentheses as operators

2021-12-28 Thread Hans Åberg via ntg-context

> On 28 Dec 2021, at 22:29, Hans Hagen  wrote:
> 
> \protected\def\FancySuperscript#1⁾{\superscript{#1}}
> \protected\def\FancySubscript  #1₍{\subscript  {#1}}
> 
> \protected\def\FancyScripts
>  {\catcode`⁽=\activecatcode\letcharcode`⁽=\FancySuperscript
>   \catcode`₍=\activecatcode\letcharcode`₍=\FancySubscript}
> 
> \appendtoks
>\FancyScripts
> \to \everymathematics
> 
> \starttext
> 
> test $ x⁽3y⁾ $
> 
> \stoptext

This is great, though there is a typo in the second line. I attach a corrected 
example, illustrating what I might use it for: A logic program, where I found 
it readable in plain text to use the Unicode superscript and subscript 
parentheses. But when typeset, they should be superscripts and subscripts.

—
\definefallbackfamily 
[mainface][serif][stixtwotext][range={00B2-00B3,00B9,02070-0208F},force=yes]

\definefallbackfamily [mainface][mono][stix][range={0100-10},force=yes]

\definefallbackfamily 
[mainface][mono][stixtwotext][range={00B2-00B3,00B9,02070-0208F},force=yes]
\definefallbackfamily 
[mainface][math][stixtwomath][range={00B2-00B3,00B9,02070-0208F},force=yes]

\definefontfamily [mainface][serif][stix]
\definefontfamily [mainface][mono][courier]

\definefontfamily [mainface][math][stix]

\setupbodyfont[mainface,10pt]

\setmathfontalternate{upright}

\setupmathematics[integral=nolimits, lcgreek=normal, default=normal]
\setupformulae[location=left, indentnext=auto]
\setuptyping[indentnext=auto]

% Might use: 'small' indentation, no indentation on 'first':
\setupindenting[yes, medium, next]
\setupheads[indentnext=yes]

\setupinteraction[state=start, click=yes, focus=standard, color=darkblue]

\mainlanguage[en]


\protected\def\FancySuperscript#1⁾{\superscript{#1}}
\protected\def\FancySubscript  #1₎{\subscript  {#1}}

\protected\def\FancyScripts
 {\catcode`⁽=\activecatcode\letcharcode`⁽=\FancySuperscript
  \catcode`₍=\activecatcode\letcharcode`₍=\FancySubscript}

\appendtoks
   \FancyScripts
\to \everymathematics

\starttext
Course-of-values induction:
  $$휞 ⊢ 푷(0); 휞, 풚 ≤ 풙 ⇒ 푷(풚) ⊢⁽풚⁾₍풙₎ 푷(s(풙)) ⊩ 휞 ⊢ 푷(풕)$$

\stoptext
—

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

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


[NTG-context] Unicode superscript and subscript parentheses as operators

2021-12-28 Thread Hans Åberg via ntg-context
Is it possible to use the Unicode superscript and subscript parentheses as 
superscript and subscript operators? That is, ⁽…⁾ having the same function as 
^{…}, and ₍…₎ as _{…}.

It might be something like the following, but somehow bundling the last part of 
\letcharcode into a command.
\appendtoks
 \catcode`⁽=\activecatcode
 \letcharcode `⁽ ^{
 \catcode`⁾=\activecatcode
 \letcharcode `⁾ }
 \catcode`₍=\activecatcode
 \letcharcode `₍ _{
 \catcode`₎=\activecatcode
 \letcharcode `₎ }
\to \everymathematics


___
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] Error: attempt to index a nil value

2021-10-13 Thread Hans Åberg via ntg-context

> On 13 Oct 2021, at 22:34, Hans Hagen  wrote:
> 
> On 10/13/2021 6:54 PM, Hans Åberg wrote:
>>> On 13 Oct 2021, at 18:37, Hans Hagen  wrote:
>>> 
>>> On 10/13/2021 6:01 PM, Hans Åberg via ntg-context wrote:
>>>> I was suggested a long ago to hack the file
>>>>  
>>>> /usr/local/texlive/2021/texmf-dist/tex/generic/context/luatex/luatex-math.tex
>>>> and use LuaTeX directly, now using Version 1.13.2 (TeX Live 2021), but I 
>>>> get this error:
>>>> (./luaotfload.sty
>>>> (/usr/local/texlive/2021/texmf-dist/tex/latex/base/ltluatex.tex))
>>>> (./luatex-math-modified.tex[\directlua]:1: attempt to index a nil value 
>>>> (global
>>>> 'arguments')
>>>> stack traceback:
>>>>[\directlua]:1: in main chunk.
>>>> l.132 }
>>>> ? …
>>>> It is from this segment in the modified luatex-math.tex:
>>>> \ifdefined\directlua
>>>>\directlua {
>>>>if arguments["mtx:lucidabright"] then
>>>>tex.print("\string\\lucidabright")
>>>>else
>>>>tex.print("\string\\latinmodern")
>>>>end
>>>>}
>>>> \fi
>>>> Is there a workaround? —I may ditch this setup in favour of using 
>>>> 'context' directly, so it is not so important if there is no fix.
>>> I have no clue ..
>> Has not stuff been moved from LuaTeX to ConTeXt? —If so, I thought it might 
>> have something with that to do.
> 
> luatex is just a tex engine and context is a macro package where context mkiv 
> is geared for luatex; the context fontloader has a generic core so it can be 
> used in plain and for latex some write a wrapper around that font hndler for 
> latex that evolved over years
> 
> i have no clue why you get "(./luaotfload.sty ..." but it is not context that 
> you run there (and i can't imagine some plain format loading it either)

I think that LaTeX extracted some parts out of ConTeXt for use with LuaTeX only 
for font loading, and that is why I have it, not remembering the details. I 
think I saw that LuaTeX a few years had more font loading stuff, but that was 
moved to ConTeXt, but you show know better, as it would then would have been 
you did it. :-)

>>> it looks like you load a latex style so I suppose that 'arguments' is no 
>>> longer defined there (as it worked for you in the past).
>> It does not contain it; it a copy in the same directory that has never 
>> changed.
> 
> hm, but i have no clue what this "mtx:..." does

It is line 97-105 in
/usr/local/texlive/2021/texmf-dist/tex/generic/context/luatex/luatex-math.tex

I have not done anything to that part, just adding some support for the STIX 
font.

>>> Maybe 'arguments' lives in some namespace?
>>> 
>>> \directlua {for k, v in pairs(_G) do print(k,v) end}
>>> 
>>> This will show you what is in the global namespace, maybe 'arg'?
>> If I put this code in right before the \ifdefined\directlua it prints a lot 
>> of "nil".
> 
> print(k,v) should print two values, key and value

I may have not used it right, just copying it in right above line 97.


___
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] Error: attempt to index a nil value

2021-10-13 Thread Hans Åberg via ntg-context

> On 13 Oct 2021, at 22:28, Hans Hagen  wrote:
> 
> On 10/13/2021 7:02 PM, Hans Åberg wrote:
>>> On 13 Oct 2021, at 18:37, Hans Hagen  wrote:
>>> 
>>> On 10/13/2021 6:01 PM, Hans Åberg via ntg-context wrote:
>>>> 
>>>> … —I may ditch this setup in favour of using 'context' directly, so it is 
>>>> not so important if there is no fix.
>>> I have no clue ..
>> I made this as experiment to make a texinfo file along with a manual 
>> generating a PDF to display math properly, which the Info format cannot do.
> 
> I'm not familiar with texinfo but in the context distribution are some 
> luatex-* files that show how to load the generic context font loader (in 
> plain tex). One can make a format with:
> 
>  mtxrun --script plain --make
> 
> an dprocess a plain file with:
> 
>  mtxrun --script plain foo.tex
> 
> I suppose that texinfo is close to plain so doable too.
> 
>> However, it has been decided that the Info format should be extended with 
>> HTML, probably HTML5 then. So one might generate that directly with ConTeXt. 
>> —This was the reason for the other post.
> ok

I first made a texinfo file, and then translated it into a context file, and it 
turns out that the latter much simpler to create indexes and such: in the 
texinfo format, one has to keep track of them in various parts because of TeX's 
limited ability to do such things. In addition, GNU has policy of enforcing 
original TeX with limited Unicode support, making it suitable for simpler types 
of manuals only. There is no requirement to use this format or produce 'info' 
documentation, but it would be nice to produce an HTML. Personally, I prefer 
the PDF format.

___
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] Error: attempt to index a nil value

2021-10-13 Thread Hans Åberg via ntg-context

> On 13 Oct 2021, at 18:37, Hans Hagen  wrote:
> 
> On 10/13/2021 6:01 PM, Hans Åberg via ntg-context wrote:
>> 
>> … —I may ditch this setup in favour of using 'context' directly, so it is 
>> not so important if there is no fix.
> I have no clue .. 

I made this as experiment to make a texinfo file along with a manual generating 
a PDF to display math properly, which the Info format cannot do.

However, it has been decided that the Info format should be extended with HTML, 
probably HTML5 then. So one might generate that directly with ConTeXt. —This 
was the reason for the other post.

___
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] Error: attempt to index a nil value

2021-10-13 Thread Hans Åberg via ntg-context

> On 13 Oct 2021, at 18:37, Hans Hagen  wrote:
> 
> On 10/13/2021 6:01 PM, Hans Åberg via ntg-context wrote:
>> I was suggested a long ago to hack the file
>>  
>> /usr/local/texlive/2021/texmf-dist/tex/generic/context/luatex/luatex-math.tex
>> and use LuaTeX directly, now using Version 1.13.2 (TeX Live 2021), but I get 
>> this error:
>> (./luaotfload.sty
>> (/usr/local/texlive/2021/texmf-dist/tex/latex/base/ltluatex.tex))
>> (./luatex-math-modified.tex[\directlua]:1: attempt to index a nil value 
>> (global
>> 'arguments')
>> stack traceback:
>>  [\directlua]:1: in main chunk.
>> l.132 }
>> ? …
>> It is from this segment in the modified luatex-math.tex:
>> \ifdefined\directlua
>>\directlua {
>>if arguments["mtx:lucidabright"] then
>>tex.print("\string\\lucidabright")
>>else
>>tex.print("\string\\latinmodern")
>>end
>>}
>> \fi
>> Is there a workaround? —I may ditch this setup in favour of using 'context' 
>> directly, so it is not so important if there is no fix.
> I have no clue ..

Has not stuff been moved from LuaTeX to ConTeXt? —If so, I thought it might 
have something with that to do.

> it looks like you load a latex style so I suppose that 'arguments' is no 
> longer defined there (as it worked for you in the past).

It does not contain it; it a copy in the same directory that has never changed.

> Maybe 'arguments' lives in some namespace?
> 
> \directlua {for k, v in pairs(_G) do print(k.v) end}
> 
> This will show you what is in the global namespace, maybe 'arg'?

If I put this code in right before the \ifdefined\directlua it prints a lot of 
"nil".


___
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] Error: attempt to index a nil value

2021-10-13 Thread Hans Åberg via ntg-context
It results in the error

! Argument of \\ has an extra }.
 
\par 
 
}
l.132 }
 
?

> On 13 Oct 2021, at 18:26, Hans van der Meer via ntg-context 
>  wrote:
> 
>>  tex.print("\string\\latinmodern")
> 
> should be at least double backslashes: tex.print("\\string\\latinmodern") I 
> would think
> 
> met vriendelijke groet
> dr. Hans van der Meer

___
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] Error: attempt to index a nil value

2021-10-13 Thread Hans Åberg via ntg-context
I was suggested a long ago to hack the file
 /usr/local/texlive/2021/texmf-dist/tex/generic/context/luatex/luatex-math.tex
and use LuaTeX directly, now using Version 1.13.2 (TeX Live 2021), but I get 
this error:
(./luaotfload.sty
(/usr/local/texlive/2021/texmf-dist/tex/latex/base/ltluatex.tex))
(./luatex-math-modified.tex[\directlua]:1: attempt to index a nil value (global
'arguments')
stack traceback:
[\directlua]:1: in main chunk.
l.132 }

? …


It is from this segment in the modified luatex-math.tex:

\ifdefined\directlua
   \directlua {
   if arguments["mtx:lucidabright"] then
   tex.print("\string\\lucidabright")
   else
   tex.print("\string\\latinmodern")
   end
   }
\fi

Is there a workaround? —I may ditch this setup in favour of using 'context' 
directly, so it is not so important if there is no fix.


___
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] Generating HTML

2021-10-11 Thread Hans Åberg via ntg-context
I would want to generate HTML, but in the example below, "html-test.tex", the 
index does not show in the file "html-test-export/html-test-div.html", and the 
source file \index{…}, gets in the HTML a black triangle. The index and links 
work fine in "html-test.pdf", though.


— html-test.tex —
\definefontfamily [mainface][math][stix]
\setupbodyfont[mainface,10pt]

\setupinteraction[state=start, click=yes, focus=standard, color=darkblue]

\setupbackend[export=yes] % Exporting HTML/XML


\defineregister [index]
\setupregister  [index] [indicator=no]

\startchapter[title={Introduction}]

Foobar\index{foobar} out of working order.

\startbodymatter

Foo\index{foo} or bar\index{bar}.

\startbackmatter

\completeindex

\stopbackmatter

\stoptext
—

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

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