[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 Hans Hagen via ntg-context

On 3/13/2024 12:26 PM, Mikael Sundqvist wrote:

Hi,

On Wed, Mar 13, 2024 at 11:37 AM Max Chernoff  wrote:


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


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]

\definebar
  [yourbar]
  [backgroundbar]
  [height=\strutht,depth=\strutdp,offset=.125ex,color=blue]

\definebar
  [ourbar]
  [backgroundbar]
  [height=\strutht,depth=\strutdp,offset=.125ex,color=green]

\starttext

\startTEXpage[width=4cm]
\startformula
a \alignhere= b + c \breakhere
    \mybar {d + \yourbar{e \alignhere=} f \breakhere
g \alignhere \ourbar{=} h} + i
\stopformula
\stopTEXpage

\stoptext

Especially when it would not pass the rigourous accessibility check (esp 
wrt color) of your university,


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
-


inter-001.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 / 
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 Mikael Sundqvist
Hi,

On Wed, Mar 13, 2024 at 11:37 AM Max Chernoff  wrote:
>
> 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

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.

/Mikael
___
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] Re: \intertext and highlighting with \alignhere/\breakhere

2024-03-12 Thread Hans Hagen

On 3/12/2024 8:57 AM, Max Chernoff wrote:

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.

the next upload will support the attached ... so no ugly hacky code needed

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-


inter-001.pdf
Description: Adobe PDF document
\definebar[mybar][inlined][offset=.25ex,color=red]

\starttext

\startformula
    a  \alignhere= b + c \breakhere
\mybar {d + e} \alignhere= f \breakhere
    g  \alignhere= h + i
\stopformula

\page

\samplefile{knuth}
\startformula
\text{something} + \text{really} + \text{really} + \text{long} 
\alignhere= \sqrt{x} \numberhere
\texthere[inbetween]{\input{knuth}}
d \alignhere= e + f \numberhere \breakhere
g \alignhere= h + i \breakhere
j \alignhere= k + l
\stopformula
\samplefile{knuth}

\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: \intertext and highlighting with \alignhere/\breakhere

2024-03-12 Thread Hans Hagen

On 3/12/2024 8:57 AM, Max Chernoff wrote:

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.

maybe

\starttexdefinition protected newintertext #1
\leftparbox [global] {
\vadjust pre \bgroup
\forgetall
\vskip.5\strutdp % needs to be more clever in the end
\dontleavehmode\vtop\bgroup
#1
\egroup
\egroup
}
\breakhere
\stoptexdefinition

but i need to discuss it with Mikael as we might integrate something 
better and then it needs to be documented (in the upcoming manual) as well


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 / 
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: split align in formulas

2023-08-14 Thread Mikael Sundqvist
Hi,

On Mon, Aug 14, 2023 at 5:13 PM Xavier B.  wrote:
>
> I have this text and the end of the paragraph:
>
> Definitivament és el mètode més senzill. L'atribució més antiga que conec 
> d'aquest mètode és de James Tanton \cite{canvi-variable-equacio-segon-grau, 
> james-tanton-web}.
> \placeformula[eq:james-tanton-canvi-de-variables]
> \startformula
> \startalign
> \NC ax^2 + bx + c = 0 \NC \NR
> \NC ax^2 + bx = -c \NC \quad \text{transposem } c\NR
> \NC x^2 + \frac{b}{a} x = - \frac{c}{a} \NC \quad \text{dividim per }a\NR
> \NC x \left( x + \frac{b}{a} \right) = - \frac{c}{a} \NC \quad 
> \text{factoritzam} \NR
> \NC (k-D)(k+D) = - \frac{c}{a} \NC \quad \text{canvi de variable} \NR
> \NC k^2 - D^2 = - \frac{c}{a} \NC \quad \text{suma per diferència} \NR
> \NC k = \pm\sqrt{ D^2 - \frac{c}{a}} \NC \quad \text{resolem l'equació} \NR
> \NC x = k - D = \NC \pm \sqrt{ D^2 - \frac{c}{a}} - D\quad \text{desfeim el 
> canvi} \NR
> \stopalign
> \stopformula
> on $D = (\frac{b}{2a})$ i $x = k-D$.
>
>
> and then the formula goes to next page. Is there any way to split align 
> environment? In wiki I could not find nothing.

No, align does not split over pages. But ordinary formulas do. You can
play with \alignhere and \breakhere, and add text with
\texthere[right]{some text} or \texthere[left]{some other text}.

/Mikael

(I think I would write sentences and a few formulas instead of
stacking them all like this)
___
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: Nested aligns in formulasjj

2023-08-14 Thread Gerion Entrup
Am Montag, 14. August 2023, 13:33:33 CEST schrieb Hans Hagen:
> On 8/14/2023 1:16 PM, Gerion Entrup wrote:
> > Hi,
> > 
> > I try to typeset a nested align in a formula. However, the results looks
> > really wrong. Here is a MWE:
> > 
> > ```
> > \starttext
> > \startformula
> > \startalign
> > \NC a = \NC (b, c) \quad \text{with}\NR
> > \NC   \NC \startalign
> > \NC b \NC = something \NR
> > \NC c \NC = someother \NR
> >   \stopalign \NR
> > \NC somelong = \NC bla \NR
> > \stopalign
> > \stopformula
> > \stoptext
> > ```
> > Am I doing something wrong or are nested aligns not possible?
> it will work if you configure the inner align to be tight (i delegate 
> that answer)
> 
> \startformula
> a   = \alignhere (b, c) \quad \text{with}
>    \breakhere b = \text{something}
>\breakhere c = \text{someother}
>\breakhere
> \text{somelong} = \alignhere bla
> \stopformula
> 
> might be okay for your purpose

Thanks, but unfortunately not. I guess, I simplified the MWE too much.
This does not align the b and c. It should become clear here:

```
\startformula
a   = \alignhere (b, thisislonger) \quad \text{with}
       \breakhere b = \text{something}
   \breakhere thisislonger = \text{someother}
   \breakhere
\text{somelong} = \alignhere bla
\stopformula
```


Gerion


signature.asc
Description: This is a digitally signed message part.
___
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: Nested aligns in formulasjj

2023-08-14 Thread Hans Hagen

On 8/14/2023 1:16 PM, Gerion Entrup wrote:

Hi,

I try to typeset a nested align in a formula. However, the results looks
really wrong. Here is a MWE:

```
\starttext
\startformula
\startalign
\NC a = \NC (b, c) \quad \text{with}\NR
\NC   \NC \startalign
\NC b \NC = something \NR
\NC c \NC = someother \NR
  \stopalign \NR
\NC somelong = \NC bla \NR
\stopalign
\stopformula
\stoptext
```
Am I doing something wrong or are nested aligns not possible?
it will work if you configure the inner align to be tight (i delegate 
that answer)


\startformula
a   = \alignhere (b, c) \quad \text{with}
  \breakhere b = \text{something}
  \breakhere c = \text{someother}
  \breakhere
\text{somelong} = \alignhere bla
\stopformula

might be okay for your purpose

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 / 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] Math alignment question

2022-09-24 Thread Jeong Dal via ntg-context
Dear Hans,


>> Thank you for your explanation.
>> I just wonder \alinghere can be applicable to multiple formula.
>> It is OK to use \NC \NR for multiple formulas.
> What probably can be done, is to let the next formula start with the align of 
> the previous one .. Mikael can add it to our todo
> 

Thank you for your concern.
When we write  two long formula, I think that to use "\alignhere, \breakhere" 
is a little bit simpler than use \NC\NR.
We may write them to use \startformula…\stopformula twice separetely. 
But, then the alignment of two formulas may be different because formula’s 
alignment is midaligned. 

Thanks again to add it todo list.

Best regards,

Dalyoung___
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] Math alignment question

2022-09-23 Thread Mikael Sundqvist via ntg-context
On Fri, Sep 23, 2022 at 8:46 PM Aditya Mahajan via ntg-context
 wrote:
>
> On Thu, 22 Sep 2022, Jeong Dal via ntg-context wrote:
>
> > Dear Mikael and Hans,
> >
> > Recently, you introdued the new command “\alignhere, \breakhere, \skiphere” 
> > which works fine.
> >
> > Since I usually use the following code that is adopted from My 
> > Way(Mathalign.pdf), I’d like to know that there is a way to use 
> > “\alignhere, \breakhere, \skiphere”  for the case below?
> >
> > \startformula\startalign
> > \NC A \NC = 3 \NR
> > \NC B \NC = 5 \NR
> > \stopalign\stopformula
>
> The way I see it is that the current implementation is that it is way to 
> break a _single_ long equation to multiple lines. For multiple equations, you 
> still need to use the \startalign method.
>

Indeed, that is the case. These formulas are done for single chain
equations. The example given above consists of two formulas, and the
new broken formula type simply does not fit. You can play with more
than one \alignhere, but they will only set new align points. I think
\startalign ... \stopalign is the way to go there. If it is cumbersome
to type all the \NC and \NR one could in principle thing of similar
input as for the simple matrices. Your example then would become

\startalign
A, = 3;
B, = 5;
\stopalign

/Mikael
___
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] Math alignment question

2022-09-23 Thread Aditya Mahajan via ntg-context
On Thu, 22 Sep 2022, Jeong Dal via ntg-context wrote:

> Dear Mikael and Hans,
> 
> Recently, you introdued the new command “\alignhere, \breakhere, \skiphere” 
> which works fine.
> 
> Since I usually use the following code that is adopted from My 
> Way(Mathalign.pdf), I’d like to know that there is a way to use “\alignhere, 
> \breakhere, \skiphere”  for the case below?
> 
> \startformula\startalign
> \NC A \NC = 3 \NR
> \NC B \NC = 5 \NR
> \stopalign\stopformula

The way I see it is that the current implementation is that it is way to break 
a _single_ long equation to multiple lines. For multiple equations, you still 
need to use the \startalign method.

Aditya___
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] Math alignment question

2022-09-22 Thread Jeong Dal via ntg-context
Dear Mikael and Hans,

Recently, you introdued the new command “\alignhere, \breakhere, \skiphere” 
which works fine.

Since I usually use the following code that is adopted from My 
Way(Mathalign.pdf), I’d like to know that there is a way to use “\alignhere, 
\breakhere, \skiphere”  for the case below?

\startformula\startalign
\NC A \NC = 3   \NR
\NC B \NC = 5 \NR
\stopalign\stopformula

Thank you.
Best regards,

Dalyoung

___
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] underbrace under matrix

2022-08-04 Thread Mikael Sundqvist via ntg-context
On Fri, Aug 5, 2022 at 2:01 AM Jethro Djan via ntg-context
 wrote:
>
> Hello,
>
> I want to get underbraces under matrices in a math alignment environment. 
> I’ve reproduced my problem here:
>
>  \definemathmatrix
>[pmatrix]
>[left={\left(\,},right={\,\right)}]
>
>  \starttext
>  \placeformula[-]\startformula\startmathalignment
>\NC\
>A \NC=\underbrace{
>\startpmatrix
>  \NC 5\NC 5\NR
>  \NC -1\NC 7\NR
>\stoppmatrix}\NR
>\NC\NC=\underbrace{
>\startpmatrix
>  \NC 2\NC 1\NR
>  \NC 4\NC 2\NR
>   \stoppmatrix}\NR
>  \stopmathalignment\stopformula
>   \stoptext
>
> How can I achieve this?
>
> Jethro

Hi Jethro,

Temporary workaround: use the simplecommand.

\definemathmatrix[pmatrix][matrix:parentheses][
simplecommand=pmatrix,
]

\starttext
% \placeformula[-]
\startformula
\startalign
\NC A \NC = \underbrace{\pmatrix{5,5;-1,7}}_{B} \NR
\NC\NC = \underbrace{\pmatrix{2,1;4,2}}_{C} \NR
\stopalign
\stopformula

% \placeformula[-]
\startformula
A \alignhere=
\underbrace{\pmatrix{5,5;-1,7}}_{B}
\breakhere
=
\underbrace{\pmatrix{2,1;4,2}}_{C}
\stopformula
\stoptext

But the code you were using should in principle also work.

/Mikael
___
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] Cron /var/www/aanhet.net/context/bin/cron/context-mirror

2022-07-29 Thread Jeong Dal via ntg-context
Dear Hans,

Thank you for the new way to align math formulas.
It is great to use “\alignhere”, “\breakhere”.

However, I got a problem today.
If I use it with figures side by side, then the alignment is broken.

Please try the following MWE.

Best regards,

Dalyoung


\setupexternalfigures[location={default,local,global}]

\starttext
\startplacefigure[location=right,]
\externalfigure[cow][width=.3\makeupwidth]
\stopplacefigure
\startformula
 U(f,P) \alignhere = f(2,2)\Delta A_{11}+f(2,3)\Delta A_{12}\breakhere
  \skiphere[1em] +f(3,2)\Delta A_{21}+f(3,3)\Delta A_{22} \breakhere
  = 4\times 2 + 6 \times 1+ 6 \times 2 +9 \times 1  \breakhere
  = 35.
\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://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] next beta

2017-06-14 Thread Hans Hagen

On 6/14/2017 11:33 AM, Mathias Schickel wrote:


Am 13.06.2017 um 16:46 schrieb Hans Hagen <pra...@wxs.nl 
<mailto:pra...@wxs.nl>>:


On 6/13/2017 1:18 PM, Mathias Schickel wrote:
Am 12.06.2017 um 18:17 schrieb Hans Hagen <pra...@wxs.nl 
<mailto:pra...@wxs.nl>>:


On 6/12/2017 5:56 PM, Mathias Schickel wrote:

Hi Hans,
if I get it right this means that you provide a mechanism that 
brakes formulas automatically across several lines? I appreciate 
this very much! Thank you for including this into the next beta!
Would it be possible to do something like that for breaking long 
formulas across pages (or is that maybe included in the new mechanism)?

that's more complex and interferes with other aspects so maybe later
Okay, that would be really great. Maybe a semi-automatic breaking 
across pages could be doable. The AMS package for LaTeX implements 
something like that. If you write \allowbreak (I am not absolutely 
sure if this is the true command, but it is something like that) at a 
line of an equation with multiple lines the typesetting algorithm 
knows that the formula can be broken across pages at that point.
If something like that could be done in ConTeXt it would be really 
great. At present it is somewhat complicated to handle equations with 
many lines since you have to typeset the text and check if everything 
fits. If you could mark certain lines of an equation to be allowed to 
be broken at the end of a page, working with multiple line equations 
would be much easier and faster.
attached what will be provided ... experimental for a while (not in 
the mood now for harder stuff)


That looks really good! Will it be possible to combine that with 
\startmathalignment? And if not can you pass several \alignhere commands 
and force breaking at user defined places?
(I tried out to test it myself but the new feature is not yet uploaded 
to the garden version.)

i didn't test with alignments

only one \alignhere per formula

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] next beta

2017-06-14 Thread Mathias Schickel

> Am 13.06.2017 um 16:46 schrieb Hans Hagen <pra...@wxs.nl>:
> 
> On 6/13/2017 1:18 PM, Mathias Schickel wrote:
>>> Am 12.06.2017 um 18:17 schrieb Hans Hagen <pra...@wxs.nl>:
>>> 
>>> On 6/12/2017 5:56 PM, Mathias Schickel wrote:
>>>> Hi Hans,
>>>> if I get it right this means that you provide a mechanism that brakes 
>>>> formulas automatically across several lines? I appreciate this very much! 
>>>> Thank you for including this into the next beta!
>>>> Would it be possible to do something like that for breaking long formulas 
>>>> across pages (or is that maybe included in the new mechanism)?
>>> that's more complex and interferes with other aspects so maybe later
>> Okay, that would be really great. Maybe a semi-automatic breaking across 
>> pages could be doable. The AMS package for LaTeX implements something like 
>> that. If you write \allowbreak (I am not absolutely sure if this is the true 
>> command, but it is something like that) at a line of an equation with 
>> multiple lines the typesetting algorithm knows that the formula can be 
>> broken across pages at that point.
>> If something like that could be done in ConTeXt it would be really great. At 
>> present it is somewhat complicated to handle equations with many lines since 
>> you have to typeset the text and check if everything fits. If you could mark 
>> certain lines of an equation to be allowed to be broken at the end of a 
>> page, working with multiple line equations would be much easier and faster.
> attached what will be provided ... experimental for a while (not in the mood 
> now for harder stuff)

That looks really good! Will it be possible to combine that with 
\startmathalignment? And if not can you pass several \alignhere commands and 
force breaking at user defined places?
(I tried out to test it myself but the new feature is not yet uploaded to the 
garden version.)

> 
> Hans
> 
> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl <http://www.pragma-ade.nl/> | 
> www.pragma-pod.nl <http://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] next beta

2017-06-13 Thread Hans Hagen

On 6/13/2017 8:06 AM, Aditya Mahajan wrote:

On Mon, 12 Jun 2017, Hans Hagen wrote:


i.e. (poor mans) multiline display math


Interesting. An important reference for automatic breaking of multiline 
display are the notes of Michael J Downes included in the documentation 
of breqn: see section 14 (page 16) of 
http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/breqn/breqn.pdf 


I remember a talk by giuseppe about nath (or so) that did something nice 
but anyway, the main question with that kind of trickery is if one is 
willing to add structure info or not .. anything semi-clever will be 
limited.


(Ignore the implementation details, which were a series of hacks to make 
things work in pdftex, but section 14 explains the different display 
math layouts and a strategy to choose between them. It will be really 
nice to have something comparable in ConTeXt.
You mean these boxed lines? I'm not a math expert so the subtle details 
are lost to me. I'd rather start from reasonable demands (after all very 
complex stuff often is best done manually anyway).


For instance

foo = bar + bar + bar
  gnu + gnu

is doable without much trouble if one is willing to enter

foo = \alignhere bar + bar + bar
  gnu + gnu

and such.

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