newcolumntype with optional argument
Clash Royale CLAN TAG#URR8PPP
With the array
package we can define a new column specifier that can be used in a tabular
environment (e.g. newcolumntypeA[>centering arraybackslashm2cm
).
It is even allowed to define a new column type with an argument like newcolumntypeB[1]>centering arraybackslashm#1
.
Now I need to let the new colomn type argument have a default value like newcolumntypeC[1][2cm]>centering arraybackslashm#1
but this results in a compilation error.
So I am asking if it is possible to provide a default argument to the newcolumntype
command?
MWE
documentclassarticle
usepackagearray
newcolumntypeA[1]>centering arraybackslashm#1
%newcolumntypeB[1]{3cm]>centering arraybackslashm#1
begindocument
begintabularhline
column width = 2 cm & column width= 4cm \hline
hello world hello world hello world & hello world hello world hello world\hline
endtabular
enddocument
tables
add a comment |
With the array
package we can define a new column specifier that can be used in a tabular
environment (e.g. newcolumntypeA[>centering arraybackslashm2cm
).
It is even allowed to define a new column type with an argument like newcolumntypeB[1]>centering arraybackslashm#1
.
Now I need to let the new colomn type argument have a default value like newcolumntypeC[1][2cm]>centering arraybackslashm#1
but this results in a compilation error.
So I am asking if it is possible to provide a default argument to the newcolumntype
command?
MWE
documentclassarticle
usepackagearray
newcolumntypeA[1]>centering arraybackslashm#1
%newcolumntypeB[1]{3cm]>centering arraybackslashm#1
begindocument
begintabularhline
column width = 2 cm & column width= 4cm \hline
hello world hello world hello world & hello world hello world hello world\hline
endtabular
enddocument
tables
add a comment |
With the array
package we can define a new column specifier that can be used in a tabular
environment (e.g. newcolumntypeA[>centering arraybackslashm2cm
).
It is even allowed to define a new column type with an argument like newcolumntypeB[1]>centering arraybackslashm#1
.
Now I need to let the new colomn type argument have a default value like newcolumntypeC[1][2cm]>centering arraybackslashm#1
but this results in a compilation error.
So I am asking if it is possible to provide a default argument to the newcolumntype
command?
MWE
documentclassarticle
usepackagearray
newcolumntypeA[1]>centering arraybackslashm#1
%newcolumntypeB[1]{3cm]>centering arraybackslashm#1
begindocument
begintabularhline
column width = 2 cm & column width= 4cm \hline
hello world hello world hello world & hello world hello world hello world\hline
endtabular
enddocument
tables
With the array
package we can define a new column specifier that can be used in a tabular
environment (e.g. newcolumntypeA[>centering arraybackslashm2cm
).
It is even allowed to define a new column type with an argument like newcolumntypeB[1]>centering arraybackslashm#1
.
Now I need to let the new colomn type argument have a default value like newcolumntypeC[1][2cm]>centering arraybackslashm#1
but this results in a compilation error.
So I am asking if it is possible to provide a default argument to the newcolumntype
command?
MWE
documentclassarticle
usepackagearray
newcolumntypeA[1]>centering arraybackslashm#1
%newcolumntypeB[1]{3cm]>centering arraybackslashm#1
begindocument
begintabularhline
column width = 2 cm & column width= 4cm \hline
hello world hello world hello world & hello world hello world hello world\hline
endtabular
enddocument
tables
tables
asked Jan 9 at 12:17
Hafid BoukhouldaHafid Boukhoulda
2,3521517
2,3521517
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can not do that without somewhat extensive changes to the array
package, adding the declaration possibility would be simple but the mechanism used to replace defined columntypes does not have anything that would help detect optional parameters, so you would have to change that mechanism, and doing that without breaking packages that depend on it (colortbl, tabularx, tabulary, ....) might be tricky.
If you accept an empty argument rather than an optional one it is easy, so the benefits of such a change compared to the risk of breaking existing code are rather discouraging adding such a feature.
newcolumntypeA[1]>centering arraybackslashmif!#1!3cmelse#1fi
would allow A
to use a default width of 3cm
Thank's for you reply! Unfortunately for me I have intensively used the column type A with no argument.
– Hafid Boukhoulda
Jan 9 at 12:57
2
@HafidBoukhoulda ok in that case, I think the answer is to use A for the default case and B for the case with an argument. It's what I'd do.
– David Carlisle
Jan 9 at 15:15
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%2f469345%2fnewcolumntype-with-optional-argument%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can not do that without somewhat extensive changes to the array
package, adding the declaration possibility would be simple but the mechanism used to replace defined columntypes does not have anything that would help detect optional parameters, so you would have to change that mechanism, and doing that without breaking packages that depend on it (colortbl, tabularx, tabulary, ....) might be tricky.
If you accept an empty argument rather than an optional one it is easy, so the benefits of such a change compared to the risk of breaking existing code are rather discouraging adding such a feature.
newcolumntypeA[1]>centering arraybackslashmif!#1!3cmelse#1fi
would allow A
to use a default width of 3cm
Thank's for you reply! Unfortunately for me I have intensively used the column type A with no argument.
– Hafid Boukhoulda
Jan 9 at 12:57
2
@HafidBoukhoulda ok in that case, I think the answer is to use A for the default case and B for the case with an argument. It's what I'd do.
– David Carlisle
Jan 9 at 15:15
add a comment |
You can not do that without somewhat extensive changes to the array
package, adding the declaration possibility would be simple but the mechanism used to replace defined columntypes does not have anything that would help detect optional parameters, so you would have to change that mechanism, and doing that without breaking packages that depend on it (colortbl, tabularx, tabulary, ....) might be tricky.
If you accept an empty argument rather than an optional one it is easy, so the benefits of such a change compared to the risk of breaking existing code are rather discouraging adding such a feature.
newcolumntypeA[1]>centering arraybackslashmif!#1!3cmelse#1fi
would allow A
to use a default width of 3cm
Thank's for you reply! Unfortunately for me I have intensively used the column type A with no argument.
– Hafid Boukhoulda
Jan 9 at 12:57
2
@HafidBoukhoulda ok in that case, I think the answer is to use A for the default case and B for the case with an argument. It's what I'd do.
– David Carlisle
Jan 9 at 15:15
add a comment |
You can not do that without somewhat extensive changes to the array
package, adding the declaration possibility would be simple but the mechanism used to replace defined columntypes does not have anything that would help detect optional parameters, so you would have to change that mechanism, and doing that without breaking packages that depend on it (colortbl, tabularx, tabulary, ....) might be tricky.
If you accept an empty argument rather than an optional one it is easy, so the benefits of such a change compared to the risk of breaking existing code are rather discouraging adding such a feature.
newcolumntypeA[1]>centering arraybackslashmif!#1!3cmelse#1fi
would allow A
to use a default width of 3cm
You can not do that without somewhat extensive changes to the array
package, adding the declaration possibility would be simple but the mechanism used to replace defined columntypes does not have anything that would help detect optional parameters, so you would have to change that mechanism, and doing that without breaking packages that depend on it (colortbl, tabularx, tabulary, ....) might be tricky.
If you accept an empty argument rather than an optional one it is easy, so the benefits of such a change compared to the risk of breaking existing code are rather discouraging adding such a feature.
newcolumntypeA[1]>centering arraybackslashmif!#1!3cmelse#1fi
would allow A
to use a default width of 3cm
answered Jan 9 at 12:29
David CarlisleDavid Carlisle
487k4111231868
487k4111231868
Thank's for you reply! Unfortunately for me I have intensively used the column type A with no argument.
– Hafid Boukhoulda
Jan 9 at 12:57
2
@HafidBoukhoulda ok in that case, I think the answer is to use A for the default case and B for the case with an argument. It's what I'd do.
– David Carlisle
Jan 9 at 15:15
add a comment |
Thank's for you reply! Unfortunately for me I have intensively used the column type A with no argument.
– Hafid Boukhoulda
Jan 9 at 12:57
2
@HafidBoukhoulda ok in that case, I think the answer is to use A for the default case and B for the case with an argument. It's what I'd do.
– David Carlisle
Jan 9 at 15:15
Thank's for you reply! Unfortunately for me I have intensively used the column type A with no argument.
– Hafid Boukhoulda
Jan 9 at 12:57
Thank's for you reply! Unfortunately for me I have intensively used the column type A with no argument.
– Hafid Boukhoulda
Jan 9 at 12:57
2
2
@HafidBoukhoulda ok in that case, I think the answer is to use A for the default case and B for the case with an argument. It's what I'd do.
– David Carlisle
Jan 9 at 15:15
@HafidBoukhoulda ok in that case, I think the answer is to use A for the default case and B for the case with an argument. It's what I'd do.
– David Carlisle
Jan 9 at 15:15
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%2f469345%2fnewcolumntype-with-optional-argument%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