Define macro as wrapper for parameters of a command
I'm trying to define a macro that is a little wrapper to a common parameter of a command. The macro is expanded, but the parameter is not taken into account by the command.
The macro, sp
is used inside an extreme table. Below are code and result: note that sp
is expanded, but the parameter is not used. How can I define that macro to expand to an usable parameter?
% define macro sp
definesp{[bottomframe=off]}
% table setup
setupxtable[frame=off, bottomframe=on]
starttext
startxtable
startxtablehead
startxrow
startxcell Head 1 stopxcell
startxcell Head 2 stopxcell
stopxrow
stopxtablehead
startxtablebody
startxrow
startxcell A1 stopxcell
startxcell sp A2 stopxcell
stopxrow
startxrow
startxcell B1 stopxcell
startxcell stopxcell
stopxrow
stopxtablebody
stopxtable
stoptext
macros context parameters definition
New contributor
add a comment |
I'm trying to define a macro that is a little wrapper to a common parameter of a command. The macro is expanded, but the parameter is not taken into account by the command.
The macro, sp
is used inside an extreme table. Below are code and result: note that sp
is expanded, but the parameter is not used. How can I define that macro to expand to an usable parameter?
% define macro sp
definesp{[bottomframe=off]}
% table setup
setupxtable[frame=off, bottomframe=on]
starttext
startxtable
startxtablehead
startxrow
startxcell Head 1 stopxcell
startxcell Head 2 stopxcell
stopxrow
stopxtablehead
startxtablebody
startxrow
startxcell A1 stopxcell
startxcell sp A2 stopxcell
stopxrow
startxrow
startxcell B1 stopxcell
startxcell stopxcell
stopxrow
stopxtablebody
stopxtable
stoptext
macros context parameters definition
New contributor
As to explain why I reached at this: I'm writing documents in Markdown, and using Pandoc to generate PDF through a conversion to ConTeXt. Pandoc doesn't allow column or row spans on tables, so I'm figuring out how to fake that using borders. Turning bottom border off for a cell would make it seems as spanned. And using a macro for this is necessary in order to use default alignment of Pandoc tables.
– José de Mattos Neto
6 hours ago
add a comment |
I'm trying to define a macro that is a little wrapper to a common parameter of a command. The macro is expanded, but the parameter is not taken into account by the command.
The macro, sp
is used inside an extreme table. Below are code and result: note that sp
is expanded, but the parameter is not used. How can I define that macro to expand to an usable parameter?
% define macro sp
definesp{[bottomframe=off]}
% table setup
setupxtable[frame=off, bottomframe=on]
starttext
startxtable
startxtablehead
startxrow
startxcell Head 1 stopxcell
startxcell Head 2 stopxcell
stopxrow
stopxtablehead
startxtablebody
startxrow
startxcell A1 stopxcell
startxcell sp A2 stopxcell
stopxrow
startxrow
startxcell B1 stopxcell
startxcell stopxcell
stopxrow
stopxtablebody
stopxtable
stoptext
macros context parameters definition
New contributor
I'm trying to define a macro that is a little wrapper to a common parameter of a command. The macro is expanded, but the parameter is not taken into account by the command.
The macro, sp
is used inside an extreme table. Below are code and result: note that sp
is expanded, but the parameter is not used. How can I define that macro to expand to an usable parameter?
% define macro sp
definesp{[bottomframe=off]}
% table setup
setupxtable[frame=off, bottomframe=on]
starttext
startxtable
startxtablehead
startxrow
startxcell Head 1 stopxcell
startxcell Head 2 stopxcell
stopxrow
stopxtablehead
startxtablebody
startxrow
startxcell A1 stopxcell
startxcell sp A2 stopxcell
stopxrow
startxrow
startxcell B1 stopxcell
startxcell stopxcell
stopxrow
stopxtablebody
stopxtable
stoptext
macros context parameters definition
macros context parameters definition
New contributor
New contributor
New contributor
asked 7 hours ago
José de Mattos Neto
555
555
New contributor
New contributor
As to explain why I reached at this: I'm writing documents in Markdown, and using Pandoc to generate PDF through a conversion to ConTeXt. Pandoc doesn't allow column or row spans on tables, so I'm figuring out how to fake that using borders. Turning bottom border off for a cell would make it seems as spanned. And using a macro for this is necessary in order to use default alignment of Pandoc tables.
– José de Mattos Neto
6 hours ago
add a comment |
As to explain why I reached at this: I'm writing documents in Markdown, and using Pandoc to generate PDF through a conversion to ConTeXt. Pandoc doesn't allow column or row spans on tables, so I'm figuring out how to fake that using borders. Turning bottom border off for a cell would make it seems as spanned. And using a macro for this is necessary in order to use default alignment of Pandoc tables.
– José de Mattos Neto
6 hours ago
As to explain why I reached at this: I'm writing documents in Markdown, and using Pandoc to generate PDF through a conversion to ConTeXt. Pandoc doesn't allow column or row spans on tables, so I'm figuring out how to fake that using borders. Turning bottom border off for a cell would make it seems as spanned. And using a macro for this is necessary in order to use default alignment of Pandoc tables.
– José de Mattos Neto
6 hours ago
As to explain why I reached at this: I'm writing documents in Markdown, and using Pandoc to generate PDF through a conversion to ConTeXt. Pandoc doesn't allow column or row spans on tables, so I'm figuring out how to fake that using borders. Turning bottom border off for a cell would make it seems as spanned. And using a macro for this is necessary in order to use default alignment of Pandoc tables.
– José de Mattos Neto
6 hours ago
add a comment |
2 Answers
2
active
oldest
votes
When a command takes a optional argument ConTeXt always checks if the next character after the command is [
which isn’t the case in your example.
To pass the argument which is hidden in the sp
command to startxcell
you have make the sp
command expandable which can be done with defineexpandable
. The next step is to expand the content of sp
which can be done with expanded
.
defineexpandablesp{[bottomframe=off]}
starttext
startxtable
startxrow
startxcell Cell 1 stopxcell
expanded{startxcell sp Cell 2 stopxcell}
stopxrow
stopxtable
stoptext
The better solution to pass the same arguments to a xtable
multiple times is to create a named setup and pass the name as argument to the startxcell
command.
setupxtable [sp] [bottomframe=off]
starttext
startxtable
startxrow
startxcell Cell 1 stopxcell
startxcell [sp] Cell 2 stopxcell
stopxrow
stopxtable
stoptext
add a comment |
Imho there is no definition of sp that will do it. You would need a variant of startxcell that expands the following command once:
definesp{[bottomframe=off]}
definestartxcello{expandafter startxcell }
% table setup
setupxtable[frame=off, bottomframe=on]
starttext
startxtable
startxtablehead
startxrow
startxcell Head 1 stopxcell
startxcell Head 2 stopxcell
stopxrow
stopxtablehead
startxtablebody
startxrow
startxcell A1 stopxcell
startxcello sp A2 stopxcell
stopxrow
startxrow
startxcell B1 stopxcell
startxcell [bottomframe=off] B2 stopxcell
stopxrow
stopxtablebody
stopxtable
stoptext
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
});
}
});
José de Mattos Neto is a new contributor. Be nice, and check out our Code of Conduct.
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%2f467453%2fdefine-macro-as-wrapper-for-parameters-of-a-command%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
When a command takes a optional argument ConTeXt always checks if the next character after the command is [
which isn’t the case in your example.
To pass the argument which is hidden in the sp
command to startxcell
you have make the sp
command expandable which can be done with defineexpandable
. The next step is to expand the content of sp
which can be done with expanded
.
defineexpandablesp{[bottomframe=off]}
starttext
startxtable
startxrow
startxcell Cell 1 stopxcell
expanded{startxcell sp Cell 2 stopxcell}
stopxrow
stopxtable
stoptext
The better solution to pass the same arguments to a xtable
multiple times is to create a named setup and pass the name as argument to the startxcell
command.
setupxtable [sp] [bottomframe=off]
starttext
startxtable
startxrow
startxcell Cell 1 stopxcell
startxcell [sp] Cell 2 stopxcell
stopxrow
stopxtable
stoptext
add a comment |
When a command takes a optional argument ConTeXt always checks if the next character after the command is [
which isn’t the case in your example.
To pass the argument which is hidden in the sp
command to startxcell
you have make the sp
command expandable which can be done with defineexpandable
. The next step is to expand the content of sp
which can be done with expanded
.
defineexpandablesp{[bottomframe=off]}
starttext
startxtable
startxrow
startxcell Cell 1 stopxcell
expanded{startxcell sp Cell 2 stopxcell}
stopxrow
stopxtable
stoptext
The better solution to pass the same arguments to a xtable
multiple times is to create a named setup and pass the name as argument to the startxcell
command.
setupxtable [sp] [bottomframe=off]
starttext
startxtable
startxrow
startxcell Cell 1 stopxcell
startxcell [sp] Cell 2 stopxcell
stopxrow
stopxtable
stoptext
add a comment |
When a command takes a optional argument ConTeXt always checks if the next character after the command is [
which isn’t the case in your example.
To pass the argument which is hidden in the sp
command to startxcell
you have make the sp
command expandable which can be done with defineexpandable
. The next step is to expand the content of sp
which can be done with expanded
.
defineexpandablesp{[bottomframe=off]}
starttext
startxtable
startxrow
startxcell Cell 1 stopxcell
expanded{startxcell sp Cell 2 stopxcell}
stopxrow
stopxtable
stoptext
The better solution to pass the same arguments to a xtable
multiple times is to create a named setup and pass the name as argument to the startxcell
command.
setupxtable [sp] [bottomframe=off]
starttext
startxtable
startxrow
startxcell Cell 1 stopxcell
startxcell [sp] Cell 2 stopxcell
stopxrow
stopxtable
stoptext
When a command takes a optional argument ConTeXt always checks if the next character after the command is [
which isn’t the case in your example.
To pass the argument which is hidden in the sp
command to startxcell
you have make the sp
command expandable which can be done with defineexpandable
. The next step is to expand the content of sp
which can be done with expanded
.
defineexpandablesp{[bottomframe=off]}
starttext
startxtable
startxrow
startxcell Cell 1 stopxcell
expanded{startxcell sp Cell 2 stopxcell}
stopxrow
stopxtable
stoptext
The better solution to pass the same arguments to a xtable
multiple times is to create a named setup and pass the name as argument to the startxcell
command.
setupxtable [sp] [bottomframe=off]
starttext
startxtable
startxrow
startxcell Cell 1 stopxcell
startxcell [sp] Cell 2 stopxcell
stopxrow
stopxtable
stoptext
answered 6 hours ago
Wolfgang Schuster
4,9811711
4,9811711
add a comment |
add a comment |
Imho there is no definition of sp that will do it. You would need a variant of startxcell that expands the following command once:
definesp{[bottomframe=off]}
definestartxcello{expandafter startxcell }
% table setup
setupxtable[frame=off, bottomframe=on]
starttext
startxtable
startxtablehead
startxrow
startxcell Head 1 stopxcell
startxcell Head 2 stopxcell
stopxrow
stopxtablehead
startxtablebody
startxrow
startxcell A1 stopxcell
startxcello sp A2 stopxcell
stopxrow
startxrow
startxcell B1 stopxcell
startxcell [bottomframe=off] B2 stopxcell
stopxrow
stopxtablebody
stopxtable
stoptext
add a comment |
Imho there is no definition of sp that will do it. You would need a variant of startxcell that expands the following command once:
definesp{[bottomframe=off]}
definestartxcello{expandafter startxcell }
% table setup
setupxtable[frame=off, bottomframe=on]
starttext
startxtable
startxtablehead
startxrow
startxcell Head 1 stopxcell
startxcell Head 2 stopxcell
stopxrow
stopxtablehead
startxtablebody
startxrow
startxcell A1 stopxcell
startxcello sp A2 stopxcell
stopxrow
startxrow
startxcell B1 stopxcell
startxcell [bottomframe=off] B2 stopxcell
stopxrow
stopxtablebody
stopxtable
stoptext
add a comment |
Imho there is no definition of sp that will do it. You would need a variant of startxcell that expands the following command once:
definesp{[bottomframe=off]}
definestartxcello{expandafter startxcell }
% table setup
setupxtable[frame=off, bottomframe=on]
starttext
startxtable
startxtablehead
startxrow
startxcell Head 1 stopxcell
startxcell Head 2 stopxcell
stopxrow
stopxtablehead
startxtablebody
startxrow
startxcell A1 stopxcell
startxcello sp A2 stopxcell
stopxrow
startxrow
startxcell B1 stopxcell
startxcell [bottomframe=off] B2 stopxcell
stopxrow
stopxtablebody
stopxtable
stoptext
Imho there is no definition of sp that will do it. You would need a variant of startxcell that expands the following command once:
definesp{[bottomframe=off]}
definestartxcello{expandafter startxcell }
% table setup
setupxtable[frame=off, bottomframe=on]
starttext
startxtable
startxtablehead
startxrow
startxcell Head 1 stopxcell
startxcell Head 2 stopxcell
stopxrow
stopxtablehead
startxtablebody
startxrow
startxcell A1 stopxcell
startxcello sp A2 stopxcell
stopxrow
startxrow
startxcell B1 stopxcell
startxcell [bottomframe=off] B2 stopxcell
stopxrow
stopxtablebody
stopxtable
stoptext
answered 6 hours ago
Ulrike Fischer
185k7289668
185k7289668
add a comment |
add a comment |
José de Mattos Neto is a new contributor. Be nice, and check out our Code of Conduct.
José de Mattos Neto is a new contributor. Be nice, and check out our Code of Conduct.
José de Mattos Neto is a new contributor. Be nice, and check out our Code of Conduct.
José de Mattos Neto is a new contributor. Be nice, and check out our Code of Conduct.
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f467453%2fdefine-macro-as-wrapper-for-parameters-of-a-command%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
As to explain why I reached at this: I'm writing documents in Markdown, and using Pandoc to generate PDF through a conversion to ConTeXt. Pandoc doesn't allow column or row spans on tables, so I'm figuring out how to fake that using borders. Turning bottom border off for a cell would make it seems as spanned. And using a macro for this is necessary in order to use default alignment of Pandoc tables.
– José de Mattos Neto
6 hours ago