4

I'm trying to write some equations with comments in ConTeXt. According to http://dl.contextgarden.net/myway/mathalign.pdf , the following example should span the whole text line. However, it seems not to work now (it adds spacing before text).

\startformula \startflalign
\NC\NC \NC 12(x-1) + 20(y-3) + 14(z-2) \NC = 0 \NR
\NC \text{which is same as } \NC\NC 6x + 10y + 7z \NC = 0 \NR
\stopflalign \stopformula

What I expect: enter image description here

What I get: enter image description here

How to avoid/remove undesired spacing below "Here is"? Otherwise, how to get the same result as the shown in the first picture? EDIT: I meant the space between math formulas and text margins, not the spacing inside.

  • 2
    Keep in mind that the MyWay is 13 years old and a lot has changed since. – Henri Menke Nov 8 '19 at 2:49
  • 3
    @HenriMenke... hmm..maybe it is time that I update it. – Aditya Nov 11 '19 at 2:14
  • @Aditya Yes, a couple of things have changed. In my MSc thesis from 2016, equations are also colliding now. – Henri Menke Nov 11 '19 at 5:55
5

The solution is incorrect since it does not correctly answer the question. The answer seems to be that the stretching of the alignment doesn't work due to a now-solved bug in ConTeXt mkiv.

Something like the following?

\starttext
Here is some text
    \startformula
        \startalign [m=2, align={left,middle,right,left}, distance=0em plus 1 fil]
            \NC \NC \NC 12(x-1) + 20(y-3) + 14(z-2) \NC = 0 \NR
            \NC \text{which is same as } \NC \NC 6x + 10y + 7z \NC = 0 \NR
        \stopalign 
    \stopformula
\stoptext

which results in Result of using align See the ConTeXt wiki.

  • Sorry, I edited the question. I want to remove the space to the left of "which", not the space inside equations. – JairoAraujo Nov 11 '19 at 5:49
  • @JairoAraujo Sorry, changing answer to comment. The 1 fil in the distance keyword forces the alignment to be full width. I'm not sure why the sintax does not allow simply 1 fil though. – Semptum Valoris Nov 11 '19 at 14:16
  • Thank you very much. – JairoAraujo Nov 12 '19 at 22:10
  • Which version of ConTeXt are you using? I've tried and it does not work on my PC. – JairoAraujo Nov 13 '19 at 5:24
  • @JairoAraujo I was using ConTeXt Live. I just checked and you are right, it doesn't work everywhere, at least not in my TeXlive distribution. The Live version is newer so I posit it will be fixed when TeXlive gets updated. Aditya made a comment about that on the newsletter in april but the thread remains empty. It might be a good idea to ask the question again here this time specifically asking why the "1 fil" glue isn't working in your version of ConTeXt and how best to work around this. – Semptum Valoris Nov 14 '19 at 2:13
2

You can change the space around the equation using spacebefore and spaceafter keys for setupformula. Here is a complete example:

\definemathalignment
  [flalign]
  [
    m=2, 
    distance=5em plus 1 fil,
    align={right,left,right,left},
  ]

\setupformula[spacebefore={none}]

\showframe
\showgrid


\starttext

Here is some text
\startformula \startflalign
  \NC\NC \NC 12(x-1) + 20(y-3) + 14(z-2) \NC = 0 \NR
  \NC \text{which is same as } \NC\NC 6x + 10y + 7z \NC = 0 \NR
\stopflalign \stopformula
\stoptext

which gives

enter image description here

  • I understood it as if it was the indentation of "which is same as" that was the problem. – mickep Nov 18 '19 at 19:27
  • Indeed, the spacebefore key isn't related at all with the problem I want to solve. My problem is the narrowing of the math alignment environment. – JairoAraujo Dec 26 '19 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.