Re: [NTG-context] Converting from LaTeX for PDF accessibility tagging?

2020-06-28 Thread Aditya Mahajan

On Mon, 29 Jun 2020, Alasdair McAndrew wrote:


(For matrices and arrays I still prefer the neat LaTeX implementation, but
maybe that's simply my general unfamiliarity with ConTeXt.)  Thanks again!


Matrices can also be entered using MATLAB syntax (you need to specify a 
`simplecommand` for mathmatrix:

\definemathmatrix[bmatrix][matrix:brackets][simplecommand=BMATRIX]

\starttext

Default style:

\startformula
  \startbmatrix
\NC 1 \NC 2 \NC 3 \NR
\NC 4 \NC 5 \NC 6 \NR
\NC 7 \NC 8 \NC 9 \NR
  \stopbmatrix
\stopformula

Compact style:

\startformula
  \BMATRIX{1, 2, 3; 4, 5, 6; 7, 8, 9}
\stopformula

\stoptext

I'd say this is more compact (and natural) than amsmath :-)

Aditya

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

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


Re: [NTG-context] Converting from LaTeX for PDF accessibility tagging?

2020-06-28 Thread Alasdair McAndrew
Thank you very much - I think the problem was with a LaTeX "align"
environment which pandoc translated into a setting which  ConTeXt didn't
recognize.  These equations were monsters, so I'll try with simpler
equations to give you an idea.  But in fact what you say makes perfect
sense, and I'll go back and read through the mathematics document again,
and more closely this time!

(For matrices and arrays I still prefer the neat LaTeX implementation, but
maybe that's simply my general unfamiliarity with ConTeXt.)  Thanks again!

Alasdair

On Mon, Jun 29, 2020 at 2:27 AM Aditya Mahajan  wrote:

> On Sun, 28 Jun 2020, Alasdair McAndrew wrote:
>
> > I tried ConTeXt a few years ago, then gave up on it because of its
> > wordiness and verbosity.  The 2006 article on creating AMSTeX output in
> > ConTeXt at https://www.ntg.nl/maps/34/06.pdf shows exactly what I mean:
> the
> > LaTeX commands are small and neat; the ConTeXt commands are not.
>
> As explained in the last paragraph, there are pre-built shortcuts for the
> main alignments and you can define your own to match amsmath style, if you
> wish.
>
> If you are worried about typing, look into tab completion for your editor
> of choice. For example, in vim, I can do `for` which expands to
> `\startformula ... \stopformula` and `fora` expands to `\startformula
> \startalign ... \stopalign \stopformula`.
>
> > However, I need now to use ConTeXt for accessibility tagging, so I'm
> > prepared to give it another try.  And this means converting some LaTeX
> > documents into ConTeXt.  Is there a better way than using pandoc?  I ran
> a
> > LaTeX document through pandoc, but the result is certainly not fully
> > "ConTeXt compliant", and generates errors instead of compiling.
>
> AFAIK, pandoc is not aware of context math. When I convert latex to
> context, I find it simpler to do it some hand written regex which translate
> commands according to my writing style.
>
> > I can get easily lost on the ConTeXt site: the documentation is there in
> > plenty, but seems hard to search.  The main problem for me is mathematics
> > and alignment: not just for equations, but for matrices and arrays.  What
> > I'd love - if it exists - is a document showing how to rewrite LaTeX into
> > ConTeXt.  Something like the above document, which is now 14 years old.
>
> The user-interface is still the same.
>
> > Anyway, as I say, my main issues are converting LaTeX into ConTeXt. and
> > dealing with mathematics.  Any pointers would be gratefully received!
>
> Can you post an example of LaTeX math that you are having difficulty in
> converting? It is hard to answer this in the abstract.
>
> Aditya
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>


-- 
https://numbersandshapes.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] Translation of ConTeXt interface

2020-06-28 Thread Garulfo
Do you think it would be easy to change the current behavior ? do you want me 
to try to propose a workaround ? I am not so familiar with mkiv files, but I 
can try.


> Le 27 juin 2020 à 19:16, Wolfgang Schuster 
>  a écrit :
> 
> Garulfo schrieb am 27.06.2020 um 19:00:
>> Hi Wolfgang,
>> 
>> Did you manage to have a look at the previous message
>> Fri Jun 26 23:38:48 CEST 202023
>> https://mailman.ntg.nl/pipermail/ntg-context/2020/098596.html
>> 
>> It contains two MWE :
>> 
>> 1/ mult-def.lua.test1_figure.diff
>> 
>> 2/ mult-def.lua.test2_itemize.diff + test2_itemize.tex
>> 
>> (not about the font issue, but the two others)
> 
> The cause for the missing translations is this line in x-setups-basics.mkiv
> 
> replace('cd:instances/cd:constant', 'value', variables)
> 
> which works only when the instances are listed in the command entry like this
> 
> 
> ...
> 
> 
> 
> 
> 
> which is never the case because I load the entries with cd:resolve like here:
> 
> 
> 
> 
> 
> 
> ...
> 
> 
> 
> 
> 
> Wolfgang
> 

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

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


[NTG-context] Commands with arguments before in ConTeXt

2020-06-28 Thread Jairo A. del Rio
I've read the following is not possible in TeX

\def#1\macro{blabla#1}

where arguments come before. The only partial exceptions are commands like
\atop or \over, which are in fact primitives. Is there a way to do this in
ConTeXt?

Could it be a feature request for LuaMetaTeX? I've seen Hans experimenting
a lot with new primitives and new possibilities for arguments, like #0 and
co., so I ask in case it's not too nonsensical to propose it. Regards

Jairo :)
___
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] Converting from LaTeX for PDF accessibility tagging?

2020-06-28 Thread Aditya Mahajan

On Sun, 28 Jun 2020, Alasdair McAndrew wrote:


I tried ConTeXt a few years ago, then gave up on it because of its
wordiness and verbosity.  The 2006 article on creating AMSTeX output in
ConTeXt at https://www.ntg.nl/maps/34/06.pdf shows exactly what I mean: the
LaTeX commands are small and neat; the ConTeXt commands are not.


As explained in the last paragraph, there are pre-built shortcuts for the main 
alignments and you can define your own to match amsmath style, if you wish.

If you are worried about typing, look into tab completion for your editor of choice. For 
example, in vim, I can do `for` which expands to `\startformula ... 
\stopformula` and `fora` expands to `\startformula \startalign ... \stopalign 
\stopformula`.


However, I need now to use ConTeXt for accessibility tagging, so I'm
prepared to give it another try.  And this means converting some LaTeX
documents into ConTeXt.  Is there a better way than using pandoc?  I ran a
LaTeX document through pandoc, but the result is certainly not fully
"ConTeXt compliant", and generates errors instead of compiling.


AFAIK, pandoc is not aware of context math. When I convert latex to context, I 
find it simpler to do it some hand written regex which translate commands 
according to my writing style.


I can get easily lost on the ConTeXt site: the documentation is there in
plenty, but seems hard to search.  The main problem for me is mathematics
and alignment: not just for equations, but for matrices and arrays.  What
I'd love - if it exists - is a document showing how to rewrite LaTeX into
ConTeXt.  Something like the above document, which is now 14 years old.


The user-interface is still the same.


Anyway, as I say, my main issues are converting LaTeX into ConTeXt. and
dealing with mathematics.  Any pointers would be gratefully received!


Can you post an example of LaTeX math that you are having difficulty in 
converting? It is hard to answer this in the abstract.

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

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


[NTG-context] Fwd: Continued fractions in ConTeXt

2020-06-28 Thread Jairo A. del Rio
Hi list! I've tried adapting the following code for continued fractions:

%https://tex.stackexchange.com/questions/73195/how-to-typeset-a-continued-fraction-in-the-following-format
\documentclass{article}\usepackage{amsmath}
\begin{document}\newcommand*{\cofrac}[2]{%
  {%
\rlap{$\dfrac{1}{\phantom{#1}}$}%
\genfrac{}{}{0pt}{0}{}{#1+#2}%
  }%}\[
  a_0 +
  \cofrac{a_1}{
\cofrac{a_2}{
  \cofrac{a_3}{
\genfrac{}{}{0pt}{0}{}{\ddots}
  }}}\]\end{document}

As I could read from the mailing list, ConTeXt no longer supports
\genfrac, so I've tried

the following using \definemathfraction

\definemathfraction[gefrac][cfrac]
\setupmathfraction[gefrac][rule=no]
\def\cofrac#1#2{%
  {%
\rlap{\cfrac{1}{\displaystyle\phantom{#1}}}%
\gefrac{}{\displaystyle\gefrac{#1+}{}#2}%
  }%
}
\def\cofracnorule#1#2{%
{%

\rlap{\gefrac{\displaystyle\phantom{1}}{\displaystyle\phantom{#1}}}%
\gefrac{}{\displaystyle\gefrac{#1}{}#2}%
}%
}
\def\endfrac#1{\cofracnorule{#1}{\phantom{1}}}
\startTEXpage
\startplacefigure[location=force,number=no]
\externalfigure[cofrac.png]
\stopplacefigure
\startformula
\alpha +
\cofrac{\alpha'}{\cofrac{\alpha''}{\cofrac{\alpha'''}{{\endfrac{\ddots}
\frac{1}{\alpha'''}
\stopformula
\stopTEXpage

Mmm, superscripts and fraction rules superpose, so indeed something is
wrong. Any ideas or references to a better result?

I've attached the expected result (it's from Legendre's Théorie des
nombres) and a normal fraction for comparison.

Thank you very much.

Jairo :)


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

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


Re: [NTG-context] Footnotes in math mode

2020-06-28 Thread Wolfgang Schuster

Jairo A. del Rio schrieb am 28.06.2020 um 13:43:

It's "subscribe nodigest", right? Sorry for the inconveniences


Yes but the config page [1] has explanations for all options to know 
what each does.


[1] https://mailman.ntg.nl/mailman/options/ntg-context

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] LSP support

2020-06-28 Thread TeXnician
> Of course, I'm glad that TexLab project does provide LSP support and bringing
> it to the Kakoune editor as well, but I'm sure that many of you know
> that bringing ConTeXt support to TexLab would benefit users of **many**
> other editors since these today many most popular editors (Atom, Emacs,
> SublimeText, (neo)Vimn, VScode...) are having support for LSP.

TeXLab is not the only LSP for *TeX.

https://github.com/astoff/digestif merged ConTeXt support including some TikZ
wrapping for ConTeXt etc. (Have a look at PR #24.)

It is written in Lua, so if you feel more native there you could contribute.

> Unfortuantely, I'm ConTeXt noob and not speaking Rust, but just want to bring
> the information if there are people familiar with both about potential benefit
> for ConTeXt to get LSP support.

If someone would extend TeXLab that would surely benefit many. But they seem
much more hard-wired towards LaTeX.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Footnotes in math mode

2020-06-28 Thread Jairo A. del Rio
It's "subscribe nodigest", right? Sorry for the inconveniences

Jairo :)

El dom., 28 de jun. de 2020 a la(s) 06:11, Wolfgang Schuster (
wolfgang.schuster.li...@gmail.com) escribió:

> Jairo A. del Rio schrieb am 28.06.2020 um 12:54:
> > Hi list! I want to know how to properly use footnotes in math mode. The
> > following:
> >
> > \starttext
> > \startformula
> > \int_{a}^{b} f(x) d x=\lim _{h=0}\left[\int_{a}^{c-h} f(x) d
> > x+\int_{c+h}^{b} f(x) d x\right] \startfootnote Footnote \stopfootnote
> > \stopformula
> > \stoptext
> >
> > doesn't complain but it doesn't show the footnote either.
> >
> > So, I'm using the following workaround:
> >
> > \starttext
> > \startformula
> > \int_{a}^{b} f(x) d x=\lim _{h=0}\left[\int_{a}^{c-h} f(x) d
> > x+\int_{c+h}^{b} f(x) d x\right]\note[mynote1]
> > \stopformula
> > \footnotetext[mynote1]{Cauchy s'occupe du cas...}
> > \stoptext
> >
> > However, 1) I have to create notes every time and it's kinda annoying
> > when a large amount of formulas are annotated (I've read somewhere it's
> > bad practice to (ab)use footnotes in math writing, but I see this often
> > in books from the 19th century or earlier), 2) the numbering is bold.
> > Making the numbering normal rather than bold would be fine, but I want
> > to know about a better solution. Thank you in advance
>
> You have two options:
>
> 1. Add \automigrateinserts at the begin of your document.
>
> \automigrateinserts
>
> \starttext
>
> \startformula
> x\footnote{Footnote}
> \stopformula
>
> \stoptext
>
> 2. Add a postponingnotes environment around the formula.
>
> \starttext
>
> \startpostponingnotes
> \startformula
> x\footnote{Footnote}
> \stopformula
> \stoppostponingnotes
>
> \stoptext
>
> The first option wasn't always reliable with many nested box levels and
> this is when you can use the second option.
>
> > Jairo :)
> >
> > PS: How to answer messages sent to the mailing list? I'm on Gmail and I
> > have to wait until the Digest comes. However, I can see messages in
> > mail-archive.com . It's a dumb question, but
> > when I want to thank Hans, Wolfgang or Aditya (and everyone else) for an
> > answer, or following a thread, I have to edit the whole Digest mail.
> > Sorry if I've been ungrateful by not answering back. Thank you again.
>
> Why don't you change this in the list settings or use a separate mail
> address for mailing lists.
>
> Wolfgang
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Converting from LaTeX for PDF accessibility tagging?

2020-06-28 Thread Alasdair McAndrew
Hello,

I tried ConTeXt a few years ago, then gave up on it because of its
wordiness and verbosity.  The 2006 article on creating AMSTeX output in
ConTeXt at https://www.ntg.nl/maps/34/06.pdf shows exactly what I mean: the
LaTeX commands are small and neat; the ConTeXt commands are not.

However, I need now to use ConTeXt for accessibility tagging, so I'm
prepared to give it another try.  And this means converting some LaTeX
documents into ConTeXt.  Is there a better way than using pandoc?  I ran a
LaTeX document through pandoc, but the result is certainly not fully
"ConTeXt compliant", and generates errors instead of compiling.

I can get easily lost on the ConTeXt site: the documentation is there in
plenty, but seems hard to search.  The main problem for me is mathematics
and alignment: not just for equations, but for matrices and arrays.  What
I'd love - if it exists - is a document showing how to rewrite LaTeX into
ConTeXt.  Something like the above document, which is now 14 years old.

I also notice that much of the contextgarden wiki is outdated.  For
example, on the use of ConTeXt in MikTeX, we read "As of end of June 2011
MikTeX is still (or again) non-functional."  I'm aware that all of this is
the work of dedicated and unpaid volunteers, so this is not a complaint!
Just an observation.

Anyway, as I say, my main issues are converting LaTeX into ConTeXt. and
dealing with mathematics.  Any pointers would be gratefully received!

Thanks,
Alasdair
-- 
https://numbersandshapes.net
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Footnotes in math mode

2020-06-28 Thread Wolfgang Schuster

Jairo A. del Rio schrieb am 28.06.2020 um 12:54:
Hi list! I want to know how to properly use footnotes in math mode. The 
following:


\starttext
\startformula
\int_{a}^{b} f(x) d x=\lim _{h=0}\left[\int_{a}^{c-h} f(x) d 
x+\int_{c+h}^{b} f(x) d x\right] \startfootnote Footnote \stopfootnote

\stopformula
\stoptext

doesn't complain but it doesn't show the footnote either.

So, I'm using the following workaround:

\starttext
\startformula
\int_{a}^{b} f(x) d x=\lim _{h=0}\left[\int_{a}^{c-h} f(x) d 
x+\int_{c+h}^{b} f(x) d x\right]\note[mynote1]

\stopformula
\footnotetext[mynote1]{Cauchy s'occupe du cas...}
\stoptext

However, 1) I have to create notes every time and it's kinda annoying 
when a large amount of formulas are annotated (I've read somewhere it's 
bad practice to (ab)use footnotes in math writing, but I see this often 
in books from the 19th century or earlier), 2) the numbering is bold. 
Making the numbering normal rather than bold would be fine, but I want 
to know about a better solution. Thank you in advance


You have two options:

1. Add \automigrateinserts at the begin of your document.

\automigrateinserts

\starttext

\startformula
x\footnote{Footnote}
\stopformula

\stoptext

2. Add a postponingnotes environment around the formula.

\starttext

\startpostponingnotes
\startformula
x\footnote{Footnote}
\stopformula
\stoppostponingnotes

\stoptext

The first option wasn't always reliable with many nested box levels and 
this is when you can use the second option.



Jairo :)

PS: How to answer messages sent to the mailing list? I'm on Gmail and I 
have to wait until the Digest comes. However, I can see messages in 
mail-archive.com . It's a dumb question, but 
when I want to thank Hans, Wolfgang or Aditya (and everyone else) for an 
answer, or following a thread, I have to edit the whole Digest mail. 
Sorry if I've been ungrateful by not answering back. Thank you again.


Why don't you change this in the list settings or use a separate mail 
address for mailing lists.


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

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


[NTG-context] Footnotes in math mode

2020-06-28 Thread Jairo A. del Rio
Hi list! I want to know how to properly use footnotes in math mode. The
following:

\starttext
\startformula
\int_{a}^{b} f(x) d x=\lim _{h=0}\left[\int_{a}^{c-h} f(x) d
x+\int_{c+h}^{b} f(x) d x\right] \startfootnote Footnote \stopfootnote
\stopformula
\stoptext

doesn't complain but it doesn't show the footnote either.

So, I'm using the following workaround:

\starttext
\startformula
\int_{a}^{b} f(x) d x=\lim _{h=0}\left[\int_{a}^{c-h} f(x) d
x+\int_{c+h}^{b} f(x) d x\right]\note[mynote1]
\stopformula
\footnotetext[mynote1]{Cauchy s'occupe du cas...}
\stoptext

However, 1) I have to create notes every time and it's kinda annoying when
a large amount of formulas are annotated (I've read somewhere it's bad
practice to (ab)use footnotes in math writing, but I see this often in
books from the 19th century or earlier), 2) the numbering is bold. Making
the numbering normal rather than bold would be fine, but I want to know
about a better solution. Thank you in advance

Jairo :)

PS: How to answer messages sent to the mailing list? I'm on Gmail and I
have to wait until the Digest comes. However, I can see messages in
mail-archive.com. It's a dumb question, but when I want to thank Hans,
Wolfgang or Aditya (and everyone else) for an answer, or following a
thread, I have to edit the whole Digest mail. Sorry if I've been ungrateful
by not answering back. Thank you again.
___
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
___