ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* align text and formula
@ 2016-08-24  8:02 Jan Willem Flamma
  2016-08-24  8:10 ` Otared Kavian
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Willem Flamma @ 2016-08-24  8:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

I would like to include text on the same line as a formula.
The text needs to be left-aligned and the formula needs to be mid-aligned (as per normal).

I’ve tried various solutions from the mathalign MyWay but have not succeeded to get the desired result sofar.
Below a M-Not-WE. Clearly, the formula is not positioned correctly yet.

Who can help me out?

Regards,
Jan Willem


\starttext
    
\setupformulas[align=flushleft]
\startformula
	\startalign[n=2,align={left,middle}]
        	\NC \text{Text1}    \NC E = mc^2    \NR
        	\NC \text{Text2}    \NC E = mc^2    \NR
	\stopalign
\stopformula

\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: align text and formula
  2016-08-24  8:02 align text and formula Jan Willem Flamma
@ 2016-08-24  8:10 ` Otared Kavian
  2016-08-24  8:19   ` Jan Willem Flamma
  2016-08-24  8:21   ` Jan Willem Flamma
  0 siblings, 2 replies; 12+ messages in thread
From: Otared Kavian @ 2016-08-24  8:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Jan,

You can specify a certain horizontal distance in the second column, as in the following:

%%% begin example.tex
\starttext

\setupformulas[align=flushleft]
\startformula
	\startalign[n=2,align={left,middle}]
       	\NC \text{Text1}    \NC\qquad E = mc^2    \NR
       	\NC \text{Text2}    \NC\qquad E = mc^2    \NR
       	\NC \text{Text2}    \NC\hskip 3cm E = mc^2    \NR
	\stopalign
\stopformula

\stoptext
%%% end example.tex

> On 24 Aug 2016, at 10:02, Jan Willem Flamma <jwfregister@icloud.com> wrote:
> 
> Dear list,
> 
> I would like to include text on the same line as a formula.
> The text needs to be left-aligned and the formula needs to be mid-aligned (as per normal).
> 
> I’ve tried various solutions from the mathalign MyWay but have not succeeded to get the desired result sofar.
> Below a M-Not-WE. Clearly, the formula is not positioned correctly yet.
> 
> Who can help me out?
> 
> Regards,
> Jan Willem
> 
> 
> \starttext
> 
> \setupformulas[align=flushleft]
> \startformula
> 	\startalign[n=2,align={left,middle}]
>        	\NC \text{Text1}    \NC E = mc^2    \NR
>        	\NC \text{Text2}    \NC E = mc^2    \NR
> 	\stopalign
> \stopformula
> 
> \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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: align text and formula
  2016-08-24  8:10 ` Otared Kavian
@ 2016-08-24  8:19   ` Jan Willem Flamma
  2016-08-24  8:21   ` Jan Willem Flamma
  1 sibling, 0 replies; 12+ messages in thread
From: Jan Willem Flamma @ 2016-08-24  8:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Otared,

Thanks for the (very quick) reply.

I’ve experiemented with that solution as well. However, the text can vary in length and this would required a lot of tweaking to try and get the formulas mid-aligned.
I’m trying to find a fool proof solution that will get the formula mid-aligned in all cases (and hope it exists).

In any case, thanks for your suggestion!

Jan Willem
 
> On 24 aug. 2016, at 10:10, Otared Kavian <otared@gmail.com> wrote:
> 
> Hi Jan,
> 
> You can specify a certain horizontal distance in the second column, as in the following:
> 
> %%% begin example.tex
> \starttext
> 
> \setupformulas[align=flushleft]
> \startformula
> 	\startalign[n=2,align={left,middle}]
>       	\NC \text{Text1}    \NC\qquad E = mc^2    \NR
>       	\NC \text{Text2}    \NC\qquad E = mc^2    \NR
>       	\NC \text{Text2}    \NC\hskip 3cm E = mc^2    \NR
> 	\stopalign
> \stopformula
> 
> \stoptext
> %%% end example.tex
> 
>> On 24 Aug 2016, at 10:02, Jan Willem Flamma <jwfregister@icloud.com> wrote:
>> 
>> Dear list,
>> 
>> I would like to include text on the same line as a formula.
>> The text needs to be left-aligned and the formula needs to be mid-aligned (as per normal).
>> 
>> I’ve tried various solutions from the mathalign MyWay but have not succeeded to get the desired result sofar.
>> Below a M-Not-WE. Clearly, the formula is not positioned correctly yet.
>> 
>> Who can help me out?
>> 
>> Regards,
>> Jan Willem
>> 
>> 
>> \starttext
>> 
>> \setupformulas[align=flushleft]
>> \startformula
>> 	\startalign[n=2,align={left,middle}]
>>       	\NC \text{Text1}    \NC E = mc^2    \NR
>>       	\NC \text{Text2}    \NC E = mc^2    \NR
>> 	\stopalign
>> \stopformula
>> 
>> \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://tex.aanhet.net
>> archive  : http://foundry.supelec.fr/projects/contextrev/
>> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: align text and formula
  2016-08-24  8:10 ` Otared Kavian
  2016-08-24  8:19   ` Jan Willem Flamma
@ 2016-08-24  8:21   ` Jan Willem Flamma
  2016-08-24 14:53     ` Otared Kavian
  2016-08-24 15:38     ` Jan Willem Flamma
  1 sibling, 2 replies; 12+ messages in thread
From: Jan Willem Flamma @ 2016-08-24  8:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Otared,

Thanks for the (very quick) reply.

I’ve experiemented with that solution as well. However, the text can vary in length and this would required a lot of tweaking to try and get the formulas mid-aligned.
I’m trying to find a fool proof solution that will get the formula mid-aligned in all cases (and hope it exists).

In any case, thanks for your suggestion!

Jan Willem

> On 24 aug. 2016, at 10:10, Otared Kavian <otared@gmail.com> wrote:
> 
> Hi Jan,
> 
> You can specify a certain horizontal distance in the second column, as in the following:
> 
> %%% begin example.tex
> \starttext
> 
> \setupformulas[align=flushleft]
> \startformula
> 	\startalign[n=2,align={left,middle}]
>       	\NC \text{Text1}    \NC\qquad E = mc^2    \NR
>       	\NC \text{Text2}    \NC\qquad E = mc^2    \NR
>       	\NC \text{Text2}    \NC\hskip 3cm E = mc^2    \NR
> 	\stopalign
> \stopformula
> 
> \stoptext
> %%% end example.tex
> 
>> On 24 Aug 2016, at 10:02, Jan Willem Flamma <jwfregister@icloud.com> wrote:
>> 
>> Dear list,
>> 
>> I would like to include text on the same line as a formula.
>> The text needs to be left-aligned and the formula needs to be mid-aligned (as per normal).
>> 
>> I’ve tried various solutions from the mathalign MyWay but have not succeeded to get the desired result sofar.
>> Below a M-Not-WE. Clearly, the formula is not positioned correctly yet.
>> 
>> Who can help me out?
>> 
>> Regards,
>> Jan Willem
>> 
>> 
>> \starttext
>> 
>> \setupformulas[align=flushleft]
>> \startformula
>> 	\startalign[n=2,align={left,middle}]
>>       	\NC \text{Text1}    \NC E = mc^2    \NR
>>       	\NC \text{Text2}    \NC E = mc^2    \NR
>> 	\stopalign
>> \stopformula
>> 
>> \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://tex.aanhet.net
>> archive  : http://foundry.supelec.fr/projects/contextrev/
>> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: align text and formula
  2016-08-24  8:21   ` Jan Willem Flamma
@ 2016-08-24 14:53     ` Otared Kavian
  2016-08-24 15:38     ` Jan Willem Flamma
  1 sibling, 0 replies; 12+ messages in thread
From: Otared Kavian @ 2016-08-24 14:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Jan,

I don’t know exactly what you want to achieve, but a possible solution is to put a column between the first and the last columns which contains only the spacement between the first column and the third one.
Here is an example:

%%% begin example-1.tex
\starttext

\setupformulas[align=flushleft]
\startformula
	\startalign[n=3,align={left,middle}]
       	\NC \text{Text1}\NC \qquad    \NC E = mc^2    \NR
       	\NC \text{This is an explanation}\NC\qquad    \NC  E = mc^2    \NR
       	\NC \text{This is a longer explanation}\NC\qquad    \NC E = mc^2    \NR
	\stopalign
\stopformula

\stoptext
%%% end example-1.tex

Best regards: OK

> On 24 Aug 2016, at 10:21, Jan Willem Flamma <jwfregister@icloud.com> wrote:
> 
> Hi Otared,
> 
> Thanks for the (very quick) reply.
> 
> I’ve experiemented with that solution as well. However, the text can vary in length and this would required a lot of tweaking to try and get the formulas mid-aligned.
> I’m trying to find a fool proof solution that will get the formula mid-aligned in all cases (and hope it exists).
> 
> In any case, thanks for your suggestion!
> 
> Jan Willem
> 
>> On 24 aug. 2016, at 10:10, Otared Kavian <otared@gmail.com> wrote:
>> 
>> Hi Jan,
>> 
>> You can specify a certain horizontal distance in the second column, as in the following:
>> 
>> %%% begin example.tex
>> \starttext
>> 
>> \setupformulas[align=flushleft]
>> \startformula
>> 	\startalign[n=2,align={left,middle}]
>>      	\NC \text{Text1}    \NC\qquad E = mc^2    \NR
>>      	\NC \text{Text2}    \NC\qquad E = mc^2    \NR
>>      	\NC \text{Text2}    \NC\hskip 3cm E = mc^2    \NR
>> 	\stopalign
>> \stopformula
>> 
>> \stoptext
>> %%% end example.tex
>> 
>>> On 24 Aug 2016, at 10:02, Jan Willem Flamma <jwfregister@icloud.com> wrote:
>>> 
>>> Dear list,
>>> 
>>> I would like to include text on the same line as a formula.
>>> The text needs to be left-aligned and the formula needs to be mid-aligned (as per normal).
>>> 
>>> I’ve tried various solutions from the mathalign MyWay but have not succeeded to get the desired result sofar.
>>> Below a M-Not-WE. Clearly, the formula is not positioned correctly yet.
>>> 
>>> Who can help me out?
>>> 
>>> Regards,
>>> Jan Willem
>>> 
>>> 
>>> \starttext
>>> 
>>> \setupformulas[align=flushleft]
>>> \startformula
>>> 	\startalign[n=2,align={left,middle}]
>>>      	\NC \text{Text1}    \NC E = mc^2    \NR
>>>      	\NC \text{Text2}    \NC E = mc^2    \NR
>>> 	\stopalign
>>> \stopformula
>>> 
>>> \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://tex.aanhet.net
>>> archive  : http://foundry.supelec.fr/projects/contextrev/
>>> 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://tex.aanhet.net
>> archive  : http://foundry.supelec.fr/projects/contextrev/
>> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: align text and formula
  2016-08-24  8:21   ` Jan Willem Flamma
  2016-08-24 14:53     ` Otared Kavian
@ 2016-08-24 15:38     ` Jan Willem Flamma
  2016-08-25 11:52       ` Henri Menke
  1 sibling, 1 reply; 12+ messages in thread
From: Jan Willem Flamma @ 2016-08-24 15:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Otared,

I apologize for not explaining it better.

Maybe the below example will illustrate better what I’m trying to achieve. 
- The first formula is perfectly aligned.
- The bottom three formulas do not line up with the top formula

I’m trying to align all formulas regardless of the amount of text added to the left of the formula. 
Of course I could add \qquad or \quad to try and manually align but basically I’m interested to know if a fool proof method exist that aligns all without using \\qquad or \quad

\starttext

% Mid-aligned formula
\startformula
E = mc^2
\stopformula

\setupformulas[align=flushleft]
\startformula
        \startalign[n=3,align={left,middle}]
      	\NC \text{Text1}						\NC \qquad	\NC E = mc^2	\NR
      	\NC \text{This is an explanation}		\NC	\qquad	\NC  E = mc^2	\NR
      	\NC \text{This is a longer explanation}	\NC	\qquad	\NC E = mc^2    \NR
        \stopalign
\stopformula

\stoptext

Thanks
JW

> On 24 aug. 2016, at 10:21, Jan Willem Flamma <jwfregister@icloud.com> wrote:
> 
> Hi Otared,
> 
> Thanks for the (very quick) reply.
> 
> I’ve experiemented with that solution as well. However, the text can vary in length and this would required a lot of tweaking to try and get the formulas mid-aligned.
> I’m trying to find a fool proof solution that will get the formula mid-aligned in all cases (and hope it exists).
> 
> In any case, thanks for your suggestion!
> 
> Jan Willem
> 
>> On 24 aug. 2016, at 10:10, Otared Kavian <otared@gmail.com> wrote:
>> 
>> Hi Jan,
>> 
>> You can specify a certain horizontal distance in the second column, as in the following:
>> 
>> %%% begin example.tex
>> \starttext
>> 
>> \setupformulas[align=flushleft]
>> \startformula
>> 	\startalign[n=2,align={left,middle}]
>>      	\NC \text{Text1}    \NC\qquad E = mc^2    \NR
>>      	\NC \text{Text2}    \NC\qquad E = mc^2    \NR
>>      	\NC \text{Text2}    \NC\hskip 3cm E = mc^2    \NR
>> 	\stopalign
>> \stopformula
>> 
>> \stoptext
>> %%% end example.tex
>> 
>>> On 24 Aug 2016, at 10:02, Jan Willem Flamma <jwfregister@icloud.com> wrote:
>>> 
>>> Dear list,
>>> 
>>> I would like to include text on the same line as a formula.
>>> The text needs to be left-aligned and the formula needs to be mid-aligned (as per normal).
>>> 
>>> I’ve tried various solutions from the mathalign MyWay but have not succeeded to get the desired result sofar.
>>> Below a M-Not-WE. Clearly, the formula is not positioned correctly yet.
>>> 
>>> Who can help me out?
>>> 
>>> Regards,
>>> Jan Willem
>>> 
>>> 
>>> \starttext
>>> 
>>> \setupformulas[align=flushleft]
>>> \startformula
>>> 	\startalign[n=2,align={left,middle}]
>>>      	\NC \text{Text1}    \NC E = mc^2    \NR
>>>      	\NC \text{Text2}    \NC E = mc^2    \NR
>>> 	\stopalign
>>> \stopformula
>>> 
>>> \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://tex.aanhet.net
>>> archive  : http://foundry.supelec.fr/projects/contextrev/
>>> 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://tex.aanhet.net
>> archive  : http://foundry.supelec.fr/projects/contextrev/
>> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: align text and formula
  2016-08-24 15:38     ` Jan Willem Flamma
@ 2016-08-25 11:52       ` Henri Menke
  2016-08-25 13:12         ` Jan Willem Flamma
  0 siblings, 1 reply; 12+ messages in thread
From: Henri Menke @ 2016-08-25 11:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Jan,

if I understood you correctly, this should produce what you are after.

\starttext

\startformula
  E = mc^2
\stopformula

\startformula
  \startalign[m=3,align={middle},distance=0pt plus 1 fil]
    \NC \rlap{\text{Text1}}                        \NC\NC E=mc^2 \NR
    \NC \rlap{\text{This is an explanation}}       \NC\NC E=\sqrt{p^2c^2+m^2c^4} \NR
    \NC \rlap{\text{This is a longer explanation}} \NC\NC \left(\beta mc^2+c\left(\sum _{n=1}^3 \alpha_n p_n \right)\right) \psi(x,t) = i \hbar \frac{\partial \psi(x,t)}{\partial t} \NR
  \stopalign
\stopformula

\stoptext

The inner workings of this solution are quite messy.  You *have* to have the \NC\NC between text and formula and the formula must not contain any further alignment points; text has to be enclosed in \rlap.  As you can see it centers the formula unconditionally and just flows into the text if it doesn't fit.  Just don't do it like this.

Cheers, Henri

On 08/24/2016 05:38 PM, Jan Willem Flamma wrote:
> Hi Otared,
> 
> I apologize for not explaining it better.
> 
> Maybe the below example will illustrate better what I’m trying to achieve. 
> - The first formula is perfectly aligned.
> - The bottom three formulas do not line up with the top formula
> 
> I’m trying to align all formulas regardless of the amount of text added to the left of the formula. 
> Of course I could add \qquad or \quad to try and manually align but basically I’m interested to know if a fool proof method exist that aligns all without using \\qquad or \quad
> 
> \starttext
> 
> % Mid-aligned formula
> \startformula
> E = mc^2
> \stopformula
> 
> \setupformulas[align=flushleft]
> \startformula
>         \startalign[n=3,align={left,middle}]
>       	\NC \text{Text1}						\NC \qquad	\NC E = mc^2	\NR
>       	\NC \text{This is an explanation}		\NC	\qquad	\NC  E = mc^2	\NR
>       	\NC \text{This is a longer explanation}	\NC	\qquad	\NC E = mc^2    \NR
>         \stopalign
> \stopformula
> 
> \stoptext
> 
> Thanks
> JW
> 
>> On 24 aug. 2016, at 10:21, Jan Willem Flamma <jwfregister@icloud.com> wrote:
>>
>> Hi Otared,
>>
>> Thanks for the (very quick) reply.
>>
>> I’ve experiemented with that solution as well. However, the text can vary in length and this would required a lot of tweaking to try and get the formulas mid-aligned.
>> I’m trying to find a fool proof solution that will get the formula mid-aligned in all cases (and hope it exists).
>>
>> In any case, thanks for your suggestion!
>>
>> Jan Willem
>>
>>> On 24 aug. 2016, at 10:10, Otared Kavian <otared@gmail.com> wrote:
>>>
>>> Hi Jan,
>>>
>>> You can specify a certain horizontal distance in the second column, as in the following:
>>>
>>> %%% begin example.tex
>>> \starttext
>>>
>>> \setupformulas[align=flushleft]
>>> \startformula
>>> 	\startalign[n=2,align={left,middle}]
>>>      	\NC \text{Text1}    \NC\qquad E = mc^2    \NR
>>>      	\NC \text{Text2}    \NC\qquad E = mc^2    \NR
>>>      	\NC \text{Text2}    \NC\hskip 3cm E = mc^2    \NR
>>> 	\stopalign
>>> \stopformula
>>>
>>> \stoptext
>>> %%% end example.tex
>>>
>>>> On 24 Aug 2016, at 10:02, Jan Willem Flamma <jwfregister@icloud.com> wrote:
>>>>
>>>> Dear list,
>>>>
>>>> I would like to include text on the same line as a formula.
>>>> The text needs to be left-aligned and the formula needs to be mid-aligned (as per normal).
>>>>
>>>> I’ve tried various solutions from the mathalign MyWay but have not succeeded to get the desired result sofar.
>>>> Below a M-Not-WE. Clearly, the formula is not positioned correctly yet.
>>>>
>>>> Who can help me out?
>>>>
>>>> Regards,
>>>> Jan Willem
>>>>
>>>>
>>>> \starttext
>>>>
>>>> \setupformulas[align=flushleft]
>>>> \startformula
>>>> 	\startalign[n=2,align={left,middle}]
>>>>      	\NC \text{Text1}    \NC E = mc^2    \NR
>>>>      	\NC \text{Text2}    \NC E = mc^2    \NR
>>>> 	\stopalign
>>>> \stopformula
>>>>
>>>> \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://tex.aanhet.net
>>>> archive  : http://foundry.supelec.fr/projects/contextrev/
>>>> 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://tex.aanhet.net
>>> archive  : http://foundry.supelec.fr/projects/contextrev/
>>> 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://tex.aanhet.net
>> archive  : http://foundry.supelec.fr/projects/contextrev/
>> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: align text and formula
  2016-08-25 11:52       ` Henri Menke
@ 2016-08-25 13:12         ` Jan Willem Flamma
  2016-08-25 13:31           ` Henri Menke
  2017-02-09 13:05           ` Jan Willem Flamma
  0 siblings, 2 replies; 12+ messages in thread
From: Jan Willem Flamma @ 2016-08-25 13:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Henri,

Thanks for your solution. This is indeed providing the functionality I was after.

I need to pick up a good Tex book one of these days to try and master those commands :-)

Regards,
Jan Willem Flamma


> On 25 aug. 2016, at 13:52, Henri Menke <henrimenke@gmail.com> wrote:
> 
> Hi Jan,
> 
> if I understood you correctly, this should produce what you are after.
> 
> \starttext
> 
> \startformula
>  E = mc^2
> \stopformula
> 
> \startformula
>  \startalign[m=3,align={middle},distance=0pt plus 1 fil]
>    \NC \rlap{\text{Text1}}                        \NC\NC E=mc^2 \NR
>    \NC \rlap{\text{This is an explanation}}       \NC\NC E=\sqrt{p^2c^2+m^2c^4} \NR
>    \NC \rlap{\text{This is a longer explanation}} \NC\NC \left(\beta mc^2+c\left(\sum _{n=1}^3 \alpha_n p_n \right)\right) \psi(x,t) = i \hbar \frac{\partial \psi(x,t)}{\partial t} \NR
>  \stopalign
> \stopformula
> 
> \stoptext
> 
> The inner workings of this solution are quite messy.  You *have* to have the \NC\NC between text and formula and the formula must not contain any further alignment points; text has to be enclosed in \rlap.  As you can see it centers the formula unconditionally and just flows into the text if it doesn't fit.  Just don't do it like this.
> 
> Cheers, Henri
> 
> On 08/24/2016 05:38 PM, Jan Willem Flamma wrote:
>> Hi Otared,
>> 
>> I apologize for not explaining it better.
>> 
>> Maybe the below example will illustrate better what I’m trying to achieve. 
>> - The first formula is perfectly aligned.
>> - The bottom three formulas do not line up with the top formula
>> 
>> I’m trying to align all formulas regardless of the amount of text added to the left of the formula. 
>> Of course I could add \qquad or \quad to try and manually align but basically I’m interested to know if a fool proof method exist that aligns all without using \\qquad or \quad
>> 
>> \starttext
>> 
>> % Mid-aligned formula
>> \startformula
>> E = mc^2
>> \stopformula
>> 
>> \setupformulas[align=flushleft]
>> \startformula
>>        \startalign[n=3,align={left,middle}]
>>      	\NC \text{Text1}						\NC \qquad	\NC E = mc^2	\NR
>>      	\NC \text{This is an explanation}		\NC	\qquad	\NC  E = mc^2	\NR
>>      	\NC \text{This is a longer explanation}	\NC	\qquad	\NC E = mc^2    \NR
>>        \stopalign
>> \stopformula
>> 
>> \stoptext
>> 
>> Thanks
>> JW
>> 
>>> On 24 aug. 2016, at 10:21, Jan Willem Flamma <jwfregister@icloud.com> wrote:
>>> 
>>> Hi Otared,
>>> 
>>> Thanks for the (very quick) reply.
>>> 
>>> I’ve experiemented with that solution as well. However, the text can vary in length and this would required a lot of tweaking to try and get the formulas mid-aligned.
>>> I’m trying to find a fool proof solution that will get the formula mid-aligned in all cases (and hope it exists).
>>> 
>>> In any case, thanks for your suggestion!
>>> 
>>> Jan Willem
>>> 
>>>> On 24 aug. 2016, at 10:10, Otared Kavian <otared@gmail.com> wrote:
>>>> 
>>>> Hi Jan,
>>>> 
>>>> You can specify a certain horizontal distance in the second column, as in the following:
>>>> 
>>>> %%% begin example.tex
>>>> \starttext
>>>> 
>>>> \setupformulas[align=flushleft]
>>>> \startformula
>>>> 	\startalign[n=2,align={left,middle}]
>>>>     	\NC \text{Text1}    \NC\qquad E = mc^2    \NR
>>>>     	\NC \text{Text2}    \NC\qquad E = mc^2    \NR
>>>>     	\NC \text{Text2}    \NC\hskip 3cm E = mc^2    \NR
>>>> 	\stopalign
>>>> \stopformula
>>>> 
>>>> \stoptext
>>>> %%% end example.tex
>>>> 
>>>>> On 24 Aug 2016, at 10:02, Jan Willem Flamma <jwfregister@icloud.com> wrote:
>>>>> 
>>>>> Dear list,
>>>>> 
>>>>> I would like to include text on the same line as a formula.
>>>>> The text needs to be left-aligned and the formula needs to be mid-aligned (as per normal).
>>>>> 
>>>>> I’ve tried various solutions from the mathalign MyWay but have not succeeded to get the desired result sofar.
>>>>> Below a M-Not-WE. Clearly, the formula is not positioned correctly yet.
>>>>> 
>>>>> Who can help me out?
>>>>> 
>>>>> Regards,
>>>>> Jan Willem
>>>>> 
>>>>> 
>>>>> \starttext
>>>>> 
>>>>> \setupformulas[align=flushleft]
>>>>> \startformula
>>>>> 	\startalign[n=2,align={left,middle}]
>>>>>     	\NC \text{Text1}    \NC E = mc^2    \NR
>>>>>     	\NC \text{Text2}    \NC E = mc^2    \NR
>>>>> 	\stopalign
>>>>> \stopformula
>>>>> 
>>>>> \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://tex.aanhet.net
>>>>> archive  : http://foundry.supelec.fr/projects/contextrev/
>>>>> 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://tex.aanhet.net
>>>> archive  : http://foundry.supelec.fr/projects/contextrev/
>>>> 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://tex.aanhet.net
>>> archive  : http://foundry.supelec.fr/projects/contextrev/
>>> 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://tex.aanhet.net
>> archive  : http://foundry.supelec.fr/projects/contextrev/
>> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: align text and formula
  2016-08-25 13:12         ` Jan Willem Flamma
@ 2016-08-25 13:31           ` Henri Menke
  2016-08-25 14:07             ` Wolfgang Schuster
  2017-02-09 13:05           ` Jan Willem Flamma
  1 sibling, 1 reply; 12+ messages in thread
From: Henri Menke @ 2016-08-25 13:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Jan,

unfortunately, these commands are in no book.  I just looked them up in the ConTeXt source.  However, these two books helped me a lot in improving my understanding of TeX and ConTeXt.  They are definitely worth their money!

The TeXbook by Donald E. Knuth https://amzn.com/0201134489
Programming in Lua by Roberto Ierusalimschy https://amzn.com/859037985X

Kind regards,
Henri

On 08/25/2016 03:12 PM, Jan Willem Flamma wrote:
> Hi Henri,
> 
> Thanks for your solution. This is indeed providing the functionality I was after.
> 
> I need to pick up a good Tex book one of these days to try and master those commands :-)
> 
> Regards,
> Jan Willem Flamma
> 
> 
>> On 25 aug. 2016, at 13:52, Henri Menke <henrimenke@gmail.com> wrote:
>>
>> Hi Jan,
>>
>> if I understood you correctly, this should produce what you are after.
>>
>> \starttext
>>
>> \startformula
>>  E = mc^2
>> \stopformula
>>
>> \startformula
>>  \startalign[m=3,align={middle},distance=0pt plus 1 fil]
>>    \NC \rlap{\text{Text1}}                        \NC\NC E=mc^2 \NR
>>    \NC \rlap{\text{This is an explanation}}       \NC\NC E=\sqrt{p^2c^2+m^2c^4} \NR
>>    \NC \rlap{\text{This is a longer explanation}} \NC\NC \left(\beta mc^2+c\left(\sum _{n=1}^3 \alpha_n p_n \right)\right) \psi(x,t) = i \hbar \frac{\partial \psi(x,t)}{\partial t} \NR
>>  \stopalign
>> \stopformula
>>
>> \stoptext
>>
>> The inner workings of this solution are quite messy.  You *have* to have the \NC\NC between text and formula and the formula must not contain any further alignment points; text has to be enclosed in \rlap.  As you can see it centers the formula unconditionally and just flows into the text if it doesn't fit.  Just don't do it like this.
>>
>> Cheers, Henri
>>
>> On 08/24/2016 05:38 PM, Jan Willem Flamma wrote:
>>> Hi Otared,
>>>
>>> I apologize for not explaining it better.
>>>
>>> Maybe the below example will illustrate better what I’m trying to achieve. 
>>> - The first formula is perfectly aligned.
>>> - The bottom three formulas do not line up with the top formula
>>>
>>> I’m trying to align all formulas regardless of the amount of text added to the left of the formula. 
>>> Of course I could add \qquad or \quad to try and manually align but basically I’m interested to know if a fool proof method exist that aligns all without using \\qquad or \quad
>>>
>>> \starttext
>>>
>>> % Mid-aligned formula
>>> \startformula
>>> E = mc^2
>>> \stopformula
>>>
>>> \setupformulas[align=flushleft]
>>> \startformula
>>>        \startalign[n=3,align={left,middle}]
>>>      	\NC \text{Text1}						\NC \qquad	\NC E = mc^2	\NR
>>>      	\NC \text{This is an explanation}		\NC	\qquad	\NC  E = mc^2	\NR
>>>      	\NC \text{This is a longer explanation}	\NC	\qquad	\NC E = mc^2    \NR
>>>        \stopalign
>>> \stopformula
>>>
>>> \stoptext
>>>
>>> Thanks
>>> JW
>>>
>>>> On 24 aug. 2016, at 10:21, Jan Willem Flamma <jwfregister@icloud.com> wrote:
>>>>
>>>> Hi Otared,
>>>>
>>>> Thanks for the (very quick) reply.
>>>>
>>>> I’ve experiemented with that solution as well. However, the text can vary in length and this would required a lot of tweaking to try and get the formulas mid-aligned.
>>>> I’m trying to find a fool proof solution that will get the formula mid-aligned in all cases (and hope it exists).
>>>>
>>>> In any case, thanks for your suggestion!
>>>>
>>>> Jan Willem
>>>>
>>>>> On 24 aug. 2016, at 10:10, Otared Kavian <otared@gmail.com> wrote:
>>>>>
>>>>> Hi Jan,
>>>>>
>>>>> You can specify a certain horizontal distance in the second column, as in the following:
>>>>>
>>>>> %%% begin example.tex
>>>>> \starttext
>>>>>
>>>>> \setupformulas[align=flushleft]
>>>>> \startformula
>>>>> 	\startalign[n=2,align={left,middle}]
>>>>>     	\NC \text{Text1}    \NC\qquad E = mc^2    \NR
>>>>>     	\NC \text{Text2}    \NC\qquad E = mc^2    \NR
>>>>>     	\NC \text{Text2}    \NC\hskip 3cm E = mc^2    \NR
>>>>> 	\stopalign
>>>>> \stopformula
>>>>>
>>>>> \stoptext
>>>>> %%% end example.tex
>>>>>
>>>>>> On 24 Aug 2016, at 10:02, Jan Willem Flamma <jwfregister@icloud.com> wrote:
>>>>>>
>>>>>> Dear list,
>>>>>>
>>>>>> I would like to include text on the same line as a formula.
>>>>>> The text needs to be left-aligned and the formula needs to be mid-aligned (as per normal).
>>>>>>
>>>>>> I’ve tried various solutions from the mathalign MyWay but have not succeeded to get the desired result sofar.
>>>>>> Below a M-Not-WE. Clearly, the formula is not positioned correctly yet.
>>>>>>
>>>>>> Who can help me out?
>>>>>>
>>>>>> Regards,
>>>>>> Jan Willem
>>>>>>
>>>>>>
>>>>>> \starttext
>>>>>>
>>>>>> \setupformulas[align=flushleft]
>>>>>> \startformula
>>>>>> 	\startalign[n=2,align={left,middle}]
>>>>>>     	\NC \text{Text1}    \NC E = mc^2    \NR
>>>>>>     	\NC \text{Text2}    \NC E = mc^2    \NR
>>>>>> 	\stopalign
>>>>>> \stopformula
>>>>>>
>>>>>> \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://tex.aanhet.net
>>>>>> archive  : http://foundry.supelec.fr/projects/contextrev/
>>>>>> 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://tex.aanhet.net
>>>>> archive  : http://foundry.supelec.fr/projects/contextrev/
>>>>> 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://tex.aanhet.net
>>>> archive  : http://foundry.supelec.fr/projects/contextrev/
>>>> 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://tex.aanhet.net
>>> archive  : http://foundry.supelec.fr/projects/contextrev/
>>> 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://tex.aanhet.net
>> archive  : http://foundry.supelec.fr/projects/contextrev/
>> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: align text and formula
  2016-08-25 13:31           ` Henri Menke
@ 2016-08-25 14:07             ` Wolfgang Schuster
  2016-08-27 12:51               ` Hans Hagen
  0 siblings, 1 reply; 12+ messages in thread
From: Wolfgang Schuster @ 2016-08-25 14:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 616 bytes --]

> Henri Menke <mailto:henrimenke@gmail.com>
> 25. August 2016 um 15:31
> Hi Jan,
>
> unfortunately, these commands are in no book. I just looked them up in 
> the ConTeXt source. However, these two books helped me a lot in 
> improving my understanding of TeX and ConTeXt. They are definitely 
> worth their money!
>
> The TeXbook by Donald E. Knuth https://amzn.com/0201134489
> Programming in Lua by Roberto Ierusalimschy https://amzn.com/859037985X
Other good books for TeX are

   - TeX by Topic (https://www.ctan.org/pkg/texbytopic) and
   - TeX for the Impatient (https://www.ctan.org/pkg/impatient)

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 1914 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: align text and formula
  2016-08-25 14:07             ` Wolfgang Schuster
@ 2016-08-27 12:51               ` Hans Hagen
  0 siblings, 0 replies; 12+ messages in thread
From: Hans Hagen @ 2016-08-27 12:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 8/25/2016 4:07 PM, Wolfgang Schuster wrote:
>> Henri Menke <mailto:henrimenke@gmail.com>
>> 25. August 2016 um 15:31
>> Hi Jan,
>>
>> unfortunately, these commands are in no book. I just looked them up in
>> the ConTeXt source. However, these two books helped me a lot in
>> improving my understanding of TeX and ConTeXt. They are definitely
>> worth their money!
>>
>> The TeXbook by Donald E. Knuth https://amzn.com/0201134489
>> Programming in Lua by Roberto Ierusalimschy https://amzn.com/859037985X
> Other good books for TeX are
>
>   - TeX by Topic (https://www.ctan.org/pkg/texbytopic) and
>   - TeX for the Impatient (https://www.ctan.org/pkg/impatient)

the next upload (not today) will provide a specifier so that one can 
make helpers

\starttext \showframe

\setupformulas[align=flushleft]

\startformula
     \startalign[m=2,align={middle}]
         \NC \text to 6cm{} \NC x = 0 \NR
     \stopalign
\stopformula

\startformula
     \startalign[m=2,align={middle}]
         \NC \text to 6cm{One\hfill}           \NC a = 1 \NR
         \NC \text to 6cm{One Two\hfill}       \NC b = 2 \NR
         \NC \text to 6cm{One Two Three\hfill} \NC c = 3 \NR
     \stopalign
\stopformula

\startformula
     \startalign[m=2,align={left}]
         \NC \text to 6cm{One\hfill}           \NC a = 1 \NR
         \NC \text to 6cm{One Two\hfill}       \NC b = 2 \NR
         \NC \text to 6cm{One Two Three\hfill} \NC c = 3 \NR
     \stopalign
\stopformula

\blank[3*big]

\startformula
     \startalign[m=2,align={middle}]
         \NC \text to 6cm{} \NC x = 0 \NR
     \stopalign
\stopformula

\startformula
     \startalign[m=2,align={middle}]
         \NC \text to 6cm{One}           \NC a = 1 \NR
         \NC \text to 6cm{One Two}       \NC b = 2 \NR
         \NC \text to 6cm{One Two Three} \NC c = 3 \NR
     \stopalign
\stopformula

\startformula
     \startalign[m=2,align={left}]
         \NC \text to 6cm{One}           \NC a = 1 \NR
         \NC \text to 6cm{One Two}       \NC b = 2 \NR
         \NC \text to 6cm{One Two Three} \NC c = 3 \NR
     \stopalign
\stopformula

\blank[3*big]

\startformula
     \startalign[m   =2,align={middle}]
         \NC \text{} \NC x = 0 \NR
     \stopalign
\stopformula

\startformula
     \startalign[m=2,align={middle}]
         \NC \text{One}           \NC a = 1 \NR
         \NC \text{One Two}       \NC b = 2 \NR
         \NC \text{One Two Three} \NC c = 3 \NR
     \stopalign
\stopformula

\startformula
     \startalign[m=2,align={left}]
         \NC \text{One}           \NC a = 1 \NR
         \NC \text{One Two}       \NC b = 2 \NR
         \NC \text{One Two Three} \NC c = 3 \NR
     \stopalign
\stopformula

\stoptext


-----------------------------------------------------------------
                                           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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: align text and formula
  2016-08-25 13:12         ` Jan Willem Flamma
  2016-08-25 13:31           ` Henri Menke
@ 2017-02-09 13:05           ` Jan Willem Flamma
  1 sibling, 0 replies; 12+ messages in thread
From: Jan Willem Flamma @ 2017-02-09 13:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list members,

The below solution stopped working in the latest bet (2017.01.27 14:39 MKIV beta)
It is still workig fine using the wiki ConTeXt online.

Has anything changed using this align feature?

Kind regards,
Jan Willem Flamma


> 
> 
>> On 25 aug. 2016, at 13:52, Henri Menke <henrimenke@gmail.com> wrote:
>> 
>> Hi Jan,
>> 
>> if I understood you correctly, this should produce what you are after.
>> 
>> \starttext
>> 
>> \startformula
>> E = mc^2
>> \stopformula
>> 
>> \startformula
>> \startalign[m=3,align={middle},distance=0pt plus 1 fil]
>>   \NC \rlap{\text{Text1}}   \NC\NC E=mc^2 \NR
>>   \NC \rlap{\text{This is an explanation}}   \NC\NC E=mc^2 \NR
>>   \NC \rlap{\text{This is a very very very long explanation}}   \NC\NC E=mc^2 \NR
>> \stopalign
>> \stopformula
>> 
>> \stoptext
>> 
>> The inner workings of this solution are quite messy.  You *have* to have the \NC\NC between text and formula and the formula must not contain any further alignment points; text has to be enclosed in \rlap.  As you can see it centers the formula unconditionally and just flows into the text if it doesn't fit.  Just don't do it like this.
>> 
>> Cheers, Henri
>> 
>> On 08/24/2016 05:38 PM, Jan Willem Flamma wrote:
>>> Hi Otared,
>>> 
>>> I apologize for not explaining it better.
>>> 
>>> Maybe the below example will illustrate better what I’m trying to achieve. 
>>> - The first formula is perfectly aligned.
>>> - The bottom three formulas do not line up with the top formula
>>> 
>>> I’m trying to align all formulas regardless of the amount of text added to the left of the formula. 
>>> Of course I could add \qquad or \quad to try and manually align but basically I’m interested to know if a fool proof method exist that aligns all without using \\qquad or \quad
>>> 
>>> \starttext
>>> 
>>> % Mid-aligned formula
>>> \startformula
>>> E = mc^2
>>> \stopformula
>>> 
>>> \setupformulas[align=flushleft]
>>> \startformula
>>>       \startalign[n=3,align={left,middle}]
>>>     	\NC \text{Text1}						\NC \qquad	\NC E = mc^2	\NR
>>>     	\NC \text{This is an explanation}		\NC	\qquad	\NC  E = mc^2	\NR
>>>     	\NC \text{This is a longer explanation}	\NC	\qquad	\NC E = mc^2    \NR
>>>       \stopalign
>>> \stopformula
>>> 
>>> \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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-02-09 13:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-24  8:02 align text and formula Jan Willem Flamma
2016-08-24  8:10 ` Otared Kavian
2016-08-24  8:19   ` Jan Willem Flamma
2016-08-24  8:21   ` Jan Willem Flamma
2016-08-24 14:53     ` Otared Kavian
2016-08-24 15:38     ` Jan Willem Flamma
2016-08-25 11:52       ` Henri Menke
2016-08-25 13:12         ` Jan Willem Flamma
2016-08-25 13:31           ` Henri Menke
2016-08-25 14:07             ` Wolfgang Schuster
2016-08-27 12:51               ` Hans Hagen
2017-02-09 13:05           ` Jan Willem Flamma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).