ConTeXt: Is ist possible to use matrices nested like in 'block' matrices?
I tried to use context's startmatrix
/stopmatrix
nested with predefined matrix blocks. In latex it works like this:
documentclass{article}
usepackage{amsmath}
defmatOne{begin{matrix}1 & 0 \ 0 & 1end{matrix}}
defmatTwo{begin{matrix}a\bend{matrix}}
defmatThree{begin{matrix}c & dend{matrix}}
begin{document}
begin{align*}
begin{pmatrix}
matOne & matTwo\
matThree & e\
end{pmatrix}\
begin{pmatrix}
1 & 0 & a\
0 & 1 & b\
c & d & e\
end{pmatrix}
end{align*}
end{document}
The top matrix out of blocks looks the same as the bottom one. In context I tried the following:
definemathmatrix[pmatrix][left={left(}, right={right)}, distance=1em]
defmatOne{startmatrixNC 1 NC 0 NRNC 0 NC 1NRstopmatrix}
defmatTwo{startmatrixNC aNRNC bNRstopmatrix}
defmatThree{startmatrixNC c NC dNRstopmatrix}
starttext
startformula
startpmatrix
NC matOne NC matTwoNR
NC matThree NC eNR
stoppmatrix
stopformula
startformula
startpmatrix
NC 1 NC 0 NC a NR
NC 0 NC 1 NC b NR
NC c NC d NC eNR
stoppmatrix
stopformula
stoptext
Here the top matrix looks different than the bottom one. It seems that the distance isn't applied after a block matrix. Is there a way to fix this?
math-mode context matrices
add a comment |
I tried to use context's startmatrix
/stopmatrix
nested with predefined matrix blocks. In latex it works like this:
documentclass{article}
usepackage{amsmath}
defmatOne{begin{matrix}1 & 0 \ 0 & 1end{matrix}}
defmatTwo{begin{matrix}a\bend{matrix}}
defmatThree{begin{matrix}c & dend{matrix}}
begin{document}
begin{align*}
begin{pmatrix}
matOne & matTwo\
matThree & e\
end{pmatrix}\
begin{pmatrix}
1 & 0 & a\
0 & 1 & b\
c & d & e\
end{pmatrix}
end{align*}
end{document}
The top matrix out of blocks looks the same as the bottom one. In context I tried the following:
definemathmatrix[pmatrix][left={left(}, right={right)}, distance=1em]
defmatOne{startmatrixNC 1 NC 0 NRNC 0 NC 1NRstopmatrix}
defmatTwo{startmatrixNC aNRNC bNRstopmatrix}
defmatThree{startmatrixNC c NC dNRstopmatrix}
starttext
startformula
startpmatrix
NC matOne NC matTwoNR
NC matThree NC eNR
stoppmatrix
stopformula
startformula
startpmatrix
NC 1 NC 0 NC a NR
NC 0 NC 1 NC b NR
NC c NC d NC eNR
stoppmatrix
stopformula
stoptext
Here the top matrix looks different than the bottom one. It seems that the distance isn't applied after a block matrix. Is there a way to fix this?
math-mode context matrices
add a comment |
I tried to use context's startmatrix
/stopmatrix
nested with predefined matrix blocks. In latex it works like this:
documentclass{article}
usepackage{amsmath}
defmatOne{begin{matrix}1 & 0 \ 0 & 1end{matrix}}
defmatTwo{begin{matrix}a\bend{matrix}}
defmatThree{begin{matrix}c & dend{matrix}}
begin{document}
begin{align*}
begin{pmatrix}
matOne & matTwo\
matThree & e\
end{pmatrix}\
begin{pmatrix}
1 & 0 & a\
0 & 1 & b\
c & d & e\
end{pmatrix}
end{align*}
end{document}
The top matrix out of blocks looks the same as the bottom one. In context I tried the following:
definemathmatrix[pmatrix][left={left(}, right={right)}, distance=1em]
defmatOne{startmatrixNC 1 NC 0 NRNC 0 NC 1NRstopmatrix}
defmatTwo{startmatrixNC aNRNC bNRstopmatrix}
defmatThree{startmatrixNC c NC dNRstopmatrix}
starttext
startformula
startpmatrix
NC matOne NC matTwoNR
NC matThree NC eNR
stoppmatrix
stopformula
startformula
startpmatrix
NC 1 NC 0 NC a NR
NC 0 NC 1 NC b NR
NC c NC d NC eNR
stoppmatrix
stopformula
stoptext
Here the top matrix looks different than the bottom one. It seems that the distance isn't applied after a block matrix. Is there a way to fix this?
math-mode context matrices
I tried to use context's startmatrix
/stopmatrix
nested with predefined matrix blocks. In latex it works like this:
documentclass{article}
usepackage{amsmath}
defmatOne{begin{matrix}1 & 0 \ 0 & 1end{matrix}}
defmatTwo{begin{matrix}a\bend{matrix}}
defmatThree{begin{matrix}c & dend{matrix}}
begin{document}
begin{align*}
begin{pmatrix}
matOne & matTwo\
matThree & e\
end{pmatrix}\
begin{pmatrix}
1 & 0 & a\
0 & 1 & b\
c & d & e\
end{pmatrix}
end{align*}
end{document}
The top matrix out of blocks looks the same as the bottom one. In context I tried the following:
definemathmatrix[pmatrix][left={left(}, right={right)}, distance=1em]
defmatOne{startmatrixNC 1 NC 0 NRNC 0 NC 1NRstopmatrix}
defmatTwo{startmatrixNC aNRNC bNRstopmatrix}
defmatThree{startmatrixNC c NC dNRstopmatrix}
starttext
startformula
startpmatrix
NC matOne NC matTwoNR
NC matThree NC eNR
stoppmatrix
stopformula
startformula
startpmatrix
NC 1 NC 0 NC a NR
NC 0 NC 1 NC b NR
NC c NC d NC eNR
stoppmatrix
stopformula
stoptext
Here the top matrix looks different than the bottom one. It seems that the distance isn't applied after a block matrix. Is there a way to fix this?
math-mode context matrices
math-mode context matrices
asked Aug 22 '17 at 20:32
IcxoluIcxolu
1425
1425
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
I'm unsure whether this breaks something else but it seems as if the definition of NC
is not reverted properly. Reported here: https://mailman.ntg.nl/pipermail/ntg-context/2017/089631.html
I cranked distance
up to 2em
to make the difference more visible.
unprotect
defmath_matrix_stop
{crcr
% ifgridsnapping else
mathstrutcrcr
noalign{vskip-baselineskip}%
% fi
egroup
gdefmath_matrix_NC{endmathaligntab}
egroup
mathmatrixright
endgroup}
protect
definemathmatrix[pmatrix][left={left(}, right={right)}, distance=2em]
defmatOne{startmatrixNC 1 NC 0 NRNC 0 NC 1NRstopmatrix}
defmatTwo{startmatrixNC aNRNC bNRstopmatrix}
defmatThree{startmatrixNC c NC dNRstopmatrix}
starttext
startformula
startpmatrix
NC matOne NC matTwo NC matTwo NR
NC matThree NC e NC eNR
stoppmatrix
stopformula
startformula
startpmatrix
NC 1 NC 0 NC a NR
NC 0 NC 1 NC b NR
NC c NC d NC eNR
stoppmatrix
stopformula
stoptext
Thanks Henry, so it seems like this is a bug in context. Your fix works in this case, but if a add a fourth column with anothermathTwo
in the first row and anf
in the second it doesn't work anymore. If you keep adding some columns it adds the distance only every second column.
– Icxolu
Aug 23 '17 at 11:27
@Icxolu Maybe it works now, maybe I broke something else this time...
– Henri Menke
Aug 23 '17 at 21:06
Thanks. I haven't found any issue, so I will accept this answer.
– Icxolu
Aug 24 '17 at 17:24
add a comment |
FWIW, nested matrices work currently with the current version of ConTeXt (2019.03.21). The bug was fixed with this commit. The code listed in the example gives the following:
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f387718%2fcontext-is-ist-possible-to-use-matrices-nested-like-in-block-matrices%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I'm unsure whether this breaks something else but it seems as if the definition of NC
is not reverted properly. Reported here: https://mailman.ntg.nl/pipermail/ntg-context/2017/089631.html
I cranked distance
up to 2em
to make the difference more visible.
unprotect
defmath_matrix_stop
{crcr
% ifgridsnapping else
mathstrutcrcr
noalign{vskip-baselineskip}%
% fi
egroup
gdefmath_matrix_NC{endmathaligntab}
egroup
mathmatrixright
endgroup}
protect
definemathmatrix[pmatrix][left={left(}, right={right)}, distance=2em]
defmatOne{startmatrixNC 1 NC 0 NRNC 0 NC 1NRstopmatrix}
defmatTwo{startmatrixNC aNRNC bNRstopmatrix}
defmatThree{startmatrixNC c NC dNRstopmatrix}
starttext
startformula
startpmatrix
NC matOne NC matTwo NC matTwo NR
NC matThree NC e NC eNR
stoppmatrix
stopformula
startformula
startpmatrix
NC 1 NC 0 NC a NR
NC 0 NC 1 NC b NR
NC c NC d NC eNR
stoppmatrix
stopformula
stoptext
Thanks Henry, so it seems like this is a bug in context. Your fix works in this case, but if a add a fourth column with anothermathTwo
in the first row and anf
in the second it doesn't work anymore. If you keep adding some columns it adds the distance only every second column.
– Icxolu
Aug 23 '17 at 11:27
@Icxolu Maybe it works now, maybe I broke something else this time...
– Henri Menke
Aug 23 '17 at 21:06
Thanks. I haven't found any issue, so I will accept this answer.
– Icxolu
Aug 24 '17 at 17:24
add a comment |
I'm unsure whether this breaks something else but it seems as if the definition of NC
is not reverted properly. Reported here: https://mailman.ntg.nl/pipermail/ntg-context/2017/089631.html
I cranked distance
up to 2em
to make the difference more visible.
unprotect
defmath_matrix_stop
{crcr
% ifgridsnapping else
mathstrutcrcr
noalign{vskip-baselineskip}%
% fi
egroup
gdefmath_matrix_NC{endmathaligntab}
egroup
mathmatrixright
endgroup}
protect
definemathmatrix[pmatrix][left={left(}, right={right)}, distance=2em]
defmatOne{startmatrixNC 1 NC 0 NRNC 0 NC 1NRstopmatrix}
defmatTwo{startmatrixNC aNRNC bNRstopmatrix}
defmatThree{startmatrixNC c NC dNRstopmatrix}
starttext
startformula
startpmatrix
NC matOne NC matTwo NC matTwo NR
NC matThree NC e NC eNR
stoppmatrix
stopformula
startformula
startpmatrix
NC 1 NC 0 NC a NR
NC 0 NC 1 NC b NR
NC c NC d NC eNR
stoppmatrix
stopformula
stoptext
Thanks Henry, so it seems like this is a bug in context. Your fix works in this case, but if a add a fourth column with anothermathTwo
in the first row and anf
in the second it doesn't work anymore. If you keep adding some columns it adds the distance only every second column.
– Icxolu
Aug 23 '17 at 11:27
@Icxolu Maybe it works now, maybe I broke something else this time...
– Henri Menke
Aug 23 '17 at 21:06
Thanks. I haven't found any issue, so I will accept this answer.
– Icxolu
Aug 24 '17 at 17:24
add a comment |
I'm unsure whether this breaks something else but it seems as if the definition of NC
is not reverted properly. Reported here: https://mailman.ntg.nl/pipermail/ntg-context/2017/089631.html
I cranked distance
up to 2em
to make the difference more visible.
unprotect
defmath_matrix_stop
{crcr
% ifgridsnapping else
mathstrutcrcr
noalign{vskip-baselineskip}%
% fi
egroup
gdefmath_matrix_NC{endmathaligntab}
egroup
mathmatrixright
endgroup}
protect
definemathmatrix[pmatrix][left={left(}, right={right)}, distance=2em]
defmatOne{startmatrixNC 1 NC 0 NRNC 0 NC 1NRstopmatrix}
defmatTwo{startmatrixNC aNRNC bNRstopmatrix}
defmatThree{startmatrixNC c NC dNRstopmatrix}
starttext
startformula
startpmatrix
NC matOne NC matTwo NC matTwo NR
NC matThree NC e NC eNR
stoppmatrix
stopformula
startformula
startpmatrix
NC 1 NC 0 NC a NR
NC 0 NC 1 NC b NR
NC c NC d NC eNR
stoppmatrix
stopformula
stoptext
I'm unsure whether this breaks something else but it seems as if the definition of NC
is not reverted properly. Reported here: https://mailman.ntg.nl/pipermail/ntg-context/2017/089631.html
I cranked distance
up to 2em
to make the difference more visible.
unprotect
defmath_matrix_stop
{crcr
% ifgridsnapping else
mathstrutcrcr
noalign{vskip-baselineskip}%
% fi
egroup
gdefmath_matrix_NC{endmathaligntab}
egroup
mathmatrixright
endgroup}
protect
definemathmatrix[pmatrix][left={left(}, right={right)}, distance=2em]
defmatOne{startmatrixNC 1 NC 0 NRNC 0 NC 1NRstopmatrix}
defmatTwo{startmatrixNC aNRNC bNRstopmatrix}
defmatThree{startmatrixNC c NC dNRstopmatrix}
starttext
startformula
startpmatrix
NC matOne NC matTwo NC matTwo NR
NC matThree NC e NC eNR
stoppmatrix
stopformula
startformula
startpmatrix
NC 1 NC 0 NC a NR
NC 0 NC 1 NC b NR
NC c NC d NC eNR
stoppmatrix
stopformula
stoptext
edited Aug 23 '17 at 21:06
answered Aug 22 '17 at 23:19
Henri MenkeHenri Menke
77.1k8170284
77.1k8170284
Thanks Henry, so it seems like this is a bug in context. Your fix works in this case, but if a add a fourth column with anothermathTwo
in the first row and anf
in the second it doesn't work anymore. If you keep adding some columns it adds the distance only every second column.
– Icxolu
Aug 23 '17 at 11:27
@Icxolu Maybe it works now, maybe I broke something else this time...
– Henri Menke
Aug 23 '17 at 21:06
Thanks. I haven't found any issue, so I will accept this answer.
– Icxolu
Aug 24 '17 at 17:24
add a comment |
Thanks Henry, so it seems like this is a bug in context. Your fix works in this case, but if a add a fourth column with anothermathTwo
in the first row and anf
in the second it doesn't work anymore. If you keep adding some columns it adds the distance only every second column.
– Icxolu
Aug 23 '17 at 11:27
@Icxolu Maybe it works now, maybe I broke something else this time...
– Henri Menke
Aug 23 '17 at 21:06
Thanks. I haven't found any issue, so I will accept this answer.
– Icxolu
Aug 24 '17 at 17:24
Thanks Henry, so it seems like this is a bug in context. Your fix works in this case, but if a add a fourth column with another
mathTwo
in the first row and an f
in the second it doesn't work anymore. If you keep adding some columns it adds the distance only every second column.– Icxolu
Aug 23 '17 at 11:27
Thanks Henry, so it seems like this is a bug in context. Your fix works in this case, but if a add a fourth column with another
mathTwo
in the first row and an f
in the second it doesn't work anymore. If you keep adding some columns it adds the distance only every second column.– Icxolu
Aug 23 '17 at 11:27
@Icxolu Maybe it works now, maybe I broke something else this time...
– Henri Menke
Aug 23 '17 at 21:06
@Icxolu Maybe it works now, maybe I broke something else this time...
– Henri Menke
Aug 23 '17 at 21:06
Thanks. I haven't found any issue, so I will accept this answer.
– Icxolu
Aug 24 '17 at 17:24
Thanks. I haven't found any issue, so I will accept this answer.
– Icxolu
Aug 24 '17 at 17:24
add a comment |
FWIW, nested matrices work currently with the current version of ConTeXt (2019.03.21). The bug was fixed with this commit. The code listed in the example gives the following:
add a comment |
FWIW, nested matrices work currently with the current version of ConTeXt (2019.03.21). The bug was fixed with this commit. The code listed in the example gives the following:
add a comment |
FWIW, nested matrices work currently with the current version of ConTeXt (2019.03.21). The bug was fixed with this commit. The code listed in the example gives the following:
FWIW, nested matrices work currently with the current version of ConTeXt (2019.03.21). The bug was fixed with this commit. The code listed in the example gives the following:
answered 4 hours ago
AdityaAditya
55.8k2110237
55.8k2110237
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f387718%2fcontext-is-ist-possible-to-use-matrices-nested-like-in-block-matrices%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown